diff --git a/BrightSharp.Ui.Tests/CustomWindow.xaml b/BrightSharp.Ui.Tests/CustomWindow.xaml
index b106d0c..9b690fe 100644
--- a/BrightSharp.Ui.Tests/CustomWindow.xaml
+++ b/BrightSharp.Ui.Tests/CustomWindow.xaml
@@ -6,10 +6,10 @@
xmlns:bs="http://schemas.brightsharp.com/developer"
xmlns:local="clr-namespace:BrightSharp.Ui.Tests"
mc:Ignorable="d" ResizeMode="CanResizeWithGrip"
- Height="640" Width="1000" Style="{DynamicResource TestWindowStyle}">
+ Height="640" Width="1000" Style="{DynamicResource BrightSharpWindowStyle}">
-
+ Custom WINDOW (BrightSharpWindowStyle)
diff --git a/BrightSharp.Ui.Tests/MainWindow.xaml b/BrightSharp.Ui.Tests/MainWindow.xaml
index fa82983..76f2ba5 100644
--- a/BrightSharp.Ui.Tests/MainWindow.xaml
+++ b/BrightSharp.Ui.Tests/MainWindow.xaml
@@ -4,7 +4,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:BrightSharp.Ui.Tests"
xmlns:viewModel="clr-namespace:BrightSharp.Ui.Tests"
- Style="{DynamicResource TestWindowStyle}"
+ Style="{DynamicResource BrightSharpWindowStyle}"
ResizeMode="CanResizeWithGrip"
xmlns:ex="http://schemas.brightsharp.com/developer"
xmlns:bsDiag="http://schemas.brightsharp.com/diagrams"
@@ -36,7 +36,7 @@
-
+
@@ -83,26 +83,32 @@
-
-
+
+
+
+
+
+
+
+
@@ -128,13 +134,13 @@
-
-
+
diff --git a/BrightSharp/Behaviors/SelectAllTextOnFocusBehavior.cs b/BrightSharp/Behaviors/SelectAllTextOnFocusBehavior.cs
new file mode 100644
index 0000000..74192bd
--- /dev/null
+++ b/BrightSharp/Behaviors/SelectAllTextOnFocusBehavior.cs
@@ -0,0 +1,33 @@
+using System.Windows.Controls.Primitives;
+using System.Windows.Input;
+using System.Windows.Interactivity;
+
+namespace BrightSharp.Behaviors
+{
+ public class SelectAllTextOnFocusBehavior : Behavior
+ {
+ protected override void OnAttached() {
+ base.OnAttached();
+ AssociatedObject.GotKeyboardFocus += AssociatedObjectGotKeyboardFocus;
+ AssociatedObject.PreviewMouseLeftButtonDown += AssociatedObjectPreviewMouseLeftButtonDown;
+ }
+
+ protected override void OnDetaching() {
+ base.OnDetaching();
+ AssociatedObject.GotKeyboardFocus -= AssociatedObjectGotKeyboardFocus;
+ AssociatedObject.PreviewMouseLeftButtonDown -= AssociatedObjectPreviewMouseLeftButtonDown;
+ }
+
+ private void AssociatedObjectGotKeyboardFocus(object sender,
+ KeyboardFocusChangedEventArgs e) {
+ AssociatedObject.SelectAll();
+ }
+
+ private void AssociatedObjectPreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) {
+ if (!AssociatedObject.IsKeyboardFocusWithin) {
+ AssociatedObject.Focus();
+ e.Handled = true;
+ }
+ }
+ }
+}
diff --git a/BrightSharp/BrightSharp.csproj b/BrightSharp/BrightSharp.csproj
index 24aaaea..caac09e 100644
--- a/BrightSharp/BrightSharp.csproj
+++ b/BrightSharp/BrightSharp.csproj
@@ -52,6 +52,7 @@
+
diff --git a/BrightSharp/Diagrams/Resources/ResizeRotateChrome.xaml b/BrightSharp/Diagrams/Resources/ResizeRotateChrome.xaml
index 6308d1d..d034582 100644
--- a/BrightSharp/Diagrams/Resources/ResizeRotateChrome.xaml
+++ b/BrightSharp/Diagrams/Resources/ResizeRotateChrome.xaml
@@ -1,7 +1,7 @@
-
+
+
-
+
\ No newline at end of file
diff --git a/BrightSharp/Mvvm/ViewModelBase.cs b/BrightSharp/Mvvm/ViewModelBase.cs
index 515423a..e84e9de 100644
--- a/BrightSharp/Mvvm/ViewModelBase.cs
+++ b/BrightSharp/Mvvm/ViewModelBase.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.ComponentModel;
using System.Linq.Expressions;
using System.Reflection;
+using System.Runtime.CompilerServices;
using System.Windows;
namespace BrightSharp.Mvvm
@@ -84,13 +85,13 @@ namespace BrightSharp.Mvvm
return true;
}
- protected void RaisePropertyChanged(string propertyName)
+ protected void RaisePropertyChanged([CallerMemberName]string propertyName = null)
{
- PropertyChangedEventHandler handler = PropertyChanged;
- if(handler != null)
- {
- handler(this, new PropertyChangedEventArgs(propertyName));
- }
+ PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+ }
+ protected void RaisePropertyChangedAll()
+ {
+ PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(null));
}
public event PropertyChangedEventHandler PropertyChanged;
diff --git a/BrightSharp/Style.Blue.xaml b/BrightSharp/Style.Blue.xaml
index 023ae2d..ab6dc2a 100644
--- a/BrightSharp/Style.Blue.xaml
+++ b/BrightSharp/Style.Blue.xaml
@@ -108,7 +108,7 @@
-
+