Browse Source

Changed menu and fixed numeric input

flabbet 5 years ago
parent
commit
3289c4a0d0

+ 35 - 42
PixiEditor/Helpers/Behaviours/TextBoxFocusBehavior.cs

@@ -26,52 +26,40 @@ namespace PixiEditor.Helpers.Behaviours
 
 
 
+        private string _oldText; //Value of textbox before editing
+        private bool _valueConverted = false; //This bool is used to avoid double convertion if enter is hitted
 
-
-        public FocusNavigationDirection NextFocusDirection
+        //Converts number to proper format if enter is clicked and moves focus to next object
+        private void AssociatedObject_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)
         {
-            get { return (FocusNavigationDirection)GetValue(NextFocusDirectionProperty); }
-            set { SetValue(NextFocusDirectionProperty, value); }
-        }
-
-        // Using a DependencyProperty as the backing store for NextFocusDirection.  This enables animation, styling, binding, etc...
-        public static readonly DependencyProperty NextFocusDirectionProperty =
-            DependencyProperty.Register("NextFocusDirection", typeof(FocusNavigationDirection), typeof(TextBoxFocusBehavior), 
-                new PropertyMetadata(FocusNavigationDirection.Up));
-
-
-
-
-
-
+            if (e.Key != System.Windows.Input.Key.Enter) return;
 
-        private string _oldText; //Value of textbox before editing
-        private bool _valueConverted = false; //This bool is used to avoid double convertion if enter is hitted
+            ConvertValue();
+            AssociatedObject.MoveFocus(new TraversalRequest(FocusNavigationDirection.Down));
+        }
 
         protected override void OnAttached()
         {
             base.OnAttached();
+            AssociatedObject.GotKeyboardFocus += AssociatedObjectGotKeyboardFocus;
+            AssociatedObject.GotMouseCapture += AssociatedObjectGotMouseCapture;
+            AssociatedObject.PreviewMouseLeftButtonDown += AssociatedObjectPreviewMouseLeftButtonDown;
             AssociatedObject.LostKeyboardFocus += AssociatedObject_LostKeyboardFocus;
-            AssociatedObject.GotKeyboardFocus += AssociatedObject_GotKeyboardFocus;
             AssociatedObject.KeyUp += AssociatedObject_KeyUp;
-            AssociatedObject.GotMouseCapture += AssociatedObject_GotMouseCapture;
         }
 
-        private void AssociatedObject_GotMouseCapture(object sender, System.Windows.Input.MouseEventArgs e)
-        {
-            AssociatedObject.SelectAll(); //Selects all text on mouse click
-        }
-        
-        //Converts number to proper format if enter is clicked and moves focus to next object
-        private void AssociatedObject_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)
+        protected override void OnDetaching()
         {
-            if (e.Key != System.Windows.Input.Key.Enter) return;
-
-            ConvertValue();
-            AssociatedObject.MoveFocus(new TraversalRequest(NextFocusDirection));
+            base.OnDetaching();
+            AssociatedObject.GotKeyboardFocus -= AssociatedObjectGotKeyboardFocus;
+            AssociatedObject.GotMouseCapture -= AssociatedObjectGotMouseCapture;
+            AssociatedObject.PreviewMouseLeftButtonDown -= AssociatedObjectPreviewMouseLeftButtonDown;
+            AssociatedObject.LostKeyboardFocus -= AssociatedObject_LostKeyboardFocus;
+            AssociatedObject.KeyUp -= AssociatedObject_KeyUp;
         }
 
-        private void AssociatedObject_GotKeyboardFocus(object sender, System.Windows.Input.KeyboardFocusChangedEventArgs e)
+        private void AssociatedObjectGotKeyboardFocus(object sender,
+            System.Windows.Input.KeyboardFocusChangedEventArgs e)
         {
             AssociatedObject.SelectAll();
             if (FillSize)
@@ -81,6 +69,21 @@ namespace PixiEditor.Helpers.Behaviours
             }
         }
 
