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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - +