Browse Source

Merge pull request #151 from PixiEditor/small-improvements

Small improvements
Krzysztof Krysiński 4 years ago
parent
commit
1c0f425218

+ 26 - 0
PixiEditor/Helpers/Converters/NotNullToBoolConverter.cs

@@ -0,0 +1,26 @@
+using System;
+using System.Globalization;
+using System.Windows.Data;
+
+namespace PixiEditor.Helpers.Converters
+{
+    [ValueConversion(typeof(object), typeof(bool))]
+    public class NotNullToBoolConverter : IValueConverter
+    {
+        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            bool result = value != null;
+            if (parameter != null)
+            {
+                return !result;
+            }
+
+            return result;
+        }
+
+        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            return value;
+        }
+    }
+}

+ 42 - 16
PixiEditor/Models/Layers/Layer.cs

@@ -64,7 +64,7 @@ namespace PixiEditor.Models.Layers
             set
             set
             {
             {
                 name = value;
                 name = value;
-                RaisePropertyChanged("Name");
+                RaisePropertyChanged(nameof(Name));
             }
             }
         }
         }
 
 
@@ -74,7 +74,7 @@ namespace PixiEditor.Models.Layers
             set
             set
             {
             {
                 isActive = value;
                 isActive = value;
-                RaisePropertyChanged("IsActive");
+                RaisePropertyChanged(nameof(IsActive));
             }
             }
         }
         }
 
 
@@ -84,6 +84,20 @@ namespace PixiEditor.Models.Layers
             set
             set
             {
             {
                 if (isVisible != value)
                 if (isVisible != value)
+                {
+                    isVisible = value;
+                    RaisePropertyChanged(nameof(IsVisible));
+                    RaisePropertyChanged(nameof(IsVisibleUndoTriggerable));
+                }
+            }
+        }
+
+        public bool IsVisibleUndoTriggerable
+        {
+            get => IsVisible;
+            set
+            {
+                if (value != IsVisible)
                 {
                 {
                     ViewModelMain.Current?.BitmapManager?.ActiveDocument?.UndoManager
                     ViewModelMain.Current?.BitmapManager?.ActiveDocument?.UndoManager
                         .AddUndoChange(
                         .AddUndoChange(
@@ -93,9 +107,8 @@ namespace PixiEditor.Models.Layers
                             value,
                             value,
                             LayerHelper.FindLayerByGuidProcess,
                             LayerHelper.FindLayerByGuidProcess,
                             new object[] { LayerGuid },
                             new object[] { LayerGuid },
-                            "Change layer visibility"), true);
-                    isVisible = value;
-                    RaisePropertyChanged("IsVisible");
+                            "Change layer visibility"));
+                    IsVisible = value;
                 }
                 }
             }
             }
         }
         }
@@ -116,7 +129,7 @@ namespace PixiEditor.Models.Layers
             set
             set
             {
             {
                 layerBitmap = value;
                 layerBitmap = value;
-                RaisePropertyChanged("LayerBitmap");
+                RaisePropertyChanged(nameof(LayerBitmap));
             }
             }
         }
         }
 
 
@@ -127,17 +140,30 @@ namespace PixiEditor.Models.Layers
             {
             {
                 if (opacity != value)
                 if (opacity != value)
                 {
                 {
-                    ViewModelMain.Current?.BitmapManager?.ActiveDocument?.UndoManager
-                        .AddUndoChange(
-                            new Change(
-                            nameof(Opacity),
-                            opacity,
-                            value,
-                            LayerHelper.FindLayerByGuidProcess,
-                            new object[] { LayerGuid },
-                            "Change layer opacity"), true);
                     opacity = value;
                     opacity = value;
-                    RaisePropertyChanged("Opacity");
+                    RaisePropertyChanged(nameof(Opacity));
+                    RaisePropertyChanged(nameof(OpacityUndoTriggerable));
+                }
+            }
+        }
+
+        public float OpacityUndoTriggerable
+        {
+            get => Opacity;
+            set
+            {
+                if (value != Opacity)
+                {
+                    ViewModelMain.Current?.BitmapManager?.ActiveDocument?.UndoManager
+                    .AddUndoChange(
+                                   new Change(
+                                   nameof(Opacity),
+                                   opacity,
+                                   value,
+                                   LayerHelper.FindLayerByGuidProcess,
+                                   new object[] { LayerGuid },
+                                   "Change layer opacity"));
+                    Opacity = value;
                 }
                 }
             }
             }
         }
         }

