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

[Solved] RadGridView Style - Blend XAML error

3 Answers 128 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.
Robin
Top achievements
Rank 1
Robin asked on 07 Mar 2011, 11:35 AM
Hello,

when creating a global Style in a ResourceDictionary with Blend we get some XAML errors.

Some properties are not accessible or are not found.

In Visual Studio no errors are reported, the Style works fine.


For example

<Border x:Name="PART_MasterGridContainer" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">

The properties BorderBrush, BorderThickness and Padding are not found.


Here is the generated Style code by Blend:

<SolidColorBrush x:Key="GridView_GroupPanelOuterBorder" Color="#FF848484"/>
  <telerik:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
  <ControlTemplate x:Key="RadGridViewTemplate" TargetType="telerik:RadGridView">
    <Border x:Name="PART_MasterGridContainer" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup x:Name="GridViewActivity">
                <VisualState x:Name="Idle">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="PART_GridViewLoadingIndicator">
                            <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Collapsed"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
                <VisualState x:Name="Busy">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="PART_GridViewLoadingIndicator">
                            <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Visible"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
            <VisualStateGroup x:Name="ColumnHeadersVisibility">
                <VisualState x:Name="ColumnHeadersVisible">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="PART_HeaderRow">
                            <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Visible"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
                <VisualState x:Name="ColumnHeadersCollapsed">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="PART_HeaderRow">
                            <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Collapsed"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
            <VisualStateGroup x:Name="ColumnFootersVisibility">
                <VisualState x:Name="ColumnFootersVisible">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="PART_FooterRow">
                            <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Visible"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
                <VisualState x:Name="ColumnFootersCollapsed">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="PART_FooterRow">
                            <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Collapsed"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
            <VisualStateGroup x:Name="GroupPanelVisibility">
                <VisualState x:Name="GroupPanelVisible">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="PART_GroupPanel">
                            <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Visible"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
                <VisualState x:Name="GroupPanelCollapsed">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="PART_GroupPanel">
                            <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Collapsed"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
            <VisualStateGroup x:Name="InsertRowVisibility">
                <VisualState x:Name="InsertRowVisible">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="PART_AddNewRow">
                            <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Visible"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
                <VisualState x:Name="InsertRowCollapsed">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="PART_AddNewRow">
                            <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Collapsed"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
        <Grid x:Name="HierrarchyBackground" Background="{TemplateBinding Background}">
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition x:Name="ScrollBarColumn" MinWidth="0" Width="0"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition x:Name="PART_AttachedBehaviorRow" Height="Auto"/>
                <RowDefinition/>
                <RowDefinition x:Name="ScrollBarRow" Height="0" MinHeight="0"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <telerikGridView:GridViewGroupPanel x:Name="PART_GroupPanel" BorderBrush="{StaticResource GridView_GroupPanelOuterBorder}" Background="{TemplateBinding GroupPanelBackground}" Grid.ColumnSpan="2" Foreground="{TemplateBinding GroupPanelForeground}" Grid.Row="0" telerik:StyleManager.Theme="{StaticResource Theme}"/>
            <telerikGridView:GridViewScrollViewer x:Name="PART_ItemsScrollViewer" Background="Transparent" CanContentScroll="True" Grid.ColumnSpan="2" Grid.Row="2" Grid.RowSpan="2" telerik:StyleManager.Theme="{StaticResource Theme}">
                <telerikGridView:GridViewScrollViewer.FooterRow>
                    <telerikGridView:GridViewFooterRow IndentLevel="{TemplateBinding GroupCount}" x:Name="PART_FooterRow" telerik:StyleManager.Theme="{StaticResource Theme}"/>
                </telerikGridView:GridViewScrollViewer.FooterRow>
                <telerikGridView:GridViewScrollViewer.HeaderRow>
                    <telerikGridView:GridViewHeaderRow IndentLevel="{TemplateBinding GroupCount}" x:Name="PART_HeaderRow" telerik:StyleManager.Theme="{StaticResource Theme}"/>
                </telerikGridView:GridViewScrollViewer.HeaderRow>
                <telerikGridView:GridViewScrollViewer.NewRow>
                    <telerikGridView:GridViewNewRow x:Name="PART_AddNewRow" IndentLevel="{TemplateBinding GroupCount}" telerik:StyleManager.Theme="{StaticResource Theme}" Visibility="Collapsed"/>
                </telerikGridView:GridViewScrollViewer.NewRow>
                <telerikGridView:GridViewVirtualizingPanel x:Name="PART_GridViewVirtualizingPanel"/>
            </telerikGridView:GridViewScrollViewer>
            <telerikGridView:ScrollPositionIndicator x:Name="PART_ScrollPositionIndicator" Grid.ColumnSpan="2" ContentTemplate="{TemplateBinding ScrollPositionIndicatorTemplate}" HorizontalAlignment="Right" IsHitTestVisible="False" Margin="0,0,28,0" Grid.Row="2" telerik:StyleManager.Theme="{StaticResource Theme}" Visibility="{Binding IsScrolling, Converter={StaticResource BooleanToVisibilityConverter}, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"/>
            <Border x:Name="PART_FrozenColumnsPreview" Background="#33000000" HorizontalAlignment="Left" Grid.Row="1" Grid.RowSpan="4" Visibility="Collapsed" VerticalAlignment="Stretch" Width="6"/>
            <telerikGridView:GridViewLoadingIndicator x:Name="PART_GridViewLoadingIndicator" Grid.ColumnSpan="2" Grid.RowSpan="4" telerik:StyleManager.Theme="{StaticResource Theme}" Visibility="Collapsed"/>
        </Grid>
    </Border>
  </ControlTemplate>
  <SolidColorBrush x:Key="ControlBackground" Color="White"/>
  <SolidColorBrush x:Key="ControlOuterBorder" Color="#FF848484"/>
  <SolidColorBrush x:Key="ControlForeground" Color="Black"/>
  <SolidColorBrush x:Key="Item_AlternateBackground" Color="#FFF4F4F4"/>
  <SolidColorBrush x:Key="GridView_GridLinesItemBorder" Color="#FFCBCBCB"/>
  <LinearGradientBrush x:Key="GridView_GroupPanelBackground" EndPoint="0.5,1" StartPoint="0.5,0">
    <GradientStop Color="#FFDFDFDF" Offset="1"/>
    <GradientStop Color="#FFBABABA"/>
  </LinearGradientBrush>
  <SolidColorBrush x:Key="GridView_GroupPanelForeground" Color="Black"/>
  <Style TargetType="telerik:RadGridView">
    <Setter Property="Template" Value="{StaticResource RadGridViewTemplate}"/>
    <Setter Property="Background" Value="{StaticResource ControlBackground}"/>
    <Setter Property="BorderBrush" Value="{StaticResource ControlOuterBorder}"/>
    <Setter Property="Foreground" Value="{StaticResource ControlForeground}"/>
    <Setter Property="BorderThickness" Value="1"/>
    <Setter Property="AlternateRowBackground" Value="{StaticResource Item_AlternateBackground}"/>
    <Setter Property="VerticalGridLinesBrush" Value="{StaticResource GridView_GridLinesItemBorder}"/>
    <Setter Property="HorizontalGridLinesBrush" Value="{StaticResource GridView_GridLinesItemBorder}"/>
    <Setter Property="GroupPanelBackground" Value="{StaticResource GridView_GroupPanelBackground}"/>
    <Setter Property="GroupPanelForeground" Value="{StaticResource GridView_GroupPanelForeground}"/>
    <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
    <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
    <Setter Property="VerticalAlignment" Value="Stretch"/>
    <Setter Property="HorizontalAlignment" Value="Stretch"/>
  </Style>


We are using Expression Blend 4 and version 2010.3.1314.1040 of the Telerik controls.

3 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 07 Mar 2011, 06:40 PM
Hi Robin,


Can you please share with us what do you mean by "some properties are not accessible or are not found"?
Since the values of the properties of the Border element named PART_MasterGridContainer are linked to the values of the correspoinding properties on the templated control, everything works as expected. It would be very helpful if you share with us a little bit more information about these issues.



Greetings,
Vanya Pavlova
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Robin
Top achievements
Rank 1
answered on 08 Mar 2011, 09:17 AM
Hi Vanya,

sorry for the vague description of the issue.

Blend marks some properties as not correct.
I got only the German version installed, so I attached a screenshot of the error descriptions.

As you said, it works. The style works as expected.
Visual Studio finds no error, just Blend is complaining.

Best regards
Robins
0
Accepted
Vanya Pavlova
Telerik team
answered on 08 Mar 2011, 10:44 AM
Hi Robin,


I believe that this is a problem related to Expression Blend rather than to RadControls. Please take a look at the following forum thread.


Greetings,
Vanya Pavlova
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Tags
GridView
Asked by
Robin
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Robin
Top achievements
Rank 1
Share this question
or