+        private void AssociatedObjectGotMouseCapture(object sender,
+            System.Windows.Input.MouseEventArgs e)
+        {
+            AssociatedObject.SelectAll();
+        }
+
+        private void AssociatedObjectPreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
+        {
+            if (!AssociatedObject.IsKeyboardFocusWithin)
+            {
+                AssociatedObject.Focus();
+                e.Handled = true;
+            }
+        }
+
         private void AssociatedObject_LostKeyboardFocus(object sender, System.Windows.Input.KeyboardFocusChangedEventArgs e)
         {
             ConvertValue();            
@@ -102,15 +105,5 @@ namespace PixiEditor.Helpers.Behaviours
             }
             _valueConverted = true;
         }
-
-        protected override void OnDetaching()
-        {
-            base.OnDetaching();
-            AssociatedObject.LostKeyboardFocus -= AssociatedObject_LostKeyboardFocus;
-            AssociatedObject.GotKeyboardFocus -= AssociatedObject_GotKeyboardFocus;
-            AssociatedObject.KeyUp -= AssociatedObject_KeyUp;
-            AssociatedObject.GotMouseCapture -= AssociatedObject_GotMouseCapture;
-
-        }
     }
 }

+ 1 - 3
PixiEditor/Models/Controllers/BitmapOperationsUtility.cs

@@ -1,5 +1,4 @@
 using PixiEditor.Helpers;
-using PixiEditor.Models.Controllers;
 using PixiEditor.Models.Enums;
 using PixiEditor.Models.Layers;
 using PixiEditor.Models.Position;
@@ -7,7 +6,6 @@ using PixiEditor.Models.Tools;
 using System;
 using System.Collections.Generic;
 using System.Collections.ObjectModel;
-using System.Diagnostics;
 using System.Linq;
 using System.Windows.Input;
 using System.Windows.Media;
@@ -306,4 +304,4 @@ public class LayersChangedEventArgs : EventArgs
         LayerAffected = layerAffected;
         LayerChangeType = layerChangeType;
     }
-}
+}

+ 1 - 2
PixiEditor/Models/Tools/ToolSettings/Settings/FloatSetting.cs

