Browse Source

Added SizeInput style to SizePicker

CPKreuz 3 years ago
parent
commit
acd72db5cd
1 changed files with 18 additions and 8 deletions
  1. 18 8
      PixiEditor/Views/UserControls/SizePicker.xaml

+ 18 - 8
PixiEditor/Views/UserControls/SizePicker.xaml

@@ -6,29 +6,39 @@
              xmlns:local="clr-namespace:PixiEditor.Views"
              xmlns:local="clr-namespace:PixiEditor.Views"
              mc:Ignorable="d"
              mc:Ignorable="d"
              d:DesignHeight="110" d:DesignWidth="215" Name="uc">
              d:DesignHeight="110" d:DesignWidth="215" Name="uc">
+    <UserControl.Resources>
+        <Style TargetType="local:SizeInput">
+            <Setter Property="HorizontalAlignment" Value="Left"/>
+            <Setter Property="MaxSize" Value="9999"/>
+            <Setter Property="SelectOnFocus" Value="False"/>
+            <Setter Property="FontSize" Value="16"/>
+            <Setter Property="Margin" Value="10,0,0,0"/>
+            <Setter Property="Width" Value="150"/>
+            <Setter Property="Height" Value="30"/>
+        </Style>
+    </UserControl.Resources>
     <StackPanel Background="{StaticResource MainColor}">
     <StackPanel Background="{StaticResource MainColor}">
         <DockPanel Margin="5,10,0,0" HorizontalAlignment="Center" VerticalAlignment="Center">
         <DockPanel Margin="5,10,0,0" HorizontalAlignment="Center" VerticalAlignment="Center">
             <TextBlock Height="20" Foreground="Snow" Text="Width:" TextAlignment="Center" FontSize="16"
             <TextBlock Height="20" Foreground="Snow" Text="Width:" TextAlignment="Center" FontSize="16"
                        HorizontalAlignment="Center" VerticalAlignment="Center" />
                        HorizontalAlignment="Center" VerticalAlignment="Center" />
-            <local:SizeInput x:Name="WidthPicker" IsEnabled="{Binding EditingEnabled, ElementName=uc}" Width="150" Height="30"
+            <local:SizeInput x:Name="WidthPicker"
+                             IsEnabled="{Binding EditingEnabled, ElementName=uc}"
                              PreserveAspectRatio="{Binding Path=IsChecked, ElementName=aspectRatio}"
                              PreserveAspectRatio="{Binding Path=IsChecked, ElementName=aspectRatio}"
                              AspectRatioValue="{Binding Path=ChosenHeight, ElementName=uc}"
                              AspectRatioValue="{Binding Path=ChosenHeight, ElementName=uc}"
                              AspectRatioControl="{Binding ElementName=HeightPicker}"
                              AspectRatioControl="{Binding ElementName=HeightPicker}"
-                             HorizontalAlignment="Left" Margin="10,0,0,0"
-                             FontSize="16" NextControl="{Binding ElementName=HeightPicker}"
-                             MaxSize="9999" SelectOnFocus="False"
+                             NextControl="{Binding ElementName=HeightPicker}"
                              Size="{Binding Path=ChosenWidth, ElementName=uc, Mode=TwoWay}" />
                              Size="{Binding Path=ChosenWidth, ElementName=uc, Mode=TwoWay}" />
         </DockPanel>
         </DockPanel>
         <DockPanel Margin="5,10,0,0" HorizontalAlignment="Center" VerticalAlignment="Center">
         <DockPanel Margin="5,10,0,0" HorizontalAlignment="Center" VerticalAlignment="Center">
             <TextBlock Height="20" Foreground="Snow" Text="Height:" TextAlignment="Center" FontSize="16"
             <TextBlock Height="20" Foreground="Snow" Text="Height:" TextAlignment="Center" FontSize="16"
                        HorizontalAlignment="Center" VerticalAlignment="Center" />
                        HorizontalAlignment="Center" VerticalAlignment="Center" />
-            <local:SizeInput x:Name="HeightPicker" IsEnabled="{Binding EditingEnabled, ElementName=uc}" Margin="5,0,0,0"
+            <local:SizeInput x:Name="HeightPicker" 
+                             IsEnabled="{Binding EditingEnabled, ElementName=uc}"
+                             Margin="5,0,0,0"
                              PreserveAspectRatio="{Binding Path=IsChecked, ElementName=aspectRatio}"
                              PreserveAspectRatio="{Binding Path=IsChecked, ElementName=aspectRatio}"
                              AspectRatioValue="{Binding Path=ChosenWidth, ElementName=uc}"
                              AspectRatioValue="{Binding Path=ChosenWidth, ElementName=uc}"
                              AspectRatioControl="{Binding ElementName=WidthPicker}"
                              AspectRatioControl="{Binding ElementName=WidthPicker}"
-                             HorizontalAlignment="Left" Width="150" Height="30"
-                             FontSize="16" NextControl="{Binding NextControl, ElementName=uc}"
-                             MaxSize="9999" SelectOnFocus="False"
+                             NextControl="{Binding NextControl, ElementName=uc}"
                              Size="{Binding ChosenHeight, ElementName=uc, Mode=TwoWay}" />
                              Size="{Binding ChosenHeight, ElementName=uc, Mode=TwoWay}" />
         </DockPanel>
         </DockPanel>
         <CheckBox Name="aspectRatio" Content="Preserve aspect ratio" Foreground="White" HorizontalAlignment="Left" Margin="50,10,0,0" />
         <CheckBox Name="aspectRatio" Content="Preserve aspect ratio" Foreground="White" HorizontalAlignment="Left" Margin="50,10,0,0" />