This is a migrated thread and some comments may be shown as answers.

Style property on GridViewDataColumn

5 Answers 277 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Patrick
Top achievements
Rank 2
Iron
Iron
Iron
Patrick asked on 11 May 2015, 09:46 AM

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

Sort by
0
Dimitrina
Telerik team
answered on 11 May 2015, 01:57 PM
Hello,

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.

 
0
Patrick
Top achievements
Rank 2
Iron
Iron
Iron
answered on 11 May 2015, 02:18 PM

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.

0
Dimitrina
Telerik team
answered on 14 May 2015, 08:53 AM
Hello,

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
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Patrick
Top achievements
Rank 2
Iron
Iron
Iron
answered on 14 May 2015, 09:44 AM

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..

0
Dimitrina
Telerik team
answered on 14 May 2015, 01:23 PM
Hello Patrick,

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
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
GridView
Asked by
Patrick
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Dimitrina
Telerik team
Patrick
Top achievements
Rank 2
Iron
Iron
Iron
Share this question
or