0
我目前使用Visual Studio 2010最終版,用於創建使用C#/的桌面應用程序。當單擊特定列/行上的內容(雙)時,我想將數據網格視圖中的數據顯示在文本框中。 我的問題是我沒有看到鼠標在屬性窗口中的選項。任何指針/指導將不勝感激。鼠標屬性在視覺工作室中不可見
我目前使用Visual Studio 2010最終版,用於創建使用C#/的桌面應用程序。當單擊特定列/行上的內容(雙)時,我想將數據網格視圖中的數據顯示在文本框中。 我的問題是我沒有看到鼠標在屬性窗口中的選項。任何指針/指導將不勝感激。鼠標屬性在視覺工作室中不可見
你定義一個DataGridTemplateColumn然後添加如下所示(它只是一個例子)的事件處理程序 - 你可以嘗試類似的東西..
<DataGridTemplateColumn>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock MouseDown="TextBlock_MouseDown"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
然後調用鼠標事件了。
private void TextBlock_MouseDown(object sender, MouseButtonEventArgs e)
{
TextBlock block = sender as TextBlock;
//your code
}
我想你可以定義一個DataGridTemplateColumn代替使用像DataGridCheckBoxColumn,DataGridComboBoxColumn預定義的列,然後添加一個事件處理程序中的數據模板中定義的UI元素。 –