+ 7 - 0
PixiEditor/Models/Tools/Tools/ColorPickerTool.cs

@@ -1,4 +1,5 @@
 using System.Drawing;
 using System.Drawing;
+using System.Windows.Input;
 using PixiEditor.Models.Position;
 using PixiEditor.Models.Position;
 using PixiEditor.ViewModels;
 using PixiEditor.ViewModels;
 using Color = System.Windows.Media.Color;
 using Color = System.Windows.Media.Color;
@@ -14,6 +15,12 @@ namespace PixiEditor.Models.Tools.Tools
             Tooltip = "Swaps primary color with selected on canvas. (O)";
             Tooltip = "Swaps primary color with selected on canvas. (O)";
         }
         }
 
 
+        public override void OnMouseDown(MouseEventArgs e)
+        {
+            base.OnMouseDown(e);
+            ViewModelMain.Current.ColorsSubViewModel.PrimaryColor = GetColorUnderMouse();
+        }
+
         public override void Use(Coordinates[] coordinates)
         public override void Use(Coordinates[] coordinates)
         {
         {
             ViewModelMain.Current.ColorsSubViewModel.PrimaryColor = GetColorUnderMouse();
             ViewModelMain.Current.ColorsSubViewModel.PrimaryColor = GetColorUnderMouse();

+ 5 - 5
PixiEditor/Models/Tools/Tools/PenTool.cs

@@ -22,7 +22,7 @@ namespace PixiEditor.Models.Tools.Tools
         private readonly BoolSetting pixelPerfectSetting;
         private readonly BoolSetting pixelPerfectSetting;
         private readonly LineTool lineTool;
         private readonly LineTool lineTool;
         private Coordinates[] lastChangedPixels = new Coordinates[3];
         private Coordinates[] lastChangedPixels = new Coordinates[3];
-        private List<Coordinates> confirmedPixels = new List<Coordinates>();
+        private readonly List<Coordinates> confirmedPixels = new List<Coordinates>();
         private byte changedPixelsindex = 0;
         private byte changedPixelsindex = 0;
 
 
         public PenTool()
         public PenTool()
@@ -50,10 +50,10 @@ namespace PixiEditor.Models.Tools.Tools
         {
         {
             Coordinates startingCords = coordinates.Length > 1 ? coordinates[1] : coordinates[0];
             Coordinates startingCords = coordinates.Length > 1 ? coordinates[1] : coordinates[0];
             BitmapPixelChanges pixels = Draw(
             BitmapPixelChanges pixels = Draw(
-                startingCords, 
-                coordinates[0], 
-                color, 
-                toolSizeSetting.Value, 
+                startingCords,
+                coordinates[0],
+                color,
+                toolSizeSetting.Value,
                 pixelPerfectSetting.Value,
                 pixelPerfectSetting.Value,
                 ViewModelMain.Current.BitmapManager.ActiveDocument.PreviewLayer);
                 ViewModelMain.Current.BitmapManager.ActiveDocument.PreviewLayer);
             return Only(pixels, layer);
             return Only(pixels, layer);

+ 2 - 2
PixiEditor/Properties/AssemblyInfo.cs

@@ -50,5 +50,5 @@ using System.Windows;
 // You can specify all the values or you can default the Build and Revision Numbers
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("0.1.4.1")]
-[assembly: AssemblyFileVersion("0.1.4.1")]
+[assembly: AssemblyVersion("0.2.0.0")]
+[assembly: AssemblyFileVersion("0.2.0.0")]

+ 8 - 10
PixiEditor/Views/MainWindow.xaml

@@ -25,6 +25,7 @@
             <vm:ViewModelMain x:Key="ViewModelMain" />
             <vm:ViewModelMain x:Key="ViewModelMain" />
             <BooleanToVisibilityConverter x:Key="BoolToVisibilityConverter" />
             <BooleanToVisibilityConverter x:Key="BoolToVisibilityConverter" />
             <converters:BoolToIntConverter x:Key="BoolToIntConverter" />
             <converters:BoolToIntConverter x:Key="BoolToIntConverter" />
+            <converters:NotNullToBoolConverter x:Key="NotNullToBoolConverter" />
             <converters:FloatNormalizeConverter x:Key="FloatNormalizeConverter" />
             <converters:FloatNormalizeConverter x:Key="FloatNormalizeConverter" />
             <converters:DoubleToIntConverter x:Key="DoubleToIntConverter"/>
             <converters:DoubleToIntConverter x:Key="DoubleToIntConverter"/>
             <ResourceDictionary.MergedDictionaries>
             <ResourceDictionary.MergedDictionaries>
@@ -294,8 +295,13 @@
                                             Style="{StaticResource DarkRoundButton}" />
                                             Style="{StaticResource DarkRoundButton}" />
                                             <StackPanel Grid.Row="1" Orientation="Horizontal" Margin="10,0">
                                             <StackPanel Grid.Row="1" Orientation="Horizontal" Margin="10,0">
                                                 <Label Content="Opacity" Foreground="White" VerticalAlignment="Center"/>
                                                 <Label Content="Opacity" Foreground="White" VerticalAlignment="Center"/>
-                                                <vws:NumberInput Min="0" Max="100" Width="40" Height="20" VerticalAlignment="Center"
-                                                         Value="{Binding BitmapManager.ActiveDocument.ActiveLayer.Opacity, Mode=TwoWay, 
+                                                <vws:NumberInput 
+                                                    Min="0" Max="100"
+                                                    IsEnabled="{Binding Path=BitmapManager.ActiveDocument, 
+                                                    Converter={StaticResource NotNullToBoolConverter}}" 
+                                                    Width="40" Height="20"
+                                                    VerticalAlignment="Center"
+                                                   Value="{Binding BitmapManager.ActiveDocument.ActiveLayer.OpacityUndoTriggerable, Mode=TwoWay, 
                                             Converter={StaticResource FloatNormalizeConverter}}" />
                                             Converter={StaticResource FloatNormalizeConverter}}" />
                                                 <Label Content="%" Foreground="White" VerticalAlignment="Center"/>
                                                 <Label Content="%" Foreground="White" VerticalAlignment="Center"/>
                                             </StackPanel>
                                             </StackPanel>
