Browse Source

Make all dialogs have the first textbox selected by default

Equbuxu 3 years ago
parent
commit
9d8accffc6

+ 4 - 3
PixiEditor/Views/Dialogs/ImportFilePopup.xaml

@@ -40,12 +40,13 @@
                         Command="{Binding ChoosePathCommand}" />
             <StackPanel Background="{StaticResource MainColor}" Height="120" Width="225" Margin="0,30,0,0">
                 <local:SizePicker EditingEnabled="{Binding PathIsCorrect}"
-                                      ChosenWidth="{Binding ImportWidth, Mode=TwoWay}"
-                                      ChosenHeight="{Binding ImportHeight,Mode=TwoWay}" />
+                                  x:Name="sizePicker"
+                                  ChosenWidth="{Binding ImportWidth, Mode=TwoWay}"
+                                  ChosenHeight="{Binding ImportHeight,Mode=TwoWay}" />
             </StackPanel>
         </StackPanel>
         <Button Grid.Row="1" Height="30" Width="60" VerticalAlignment="Bottom" HorizontalAlignment="Right"
                     Margin="10" Style="{StaticResource DarkRoundButton}" Content="OK" Command="{Binding OkCommand}"
                     CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" />
     </Grid>
-</Window>
+</Window>

+ 4 - 3
PixiEditor/Views/Dialogs/ImportFilePopup.xaml.cs

@@ -1,6 +1,6 @@
-using System.Windows;
+using PixiEditor.ViewModels;
+using System.Windows;
 using System.Windows.Input;
-using PixiEditor.ViewModels;
 
 namespace PixiEditor.Views
 {
@@ -15,6 +15,7 @@ namespace PixiEditor.Views
         {
             InitializeComponent();
             DataContext = dc;
+            Loaded += (_, _) => sizePicker.FocusWidthPicker();
         }
 
 
@@ -48,4 +49,4 @@ namespace PixiEditor.Views
             SystemCommands.CloseWindow(this);
         }
     }
-}
+}

+ 3 - 2
PixiEditor/Views/Dialogs/ResizeCanvasPopup.xaml

@@ -28,7 +28,7 @@
         <i:Interaction.Behaviors>
             <behaviors:ClearFocusOnClickBehavior/>
         </i:Interaction.Behaviors>
-        
+
         <DockPanel Grid.Row="0" Background="{StaticResource MainColor}">
             <Button DockPanel.Dock="Right" HorizontalAlignment="Right" Style="{StaticResource CloseButtonStyle}"
                     WindowChrome.IsHitTestVisibleInChrome="True" ToolTip="Close"
@@ -39,6 +39,7 @@
         <StackPanel HorizontalAlignment="Center" Margin="0,50,0,0" Background="{StaticResource MainColor}"
                     VerticalAlignment="Top" Grid.Row="1" Width="300" Height="250">
             <local:SizePicker Margin="0,10,0,0" Width="300" Height="110"
+                              x:Name="sizePicker"
                               ChosenHeight="{Binding NewHeight, Mode=TwoWay, ElementName=window}"
                               ChosenWidth="{Binding NewWidth, Mode=TwoWay, ElementName=window}" />
             <Separator Margin="10,20,10,0" Background="{StaticResource AccentColor}" Height="1" />
@@ -50,4 +51,4 @@
         <Button Grid.Row="1" Height="30" Width="60" VerticalAlignment="Bottom" HorizontalAlignment="Right" Margin="10"
                 Style="{StaticResource DarkRoundButton}" Content="OK" Click="Button_Click" />
     </Grid>
-</Window>
+</Window>

+ 1 - 0
PixiEditor/Views/Dialogs/ResizeCanvasPopup.xaml.cs

@@ -26,6 +26,7 @@ namespace PixiEditor.Views
         {
             InitializeComponent();
             Owner = Application.Current.MainWindow;
+            Loaded += (_, _) => sizePicker.FocusWidthPicker();
         }
 
 

+ 5 - 3
PixiEditor/Views/Dialogs/ResizeDocumentPopup.xaml