@@ -11,7 +11,6 @@ namespace PixiEditor.Models.Tools.ToolSettings.Settings
 {
     public class FloatSetting : Setting
     {
-
         public float Min { get; set; }
         public float Max { get; set; }
 
@@ -32,7 +31,7 @@ namespace PixiEditor.Models.Tools.ToolSettings.Settings
                 Width = 40,
                 Height = 20,
                 Min = Min,
-                Max = Max
+                Max = Max,                
 
             };
             Binding binding = new Binding("Value")

+ 117 - 50
PixiEditor/Styles/MenuButtonStyle.xaml

@@ -1,60 +1,127 @@
 <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-                    xmlns:local="clr-namespace:PixiEditor.Styles">
-    <Style TargetType="Button" x:Key="MenuButton">
-        <Setter Property="Height" Value="30"/>
-        <Setter Property="Width" Value="60"/>
-        <Setter Property="Background" Value="Transparent"/>
-        <Setter Property="Foreground" Value="Snow"/>
-        <Setter Property="BorderThickness" Value="0"/>
-    </Style>
-    
-    <Style TargetType="Button" x:Key="MenuInsideButtonStyle">
-        <Setter Property="Height" Value="20"/>
-        <Setter Property="Width" Value="185"/>
-        <Setter Property="Background" Value="Transparent"/>
-        <Setter Property="Foreground" Value="Snow"/>
-        <Setter Property="BorderThickness" Value="0"/>
-        <Setter Property="HorizontalContentAlignment" Value="Left"/>
-        <Setter Property="OverridesDefaultStyle" Value="True"/>
-        <Setter Property="DataContext" Value="{DynamicResource ViewModelMain}"/>
+                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+
+    <Style x:Key="parentMenuItem" TargetType="{x:Type MenuItem}">
+        <Setter Property="Foreground" Value="{Binding Path=Foreground, RelativeSource={RelativeSource AncestorType={x:Type Menu}}}"/>
+        <Setter Property="FontSize" Value="12"/>
+        <Setter Property="Margin" Value="5,0,0,5"/>
         <Setter Property="Template">
             <Setter.Value>
-                <ControlTemplate TargetType="Button">
-                    <Grid Background="{TemplateBinding Background}">
-                        <ContentPresenter x:Name="MyContentPresenter"
-                                          Content="{TemplateBinding Content}"/>
-                    </Grid>
+                <ControlTemplate TargetType="{x:Type MenuItem}">
+                    <Border x:Name="Border"
+                        Background="Transparent"
+                        BorderBrush="{TemplateBinding BorderBrush}"
+                        BorderThickness="0">
+                        <Grid>
+                            <Grid.ColumnDefinitions>
+                                <ColumnDefinition x:Name="Col0" MinWidth="17" Width="Auto" SharedSizeGroup="MenuItemIconColumnGroup"/>
+                                <ColumnDefinition Width="Auto" SharedSizeGroup="MenuTextColumnGroup"/>
+                                <ColumnDefinition Width="Auto" SharedSizeGroup="MenuItemIGTColumnGroup"/>
+                                <ColumnDefinition x:Name="Col3" Width="14"/>
+                            </Grid.ColumnDefinitions>
+
+                            <!-- ContentPresenter to show an Icon if needed -->
+                            <ContentPresenter Grid.Column="0" Margin="4,0,6,0" x:Name="Icon" VerticalAlignment="Center" ContentSource="Icon"/>
+
+                            <!-- Glyph is a checkmark if needed for a checkable menu -->
+                            <Grid Grid.Column="0" Visibility="Hidden" Margin="4,0,6,0" x:Name="GlyphPanel" VerticalAlignment="Center">
+                                <Path x:Name="GlyphPanelpath" VerticalAlignment="Center" Fill="{TemplateBinding Foreground}" Data="M0,2 L0,4.8 L2.5,7.4 L7.1,2.8 L7.1,0 L2.5,4.6 z" FlowDirection="LeftToRight"/>
+                            </Grid>
+
+                            <!-- Content for the menu text etc -->
+                            <ContentPresenter Grid.Column="1"
+                                          Margin="{TemplateBinding Padding}"
+                                          x:Name="HeaderHost"
+                                          RecognizesAccessKey="True"                                              
+                                          ContentSource="Header"/>
+
+                            <!-- Content for the menu IGT -->
+                            <ContentPresenter Grid.Column="2"
+                                          Margin="8,1,8,1"
+                                          x:Name="IGTHost"
+                                          ContentSource="InputGestureText"
+                                          VerticalAlignment="Center"/>
+
+                            <!-- Arrow drawn path which points to the next level of the menu -->
+                            <Grid Grid.Column="3" Margin="4,0,6,0" x:Name="ArrowPanel" VerticalAlignment="Center">
+                                <Path x:Name="ArrowPanelPath" HorizontalAlignment="Right" VerticalAlignment="Center" Fill="{TemplateBinding Foreground}" Data="M0,0 L0,8 L4,4 z"/>
+                            </Grid>
+
+                            <!-- The Popup is the body of the menu which expands down or across depending on the level of the item -->
+                            <Popup IsOpen="{Binding Path=IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}" Placement="Right" x:Name="SubMenuPopup" Focusable="false" PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}">
+                                <Border x:Name="SubMenuBorder" Background="#202020" BorderBrush="{Binding Path=Foreground, RelativeSource={RelativeSource AncestorType={x:Type Menu}}}" BorderThickness="1" Padding="2,2,2,2">
+                                    <Grid x:Name="SubMenu" Grid.IsSharedSizeScope="True">
+                                        <!-- StackPanel holds children of the menu. This is set by IsItemsHost=True -->
+                                        <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle"/>
+                                    </Grid>
+                                </Border>
+                            </Popup>
+                        </Grid>
+                    </Border>
+
+                    <!-- These triggers re-configure the four arrangements of MenuItem to show different levels of menu via Role -->
+                    <ControlTemplate.Triggers>
+                        <!-- Role = TopLevelHeader : this is the root menu item in a menu; the Popup expands down -->
+                        <Trigger Property="Role" Value="TopLevelHeader">
+                            <Setter Property="Padding" Value="6,1,6,1"/>
+                            <Setter Property="Placement" Value="Bottom" TargetName="SubMenuPopup"/>
+                            <Setter Property="MinWidth" Value="0" TargetName="Col0"/>
+                            <Setter Property="Width" Value="Auto" TargetName="Col3"/>
+                            <Setter Property="Visibility" Value="Collapsed" TargetName="Icon"/>
+                            <Setter Property="Visibility" Value="Collapsed" TargetName="GlyphPanel"/>
+                            <Setter Property="Visibility" Value="Collapsed" TargetName="IGTHost"/>
+                            <Setter Property="Visibility" Value="Collapsed" TargetName="ArrowPanel"/>
+                        </Trigger>
+
+                        <!-- Role = TopLevelItem :  this is a child menu item from the top level without any child items-->
+                        <Trigger Property="Role" Value="TopLevelItem">
+                            <Setter Property="Padding" Value="6,1,6,1"/>
+                            <Setter Property="Visibility" Value="Collapsed" TargetName="ArrowPanel"/>
+                        </Trigger>
+
+                        <!-- Role = SubMenuHeader : this is a child menu item which does not have children -->
+                        <Trigger Property="Role" Value="SubmenuHeader">
+                            <Setter Property="DockPanel.Dock" Value="Top"/>
+                            <Setter Property="Padding" Value="0,2,0,2"/>
+                        </Trigger>
+
+                        <!-- Role = SubMenuItem : this is a child menu item which has children-->
+                        <Trigger Property="Role" Value="SubmenuItem">
+                            <Setter Property="DockPanel.Dock" Value="Top"/>
+                            <Setter Property="Padding" Value="0,2,0,2"/>
+                            <Setter Property="Visibility" Value="Collapsed" TargetName="ArrowPanel"/>
+                        </Trigger>
+                        <Trigger Property="IsSuspendingPopupAnimation" Value="true">
+                            <Setter Property="PopupAnimation" Value="None" TargetName="SubMenuPopup"/>
+                        </Trigger>
+
+                        <!-- If no Icon is present the we collapse the Icon Content -->
+                        <Trigger Property="Icon" Value="{x:Null}">
+                            <Setter Property="Visibility" Value="Collapsed" TargetName="Icon"/>
+                        </Trigger>
+
+                        <!-- The GlyphPanel contains the CheckMark -->
+                        <Trigger Property="IsChecked" Value="true">
+                            <Setter Property="Visibility" Value="Visible" TargetName="GlyphPanel"/>
+                            <Setter Property="Visibility" Value="Collapsed" TargetName="Icon"/>
+                        </Trigger>
+
+                        <!-- Using the system colors for the Menu Highlight and IsEnabled-->
+                        <Trigger Property="IsHighlighted" Value="true">
+                            <Setter Property="Background" Value="#33000000" TargetName="Border"/>
+                            <Setter Property="Foreground" Value="Black"/>
+                        </Trigger>
+                        <Trigger Property="IsEnabled" Value="true">
+                            <Setter Property="Foreground" Value="Snow"/>
+                        </Trigger>
+                        <Trigger Property="IsEnabled" Value="false">
+                            <Setter Property="Foreground" Value="LightGray"/>
+                        </Trigger>
+                    </ControlTemplate.Triggers>
                 </ControlTemplate>
             </Setter.Value>
         </Setter>