@@ -381,14 +387,6 @@
             </ItemsControl>
             </ItemsControl>
         </StackPanel>
         </StackPanel>
 
 
-        <!--<Grid Grid.Column="2" Background="{StaticResource AccentColor}" Grid.Row="2" Grid.RowSpan="1">
-            <avalondock:DockingManager Foreground="White" Background="{StaticResource AccentColor}" BorderThickness="0">
-
-                <avalondock:DockingManager.Theme>
-                    <avalonDockTheme:PixiEditorDockTheme />
-                </avalondock:DockingManager.Theme>
-            </avalondock:DockingManager>
-        </Grid>-->
         <Grid Grid.Row="3" Grid.Column="1">
         <Grid Grid.Row="3" Grid.Column="1">
             <Grid.ColumnDefinitions>
             <Grid.ColumnDefinitions>
                 <ColumnDefinition Width="*"/>
                 <ColumnDefinition Width="*"/>

+ 4 - 4
PixiEditor/Views/UserControls/EditableTextBlock.xaml

@@ -11,14 +11,14 @@
     </UserControl.Resources>
     </UserControl.Resources>
     <Grid>
     <Grid>
         <TextBlock Foreground="Snow" MouseLeftButtonDown="TextBlock_MouseDown"
         <TextBlock Foreground="Snow" MouseLeftButtonDown="TextBlock_MouseDown"
-                   TextTrimming="CharacterEllipsis"
+                   TextTrimming="CharacterEllipsis" Name="textBlock"
                    Visibility="{Binding Path=TextBlockVisibility, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}}"
                    Visibility="{Binding Path=TextBlockVisibility, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}}"
                    Text="{Binding Path=Text, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}}" />
                    Text="{Binding Path=Text, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}}" />
         <TextBox Style="{StaticResource DarkTextBoxStyle}"
         <TextBox Style="{StaticResource DarkTextBoxStyle}"
-                 LostFocus="TextBox_LostFocus" 
+                 LostFocus="TextBox_LostFocus"
                  Text="{Binding Path=Text, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}}"
                  Text="{Binding Path=Text, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}}"
