Hi,
How can I set properties of the ComboBox's in a GridViewComboBoxColumn.
I want to set the ClearSelectionButtonVisibility and ClearSelectionButtonContent properties as described in this thread
http://www.telerik.com/community/forums/wpf/combobox/selectable-null-value-in-radcombobox.aspx
I have tried it with a style in the GridViewComboBoxColumn ressources:
This approach is not working.
Thanks and regards,
Franziska
How can I set properties of the ComboBox's in a GridViewComboBoxColumn.
I want to set the ClearSelectionButtonVisibility and ClearSelectionButtonContent properties as described in this thread
http://www.telerik.com/community/forums/wpf/combobox/selectable-null-value-in-radcombobox.aspx
I have tried it with a style in the GridViewComboBoxColumn ressources:
<telerik:GridViewComboBoxColumn.Resources> <Style TargetType="Controls:RadComboBox"> <Setter Property="ClearSelectionButtonVisibility" Value="Visible" /> <Setter Property="ClearSelectionButtonContent" Value="Test" /> </Style></telerik:GridViewComboBoxColumn.Resources>This approach is not working.
Thanks and regards,
Franziska
5 Answers, 1 is accepted
0
Hi Franziska,
Furthermore, please remember that in order not to get any validation errors, the underlying property (in the case above ClubID) should be nullable.
Kind regards,
Maya
the Telerik team
You could define the style in the grid's Resources section. For example:
<telerik:RadGridView Name="playersGrid" ItemsSource="{Binding Players}" AutoGenerateColumns="False"> <telerik:RadGridView.Resources> <Style TargetType="telerik:RadComboBox" > <Setter Property="ClearSelectionButtonVisibility" Value="Visible" /> <Setter Property="ClearSelectionButtonContent" Value="test" /> </Style> </telerik:RadGridView.Resources> <telerik:RadGridView.Columns> <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}"/> <telerik:GridViewDataColumn DataMemberBinding="{Binding Number}"/> <telerik:GridViewDataColumn DataMemberBinding="{Binding Position}"/> <telerik:GridViewDataColumn DataMemberBinding="{Binding Country}"/> <telerik:GridViewComboBoxColumn DataMemberBinding="{Binding ClubID}" ItemsSource="{Binding Clubs, Source={StaticResource MyViewModel}}" SelectedValueMemberPath="ID" DisplayMemberPath="Name" /> </telerik:RadGridView.Columns></telerik:RadGridView>Furthermore, please remember that in order not to get any validation errors, the underlying property (in the case above ClubID) should be nullable.
Kind regards,
Maya
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Franziska
Top achievements
Rank 1
answered on 12 Oct 2011, 10:05 AM
Hi Maya,
Thanks for you quick response.
This is the same what I did, but it affects all the
I only want to apply the style to certain columns. It does not work if I define the style in the resources of the
Thanks,
Franziska
Thanks for you quick response.
This is the same what I did, but it affects all the
telerik:GridViewComboBoxColumn 's.I only want to apply the style to certain columns. It does not work if I define the style in the resources of the
telerik:GridViewComboBoxColumn Thanks,
Franziska
0
Hi Franziska,
Best wishes,
Maya
the Telerik team
If you want to set this style only for a particular column, you can define a key attribute for it and set it to the EditorStyle of that particular column. For example:
<telerik:RadGridView Name="playersGrid" ItemsSource="{Binding Players}" AutoGenerateColumns="False"> <telerik:RadGridView.Resources> <Style x:Key="myStyle" TargetType="telerik:RadComboBox" > <Setter Property="ClearSelectionButtonVisibility" Value="Visible" /> <Setter Property="ClearSelectionButtonContent" Value="test" /> </Style> </telerik:RadGridView.Resources> <telerik:RadGridView.Columns> <telerik:GridViewComboBoxColumn DataMemberBinding="{Binding ClubID}" EditorStyle="{StaticResource myStyle}" ItemsSource="{Binding Clubs, Source={StaticResource MyViewModel}}" SelectedValueMemberPath="ID" DisplayMemberPath="Name" /> </telerik:RadGridView.Columns> </telerik:RadGridView>Maya
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Franziska
Top achievements
Rank 1
answered on 12 Oct 2011, 10:40 AM
Hi Maya,
That is exactly, what I was looking for.
One last question... Is there an easy way to change the style of the ClearButton to look like a normal RadComboBoxItem?
At the moment I am trying to change the style of the button to look like the other items... but it is hard to find out the exact same values of the RadComboBoxItems sytles.
Thanks
Franziska
That is exactly, what I was looking for.
One last question... Is there an easy way to change the style of the ClearButton to look like a normal RadComboBoxItem?
At the moment I am trying to change the style of the button to look like the other items... but it is hard to find out the exact same values of the RadComboBoxItems sytles.
Thanks
Franziska
0
Hello Franziska,
Regards,
Maya
the Telerik team
You could try to create a style targeting RadButton. It could be something similar to:
<telerik:RadGridView.Resources> <Style TargetType="telerik:RadButton"> <Setter Property="Background" Value="Transparent" /> <Setter Property="BorderThickness" Value="0" /> <Setter Property="HorizontalContentAlignment" Value="Left" /> <Setter Property="Padding" Value="6,0,0,0" /> </Style> <Style x:Key="myStyle" TargetType="telerik:RadComboBox" > <Setter Property="ClearSelectionButtonVisibility" Value="Visible" /> <Setter Property="ClearSelectionButtonContent" Value="test" /> </Style> </telerik:RadGridView.Resources>Regards,
Maya
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>