-        <Style.Triggers>
-            <Trigger Property="IsEnabled" Value="False">
-                <Setter Property="Background" Value="Transparent"/>
-                <Setter Property="Foreground" Value="DarkGray"/>
-            </Trigger>
-            <Trigger Property="IsMouseOver" Value="True">
-                <Setter Property="Background" Value="#666666"/>
-            </Trigger>
-        </Style.Triggers>
     </Style>
 
-    <Style TargetType="ListView" x:Key="MenuListViewStyle">
-        <Setter Property="Background" Value="#343636"/>
-        <Setter Property="Height" Value="300"/>
-        <Setter Property="Width" Value="200"/>
-        <Style.Resources>
-            <Style TargetType="ContentControl">
-                <Setter Property="Foreground" Value="Snow"/>
-                <Setter Property="Margin" Value="0,0,0,2"/>
-                <Setter Property="Background" Value="Transparent"/>
-                <Setter Property="BorderThickness" Value="0"/>
-                <Setter Property="HorizontalContentAlignment" Value="Left"/>
-                <Setter Property="Height" Value="290"/>
-                <Setter Property="Width" Value="185"/>
-            </Style>
-        </Style.Resources>
-    </Style>
-   
 
 </ResourceDictionary>

+ 2 - 2
PixiEditor/Views/ImportFilePopup.xaml

