<ComboBox x:Name="MainComboBox" Height="35" Width="250" removed="WhiteSmoke" BorderBrush="Gray" IsEditable="True" TextSearch.TextPath="Name" TextBoxBase.TextChanged="MainComboBox_TextChanged"> <ComboBox.Resources> <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent"/> <SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Transparent"/> </ComboBox.Resources> <ComboBox.ItemTemplate> <DataTemplate> <TreeView BorderBrush="Transparent" BorderThickness="0" ItemsSource="{Binding RelativeSource={RelativeSource AncestorType={x:Type ComboBox}, Mode=FindAncestor}, Path=ItemsSource}"> <TreeView.ItemTemplate> <HierarchicalDataTemplate ItemsSource="{Binding Children}" DataType="{x:Type data:SubscriberGroupModel}"> <CheckBox Content="{Binding Name}" Height="25" Width="80" /> </HierarchicalDataTemplate> </TreeView.ItemTemplate> </TreeView> </DataTemplate> </ComboBox.ItemTemplate> </ComboBox>
private void Window_Loaded(object sender, RoutedEventArgs e) { List<SubscriberGroupModel> list = SubscriberGroupDB.GetCustomSubscriberGroup(); MainComboBox.ItemsSource = list; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)