Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Horizontal Rule in Silverlight/XAML

I'm looking for a way to draw a horizontal rule across my Silverlight App. I'd like to be able to insert it in the XAML rather than the C#. Can't seem to find much via Google or MSDN.

Thanks!

like image 707
Siege898 Avatar asked Aug 10 '10 16:08

Siege898


2 Answers

Just use something like this:

HRULE:

<Border Margin="48,67,30,0" 
        Name="border1" 
        Height="2" 
        VerticalAlignment="Top" 
        BorderBrush="Black" 
        BorderThickness="2" />

VRULE:

<Border BorderBrush="Black" 
        BorderThickness="2" 
        Margin="92,124,0,62" 
        Name="border2" 
        HorizontalAlignment="Left" 
        Width="2" />
like image 91
IbrarMumtaz Avatar answered Nov 06 '22 12:11

IbrarMumtaz


Similar to using a border you can also use a rectangle - I believe this is the 'recommended' way to do a horizontal or vertical line rather than using a line element.

<Rectangle Height="1" Fill="Black" />

Or, if for example you need it below some kind of block element you can always add a border just on the bottom of the element...

like image 17
TrystanC Avatar answered Nov 06 '22 12:11

TrystanC