@@ -39,7 +39,7 @@
                     <TextBlock Width="40" HorizontalAlignment="Left" Text="Width:" Foreground="Snow" FontSize="14"/>
                     <TextBox Style="{StaticResource DarkTextBoxStyle}" Width="75" Margin="-10,0,0,0" Text="{Binding ImportWidth, Converter={StaticResource ToolSizeToIntConverter}, Mode=TwoWay}">
                         <i:Interaction.Behaviors>
-                                <behaviors:TextBoxFocusBehavior FillSize="True" NextFocusDirection="Next"/>
+                                <behaviors:TextBoxFocusBehavior FillSize="True"/>
                             </i:Interaction.Behaviors>
                     </TextBox>
                 </DockPanel>
@@ -47,7 +47,7 @@
                     <TextBlock Width="45" HorizontalAlignment="Left" Text="Height:" Foreground="Snow" FontSize="14"/>
                     <TextBox Style="{StaticResource DarkTextBoxStyle}" Width="75" Margin="-15,0,0,0" Text="{Binding ImportHeight, Converter={StaticResource ToolSizeToIntConverter}, Mode=TwoWay}">
                         <i:Interaction.Behaviors>
-                                <behaviors:TextBoxFocusBehavior FillSize="True" NextFocusDirection="Next"/>
+                                <behaviors:TextBoxFocusBehavior FillSize="True"/>
                             </i:Interaction.Behaviors>
                     </TextBox>
                 </DockPanel>

+ 15 - 30
PixiEditor/Views/MainWindow.xaml

@@ -13,7 +13,7 @@
         xmlns:xcad="http://schemas.xceed.com/wpf/xaml/avalondock"
         xmlns:ui="clr-namespace:PixiEditor.Helpers.UI"
         xmlns:cmd="http://www.galasoft.ch/mvvmlight"
-        mc:Ignorable="d"
+        mc:Ignorable="d"   
         Title="PixiEditor" Name="mainWindow" Height="1000" Width="1600" Background="#FF252424" WindowStartupLocation="CenterScreen"  WindowState="Maximized" DataContext="{DynamicResource ViewModelMain}">
     <Window.Resources>
         <vm:ViewModelMain x:Key="ViewModelMain"/>
@@ -28,7 +28,7 @@
             <cmd:EventToCommand Command="{Binding KeyDownCommand}" PassEventArgsToCommand="True"/>
         </i:EventTrigger>
     </i:Interaction.Triggers>
