MainView.xaml 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <UserControl xmlns="https://github.com/avaloniaui"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  4. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5. xmlns:vm="clr-namespace:SafeAreaDemo.ViewModels"
  6. mc:Ignorable="d"
  7. d:DesignWidth="800"
  8. d:DesignHeight="450"
  9. x:Class="SafeAreaDemo.Views.MainView"
  10. x:DataType="vm:MainViewModel"
  11. Background="#ccc"
  12. TopLevel.AutoSafeAreaPadding="{Binding AutoSafeAreaPadding, Mode=TwoWay}">
  13. <Grid HorizontalAlignment="Stretch"
  14. VerticalAlignment="Stretch"
  15. Bounds="{Binding CanvasSize, Mode=OneWayToSource}">
  16. <Border BorderBrush="Red"
  17. Margin="{Binding ViewPadding}"
  18. BorderThickness="1">
  19. <Grid>
  20. <Label Margin="5"
  21. Foreground="Red"
  22. HorizontalAlignment="Stretch"
  23. HorizontalContentAlignment="Right">View Bounds</Label>
  24. <Label Margin="5"
  25. Foreground="Red"
  26. VerticalAlignment="Bottom"
  27. HorizontalContentAlignment="Right">View Bounds</Label>
  28. </Grid>
  29. </Border>
  30. <Border BorderBrush="LimeGreen"
  31. Margin="{Binding SafeAreaPadding}"
  32. BorderThickness="1">
  33. <DockPanel>
  34. <Label Margin="5"
  35. Foreground="LimeGreen"
  36. DockPanel.Dock="Bottom"
  37. HorizontalAlignment="Stretch"
  38. HorizontalContentAlignment="Left" >Safe Area</Label>
  39. <Grid DockPanel.Dock="Bottom"
  40. HorizontalAlignment="Stretch"
  41. VerticalAlignment="Stretch">
  42. <StackPanel Orientation="Vertical"
  43. HorizontalAlignment="Center"
  44. VerticalAlignment="Center">
  45. <Label HorizontalAlignment="Left">Options:</Label>
  46. <CheckBox IsChecked="{Binding DisplayEdgeToEdge}">Display Edge To Edge</CheckBox>
  47. <CheckBox IsChecked="{Binding UseSafeArea}" IsEnabled="{Binding !AutoSafeAreaPadding}">Use Safe Area</CheckBox>
  48. <CheckBox IsChecked="{Binding AutoSafeAreaPadding}">Automatic Paddings</CheckBox>
  49. <CheckBox IsChecked="{Binding HideSystemBars}">Hide System Bars</CheckBox>
  50. <TextBox Width="200" Watermark="Tap to Show Keyboard"/>
  51. </StackPanel>
  52. </Grid>
  53. </DockPanel>
  54. </Border>
  55. <Button Margin="{Binding InputPaneMarkerMargin}"
  56. VerticalAlignment="Bottom"
  57. Content="X">
  58. <Button.Transitions>
  59. <Transitions>
  60. <ThicknessTransition Property="Margin"
  61. Duration="{Binding InputPaneDuration}"
  62. Easing="{Binding InputPaneEasing}"/>
  63. </Transitions>
  64. </Button.Transitions>
  65. </Button>
  66. </Grid>
  67. </UserControl>