Last active
January 30, 2020 12:35
-
-
Save s-fernandez-v/f61cab2616dc3a165783aef687cae8a2 to your computer and use it in GitHub Desktop.
Canvas: Content layout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Grid | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> | |
<Grid HorizontalAlignment="Center" VerticalAlignment="Center" Background="LightGray" TextElement.Foreground="Black"> | |
<Grid.Resources> | |
<LinearGradientBrush x:Key="BgBrush" StartPoint="0,0" EndPoint="1,1"> | |
<GradientStop Offset="0" Color="#FF9BDEFF"/> | |
<GradientStop Offset="1" Color="#FF69B5FF"/> | |
</LinearGradientBrush> | |
<Style x:Key="BorderStyle" TargetType="Border"> | |
<Setter Property="BorderBrush" Value="Black"/> | |
<Setter Property="BorderThickness" Value="1"/> | |
<Setter Property="Background" Value="{StaticResource BgBrush}"/> | |
<Setter Property="Height" Value="50"/> | |
</Style> | |
</Grid.Resources> | |
<Grid.RowDefinitions> | |
<RowDefinition Height="Auto"/> | |
<RowDefinition/> | |
</Grid.RowDefinitions> | |
<TextBlock Margin="0,8,0,0" HorizontalAlignment="Center"> | |
<Run Text="{Binding ActualWidth, ElementName=Canvas, StringFormat=Canvas size: {0}, Mode=OneWay}"/> | |
<Run Text="{Binding ActualHeight, ElementName=Canvas, StringFormat=x{0}, Mode=OneWay}"/> | |
</TextBlock> | |
<Canvas x:Name="Canvas" Width="350" Height="300" Grid.Row="1" Background="White" Margin="8"> | |
<Border Canvas.Left="20" Canvas.Top="15" Style="{StaticResource BorderStyle}" CornerRadius="0,4,4,4"> | |
<Grid> | |
<TextBlock VerticalAlignment="Top" Margin="2,0,10,0"> | |
<Run Text="{Binding (Canvas.Left), RelativeSource={RelativeSource AncestorType={x:Type Border}}, StringFormat='(left={0},', Mode=OneWay}"/> | |
<Run Text="{Binding (Canvas.Top), RelativeSource={RelativeSource AncestorType={x:Type Border}}, StringFormat='top={0})', Mode=OneWay}"/> | |
</TextBlock> | |
<Ellipse Fill="Black" Stroke="#00000000" Width="4" Height="4" HorizontalAlignment="Left" VerticalAlignment="Top" StrokeThickness="0" Margin="-2,-2,0,0"/> | |
</Grid> | |
</Border> | |
<Border Canvas.Right="15" Canvas.Top="35" Style="{StaticResource BorderStyle}" CornerRadius="4,0,4,4"> | |
<Grid> | |
<TextBlock VerticalAlignment="Top" Margin="10,0,2,0"> | |
<Run Text="{Binding (Canvas.Right), RelativeSource={RelativeSource AncestorType={x:Type Border}}, StringFormat='(right={0},', Mode=OneWay}"/> | |
<Run Text="{Binding (Canvas.Top), RelativeSource={RelativeSource AncestorType={x:Type Border}}, StringFormat='top={0})', Mode=OneWay}"/> | |
</TextBlock> | |
<Ellipse Fill="Black" Stroke="#00000000" Width="4" Height="4" HorizontalAlignment="Right" VerticalAlignment="Top" StrokeThickness="0" Margin="0,-2,-2,0"/> | |
</Grid> | |
</Border> | |
<Border Canvas.Left="10" Canvas.Bottom="35" Style="{StaticResource BorderStyle}" CornerRadius="4,4,4,0"> | |
<Grid> | |
<TextBlock VerticalAlignment="Bottom" Margin="2,0,10,0"> | |
<Run Text="{Binding (Canvas.Left), RelativeSource={RelativeSource AncestorType={x:Type Border}}, StringFormat='(left={0},', Mode=OneWay}"/> | |
<Run Text="{Binding (Canvas.Bottom), RelativeSource={RelativeSource AncestorType={x:Type Border}}, StringFormat='bottom={0})', Mode=OneWay}"/> | |
</TextBlock> | |
<Ellipse Fill="Black" Stroke="#00000000" Width="4" Height="4" HorizontalAlignment="Left" VerticalAlignment="Bottom" StrokeThickness="0" Margin="-2,0,0,-2"/> | |
</Grid> | |
</Border> | |
<Border Canvas.Right="10" Canvas.Bottom="5" Style="{StaticResource BorderStyle}" CornerRadius="4,4,0,4"> | |
<Grid> | |
<TextBlock VerticalAlignment="Bottom" Margin="10,0,2,0"> | |
<Run Text="{Binding (Canvas.Right), RelativeSource={RelativeSource AncestorType={x:Type Border}}, StringFormat='(right={0},', Mode=OneWay}"/> | |
<Run Text="{Binding (Canvas.Bottom), RelativeSource={RelativeSource AncestorType={x:Type Border}}, StringFormat='bottom={0})', Mode=OneWay}"/> | |
</TextBlock> | |
<Ellipse Fill="Black" Stroke="#00000000" Width="4" Height="4" HorizontalAlignment="Right" VerticalAlignment="Bottom" StrokeThickness="0" Margin="0,0,-2,-2"/> | |
</Grid> | |
</Border> | |
<Border Canvas.Left="160" Canvas.Top="115" Style="{StaticResource BorderStyle}" CornerRadius="0,4,4,4"> | |
<Grid> | |
<TextBlock VerticalAlignment="Top" Margin="2,0,10,0"> | |
<Run Text="{Binding (Canvas.Left), RelativeSource={RelativeSource AncestorType={x:Type Border}}, StringFormat='(left={0},', Mode=OneWay}"/> | |
<Run Text="{Binding (Canvas.Top), RelativeSource={RelativeSource AncestorType={x:Type Border}}, StringFormat='top={0})', Mode=OneWay}"/> | |
</TextBlock> | |
<Ellipse Fill="Black" Stroke="#00000000" Width="4" Height="4" HorizontalAlignment="Left" VerticalAlignment="Top" StrokeThickness="0" Margin="-2,-2,0,0"/> | |
</Grid> | |
</Border> | |
</Canvas> | |
</Grid> | |
</Grid> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment