WPF combobox in a datagrid group header -


Is it possible to use a combobox in the DataGrade group header to set a selected value for each cell in the appropriate column (This is a combo box included)? Or is there a better solution to set more than one combobox value in a column at the same time?

You can place the combo box in the group header:

  & lt; DataGrid.GroupStyle & gt; & Lt; GroupStyle & gt; & Lt; GroupStyle.ContainerStyle & gt; & Lt; Style TargetType = "{x: Type GroupItem}" & gt; & Lt; Setter Property = "Template" & gt; & Lt; Setter.Value & gt; & Lt; ControlTemplate TargetType = "{x: Type GroupItem}" & gt; & Lt; Expander & gt; & Lt; Expander.Header & gt; & Lt; StackPanel Orientation = "Horizontal" & gt; & Lt; Text block text = "{binding path = name}" vertical alignment = "center" /> & Lt; TextBlock Text = "{Binding Path = ItemCount}" margin = "5,0,2,0" vertical alignment = "center" /> & Lt; Text block text = "item" vertical element = "center" /> & Lt; Combo box margin = "10,0" selection = changed "combo box selection" has changed & gt; & Lt; Combobox item content = "1" /> & Lt; Combobox item content = "2" /> & Lt; Combobox item content = "3" /> & Lt; / ComboBox & gt; & Lt; / StackPanel & gt; & Lt; /Expander.Header> & Lt; Item receiver / & gt; & Lt; / Expander & gt; & Lt; / ControlTemplate & gt; & Lt; /Setter.Value> & Lt; / Setter & gt; & Lt; / Style & gt; & Lt; /GroupStyle.ContainerStyle> & Lt; / GroupStyle & gt; & Lt; /DataGrid.GroupStyle>   

The SelectionChanged event handler looks like this:

  Private zero comboBox_electionChanged (Object Sender, SelectionChangedEventArgs E) {DependencyObject dependencyObject = Sender as DependencyObject; // Run a visual tree from the combo box to find the group item. While (dependency object! = Empty & dependency object.gettip ()! = Typef (grupetam)) {dependency object = visualtrayhelper. Gatepaint (dependency object); } GroupItem groupItem = Dependency object as GroupItem; CollectionView Group ArchiveView group = groupItem Collection archive group; // Break CollectionViewGroup items for GroupItem. Foreach (View group items in object object collections) {// Change your value here ...}}    

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -