c# - WPF DataGridComboBoxColumn does not work -
I have a person and a name list of what people say, shown below:
Namespot WpfApplication1 {Public Partial Class Main Window: Window {Public List & lt; Person & gt; People; Public Manvindo () {Initialization (); People = new list & lt; Person & gt; (); People Add (new person () {id = 1, name = "john"}); People Add (new person () {id = 2, name = "mike"}); }} Public Class Insurance {Public Entity ID} set; } Public string name {get; Set; }}}
And I want to show 2 people in a data grid, using Cambodia to choose between 2 people.
& lt; DataGrade X: Name = "DataGrid1" Height = "300" & gt; & Lt; DataGridComboBoxColumn Header = "Name" DisplayMemberPath = "Name" SelectedItemBinding = "{Binding Path = Name}" & gt; & Lt; DataGridComboBoxColumn.EditingElementStyle & gt; & Lt; Style TargetType = "ComboBox" & gt; & Lt; Setter Property = "ItemsSource" Value = "{Binding Path = People}" /> & Lt; / Style & gt; & Lt; /DataGridComboBoxColumn.EditingElementStyle> & Lt; DataGridComboBoxColumn.ElementStyle & gt; & Lt; Style TargetType = "ComboBox" & gt; & Lt; Setter Property = "ItemsSource" Value = "{Binding Path = People}" /> & Lt; / Style & gt; & Lt; /DataGridComboBoxColumn.ElementStyle> & Lt; / DataGridComboBoxColumn & gt; & Lt; / Data grid & gt;
But the datagrid just does not show anything. What's the problem
call it & lt; DataGrid.Column & gt;
tags?
Comments
Post a Comment