@@ -27,7 +27,7 @@
         <i:Interaction.Behaviors>
             <behaviors:ClearFocusOnClickBehavior/>
         </i:Interaction.Behaviors>
-        
+
         <DockPanel Grid.Row="0" Background="{StaticResource MainColor}">
             <Button DockPanel.Dock="Right" HorizontalAlignment="Right" Style="{StaticResource CloseButtonStyle}"
                     WindowChrome.IsHitTestVisibleInChrome="True" ToolTip="Close"
@@ -37,10 +37,12 @@
                Content="Resize document" />
         <StackPanel HorizontalAlignment="Center" Margin="0,50,0,0" Background="{StaticResource MainColor}"
                     VerticalAlignment="Top" Grid.Row="1" Width="350" Height="150">
-            <local:SizePicker Margin="0,20" ChosenHeight="{Binding Path=NewHeight, Mode=TwoWay, ElementName=window}"
+            <local:SizePicker Margin="0,20" 
+                              x:Name="sizePicker"
+                              ChosenHeight="{Binding Path=NewHeight, Mode=TwoWay, ElementName=window}"
                               ChosenWidth="{Binding Path=NewWidth, Mode=TwoWay, ElementName=window}" />
         </StackPanel>
         <Button Grid.Row="1" Height="30" Width="60" VerticalAlignment="Bottom" HorizontalAlignment="Right" Margin="10"
                 Style="{StaticResource DarkRoundButton}" Content="OK" Click="Button_Click" />
     </Grid>
-</Window>
+</Window>

+ 1 - 0
PixiEditor/Views/Dialogs/ResizeDocumentPopup.xaml.cs

@@ -19,6 +19,7 @@ namespace PixiEditor.Views
             InitializeComponent();
             Owner = Application.Current.MainWindow;
             DataContext = this;
+            Loaded += (_, _) => sizePicker.FocusWidthPicker();
         }
 
         public int NewHeight

+ 7 - 6
PixiEditor/Views/Dialogs/SaveFilePopup.xaml

@@ -33,19 +33,20 @@
                     WindowChrome.IsHitTestVisibleInChrome="True" ToolTip="Close"
                     Command="{x:Static SystemCommands.CloseWindowCommand}" />
         </DockPanel>
-        
+
         <TextBlock Grid.Row="1" Foreground="Snow" VerticalAlignment="Top" HorizontalAlignment="Center"
                        Text="File settings" TextAlignment="Center" Margin="0,10,0,0" FontSize="24" />
-            <StackPanel Orientation="Vertical" Grid.Row="1" Margin="0,50,0,0">
-                <local:SizePicker Width="250" Height="120"
+        <StackPanel Orientation="Vertical" Grid.Row="1" Margin="0,50,0,0">
+            <local:SizePicker Width="250" Height="120"
+                                  x:Name="sizePicker"
                                   ChosenHeight="{Binding Path=SaveHeight, Mode=TwoWay, ElementName=saveFilePopup}"
                                   ChosenWidth="{Binding Path=SaveWidth, Mode=TwoWay, ElementName=saveFilePopup}" />
-                <Button Foreground="Snow" Height="40" Width="160" Margin="0,10,0,0" Content="Path"
+            <Button Foreground="Snow" Height="40" Width="160" Margin="0,10,0,0" Content="Path"
                         Background="{StaticResource MainColor}" BorderBrush="{Binding PathButtonBorder}"
                         Command="{Binding ChoosePathCommand}" />
-            </StackPanel>
+        </StackPanel>
         <Button Grid.Row="1" Height="30" Width="60" VerticalAlignment="Bottom" HorizontalAlignment="Right"
                     Margin="10" Style="{StaticResource DarkRoundButton}" Content="OK" Command="{Binding OkCommand}"
                     CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" />
     </Grid>
-</Window>
+</Window>

+ 1 - 0
PixiEditor/Views/Dialogs/SaveFilePopup.xaml.cs

@@ -33,6 +33,7 @@ namespace PixiEditor.Views
             InitializeComponent();
             Owner = Application.Current.MainWindow;
             DataContext = dataContext;
+            Loaded += (_, _) => sizePicker.FocusWidthPicker();
         }