-    <Grid>
+    <Grid Name="mainGrid">
         <Grid.ColumnDefinitions>
             <ColumnDefinition Width="37*"/>
             <ColumnDefinition Width="1416*"/>
@@ -41,34 +41,19 @@
             <RowDefinition Height="30*"/>
         </Grid.RowDefinitions>
 
-        <Border Grid.ColumnSpan="3" Background="#FF363434" Grid.Row="0"/>
-        <WrapPanel Grid.ColumnSpan="2" Grid.Column="0" Grid.Row="0" Grid.RowSpan="3" Panel.ZIndex="100">
-            <vws:MenuButton Text="File" Margin="0,0,-140,0">
-                <vws:MenuButton.Item>
-                    <StackPanel>
-                        <Button Style="{StaticResource MenuInsideButtonStyle}" Content="New" Command="{Binding GenerateDrawAreaCommand}"/>
-                        <Button Style="{StaticResource MenuInsideButtonStyle}" Content="Export" Command="{Binding SaveFileCommand}"/>
-                        <Button Style="{StaticResource MenuInsideButtonStyle}" Content="Export As..." Command="{Binding SaveFileCommand}" CommandParameter="AsNew"/>
-                        <Button Style="{StaticResource MenuInsideButtonStyle}" Content="Open" Command="{Binding OpenFileCommand}"/>
-                    </StackPanel>
-                </vws:MenuButton.Item>
-            </vws:MenuButton>
-            <vws:MenuButton Text="Edit" Margin="0,0,-140,0">
-                <vws:MenuButton.Item>
-                    <StackPanel>
-                        <Button Style="{StaticResource MenuInsideButtonStyle}" Content="Undo" Command="{Binding UndoCommand}"/>
-                        <Button Style="{StaticResource MenuInsideButtonStyle}" Content="Redo" Command="{Binding RedoCommand}"/>
-                    </StackPanel>
-                </vws:MenuButton.Item>
-            </vws:MenuButton>
-
-            <vws:MenuButton Text="View" Margin="0,0,-140,0">
-                <vws:MenuButton.Item>
-                    <StackPanel>
-                        <Button Style="{StaticResource MenuInsideButtonStyle}" Content="Recenter" Command="{Binding RecenterZoomboxCommand}" CommandParameter="{Binding ElementName=Zoombox}"/>
-                    </StackPanel>
-                </vws:MenuButton.Item>
-            </vws:MenuButton>
+        <WrapPanel  Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2">
+            <Menu Margin="10, 4, 0, 0" HorizontalAlignment="Left" VerticalAlignment="Top" Background="Transparent" IsMainMenu="True" >
+            <MenuItem Header="_File" Style="{StaticResource parentMenuItem}">
+                <MenuItem InputGestureText="CTRL+N" Header="_New" Command="{Binding GenerateDrawAreaCommand}"/>
+                <MenuItem Header="_Open" Command="{Binding OpenFileCommand}"/>
+                <MenuItem Header="_Export" Command="{Binding SaveFileCommand}"/>
+                <MenuItem Header="_Export As..." Command="{Binding SaveFileCommand}" CommandParameter="AsNew"/>
+            </MenuItem>
+            <MenuItem Header="_Edit" Style="{StaticResource parentMenuItem}">
+                <MenuItem Header="_Undo" Command="{Binding UndoCommand}"/>
+                <MenuItem Header="_Redo" Command="{Binding RedoCommand}"/>
+            </MenuItem>
+        </Menu>
         </WrapPanel>
         <StackPanel Background="#404040" Orientation="Horizontal" Grid.ColumnSpan="2" Margin="0,30,0,0" Grid.RowSpan="2">
             <ItemsControl ItemsSource="{Binding BitmapUtility.SelectedTool.Toolbar.Settings}">

+ 2 - 2
PixiEditor/Views/NewFilePopup.xaml

