Saturday, 15 January 2011

c# - Retrieve column name from a gridcontrol in mvvm design -


Hi, I am working on a WPF project in which I have grid control. The property property of the item grid control is bound to a figure in my view-modal. I am following the MVVM pattern, so my question is that I have to attach the property of grid control to an asset in my visual model class. Is it possible to define the name of this column in which the cell remains by binding into one model in model model. I know that an event handler can be connected to the cell which will call the function in the code behind the view, but I do not want to follow that approach because it will not be mvvm Please help me with any suggestions.

Bind property to CurrentCell in your XAML DataGridCellInfo for

  datagrid selectioninet = "cell" selectionmode = "single" itemsusource = "{binding headset tab}" currentcale = "{binding selected selenfo mode, mode = forestwestoursource } "/>  

Then in your visual model you can access the header from the bound object:

  Public DataGridCellInfo SelectedCellInfo {get {return_selectedCellInfo; } Set {_selectedCellInfo = value; OnPropertyChanged ("SelectedCellInfo"); _columnName = _selectedCellInfo.Column.Header; }}  

No comments:

Post a Comment