add RelativePanel

This commit is contained in:
NaBian committed 2019-12-10 00:41:49 +08:00
1 parent af877ffc91
commit fc1fa6fcf7
6 files changed
+482 -106

No files matched your search

@@ -1,8 +1,59 @@
<UserControl x:Class="HandyControlDemo.UserControl.RelativePanelDemoCtl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:hc="https://handyorg.github.io/handycontrol"
Background="{DynamicResource RegionBrush}">
<Grid>
</Grid>
<hc:RelativePanel Width="620" Height="700">
<hc:RectangleDemo Name="Rect1" Background="Red" Height="50" Width="50">
<TextBlock Text="Rect1" Foreground="White" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</hc:RectangleDemo>
<hc:RectangleDemo Name="Rect2" Background="Blue" Height="50" Width="50" hc:RelativePanel.AlignHorizontalCenterWithPanel="True">
<TextBlock Text="Rect2" Foreground="White" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</hc:RectangleDemo>
<hc:RectangleDemo Name="Rect3" Background="Purple" Height="50" Width="50" hc:RelativePanel.AlignRightWithPanel="True">
<TextBlock Text="Rect3" Foreground="White" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</hc:RectangleDemo>
<hc:RectangleDemo Name="Rect4" Background="Red" Height="50" Width="50" hc:RelativePanel.AlignBottomWithPanel="True">
<TextBlock Text="Rect4" Foreground="White" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</hc:RectangleDemo>
<hc:RectangleDemo Name="Rect5" Background="Blue" Height="50" Width="50" hc:RelativePanel.AlignBottomWithPanel="True" hc:RelativePanel.AlignHorizontalCenterWithPanel="True">
<TextBlock Text="Rect5" Foreground="White" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</hc:RectangleDemo>
<hc:RectangleDemo Name="Rect6" Background="Purple" Height="50" Width="50" hc:RelativePanel.AlignBottomWithPanel="True" hc:RelativePanel.AlignRightWithPanel="True">
<TextBlock Text="Rect6" Foreground="White" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</hc:RectangleDemo>
<hc:RectangleDemo Name="Rect7" Background="Blue" Height="50" hc:RelativePanel.RightOf="{Binding ElementName=Rect1}">
<TextBlock Text="Rect7 (RightOf Rect1)" Padding="10,0" Foreground="White" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</hc:RectangleDemo>
<hc:RectangleDemo Name="Rect8" Background="Purple" Height="50" hc:RelativePanel.Below="{Binding ElementName=Rect7}">
<TextBlock Text="Rect8 (Below Rect7)" Padding="10,0" Foreground="White" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</hc:RectangleDemo>
<hc:RectangleDemo Name="Rect9" Background="Blue" Height="140" Width="460" hc:RelativePanel.AlignHorizontalCenterWithPanel="True" hc:RelativePanel.AlignVerticalCenterWithPanel="True">
<TextBlock Text="Rect9" Padding="10" Foreground="White" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Top"/>
</hc:RectangleDemo>
<hc:RectangleDemo Name="Rect10" Background="Red" Width="50" hc:RelativePanel.RightOf="{Binding ElementName=Rect9}" hc:RelativePanel.AlignVerticalCenterWith="{Binding ElementName=Rect9}">
<TextBlock Text="Rect14 (RightOf Rect9, AlignVerticalCenterWith Rect9)" Padding="10,0" Foreground="White" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock.LayoutTransform>
<TransformGroup>
<RotateTransform Angle="-90"/>
</TransformGroup>
</TextBlock.LayoutTransform>
</TextBlock>
</hc:RectangleDemo>
<hc:RectangleDemo Name="Rect11" Background="Red" Height="50" hc:RelativePanel.AlignBottomWith="{Binding ElementName=Rect9}" hc:RelativePanel.AlignHorizontalCenterWith="{Binding ElementName=Rect9}">
<TextBlock Text="Rect11 (AlignBottomWith Rect9, AlignHorizontalCenterWith Rect9)" Padding="10,0" Foreground="White" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</hc:RectangleDemo>
<hc:RectangleDemo Name="Rect12" Background="Red" Height="50" hc:RelativePanel.Below="{Binding ElementName=Rect8}" hc:RelativePanel.AlignLeftWith="{Binding ElementName=Rect7}">
<TextBlock Text="Rect12 (Below Rect8, AlignLeftWith Rect7)" Padding="10,0" Foreground="White" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</hc:RectangleDemo>
<hc:RectangleDemo Name="Rect13" Background="Blue" Height="50" hc:RelativePanel.Below="{Binding ElementName=Rect12}" hc:RelativePanel.AlignRightWith="{Binding ElementName=Rect12}">
<TextBlock Text="Rect13 (Below Rect12, AlignRightWith Rect12)" Padding="10,0" Foreground="White" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</hc:RectangleDemo>
<hc:RectangleDemo Name="Rect14" Background="Purple" Height="50" hc:RelativePanel.Above="{Binding ElementName=Rect9}" hc:RelativePanel.AlignRightWith="{Binding ElementName=Rect9}">
<TextBlock Text="Rect14 (Above Rect9, AlignRightWith Rect9)" Padding="10,0" Foreground="White" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</hc:RectangleDemo>
<hc:RectangleDemo Name="Rect15" Background="Red" Height="50" hc:RelativePanel.LeftOf="{Binding ElementName=Rect5}" hc:RelativePanel.AlignTopWith="{Binding ElementName=Rect9}">
<TextBlock Text="Rect15 (LeftOf Rect5, AlignTopWith Rect9)" Padding="10,0" Foreground="White" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</hc:RectangleDemo>
</hc:RelativePanel>
</UserControl>