-                 KeyDown="TextBox_KeyDown"                 
-                 LostKeyboardFocus="textBox_LostKeyboardFocus"
+                 KeyDown="TextBox_KeyDown"
+                 LostKeyboardFocus="TextBox_LostKeyboardFocus"
                  Visibility="{Binding Path=TextBlockVisibility, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}, 
                  Visibility="{Binding Path=TextBlockVisibility, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}, 
             Converter={StaticResource OppositeVisibilityConverter}}"
             Converter={StaticResource OppositeVisibilityConverter}}"
                  Name="textBox">
                  Name="textBox">

+ 15 - 5
PixiEditor/Views/UserControls/EditableTextBlock.xaml.cs

@@ -1,6 +1,8 @@
-using System.Windows;
+using System;
+using System.Windows;
 using System.Windows.Controls;
 using System.Windows.Controls;
 using System.Windows.Input;
 using System.Windows.Input;
+using System.Windows.Threading;
 using PixiEditor.Models.Controllers;
 using PixiEditor.Models.Controllers;
 using PixiEditor.Models.Controllers.Shortcuts;
 using PixiEditor.Models.Controllers.Shortcuts;
 
 
@@ -29,10 +31,12 @@ namespace PixiEditor.Views
 
 
         // Using a DependencyProperty as the backing store for EnableEditing.  This enables animation, styling, binding, etc...
         // Using a DependencyProperty as the backing store for EnableEditing.  This enables animation, styling, binding, etc...
         public static readonly DependencyProperty EnableEditingProperty =
         public static readonly DependencyProperty EnableEditingProperty =
-            DependencyProperty.Register("IsEditing", typeof(bool), typeof(EditableTextBlock),
+            DependencyProperty.Register(
+                "IsEditing",
+                typeof(bool),
+                typeof(EditableTextBlock),
                 new PropertyMetadata(OnIsEditingChanged));
                 new PropertyMetadata(OnIsEditingChanged));
 
 
-
         public EditableTextBlock()
         public EditableTextBlock()
         {
         {
             InitializeComponent();
             InitializeComponent();
@@ -61,7 +65,13 @@ namespace PixiEditor.Views
             ShortcutController.BlockShortcutExecution = true;
             ShortcutController.BlockShortcutExecution = true;
             TextBlockVisibility = Visibility.Hidden;
             TextBlockVisibility = Visibility.Hidden;
             IsEditing = true;
             IsEditing = true;
-            textBox.Focus();
+            Dispatcher.BeginInvoke(
+                DispatcherPriority.Input,
+                new Action(delegate()
+                {
+                    textBox.Focus();         // Set Logical Focus
+                    Keyboard.Focus(textBox); // Set Keyboard Focus
+                }));
             textBox.SelectAll();
             textBox.SelectAll();
         }
         }
 
 
@@ -102,7 +112,7 @@ namespace PixiEditor.Views
             DisableEditing();
             DisableEditing();
         }
         }
 
 
-        private void textBox_LostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
+        private void TextBox_LostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
         {
         {
             DisableEditing();
             DisableEditing();
         }
         }

+ 6 - 3
PixiEditor/Views/UserControls/LayerItem.xaml

@@ -5,15 +5,18 @@
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
              xmlns:local="clr-namespace:PixiEditor.Views"
              xmlns:local="clr-namespace:PixiEditor.Views"
              xmlns:converters="clr-namespace:PixiEditor.Helpers.Converters"
              xmlns:converters="clr-namespace:PixiEditor.Helpers.Converters"
-             xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
+             xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:behaviors="clr-namespace:PixiEditor.Helpers.Behaviours"
              mc:Ignorable="d" Focusable="True"
              mc:Ignorable="d" Focusable="True"
              d:DesignHeight="60" d:DesignWidth="250" Name="uc"
              d:DesignHeight="60" d:DesignWidth="250" Name="uc"
              MouseLeave="LayerItem_OnMouseLeave" MouseEnter="LayerItem_OnMouseEnter">
              MouseLeave="LayerItem_OnMouseLeave" MouseEnter="LayerItem_OnMouseEnter">
     <UserControl.Resources>
     <UserControl.Resources>
         <converters:BoolToColorConverter x:Key="BoolToColorConverter" />
         <converters:BoolToColorConverter x:Key="BoolToColorConverter" />
     </UserControl.Resources>
     </UserControl.Resources>
