GridViewColumn
-
hi evrybody i try to do task by WPF for trying the work with WPF enviroment i try to add combobox in gridview but i dont know how can i bind or fill combobox in xaml i wrote this but not enough <ListView Width="Auto" ItemsSource="{Binding}" Height="Auto" IsSynchronizedWithCurrentItem="True"> <ListView.View> <GridView> <GridViewColumn Header="Gender ID" Width="120"> <GridViewColumn.CellTemplate> <DataTemplate > <TextBox Margin="0,0,0,0" Text="{Binding Path=GenderID}" Width="100"></TextBox> </DataTemplate> </GridViewColumn.CellTemplate> </GridViewColumn> <GridViewColumn Header="Gender Type" Width="120"> <GridViewColumn.CellTemplate> <DataTemplate> <ComboBox Name="Combo_Type" ItemsSource="{Binding Source={}" DisplayMemberPath="{Binding Path=GenderType}" Width="100"></ComboBox> </DataTemplate> </GridViewColumn.CellTemplate> </GridViewColumn> </GridView> </ListView.View> MD_NADA
-
hi evrybody i try to do task by WPF for trying the work with WPF enviroment i try to add combobox in gridview but i dont know how can i bind or fill combobox in xaml i wrote this but not enough <ListView Width="Auto" ItemsSource="{Binding}" Height="Auto" IsSynchronizedWithCurrentItem="True"> <ListView.View> <GridView> <GridViewColumn Header="Gender ID" Width="120"> <GridViewColumn.CellTemplate> <DataTemplate > <TextBox Margin="0,0,0,0" Text="{Binding Path=GenderID}" Width="100"></TextBox> </DataTemplate> </GridViewColumn.CellTemplate> </GridViewColumn> <GridViewColumn Header="Gender Type" Width="120"> <GridViewColumn.CellTemplate> <DataTemplate> <ComboBox Name="Combo_Type" ItemsSource="{Binding Source={}" DisplayMemberPath="{Binding Path=GenderType}" Width="100"></ComboBox> </DataTemplate> </GridViewColumn.CellTemplate> </GridViewColumn> </GridView> </ListView.View> MD_NADA
It sounds like you want to use an enum for the items source of your combobox, so this article should be a good starting point. You will probably want to bind
SelectedItem="{Binding Path=GenderType}"
instead of DisplayMemberPath. -
It sounds like you want to use an enum for the items source of your combobox, so this article should be a good starting point. You will probably want to bind
SelectedItem="{Binding Path=GenderType}"
instead of DisplayMemberPath.thanks for reply but this not working in fact the GridView Bind to CollectionView and i want to fill the combobox in GridView by the binding to anothet table , i know how can i do this in windows forms but in WPF i see i can set binding in xaml i hope i show this point clearly
MD_NADA