Silverlight: Line does not appear.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Bassem
    Contributor
    • Dec 2008
    • 344

    Silverlight: Line does not appear.

    Hello,

    I'm posting my Silverlight question to .NET section because I didn't find a Silverlight section in Bytes. I was planning to post in the feedback section about that but I can not get to that section now! I don't know where the links hide :) I'll try again.

    I'm too new to Silverlight and I'm doing a basic layout. What I'm trying to solve from beginning is to add a strike through TextDecorations to my TextBlock Text. I searched for that and found that adding a Line control is the solution.

    I did but it does not appear!!

    Here is my XAML for MainPage:
    Code:
    	<Grid x:Name="LayoutRoot" Width="250" Height="90" Loaded="LayoutRoot_Loaded">
            [b]<Line HorizontalAlignment="Stretch" Grid.Row="1" Grid.ColumnSpan="11" Stroke="White" StrokeThickness="3" X1="1" X2="1" Y1="1" Y2="1" />[/b]
            <Grid Grid.Row="1" Grid.Column="0">
                <Border Style="{StaticResource DaysLeftBorder}"/>
    	        <TextBlock x:Name="DaysPart1" Style="{StaticResource DaysLeftTextBlock}"/>
    		</Grid>
            <Grid Grid.Row="1" Grid.Column="1">
                <Border Style="{StaticResource DaysLeftBorder}"/>
                <TextBlock x:Name="DaysPart2" Style="{StaticResource DaysLeftTextBlock}"/>
            </Grid>
            <Border Grid.Row="1" Grid.Column="2" Style="{StaticResource DaysLeftBorder}"/>
    ...
            </Grid>
        </Grid>
    And for App:
    Code:
            <Style x:Key="DaysLeftTextBlock" TargetType="TextBlock">
    			<Setter Property="Foreground" Value="#FFF"/>
    			<Setter Property="FontSize" Value="36"/>
    			<Setter Property="VerticalAlignment" Value="Center"/>
    			<Setter Property="HorizontalAlignment" Value="Center"/>
                <Setter Property="FontFamily" Value="Arial"/>
                <Setter Property="FontWeight" Value="Bold"/>
    		</Style>
            <Style x:Key="DaysLeftBorder" TargetType="Border">
                <Setter Property="BorderThickness" Value=".1"/>
                <Setter Property="Background" Value="#000"/>
                <Setter Property="Margin" Value="0,0,1,0"/>
            </Style>
    Note: I use Silverlight 3, because I use the VWD Express 2010, and I couldn't find Silverlight 4 for this version by searching! Anyone has information about that?!

    I really appreciate your time for help!

    Thanks a lot,
    Bassem
    Last edited by Bassem; Sep 25 '10, 06:10 AM. Reason: Minimizing number of lines of code.
  • Bassem
    Contributor
    • Dec 2008
    • 344

    #2
    Hi,

    Sorry I found that there is a WPF/Silverlight section, I hope you can move my question there.

    I found the problem: I didn't draw a line, it was a point where X1 = X2, and Y1 = Y2! And the Canvas.ZIndex should be higher than the TextBlock.

    Thank you.

    Comment

    Working...