Browse Source

minor layout tweaks

Tim U 3 years ago
parent
commit
05e752d01a

+ 18 - 0
samples/ControlCatalog/Converter/MathSubtractConverter.cs

@@ -0,0 +1,18 @@
+using System;
+using System.Globalization;
+using Avalonia.Data.Converters;
+
+namespace ControlCatalog.Converter;
+
+public class MathSubtractConverter : IValueConverter
+{
+    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+    {
+        return (double)value - (double)parameter;
+    }
+
+    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+    {
+        throw new NotSupportedException();
+    }
+}

+ 10 - 2
samples/ControlCatalog/Pages/TransitioningContentControlPage.axaml

@@ -3,8 +3,9 @@
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
              xmlns:vm="using:ControlCatalog.ViewModels"
+             xmlns:converter="clr-namespace:ControlCatalog.Converter"
+             xmlns:system="using:System"
              mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
-             Height="{Binding $parent[ScrollViewer].Bounds.Height}"
              x:DataType="vm:TransitioningContentControlPageViewModel"
              x:CompileBindings="True"
              x:Class="ControlCatalog.Pages.TransitioningContentControlPage">
@@ -35,7 +36,14 @@
             </Setter>
         </Style>
     </UserControl.Styles>
-    <DockPanel LastChildFill="True">
+  
+  <UserControl.Resources>
+    <converter:MathSubtractConverter x:Key="MathSubtractConverter" />
+    <system:Double x:Key="TopMargin">8</system:Double>
+  </UserControl.Resources>
+  
+    <DockPanel LastChildFill="True" 
+               Height="{Binding Path=Bounds.Height, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Grid}, Converter={StaticResource MathSubtractConverter},ConverterParameter={StaticResource TopMargin}}">
 
         <TextBlock DockPanel.Dock="Top" Classes="h2">The TransitioningContentControl control allows you to show a page transition whenever the Content changes.</TextBlock>
 

+ 1 - 1
samples/SampleControls/HamburgerMenu/HamburgerMenu.xaml

@@ -22,7 +22,7 @@
 
   <Styles.Resources>
     <x:Double x:Key="PaneCompactWidth">40</x:Double>
-    <x:Double x:Key="PaneExpandWidth">200</x:Double>
+    <x:Double x:Key="PaneExpandWidth">220</x:Double>
     <x:Double x:Key="HeaderHeight">36</x:Double>
     <x:Double x:Key="NavigationItemHeight">36</x:Double>
     <x:Double x:Key="HamburgerMenuButtonHeight">32</x:Double>