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

Problem when defining a Border style in Office2013

1 Answer 41 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Patrick
Top achievements
Rank 2
Iron
Iron
Iron
Patrick asked on 06 Jan 2014, 04:39 PM
Hello,
create a new WPF application, add references to Telerik.Windows.Controls and Telerik.Windows.Themes.Office2013.

Then, replace App.xaml with:
<Application
  x:Class="WpfApplication1.App"
  StartupUri="MainWindow.xaml">
 
  <Application.Resources>
    <ResourceDictionary>
 
      <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/Telerik.Windows.Themes.Office2013;component/Themes/System.Windows.xaml"/>
        <ResourceDictionary Source="/Telerik.Windows.Themes.Office2013;component/Themes/Telerik.Windows.Controls.xaml"/>
      </ResourceDictionary.MergedDictionaries>
 
    <Style x:Name="MyBorderStyle" TargetType="Border">
      <Setter Property="BorderBrush"     Value="Black" />
      <Setter Property="BorderThickness" Value="1" />
    </Style>
 
    </ResourceDictionary>
  </Application.Resources>
 
</Application>

Replace MainWindow.xaml with:
<Window
  x:Class="WpfApplication1.MainWindow"
  Title="MainWindow" Height="350" Width="525">
  <tk:RadListBox Margin="10">
    <tk:RadListBoxItem Content="One" />
    <tk:RadListBoxItem Content="Two" />
    <tk:RadListBoxItem Content="Three" />
  </tk:RadListBox>
</Window>

Run the application: the list box items have a black border around them, as defined in the border style. But that's wrong because this is not a default style, so it should not be applied in this case.

Patrick

1 Answer, 1 is accepted

Sort by
0
Patrick
Top achievements
Rank 2
Iron
Iron
Iron
answered on 07 Jan 2014, 09:14 AM
Hello,
I found the solution: the style should be defined with x:Key and not x:Name.
Patrick
Tags
ListBox
Asked by
Patrick
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Patrick
Top achievements
Rank 2
Iron
Iron
Iron
Share this question
or