<syncfusion:ComboBoxAdv x:Name="comboBoxAdv" Style="{DynamicResource ComboBoxAdvStyle1}" AllowMultiSelect="True" AllowSelectAll="True" HorizontalAlignment="Left" Height="34" Width="311" Margin="118,66,0,0" SelectionChanged="ComboBoxAdv_SelectionChanged">
<ListBoxItem Content="item1"/>
<ListBoxItem Content="item2"/>
<ListBoxItem Content="item3"/>
</syncfusion:ComboBoxAdv>
<Style x:Key="ComboBoxAdvStyle1" TargetType="{x:Type syncfusion:ComboBoxAdv}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type syncfusion:ComboBoxAdv}">
…….
<syncfusion:ComboBoxItemAdv x:Name="PART_SelectAll" Background="{Binding Background, ElementName=DropDownBorder}" Content="SelectAll item" Margin="0.2,0,0,0.5" Grid.Row="0">
<syncfusion:ComboBoxItemAdv.Visibility>
<TemplateBinding Property="AllowSelectAll">
<TemplateBinding.Converter>
<BooleanToVisibilityConverter/>
</TemplateBinding.Converter>
</TemplateBinding>
</syncfusion:ComboBoxItemAdv.Visibility>
</syncfusion:ComboBoxItemAdv>
……….
|
public MainWindow()
{
InitializeComponent();
this.Loaded += OnLoaded;
this.comboBoxAdv.DropDownOpened += ComboBoxAdv_DropDownOpened;
}
private void ComboBoxAdv_DropDownOpened(object sender, EventArgs e)
{
FieldInfo infor = typeof(ComboBoxAdv).GetField("SelectAllItem", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
var value = infor.GetValue(this.comboBoxAdv) as ComboBoxItemAdv;
value.Content = "Select All Item";
} |