@@ -40,7 +40,7 @@
                              HorizontalAlignment="Left" TextAlignment="Center" 
                              Margin="5,0,0,0" Text="{Binding ElementName=newFilePopup, Converter={StaticResource ToolSizeToIntConverter}, Path=FileHeight, Mode=TwoWay}" MaxLength="4">
                         <i:Interaction.Behaviors>
-                            <helpers:TextBoxFocusBehavior FillSize="True" NextFocusDirection="Next"/>
+                            <helpers:TextBoxFocusBehavior FillSize="True"/>
                         </i:Interaction.Behaviors>
                     </TextBox>
                 </DockPanel>
@@ -49,7 +49,7 @@
                     <TextBox Height="30" Width="150" Style="{StaticResource DarkTextBoxStyle}" FontSize="16" HorizontalAlignment="Left" Margin="10,0,0,0" TextAlignment="Center"
                              Text="{Binding ElementName=newFilePopup, Converter={StaticResource ToolSizeToIntConverter}, Path=FileWidth, Mode=TwoWay}" MaxLength="4">
                         <i:Interaction.Behaviors>
-                            <helpers:TextBoxFocusBehavior FillSize="True" NextFocusDirection="Next"/>
+                            <helpers:TextBoxFocusBehavior FillSize="True"/>
                         </i:Interaction.Behaviors>
                     </TextBox>
                 </DockPanel>

+ 2 - 1
PixiEditor/Views/NumerInput.xaml

@@ -3,7 +3,7 @@
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
-             xmlns:local="clr-namespace:PixiEditor.Views" xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:behaviours="clr-namespace:PixiEditor.Helpers.Behaviours"
+             xmlns:local="clr-namespace:PixiEditor.Views" xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:behaviours="clr-namespace:PixiEditor.Helpers.Behaviours" xmlns:ui="clr-namespace:PixiEditor.Helpers.UI"
              mc:Ignorable="d" 
              d:DesignHeight="20" d:DesignWidth="40" x:Name="numberInput">
     <Grid>
@@ -12,5 +12,6 @@
                 <behaviours:TextBoxFocusBehavior/>
             </i:Interaction.Behaviors>
         </TextBox>
+        <TextBox Width="0" Height="0"/>
     </Grid>
 </UserControl>

+ 2 - 2
PixiEditor/Views/SaveFilePopup.xaml

@@ -37,14 +37,14 @@
             <TextBox Style="{StaticResource DarkTextBoxStyle}" Width="70" Height="20" HorizontalAlignment="Left" Margin="5,0,0,0" 
                      Text="{Binding ElementName=saveFilePopup, Converter={StaticResource ToolSizeToIntConverter}, Path=SaveWidth, Mode=TwoWay}">
                 <i:Interaction.Behaviors>
-                        <helpers:TextBoxFocusBehavior FillSize="True" NextFocusDirection="Next"/>
+                        <helpers:TextBoxFocusBehavior FillSize="True"/>
                     </i:Interaction.Behaviors>
             </TextBox>
             <TextBlock Foreground="Snow" Width="40" Height="40"  HorizontalAlignment="Left" Margin="5,0,0,0" Text="Height:" TextAlignment="Center" Padding="0,11.5,0,0"/>
             <TextBox Style="{StaticResource DarkTextBoxStyle}" Width="70" Height="20" HorizontalAlignment="Left" 
                      Margin="5,0,0,0" Text="{Binding ElementName=saveFilePopup, Converter={StaticResource ToolSizeToIntConverter}, Path=SaveHeight,Mode=TwoWay}">
                 <i:Interaction.Behaviors>
-                        <helpers:TextBoxFocusBehavior FillSize="True" NextFocusDirection="Next"/>
+                        <helpers:TextBoxFocusBehavior FillSize="True"/>
                     </i:Interaction.Behaviors>
             </TextBox>
         </DockPanel>