From b3f14b463709098ee9eec52aaeb5009106114e7b Mon Sep 17 00:00:00 2001 From: VitalickS Date: Sun, 27 Aug 2017 13:05:14 +0300 Subject: [PATCH] Ver 2.0. Fixes and improvements. --- BrightSharp.Ui.Tests/App.xaml | 2 - .../BrightSharp.Ui.Tests.csproj | 17 + BrightSharp.Ui.Tests/BrushesMapList.cs | 27 + BrightSharp.Ui.Tests/CustomWindow.xaml | 76 +- BrightSharp.Ui.Tests/ListViewItemModel.cs | 48 +- BrightSharp.Ui.Tests/MainWindow.xaml | 190 ++++- BrightSharp.Ui.Tests/MainWindow.xaml.cs | 6 +- BrightSharp.Ui.Tests/TestPage.xaml | 22 + BrightSharp.Ui.Tests/TestPage.xaml.cs | 28 + BrightSharp.Ui.Tests/TestPage2.xaml | 16 + BrightSharp.Ui.Tests/TestPage2.xaml.cs | 28 + BrightSharp.Ui.Tests/how_to_find_us.png | Bin 487517 -> 0 bytes BrightSharp.sln | 33 +- BrightSharp/BrightSharp.csproj | 2 - BrightSharp/Converters/StringHelpConverter.cs | 32 - BrightSharp/Diagrams/SelectionBehavior.cs | 4 +- BrightSharp/Diagrams/Thumbs/MoveThumb.cs | 37 +- BrightSharp/Extensions/WpfExtensions.cs | 108 ++- BrightSharp/Generic.xaml | 688 ++++++++++++------ BrightSharp/Mvvm/ViewModelBase.cs | 99 --- BrightSharp/Properties/AssemblyInfo.cs | 4 +- BrightSharp/Properties/Resources.Designer.cs | 2 +- BrightSharp/Properties/Settings.Designer.cs | 2 +- BrightSharp/Style.Blue.xaml | 2 +- BrightSharp/Style.DarkBlue.xaml | 47 +- BrightSharp/Style.DevLab.xaml | 4 +- BrightSharp/Style.Silver.xaml | 13 +- BrightSharp/ZoomControl.cs | 14 +- README.md | 44 +- ...ightSharp.Toolkit.Extra.UiTests.exe.config | 6 - ...rp.Toolkit.Extra.UiTests.vshost.exe.config | 6 - ....Toolkit.Extra.UiTests.vshost.exe.manifest | 11 - docs/BrushesList.png | Bin 40802 -> 115225 bytes docs/additional-datagrid.png | Bin 99973 -> 0 bytes docs/additional-frame.png | Bin 26959 -> 0 bytes docs/additional-listview.png | Bin 59246 -> 0 bytes docs/additional-propertygrid.png | Bin 36035 -> 0 bytes docs/additional-treeview.png | Bin 52328 -> 0 bytes docs/blue-theme.png | Bin 0 -> 157947 bytes docs/classic-theme.png | Bin 64013 -> 135290 bytes docs/darkblue-theme.png | Bin 0 -> 127275 bytes docs/datagrid.png | Bin 72687 -> 0 bytes docs/devlab-theme.png | Bin 0 -> 132198 bytes docs/help/apply-themes.md | 11 +- docs/help/brushes.md | 108 +-- docs/help/htmleditor.md | 2 +- docs/silver-theme.png | Bin 0 -> 128889 bytes docs/theme-blue.png | Bin 100057 -> 0 bytes docs/theme-darkblue.png | Bin 91377 -> 0 bytes docs/theme-devlab.png | Bin 86214 -> 0 bytes docs/theme-silver.png | Bin 60165 -> 0 bytes docs/theme-standard.png | Bin 75933 -> 0 bytes 52 files changed, 1092 insertions(+), 647 deletions(-) create mode 100644 BrightSharp.Ui.Tests/BrushesMapList.cs create mode 100644 BrightSharp.Ui.Tests/TestPage.xaml create mode 100644 BrightSharp.Ui.Tests/TestPage.xaml.cs create mode 100644 BrightSharp.Ui.Tests/TestPage2.xaml create mode 100644 BrightSharp.Ui.Tests/TestPage2.xaml.cs delete mode 100644 BrightSharp.Ui.Tests/how_to_find_us.png delete mode 100644 BrightSharp/Converters/StringHelpConverter.cs delete mode 100644 BrightSharp/Mvvm/ViewModelBase.cs delete mode 100644 build.extra/BrightSharp.Toolkit.Extra.UiTests.exe.config delete mode 100644 build.extra/BrightSharp.Toolkit.Extra.UiTests.vshost.exe.config delete mode 100644 build.extra/BrightSharp.Toolkit.Extra.UiTests.vshost.exe.manifest delete mode 100644 docs/additional-datagrid.png delete mode 100644 docs/additional-frame.png delete mode 100644 docs/additional-listview.png delete mode 100644 docs/additional-propertygrid.png delete mode 100644 docs/additional-treeview.png create mode 100644 docs/blue-theme.png create mode 100644 docs/darkblue-theme.png delete mode 100644 docs/datagrid.png create mode 100644 docs/devlab-theme.png create mode 100644 docs/silver-theme.png delete mode 100644 docs/theme-blue.png delete mode 100644 docs/theme-darkblue.png delete mode 100644 docs/theme-devlab.png delete mode 100644 docs/theme-silver.png delete mode 100644 docs/theme-standard.png diff --git a/BrightSharp.Ui.Tests/App.xaml b/BrightSharp.Ui.Tests/App.xaml index 7cdf935..9b82342 100644 --- a/BrightSharp.Ui.Tests/App.xaml +++ b/BrightSharp.Ui.Tests/App.xaml @@ -1,8 +1,6 @@  diff --git a/BrightSharp.Ui.Tests/BrightSharp.Ui.Tests.csproj b/BrightSharp.Ui.Tests/BrightSharp.Ui.Tests.csproj index 397c086..32ee8a6 100644 --- a/BrightSharp.Ui.Tests/BrightSharp.Ui.Tests.csproj +++ b/BrightSharp.Ui.Tests/BrightSharp.Ui.Tests.csproj @@ -38,8 +38,10 @@ false + + @@ -58,6 +60,12 @@ MSBuild:Compile Designer + + TestPage2.xaml + + + TestPage.xaml + Designer MSBuild:Compile @@ -70,6 +78,7 @@ App.xaml Code + CustomWindow.xaml @@ -78,6 +87,14 @@ MainWindow.xaml Code + + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + diff --git a/BrightSharp.Ui.Tests/BrushesMapList.cs b/BrightSharp.Ui.Tests/BrushesMapList.cs new file mode 100644 index 0000000..671aee8 --- /dev/null +++ b/BrightSharp.Ui.Tests/BrushesMapList.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Windows; +using System.Windows.Media; + +namespace BrightSharp.Ui.Tests +{ + public class BrushesMapList : Dictionary + { + public BrushesMapList() { + var dic = Application.Current.Resources.MergedDictionaries.First(); + foreach (string key in dic.Keys.OfType().OrderBy(x => x)) { + var value = Application.Current.TryFindResource(key); + if (value != null) { + bool isBorder = key.Contains("Border"); + if (value is Color col) { + Add(key, new { Type = "C", Brush = new SolidColorBrush(col), IsBorder = isBorder }); + } + else if (value is Brush br) { + Add(key, new { Type = "Br", Brush = br, IsBorder = isBorder }); + } + } + } + } + } +} diff --git a/BrightSharp.Ui.Tests/CustomWindow.xaml b/BrightSharp.Ui.Tests/CustomWindow.xaml index ddfefec..2932427 100644 --- a/BrightSharp.Ui.Tests/CustomWindow.xaml +++ b/BrightSharp.Ui.Tests/CustomWindow.xaml @@ -4,18 +4,78 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:bs="http://schemas.brightsharp.com/developer" + xmlns:conv="http://schemas.brightsharp.com/developer" xmlns:local="clr-namespace:BrightSharp.Ui.Tests" + xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" mc:Ignorable="d" ResizeMode="CanResizeWithGrip" - WindowStyle="ToolWindow" - Height="640" Width="1000" Style="{DynamicResource BrightSharpWindowStyle}"> + WindowStyle="ToolWindow" Title="Brushes Explorer" + Height="800" Width="600" Style="{DynamicResource BrightSharpWindowStyle}"> + + + + + + - Custom WINDOW (BrightSharpWindowStyle) + Brushes Explorer - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BrightSharp.Ui.Tests/ListViewItemModel.cs b/BrightSharp.Ui.Tests/ListViewItemModel.cs index dd61d08..cb33eb0 100644 --- a/BrightSharp.Ui.Tests/ListViewItemModel.cs +++ b/BrightSharp.Ui.Tests/ListViewItemModel.cs @@ -1,10 +1,10 @@ -using BrightSharp.Mvvm; -using System; +using System; using System.ComponentModel; +using System.Runtime.CompilerServices; namespace BrightSharp.Ui.Tests { - public class CustomerViewModel : ObservableObject + public class CustomerViewModel : INotifyPropertyChanged { static Random rnd = new Random(); private string _customerId; @@ -19,6 +19,9 @@ namespace BrightSharp.Ui.Tests private string _phone; private string _fax; private string _color; + private int? _numberProperty; + + public event PropertyChangedEventHandler PropertyChanged; public CustomerViewModel() { @@ -30,57 +33,58 @@ namespace BrightSharp.Ui.Tests public string CustomerID { get { return _customerId; } - set { _customerId = value; RaisePropertyChanged(nameof(CustomerID)); } + set { _customerId = value; RaisePropertyChanged(); } } + public string CompanyName { get { return _companyName; } - set { _companyName = value; RaisePropertyChanged(nameof(CompanyName)); } + set { _companyName = value; RaisePropertyChanged(); } } public string ContactNameCN { get { return _contactName; } - set { _contactName = value; RaisePropertyChanged(nameof(ContactNameCN)); } + set { _contactName = value; RaisePropertyChanged(); } } public string ContactTitle { get { return _contactTitle; } - set { _contactTitle = value; RaisePropertyChanged(nameof(ContactTitle)); } + set { _contactTitle = value; RaisePropertyChanged(); } } [Category("Location")] public string Address { get { return _address; } - set { _address = value; RaisePropertyChanged(nameof(Address)); } + set { _address = value; RaisePropertyChanged(); } } [Category("Location")] public string City { get { return _city; } - set { _city = value; RaisePropertyChanged(nameof(City)); } + set { _city = value; RaisePropertyChanged(); } } [Category("Location")] public string Region { get { return _region; } - set { _region = value; RaisePropertyChanged(nameof(Region)); } + set { _region = value; RaisePropertyChanged(); } } [Category("Contact Information")] [Description("Postal code for Customer")] public string PostalCode { get { return _postalCode; } - set { _postalCode = value; RaisePropertyChanged(nameof(PostalCode)); } + set { _postalCode = value; RaisePropertyChanged(); } } [Category("Location")] [Description("Country for Customer")] public string Country { get { return _country; } - set { _country = value; RaisePropertyChanged(nameof(Country)); } + set { _country = value; RaisePropertyChanged(); } } [Category("Contact Information")] @@ -88,7 +92,7 @@ namespace BrightSharp.Ui.Tests public string Phone { get { return _phone; } - set { _phone = value; RaisePropertyChanged(nameof(Phone)); } + set { _phone = value; RaisePropertyChanged(); } } [Category("Contact Information")] @@ -96,16 +100,21 @@ namespace BrightSharp.Ui.Tests public string Fax { get { return _fax; } - set { _fax = value; RaisePropertyChanged(nameof(Fax)); } + set { _fax = value; RaisePropertyChanged(); } } [Category("Appearance")] public string Color { get { return _color; } - set { _color = value; RaisePropertyChanged(nameof(Color)); } + set { _color = value; RaisePropertyChanged(); } + } + + public int? NumberProperty + { + get { return _numberProperty; } + set { _numberProperty = value; RaisePropertyChanged(); } } - public int NumberProperty { get; set; } public double DoubleNumberProperty { get; set; } @@ -117,5 +126,12 @@ namespace BrightSharp.Ui.Tests [Description("Indicates that Customer is has active state or it absent")] [DisplayName("Is Active Or Not Exists")] public bool? IsActiveOrEmpty { get; set; } + + + + + private void RaisePropertyChanged([CallerMemberName]string memeberName = null) { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(memeberName)); + } } } diff --git a/BrightSharp.Ui.Tests/MainWindow.xaml b/BrightSharp.Ui.Tests/MainWindow.xaml index 76f2ba5..be00ae4 100644 --- a/BrightSharp.Ui.Tests/MainWindow.xaml +++ b/BrightSharp.Ui.Tests/MainWindow.xaml @@ -2,18 +2,16 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 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 BrightSharpWindowStyle}" - ResizeMode="CanResizeWithGrip" xmlns:ex="http://schemas.brightsharp.com/developer" xmlns:bsDiag="http://schemas.brightsharp.com/diagrams" + Style="{DynamicResource BrightSharpWindowStyle}" + ResizeMode="CanResizeWithGrip" x:Class="BrightSharp.Ui.Tests.MainWindow" - mc:Ignorable="d" Background="{DynamicResource WindowBackgroundBrush}" + mc:Ignorable="d" ex:MarkupExtensionProperties.HeaderHorizontalAlignment="Center" - Title="BrightSharp.Ui.Tests" Height="750" Width="1600"> + Title="BrightSharp.Ui.Tests" Height="750" Width="1900"> - @@ -26,35 +24,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - +