Click here to Skip to main content
15,902,114 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
I have used my xaml code like below:
<SolidColorBrush x:Key="ScrollBarBackground" Color="White" />

<Style x:Key="MetroScrollBarStyle" TargetType="{x:Type ScrollBar}">
<Style.Triggers>
<Trigger Property="Orientation" Value="Horizontal">
<Setter Property="Background" Value="{StaticResource ScrollBarBackground}" />
</Trigger>
</Style.Triggers>
</Style>
<Style BasedOn="{StaticResource MetroScrollBarStyle}" TargetType="{x:Type ScrollBar}" />

It causes null reference exception in designer page (Null reference exception). if i'm modifying the above code snippet as,

<SolidColorBrush x:Key="ScrollBarBackground" Color="White" />

<Style TargetType="{x:Type ScrollBar}">
<Style.Triggers>
<Trigger Property="Orientation" Value="Horizontal">
<Setter Property="Background" Value="{StaticResource ScrollBarBackground}" />
</Trigger>
</Style.Triggers>
</Style>

It works fine in designer. but i couldnt find the reason behind this.

Any one please share your ideas.

Thanks in advance.

Regards,

Jayapradha
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900