Hello,
in the GridViewDataColumn control for WPF, there is a Style property. This property is not available in the Silverlight control. Is there a reason for that?
This makes creating UI common to both Silverlight and WPF difficult (I can't use styles).
5 Answers, 1 is accepted
In WPF, GridViewColumn inherits from FrameworkContentElement while in Silverlight it inherits from DependencyObject. That is where the difference comes from.
Would you please share some more information on what result would you like to achieve?
Regards,
Dimitrina
Telerik
See What's Next in App Development. Register for TelerikNEXT.

Hi Dimitrina,
I have a GridView with 30 columns, of which 28 have the same values for 5 properties. Using a style in WPF let me simplify the XAML code and also simplify the change in the formatting.
The WPF style is defined as:
<
Style
x:Key
=
"ValueColumn"
TargetType
=
"tk:GridViewColumn"
>
<
Setter
Property
=
"HeaderTextAlignment"
Value
=
"Center"
/>
<
Setter
Property
=
"IsGroupable"
Value
=
"False"
/>
<
Setter
Property
=
"TextAlignment"
Value
=
"Center"
/>
<
Setter
Property
=
"Width"
Value
=
"35"
/>
</
Style
>
<
Style
x:Key
=
"BoldValueColumn"
TargetType
=
"tk:GridViewColumn"
BasedOn
=
"{StaticResource ValueColumn}"
>
<
Setter
Property
=
"Background"
Value
=
"#40D0D0D0"
/>
</
Style
>
Unfortunately, doing so will break the Silverlight compatibility: the same source code is used for both Silverlight and WPF clients.
You can apply CellStyle instead. This is the recommended way.
In case you may need to apply conditional styling, you can consider applying a CellStyleSelector.
Regards,
Dimitrina
Telerik

Hi Dimitrina,
It could be a possibility, except that HeaderTextAlignment, IsGroupable and Width properties are not accessible with CellStyle, making it about useless in my case..
It is indeed not possible to set those properties through CellStyle, still, there is not another option to suggest as it comes to columns specifically. In case you would like to disable grouping at RadGridView's level, you may configure it with ShowGroupPanel="False".
We apologize for this inconvenience.
Regards,
Dimitrina
Telerik