The Hackers Manifesto

How To Create a Vertical Separator with WPF

4. January 2012 17:21 by Scott in   //  Tags:   //   Comments (0)

<Window.Resources>
    <Style x:Key="SeparatorStyle"
           TargetType="{x:Type Border}">
      <Setter Property="BorderThickness" Value="1,0,0,0"/>
      <Setter Property="BorderBrush" Value="#FFC5C5C5"/>
      <Setter Property="Margin" Value="10,0,10,0"/>
      <Setter Property="Width" Value="2"/>
      <Setter Property="Background" Value="White"/>
    </Style>
  </Window.Resources>

  <StackPanel Orientation="Horizontal">
    <TextBlock>Hello</TextBlock>
    <Border Style="{StaticResource SeparatorStyle}"/>
    <TextBlock>Hello</TextBlock>
  </StackPanel>

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading