I recently upgraded my telerik DLL's to UI for WPF Q1 2015 SP1, After upgrading i am getting error with scrollviewerstyle.
I am overriding scrollviewer style <Style TargetType="{x:Type ScrollViewer}" BasedOn="{StaticResource ScrollViewerStyle}"> .... </style> and this was working fine with older version of telerik, I had 2014 version.
I am using implicit styles so i have Syste.Windows.xaml file in my project and i am loading it in my app.xaml.cs
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/ntierHealth;component/Resources/Themes/System.Windows.xaml"/>
<ResourceDictionary Source="/ntierHealth;component/Resources/Themes/Telerik.Windows.Controls.xaml"/> .....
If i use the old version of system.windows.xaml or if i remove my style everything works but not with the latest version. I am getting StaticResourceHolder threw an exception. I have attached screen shot of the error.
Thanks
vikas
4 Answers, 1 is accepted
My scrollviewer style
<!-- Updated-->
<Style x:Key="CustomScrollBarStyle" TargetType="{x:Type ScrollBar}">
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="OverridesDefaultStyle" Value="true" />
<Style.Triggers>
<Trigger Property="Orientation" Value="Horizontal">
<Setter Property="Width" Value="Auto" />
<Setter Property="Height" Value="15" />
<Setter Property="Template" Value="{StaticResource HorizontalScrollBar}" />
</Trigger>
<Trigger Property="Orientation" Value="Vertical">
<Setter Property="Width" Value="15" />
<Setter Property="Height" Value="Auto" />
<Setter Property="Template" Value="{StaticResource VerticalScrollBar}" />
</Trigger>
</Style.Triggers>
</Style>
<!-- Add ScrollViewer Style which includes CustomScrollBarStyle inside -->
<Style BasedOn="{StaticResource ScrollViewerStyle}" TargetType="ScrollViewer">
<!--<Style TargetType="{x:Type ScrollViewer}" BasedOn="{StaticResource ScrollViewerStyle}">-->
<!--<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ScrollViewer">
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<ScrollContentPresenter
Grid.Column="0"
Grid.Row="0"
Margin="{TemplateBinding Padding}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
CanContentScroll="{TemplateBinding CanContentScroll}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
<Border Grid.Column="1" Grid.Row="1" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Margin="0 0 -1 -1">
<Border
Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
BorderThickness="0 0 1 1"
BorderBrush="{StaticResource ScrollBarOuterBorder_Normal}"
Background="{StaticResource ScrollViewerIntersectionRectangle}"/>
</Border>
<ScrollBar x:Name="PART_VerticalScrollBar"
Margin="0 0 -1 0"
BorderThickness="{StaticResource ScrollViewerVerticalScrollBarBorderThickness}"
Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
Grid.Column="1"
Grid.Row="0"
Orientation="Vertical"
Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}"
ViewportSize="{TemplateBinding ViewportHeight}"
Style="{StaticResource CustomScrollBarStyle}"
IsTabStop="False"
Minimum="0"
Maximum="{TemplateBinding ScrollableHeight}"/>
<ScrollBar x:Name="PART_HorizontalScrollBar"
Margin="0 0 0 -1"
BorderThickness="{StaticResource ScrollViewerHorizontalScrollBarBorderThickness}"
Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"
Grid.Column="0"
Grid.Row="1"
Orientation="Horizontal"
Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}"
ViewportSize="{TemplateBinding ViewportWidth}"
Style="{StaticResource CustomScrollBarStyle}"
IsTabStop="False"
Minimum="0"
Maximum="{TemplateBinding ScrollableWidth}"/>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>-->
</Style>
Looking at the exception a resource required by the style could not be resolved.
Can you clarify which built-in Telerik theme you are currently using as base?
Based on this information we will try to isolate the problem by our side.
I look forward to hearing from you.
Regards,
Vanya Pavlova
Telerik
I am using these resources, the error is coming from system.windows.xaml, it has scrollviewer style.
<ResourceDictionary Source="/ntierHealth;component/Resources/Themes/System.Windows.xaml"/>
<ResourceDictionary Source="/ntierHealth;component/Resources/Themes/Telerik.Windows.Controls.xaml"/>
<ResourceDictionary Source="/ntierHealth;component/Resources/Themes/Telerik.Windows.Controls.Input.xaml"/>
<ResourceDictionary Source="/ntierHealth;component/Resources/Themes/Telerik.Windows.Controls.GridView.xaml"/>
<ResourceDictionary Source="/ntierHealth;component/Resources/Themes/Telerik.Windows.Controls.Data.xaml"/>
<ResourceDictionary Source="/ntierHealth;component/Resources/Themes/Telerik.Windows.Controls.Docking.xaml"/>
<ResourceDictionary Source="/ntierHealth;component/Resources/Themes/Telerik.Windows.Controls.Navigation.xaml"/>
Do we have to peform some tests against specific Telerik built-in theme?
Regards,
Vanya Pavlova
Telerik