-    <Border BorderThickness="0 0 0 0.5" BorderBrush="Gray" MinWidth="60"
+    <Border BorderThickness="0 0 0 0.5" BorderBrush="Gray" MinWidth="60" Focusable="True"
             Background="{Binding IsActive, Mode=TwoWay, Converter={StaticResource BoolToColorConverter}}">
             Background="{Binding IsActive, Mode=TwoWay, Converter={StaticResource BoolToColorConverter}}">
+        <i:Interaction.Behaviors>
+            <behaviors:ClearFocusOnClickBehavior/>
+        </i:Interaction.Behaviors>
         <i:Interaction.Triggers>
         <i:Interaction.Triggers>
             <i:EventTrigger EventName="MouseDown">
             <i:EventTrigger EventName="MouseDown">
                 <i:InvokeCommandAction Command="{Binding ElementName=uc, 
                 <i:InvokeCommandAction Command="{Binding ElementName=uc, 
@@ -29,7 +32,7 @@
             </Grid.ColumnDefinitions>
             </Grid.ColumnDefinitions>
             <CheckBox Style="{StaticResource ImageCheckBox}" VerticalAlignment="Center"
             <CheckBox Style="{StaticResource ImageCheckBox}" VerticalAlignment="Center"
                       IsThreeState="False" HorizontalAlignment="Center" 
                       IsThreeState="False" HorizontalAlignment="Center" 
-                      IsChecked="{Binding Path=IsVisible, Mode=TwoWay}" Grid.Column="0" Height="16" />
+                      IsChecked="{Binding Path=IsVisibleUndoTriggerable, Mode=TwoWay}" Grid.Column="0" Height="16" />
             <StackPanel Orientation="Horizontal" Grid.Column="1" HorizontalAlignment="Left" Margin="5,0,0,0">
             <StackPanel Orientation="Horizontal" Grid.Column="1" HorizontalAlignment="Left" Margin="5,0,0,0">
                 <Image Source="{Binding PreviewImage,ElementName=uc}" Stretch="Uniform" Width="50" Height="20" Margin="0,0,20,0"
                 <Image Source="{Binding PreviewImage,ElementName=uc}" Stretch="Uniform" Width="50" Height="20" Margin="0,0,20,0"
                        RenderOptions.BitmapScalingMode="NearestNeighbor"/>
                        RenderOptions.BitmapScalingMode="NearestNeighbor"/>

+ 1 - 2
PixiEditor/Views/UserControls/LayerItem.xaml.cs

@@ -107,7 +107,6 @@ namespace PixiEditor.Views
             set { SetValue(MoveToFrontCommandProperty, value); }
             set { SetValue(MoveToFrontCommandProperty, value); }
         }
         }
 
 
-
         private void LayerItem_OnMouseEnter(object sender, MouseEventArgs e)
         private void LayerItem_OnMouseEnter(object sender, MouseEventArgs e)
         {
         {
             ControlButtonsVisible = Visibility.Visible;
             ControlButtonsVisible = Visibility.Visible;
@@ -119,4 +118,4 @@ namespace PixiEditor.Views
 
 
         }
         }
     }
     }
-}
+}

+ 1 - 1
PixiEditor/Views/UserControls/MainDrawingPanel.xaml

@@ -9,7 +9,7 @@
              xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
              xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
              mc:Ignorable="d" PreviewMouseDown="mainDrawingPanel_MouseDown" PreviewMouseUp="mainDrawingPanel_PreviewMouseUp"
              mc:Ignorable="d" PreviewMouseDown="mainDrawingPanel_MouseDown" PreviewMouseUp="mainDrawingPanel_PreviewMouseUp"
              d:DesignHeight="450" d:DesignWidth="800" x:Name="mainDrawingPanel" PreviewMouseWheel="Zoombox_MouseWheel">
              d:DesignHeight="450" d:DesignWidth="800" x:Name="mainDrawingPanel" PreviewMouseWheel="Zoombox_MouseWheel">
