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

Theme causes VS to crash / other problem

3 Answers 86 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Edward
Top achievements
Rank 1
Edward asked on 16 May 2011, 09:29 PM
Using the latest version of the control and VS 2010.

If I try to use the following code, Visual Studio will crash when opening the design view that has a grid in it.  However, it works fine when running.

<Style TargetType="telerik:RadGridView" >
    <Setter Property="telerik:StyleManager.Theme" Value="Windows7" />
    <Setter Property="IsSynchronizedWithCurrentItem" Value="true" />
</Style>


For the following code, the default theme just doesn't seems to take hold.  However the same technique works for other controls (I tried RadButton and RadComboBox).

<telerik:Windows7Theme x:Name="thmWin7" />
    <Style TargetType="telerik:RadGridView" telerik:StyleManager.BasedOn="{StaticResource thmWin7}">
        <Setter Property="Margin" Value="2 2 2 2"/>
        <Setter Property="VerticalAlignment" Value="Center"/>
    </Style>

3 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 17 May 2011, 08:02 AM
Hello Edward,

 

Thank you for sharing these snippets with us! Indeed the both are correct and it depends on the platform.


The recommended approach in WPF is to use the following:

<Style TargetType="telerik:RadGridView">
        <Setter Property="telerik:StyleManager.Theme" Value="Expression_Dark"/>
        <Setter Property="RowIndicatorVisibility" Value="Collapsed"/>
</Style>

In Silverlight you should use the one below:

<telerik:Windows7Theme x:Name="thmWin7" />
    <Style TargetType="telerik:RadGridView" telerik:StyleManager.BasedOn="{StaticResource thmWin7}">
        <Setter Property="Margin" Value="2 2 2 2"/>
        <Setter Property="VerticalAlignment" Value="Center"/>
</Style>


The same is valid for any other RadControl or a native one supported by our theming mechanism. 
Hope this helps!


Best wishes,
Vanya Pavlova
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Edward
Top achievements
Rank 1
answered on 17 May 2011, 02:20 PM
The second approach does not work.  An example of my code:

<telerik:RadGridView  Grid.Row="12" Grid.ColumnSpan="2" CanUserInsertRows="True" CanUserDeleteRows="true" ShowInsertRow="True"
                                                 AutoGenerateColumns="False" ShowGroupPanel="False" ShowGroupFooters="False" DataLoaded="gdvLanguage_DataLoaded" >
                                <telerik:RadGridView.Columns>
                                    <telerik:GridViewComboBoxColumn Header="Type" DisplayMemberPath="desc1" SelectedValueMemberPath="idLanguageTypeKey" DataMemberBinding="{Binding idLanguageTypeKey}" />
                                    <telerik:GridViewComboBoxColumn Header="Language" DisplayMemberPath="desc1" SelectedValueMemberPath="idLanguageKey" DataMemberBinding="{Binding idLanguageKey}" />
                                    <telerik:GridViewCheckBoxColumn Header="Primary" DataMemberBinding="{Binding isPrimary}" />
                                </telerik:RadGridView.Columns>
                            </telerik:RadGridView>

The grid still shows up as with the default yellow-black theme, instead of Windows 7.
0
Vanya Pavlova
Telerik team
answered on 18 May 2011, 03:25 PM
Hi Edward,

 
A style based on a theme will simply change simple properties of RadGridView. The rest of its parts will maintain the default theme, you may refer to the following:

<Style TargetType="telerik:RadGridView" telerik:StyleManager.BasedOn="Windows7">
        <Setter Property="BorderBrush" Value="Red"/>
        <Setter Property="RowIndicatorVisibility" Value="Collapsed"/>
        <Setter Property="BorderThickness" Value="2"/>
        </Style>
        <Style TargetType="telerik:GridViewRow" telerik:StyleManager.BasedOn="Windows7">
            </Style>
            <Style TargetType="telerik:GridViewHeaderRow" telerik:StyleManager.BasedOn="Windows7">
                </Style>
                <Style TargetType="telerik:GridViewHeaderCell" telerik:StyleManager.BasedOn="Windows7">
                    <Setter Property="Background" Value="Yellow"/>
</Style>


This will change only the specified properties for RadGridView, GridViewRow, GridViewHeaderRow, GridViewHeaderCell. Attached is a sample project that demonstrates this approach.



Kind regards,
Vanya Pavlova
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Edward
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Edward
Top achievements
Rank 1
Share this question
or