We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Rename "Select All" but only for one Instace

Hi forum,

Is it possible to change the text "Select all" in a ComboBoxAdv?
But only for one instance not for all instances.

regards
Thomas

5 Replies

JP Jagadeesan Pichaimuthu Syncfusion Team June 27, 2019 06:47 AM

Hi Thomas, 
 
Thanks for using Syncfusion product. 
 
We have checked your requirement to change the text "Select all" in a ComboBoxAdv and you can able to achieve your requirement by customizing the style of the control. Here you can able to initialize the text to Content of the ComboBoxItemAdv as like below code snippet, 
 
<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> 
 
………. 
 
 
Also please refer the below sample for your reference. 
 
 
 
Also you can refer how to create the EditTemplate to customize the appearance of the control. 
 
Let us know whether this helps also if you need any further assistance on this. 
 
Regards, 
Jagadeesan


TB Thomas Beimel June 28, 2019 09:24 AM

Hi Jagadeesan,

Ok, it works.
But is there an easier way than overwriting the entire template?

Regards
Thomas


JP Jagadeesan Pichaimuthu Syncfusion Team July 1, 2019 07:53 AM

Hi Thomas, 
 
Thanks for your update. 
 
We have checked your query and you can able to rename the SelectAll item, by using the below code snippet. Here you can get the SelectAllItem using reflection and change the content as like below code snippet, 
 
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"; 
} 
 
 
 
 
Let us know whether this helps also if you need any further assistance on this. 
 
Regards, 
Jagadeesan 



TB Thomas Beimel July 1, 2019 09:27 AM

Hi Jagadeesan,

thank you. It works fine!

regards
Thomas


JP Jagadeesan Pichaimuthu Syncfusion Team July 2, 2019 01:14 AM

Hi Thomas, 
 
Thanks for your update. 
 
We are glad to know that the provided solution worked at your end. Please let us know if you have any further queries on this. We are happy to help you. 
 
Regards, 
Jagadeesan 


Loader.
Live Chat Icon For mobile
Up arrow icon