-    <xctk:Zoombox PreviewMouseDown="Zoombox_PreviewMouseDown" Cursor="{Binding Cursor}" Name="Zoombox" KeepContentInBounds="True"
+    <xctk:Zoombox PreviewMouseDown="Zoombox_PreviewMouseDown" Cursor="{Binding Cursor}" Name="Zoombox" KeepContentInBounds="False"
                   Loaded="Zoombox_Loaded" IsAnimated="False" MouseDown="Zoombox_MouseDown"
                   Loaded="Zoombox_Loaded" IsAnimated="False" MouseDown="Zoombox_MouseDown"
                   CurrentViewChanged="Zoombox_CurrentViewChanged" DragModifiers="Blocked" ZoomModifiers="None">
                   CurrentViewChanged="Zoombox_CurrentViewChanged" DragModifiers="Blocked" ZoomModifiers="None">
         <i:Interaction.Triggers>
         <i:Interaction.Triggers>

+ 0 - 1
PixiEditor/Views/UserControls/MainDrawingPanel.xaml.cs

@@ -185,7 +185,6 @@ namespace PixiEditor.Views
         private void Zoombox_CurrentViewChanged(object sender, ZoomboxViewChangedEventArgs e)
         private void Zoombox_CurrentViewChanged(object sender, ZoomboxViewChangedEventArgs e)
         {
         {
             Zoombox.MinScale = 32 / ((FrameworkElement)Item).Width;
             Zoombox.MinScale = 32 / ((FrameworkElement)Item).Width;
-            Zoombox.KeepContentInBounds = !(Zoombox.Scale > Zoombox.MinScale * 35.0);
         }
         }
 
 
         private void Zoombox_PreviewMouseDown(object sender, MouseButtonEventArgs e)
         private void Zoombox_PreviewMouseDown(object sender, MouseButtonEventArgs e)

+ 2 - 4
PixiEditor/Views/UserControls/NumberInput.xaml

@@ -3,15 +3,13 @@
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
              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:i="http://schemas.microsoft.com/expression/2010/interactivity"
              xmlns:behaviours="clr-namespace:PixiEditor.Helpers.Behaviours"
              xmlns:behaviours="clr-namespace:PixiEditor.Helpers.Behaviours"
-             xmlns:ui="clr-namespace:PixiEditor.Helpers.UI"
-             mc:Ignorable="d" Focusable="True"
+             mc:Ignorable="d"
              d:DesignHeight="20" d:DesignWidth="40" x:Name="numberInput">
              d:DesignHeight="20" d:DesignWidth="40" x:Name="numberInput">
     <TextBox TextAlignment="Center" Style="{StaticResource DarkTextBoxStyle}" Focusable="True"
     <TextBox TextAlignment="Center" Style="{StaticResource DarkTextBoxStyle}" Focusable="True"
                
                
-             PreviewTextInput="TextBox_PreviewTextInput" Text="{Binding ElementName=numberInput, Path=Value, UpdateSourceTrigger=PropertyChanged}">
+             PreviewTextInput="TextBox_PreviewTextInput" Text="{Binding ElementName=numberInput, Path=Value}">
         <i:Interaction.Behaviors>
         <i:Interaction.Behaviors>
             <behaviours:TextBoxFocusBehavior/>
             <behaviours:TextBoxFocusBehavior/>
             <behaviours:GlobalShortcutFocusBehavior/>
             <behaviours:GlobalShortcutFocusBehavior/>

+ 1 - 1
PixiEditor/Views/UserControls/ToolSettingColorPicker.xaml

@@ -9,7 +9,7 @@
              d:Background="{StaticResource AccentColor}">
              d:Background="{StaticResource AccentColor}">
     <Grid>
     <Grid>
         <StackPanel Orientation="Horizontal">
         <StackPanel Orientation="Horizontal">
-            <colorpicker:PortableColorPicker x:Name="ColorPicker" SelectedColor="{Binding SelectedColor, ElementName=uc}"/>
+            <colorpicker:PortableColorPicker x:Name="ColorPicker" SelectedColor="{Binding SelectedColor, ElementName=uc,Mode=TwoWay}"/>
             <Button Command="{Binding CopyMainColorCommand, ElementName=uc}" Style="{StaticResource DarkRoundButton}" FontSize="12" Width="100" Margin="5,0,0,0">Copy Main Color</Button>
             <Button Command="{Binding CopyMainColorCommand, ElementName=uc}" Style="{StaticResource DarkRoundButton}" FontSize="12" Width="100" Margin="5,0,0,0">Copy Main Color</Button>
         </StackPanel>
         </StackPanel>
     </Grid>
     </Grid>