.NET Framework Bookmark and Share   
 index > Windows Presentation Foundation (WPF) > How to capture the Id of the newly selected value in the Dropdowncombobox in WPF dataGrid
 

How to capture the Id of the newly selected value in the Dropdowncombobox in WPF dataGrid

Hi,

I have created a DropdownCombobox column in WPFDataGrid and i have just binded the column as below

<dg:DataGridComboBoxColumn SelectedValueBinding="{Binding CustomerID}"
SelectedValuePath="CustomerID"
DisplayMemberPath="ContactName"
Header="CustomerID (ContactName alias using SelectedValueBinding)"
ItemsSource="{Binding Account}">

But i need tocapture the CustomerID of the selected value in the DropdowncomboBox in WPF dataGrid (May be in the Selectionchanged event).
But i dont know how to create these events as it is not available by default.

Please any help how create event and how tocapture the selected value

Thanks in advance

ksvimal
In that case, you'll have to implement a TemplateColumn with a ComboxBox inside and set the SelectionChanged event.

But, if yourclass implements INofityPropertyChanged interface, you might listen to objects PropertyChanged event instead which would much more WPFish.


Bigsby, Lisboa, Portugal - O que for, quando for, é que será o que é... http://bigsby.eu
Bigsby
Hi Bigsby,


Can you please provide some code, so i can understand easily?
ksvimal
Hi Bigsby,


Can you please explain me with an example?
ksvimal
What do you want to happen when ComboBox value changes?
Bigsby, Lisboa, Portugal - O que for, quando for, é que será o que é... http://bigsby.eu
Bigsby

You can use google to search for other answers

Custom Search

More Threads

• BitmapEffect Performance Issues
• Issue with StackPanel inside TabHeader
• WPF Validation
• Problems in using listView...
• Style not working for class based on TabItem
• URI and Application.LoadComponent question
• I get an AudioException : 0x2
• Hosting WPF Control on WindowsForms Secondary Thread
• Animating WidthProperty of an Image
• Mask anything outside of Grid