Ver 2.0. Fixes and improvements.

This commit is contained in:
2017-08-27 13:05:14 +03:00
parent 9ec10b207b
commit b3f14b4637
52 changed files with 1092 additions and 647 deletions

View File

@@ -1,8 +1,6 @@
<Application x:Class="BrightSharp.Ui.Tests.App" <Application x:Class="BrightSharp.Ui.Tests.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:local="clr-namespace:BrightSharp.Ui.Tests"
StartupUri="MainWindow.xaml"> StartupUri="MainWindow.xaml">
<Application.Resources> <Application.Resources>
<ResourceDictionary> <ResourceDictionary>

View File

@@ -38,8 +38,10 @@
<Prefer32Bit>false</Prefer32Bit> <Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="PresentationFramework.Aero2" />
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
@@ -58,6 +60,12 @@
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</ApplicationDefinition> </ApplicationDefinition>
<Compile Include="TestPage2.xaml.cs">
<DependentUpon>TestPage2.xaml</DependentUpon>
</Compile>
<Compile Include="TestPage.xaml.cs">
<DependentUpon>TestPage.xaml</DependentUpon>
</Compile>
<Page Include="CustomWindow.xaml"> <Page Include="CustomWindow.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
@@ -70,6 +78,7 @@
<DependentUpon>App.xaml</DependentUpon> <DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Include="BrushesMapList.cs" />
<Compile Include="CustomWindow.xaml.cs"> <Compile Include="CustomWindow.xaml.cs">
<DependentUpon>CustomWindow.xaml</DependentUpon> <DependentUpon>CustomWindow.xaml</DependentUpon>
</Compile> </Compile>
@@ -78,6 +87,14 @@
<DependentUpon>MainWindow.xaml</DependentUpon> <DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Page Include="TestPage2.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="TestPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs"> <Compile Include="Properties\AssemblyInfo.cs">

View File

@@ -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<string, object>
{
public BrushesMapList() {
var dic = Application.Current.Resources.MergedDictionaries.First();
foreach (string key in dic.Keys.OfType<string>().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 });
}
}
}
}
}
}

View File

@@ -4,18 +4,78 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:bs="http://schemas.brightsharp.com/developer" xmlns:bs="http://schemas.brightsharp.com/developer"
xmlns:conv="http://schemas.brightsharp.com/developer"
xmlns:local="clr-namespace:BrightSharp.Ui.Tests" xmlns:local="clr-namespace:BrightSharp.Ui.Tests"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
mc:Ignorable="d" ResizeMode="CanResizeWithGrip" mc:Ignorable="d" ResizeMode="CanResizeWithGrip"
WindowStyle="ToolWindow" WindowStyle="ToolWindow" Title="Brushes Explorer"
Height="640" Width="1000" Style="{DynamicResource BrightSharpWindowStyle}"> Height="800" Width="600" Style="{DynamicResource BrightSharpWindowStyle}">
<Window.Resources>
<local:BrushesMapList x:Key="Brushes" />
<BooleanToVisibilityConverter x:Key="btvc" />
<conv:InverseBooleanToVisibilityConverter x:Key="ibtvc" />
</Window.Resources>
<bs:MarkupExtensionProperties.Header> <bs:MarkupExtensionProperties.Header>
<Grid> <Grid>
<TextBlock>Custom WINDOW (BrightSharpWindowStyle)</TextBlock> <TextBlock>Brushes Explorer</TextBlock>
</Grid> </Grid>
</bs:MarkupExtensionProperties.Header> </bs:MarkupExtensionProperties.Header>
<Window.Resources> <Grid>
</Window.Resources> <ScrollViewer VerticalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Auto">
<Label> <ItemsControl ItemsSource="{Binding Source={StaticResource Brushes}}">
TEST (Dev) WINDOW STYLE (CONTENT) <ItemsControl.ItemsPanel>
</Label> <ItemsPanelTemplate>
<WrapPanel Orientation="Vertical" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid HorizontalAlignment="Left" Margin="0,1">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Rectangle Stroke="#444" StrokeThickness="1" Width="80" Height="24">
<Rectangle.Fill>
<DrawingBrush TileMode="Tile" Viewport="0,0,30,30"
ViewportUnits="Absolute">
<DrawingBrush.Drawing>
<GeometryDrawing Brush="#BDBDBD"
Geometry="M5,5 L0,5 0,10 5,10 5,5 10,5 10,0 5,0 Z"/>
</DrawingBrush.Drawing>
</DrawingBrush>
</Rectangle.Fill>
</Rectangle>
<Rectangle Stroke="#444" StrokeThickness="1" Fill="{Binding Path=Value.Brush}" Visibility="{Binding Path=Value.IsBorder, Converter={StaticResource ibtvc}}" >
<Rectangle.ToolTip>
<StackPanel Orientation="Horizontal">
<Rectangle Margin="5" Fill="{Binding Path=Value.Brush}" Width="250" Height="50" Visibility="{Binding Path=Value.IsBorder, Converter={StaticResource ibtvc}}" />
</StackPanel>
</Rectangle.ToolTip>
</Rectangle>
<Rectangle Fill="#4444" StrokeThickness="2" Margin="3" Stroke="{Binding Path=Value.Brush}" Visibility="{Binding Path=Value.IsBorder, Converter={StaticResource btvc}}" >
<Rectangle.ToolTip>
<StackPanel Orientation="Horizontal">
<Rectangle Margin="5" Stroke="{Binding Path=Value.Brush}" Width="250" Height="50" Visibility="{Binding Path=Value.IsBorder, Converter={StaticResource btvc}}" />
</StackPanel>
</Rectangle.ToolTip>
</Rectangle>
<TextBlock IsHitTestVisible="False" Margin="2,2,0,0" Foreground="{DynamicResource WindowBackgroundBrush}" VerticalAlignment="Center" HorizontalAlignment="Center" Text="{Binding Path=Value.Type}" />
<TextBlock IsHitTestVisible="False" VerticalAlignment="Center" Foreground="{DynamicResource OnWindowForegroundBrush}" HorizontalAlignment="Center" Text="{Binding Path=Value.Type}" />
<TextBox VerticalContentAlignment="Center" Grid.Column="1" Text="{Binding Path=Key, Mode=OneTime}" BorderThickness="0" Background="Transparent">
<i:Interaction.Behaviors>
<bs:SelectAllTextOnFocusBehavior />
</i:Interaction.Behaviors>
</TextBox>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Grid>
</Window> </Window>

View File

@@ -1,10 +1,10 @@
using BrightSharp.Mvvm; using System;
using System;
using System.ComponentModel; using System.ComponentModel;
using System.Runtime.CompilerServices;
namespace BrightSharp.Ui.Tests namespace BrightSharp.Ui.Tests
{ {
public class CustomerViewModel : ObservableObject public class CustomerViewModel : INotifyPropertyChanged
{ {
static Random rnd = new Random(); static Random rnd = new Random();
private string _customerId; private string _customerId;
@@ -19,6 +19,9 @@ namespace BrightSharp.Ui.Tests
private string _phone; private string _phone;
private string _fax; private string _fax;
private string _color; private string _color;
private int? _numberProperty;
public event PropertyChangedEventHandler PropertyChanged;
public CustomerViewModel() public CustomerViewModel()
{ {
@@ -30,57 +33,58 @@ namespace BrightSharp.Ui.Tests
public string CustomerID public string CustomerID
{ {
get { return _customerId; } get { return _customerId; }
set { _customerId = value; RaisePropertyChanged(nameof(CustomerID)); } set { _customerId = value; RaisePropertyChanged(); }
} }
public string CompanyName public string CompanyName
{ {
get { return _companyName; } get { return _companyName; }
set { _companyName = value; RaisePropertyChanged(nameof(CompanyName)); } set { _companyName = value; RaisePropertyChanged(); }
} }
public string ContactNameCN public string ContactNameCN
{ {
get { return _contactName; } get { return _contactName; }
set { _contactName = value; RaisePropertyChanged(nameof(ContactNameCN)); } set { _contactName = value; RaisePropertyChanged(); }
} }
public string ContactTitle public string ContactTitle
{ {
get { return _contactTitle; } get { return _contactTitle; }
set { _contactTitle = value; RaisePropertyChanged(nameof(ContactTitle)); } set { _contactTitle = value; RaisePropertyChanged(); }
} }
[Category("Location")] [Category("Location")]
public string Address public string Address
{ {
get { return _address; } get { return _address; }
set { _address = value; RaisePropertyChanged(nameof(Address)); } set { _address = value; RaisePropertyChanged(); }
} }
[Category("Location")] [Category("Location")]
public string City public string City
{ {
get { return _city; } get { return _city; }
set { _city = value; RaisePropertyChanged(nameof(City)); } set { _city = value; RaisePropertyChanged(); }
} }
[Category("Location")] [Category("Location")]
public string Region public string Region
{ {
get { return _region; } get { return _region; }
set { _region = value; RaisePropertyChanged(nameof(Region)); } set { _region = value; RaisePropertyChanged(); }
} }
[Category("Contact Information")] [Category("Contact Information")]
[Description("Postal code for Customer")] [Description("Postal code for Customer")]
public string PostalCode public string PostalCode
{ {
get { return _postalCode; } get { return _postalCode; }
set { _postalCode = value; RaisePropertyChanged(nameof(PostalCode)); } set { _postalCode = value; RaisePropertyChanged(); }
} }
[Category("Location")] [Category("Location")]
[Description("Country for Customer")] [Description("Country for Customer")]
public string Country public string Country
{ {
get { return _country; } get { return _country; }
set { _country = value; RaisePropertyChanged(nameof(Country)); } set { _country = value; RaisePropertyChanged(); }
} }
[Category("Contact Information")] [Category("Contact Information")]
@@ -88,7 +92,7 @@ namespace BrightSharp.Ui.Tests
public string Phone public string Phone
{ {
get { return _phone; } get { return _phone; }
set { _phone = value; RaisePropertyChanged(nameof(Phone)); } set { _phone = value; RaisePropertyChanged(); }
} }
[Category("Contact Information")] [Category("Contact Information")]
@@ -96,16 +100,21 @@ namespace BrightSharp.Ui.Tests
public string Fax public string Fax
{ {
get { return _fax; } get { return _fax; }
set { _fax = value; RaisePropertyChanged(nameof(Fax)); } set { _fax = value; RaisePropertyChanged(); }
} }
[Category("Appearance")] [Category("Appearance")]
public string Color public string Color
{ {
get { return _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; } public double DoubleNumberProperty { get; set; }
@@ -117,5 +126,12 @@ namespace BrightSharp.Ui.Tests
[Description("Indicates that Customer is has active state or it absent")] [Description("Indicates that Customer is has active state or it absent")]
[DisplayName("Is Active Or Not Exists")] [DisplayName("Is Active Or Not Exists")]
public bool? IsActiveOrEmpty { get; set; } public bool? IsActiveOrEmpty { get; set; }
private void RaisePropertyChanged([CallerMemberName]string memeberName = null) {
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(memeberName));
}
} }
} }

View File

@@ -2,18 +2,16 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:BrightSharp.Ui.Tests"
xmlns:viewModel="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:ex="http://schemas.brightsharp.com/developer"
xmlns:bsDiag="http://schemas.brightsharp.com/diagrams" xmlns:bsDiag="http://schemas.brightsharp.com/diagrams"
Style="{DynamicResource BrightSharpWindowStyle}"
ResizeMode="CanResizeWithGrip"
x:Class="BrightSharp.Ui.Tests.MainWindow" x:Class="BrightSharp.Ui.Tests.MainWindow"
mc:Ignorable="d" Background="{DynamicResource WindowBackgroundBrush}" mc:Ignorable="d"
ex:MarkupExtensionProperties.HeaderHorizontalAlignment="Center" ex:MarkupExtensionProperties.HeaderHorizontalAlignment="Center"
Title="BrightSharp.Ui.Tests" Height="750" Width="1600"> Title="BrightSharp.Ui.Tests" Height="750" Width="1900">
<Window.Resources> <Window.Resources>
<ex:StringHelpConverter x:Key="StringHelpConverter" />
<x:Array x:Key="coll" Type="{x:Type viewModel:CustomerViewModel}"> <x:Array x:Key="coll" Type="{x:Type viewModel:CustomerViewModel}">
<viewModel:CustomerViewModel CustomerID="ALFKI" CompanyName="Alfreds Futterkiste" ContactNameCN="Maria Anders" ContactTitle="Sales Representative" Address="Obere Str. 57" City="Berlin" PostalCode="12209" Country="Germany" Phone="030-0074321" Fax="030-0076545" /> <viewModel:CustomerViewModel CustomerID="ALFKI" CompanyName="Alfreds Futterkiste" ContactNameCN="Maria Anders" ContactTitle="Sales Representative" Address="Obere Str. 57" City="Berlin" PostalCode="12209" Country="Germany" Phone="030-0074321" Fax="030-0076545" />
<viewModel:CustomerViewModel CustomerID="ANATR" CompanyName="Ana Trujillo Emparedados y helados" ContactNameCN="Ana Trujillo" ContactTitle="Owner" Address="Avda. de la Constitución 2222" City="México D.F." PostalCode="05021" Country="Mexico" Phone="(5) 555-4729" Fax="(5) 555-3745" /> <viewModel:CustomerViewModel CustomerID="ANATR" CompanyName="Ana Trujillo Emparedados y helados" ContactNameCN="Ana Trujillo" ContactTitle="Owner" Address="Avda. de la Constitución 2222" City="México D.F." PostalCode="05021" Country="Mexico" Phone="(5) 555-4729" Fax="(5) 555-3745" />
@@ -26,35 +24,73 @@
</x:Array> </x:Array>
<CollectionViewSource Source="{StaticResource coll}" x:Key="coll1" /> <CollectionViewSource Source="{StaticResource coll}" x:Key="coll1" />
<CollectionViewSource Source="{StaticResource coll}" x:Key="coll2" /> <CollectionViewSource Source="{StaticResource coll}" x:Key="coll2" />
</Window.Resources> </Window.Resources>
<ex:MarkupExtensionProperties.Header>
<StackPanel Orientation="Horizontal">
<Label Foreground="Red">❖</Label>
<Label Foreground="White">BrightSharp.Toolkit Presentation ver.2</Label>
<Label Foreground="Blue">❖</Label>
</StackPanel>
</ex:MarkupExtensionProperties.Header>
<Grid> <Grid>
<Grid Margin="2" ClipToBounds="True"> <Grid Margin="2" ClipToBounds="True">
<bsDiag:ZoomControl x:Name="zc" UseAnimation="True" ClipToBounds="False"> <bsDiag:ZoomControl x:Name="zc" UseAnimation="True" ClipToBounds="False">
<ContentControl Style="{StaticResource DesignerItemStyle}"
Canvas.Left="1600" Canvas.Top="20" Width="300">
<GroupBox Style="{StaticResource ExpandrStyleGroupBox}">
<GroupBox.Header>
<StackPanel Orientation="Horizontal">
<Label>Extended Frame</Label>
</StackPanel>
</GroupBox.Header>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition />
</Grid.RowDefinitions>
<Slider Minimum="20" Maximum="50" Value="35" x:Name="FrameHeightSlider" />
<Frame Source="TestPage.xaml" Style="{DynamicResource DevLabFrameStyle}" Grid.Row="1"
ex:MarkupExtensionProperties.HeaderHeight="{Binding ElementName=FrameHeightSlider, Path=Value}"
>
<ex:MarkupExtensionProperties.Header>
<Label VerticalContentAlignment="Center">
Additional Header Content
</Label>
</ex:MarkupExtensionProperties.Header>
</Frame>
</Grid>
</GroupBox>
</ContentControl>
<ContentControl Style="{StaticResource DesignerItemStyle}" <ContentControl Style="{StaticResource DesignerItemStyle}"
Canvas.Left="10" Canvas.Top="20" Width="330"> Canvas.Left="10" Canvas.Top="20" Width="330">
<GroupBox Header="Common"> <GroupBox Header="Common" Background="{DynamicResource GradientWindowBackgroundBrush}">
<Grid> <Grid>
<Button IsDefault="True" Content="Change Theme" Click="Button_Click" HorizontalAlignment="Left" Width="108" Height="32" VerticalAlignment="Top" Margin="10,10,0,0"/> <Button IsDefault="True" Content="Change Theme" Click="Button_Click" HorizontalAlignment="Left" Width="108" Height="32" VerticalAlignment="Top" Margin="10,10,0,0"/>
<Button ex:MarkupExtensionProperties.CornerRadius="25" FocusVisualStyle="{DynamicResource ButtonEllipseFocusVisual}" Content="Round" HorizontalAlignment="Left" Width="50" Height="50" VerticalAlignment="Top" Margin="10,84,0,0"/>
<ToggleButton IsChecked="True" ex:MarkupExtensionProperties.CornerRadius="25" FocusVisualStyle="{DynamicResource ButtonEllipseFocusVisual}" Content="Round" HorizontalAlignment="Left" Width="50" Height="50" VerticalAlignment="Top" Margin="70,84,0,0"/>
<ToggleButton Content="Toggle" HorizontalAlignment="Left" Width="108" Height="32" VerticalAlignment="Top" Margin="10,47,0,0"/> <ToggleButton Content="Toggle" HorizontalAlignment="Left" Width="108" Height="32" VerticalAlignment="Top" Margin="10,47,0,0"/>
<CheckBox Margin="10,84,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Content="CheckBox" IsThreeState="True" IsChecked="{x:Null}"/> <CheckBox Margin="10,140,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Content="CheckBox" IsThreeState="True" IsChecked="{x:Null}"/>
<CheckBox IsThreeState="True" ex:MarkupExtensionProperties.Docking="Right" Margin="10,105,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Content="CheckBox Right Allign"/> <CheckBox IsThreeState="True" ex:MarkupExtensionProperties.Docking="Right" Margin="10,161,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Content="CheckBox Right Allign"/>
<CheckBox HorizontalContentAlignment="Center" IsThreeState="True" ex:MarkupExtensionProperties.Docking="Top" Margin="151,35,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="137" Content="CheckBox Top Allign"/> <CheckBox HorizontalContentAlignment="Center" IsThreeState="True" ex:MarkupExtensionProperties.Docking="Top" Margin="151,35,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="137" Content="CheckBox Top Allign"/>
<RadioButton IsChecked="True" Margin="10,130,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Content="RadioButton"/> <RadioButton IsChecked="True" Margin="10,183,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Content="RadioButton"/>
<RadioButton Margin="10,151,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Content="RadioButton"/> <RadioButton Margin="10,204,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Content="RadioButton"/>
<TextBox x:Name="tb" Canvas.Left="10" Canvas.Top="269" Margin="151,10,10,0" VerticalAlignment="Top" /> <TextBox x:Name="tb" Canvas.Left="10" Canvas.Top="269" Margin="151,10,10,0" VerticalAlignment="Top" />
<TabControl BorderThickness="1" Margin="151,72,10,0" Height="122" VerticalAlignment="Top"> <TabControl BorderThickness="1" Margin="151,72,10,0" Height="122" VerticalAlignment="Top">
<TabItem Header="Tab1"/> <TabItem Header="Tab1"/>
<TabItem Header="Tab2"/> <TabItem Header="Tab2"/>
<TabItem Header="Tab3"/> <TabItem Header="Tab3"/>
</TabControl> </TabControl>
<CheckBox HorizontalAlignment="Left" Style="{StaticResource SwitchCheckBoxStyle}" VerticalAlignment="Top" Margin="37,204,0,0" Content="SwitchCheckBoxStyle" Width="213" RenderTransformOrigin="0.5,0.5" Height="Auto" /> <CheckBox HorizontalAlignment="Left" Style="{StaticResource SwitchCheckBoxStyle}" VerticalAlignment="Top" Margin="40,275,0,0" Content="SwitchCheckBoxStyle" Width="213" RenderTransformOrigin="0.5,0.5" Height="Auto" />
<TextBox Margin="35,236,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="246"> <TextBox Margin="40,304,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="246" Padding="3">
<ex:MarkupExtensionProperties.LeadingElement>L.El.</ex:MarkupExtensionProperties.LeadingElement> <ex:MarkupExtensionProperties.LeadingElement>L.El.</ex:MarkupExtensionProperties.LeadingElement>
<ex:MarkupExtensionProperties.TrailingElement>T.El.</ex:MarkupExtensionProperties.TrailingElement> <ex:MarkupExtensionProperties.TrailingElement>T.El.</ex:MarkupExtensionProperties.TrailingElement>
<ex:MarkupExtensionProperties.Header>Watermark</ex:MarkupExtensionProperties.Header> <ex:MarkupExtensionProperties.Header>Watermark</ex:MarkupExtensionProperties.Header>
</TextBox> </TextBox>
<Button Content="Test Custom Window" Margin="93,266,0,0" HorizontalAlignment="Left" Width="134" Height="25" VerticalAlignment="Top" Click="Button_Click_ShowCustomWindow"></Button> <Button Content="Brushes Explorer" Margin="97,416,0,0" HorizontalAlignment="Left" Width="134" Height="25" VerticalAlignment="Top" Click="Button_Click_ShowCustomWindow"/>
<Calendar Margin="10,295,10,0" VerticalAlignment="Top" Loaded="Calendar_Loaded"> <Calendar Margin="10,441,10,0" VerticalAlignment="Top" Loaded="Calendar_Loaded">
<ex:MarkupExtensionProperties.TrailingElement> <ex:MarkupExtensionProperties.TrailingElement>
<TextBlock HorizontalAlignment="Center" Foreground="DarkRed"><Run Text="Trailing Region"/></TextBlock> <TextBlock HorizontalAlignment="Center" Foreground="DarkRed"><Run Text="Trailing Region"/></TextBlock>
</ex:MarkupExtensionProperties.TrailingElement> </ex:MarkupExtensionProperties.TrailingElement>
@@ -62,7 +98,7 @@
<TextBlock HorizontalAlignment="Center" Foreground="DarkBlue"><Run Text="Leading Region"/></TextBlock> <TextBlock HorizontalAlignment="Center" Foreground="DarkBlue"><Run Text="Leading Region"/></TextBlock>
</ex:MarkupExtensionProperties.LeadingElement> </ex:MarkupExtensionProperties.LeadingElement>
</Calendar> </Calendar>
<ComboBox IsEditable="True" Margin="10,172,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" SelectedIndex="0" Width="136"> <ComboBox IsEditable="True" Margin="10,225,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" SelectedIndex="0" Width="136">
<ComboBoxItem Content="Item 1"/> <ComboBoxItem Content="Item 1"/>
<ComboBoxItem Content="Item 2"/> <ComboBoxItem Content="Item 2"/>
<ComboBoxItem Content="Item 3"/> <ComboBoxItem Content="Item 3"/>
@@ -70,6 +106,54 @@
<ComboBoxItem Content="Item 4"/> <ComboBoxItem Content="Item 4"/>
<ComboBoxItem Content="Item 5"/> <ComboBoxItem Content="Item 5"/>
</ComboBox> </ComboBox>
<ComboBox ItemsSource="{Binding Source={StaticResource coll1}}" TextSearch.TextPath="ContactNameCN" IsEditable="True" Margin="10,250,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" SelectedIndex="0" Width="136">
<ex:MarkupExtensionProperties.LeadingElement>
<ToolBar Style="{DynamicResource FlatToolBar}" Margin="0,2" ex:MarkupExtensionProperties.CornerRadius="3,3,0,0">
<Button Content="Press me" />
<Button Content="Press me" />
</ToolBar>
</ex:MarkupExtensionProperties.LeadingElement>
<ex:MarkupExtensionProperties.TrailingElement>
<Button HorizontalAlignment="Left" Content="Trailing"/>
</ex:MarkupExtensionProperties.TrailingElement>
<ComboBox.ItemTemplate>
<DataTemplate>
<Border BorderThickness="0,0,0,1" BorderBrush="{DynamicResource SolidBorderBrush}" MinWidth="140">
<StackPanel>
<TextBlock Text="{Binding ContactNameCN}" FontWeight="DemiBold" />
<Label Background="White" BorderBrush="Black" BorderThickness="1" Padding="3,0" Margin="0,-14,3,0" HorizontalAlignment="Right">
<Label.ToolTip>
<StackPanel>
<TextBlock Text="{Binding ContactNameCN}" FontWeight="DemiBold" />
<TextBlock Text="{Binding Address}" FontStyle="Italic" />
<TextBlock Text="{Binding City}" />
<TextBlock Text="{Binding CompanyName}" />
<TextBlock Text="{Binding ContactTitle}" />
<TextBlock Text="{Binding Phone}" />
</StackPanel>
</Label.ToolTip>
<TextBlock Foreground="Black"><Run Text="i"/></TextBlock>
</Label>
<TextBlock Text="{Binding Address}" FontStyle="Italic" MaxWidth="130" TextTrimming="CharacterEllipsis" HorizontalAlignment="Left" ToolTip="{Binding Address}" />
</StackPanel>
</Border>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<Button Style="{DynamicResource GlassButtonStyle}" Content="GlassButton" HorizontalAlignment="Left" Width="70" Height="70" VerticalAlignment="Top" Margin="161,199,0,0"/>
<Button Style="{DynamicResource GlassButtonStyle}" Content="Style" HorizontalAlignment="Left" Width="50" Height="50" VerticalAlignment="Top" Margin="248,209,0,0" Background="#FFFF6868"/>
<TextBox Padding="3" Margin="40,332,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="246"
Text="{Binding Source={StaticResource coll}, Path=[0].NumberProperty, UpdateSourceTrigger=PropertyChanged}">
<ex:MarkupExtensionProperties.LeadingElement>LD</ex:MarkupExtensionProperties.LeadingElement>
<ex:MarkupExtensionProperties.TrailingElement>TR</ex:MarkupExtensionProperties.TrailingElement>
<ex:MarkupExtensionProperties.Header>Check Validation Style (Number)</ex:MarkupExtensionProperties.Header>
</TextBox>
<PasswordBox Padding="3" Margin="40,375,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="246">
<ex:MarkupExtensionProperties.LeadingElement>Password</ex:MarkupExtensionProperties.LeadingElement>
<ex:MarkupExtensionProperties.TrailingElement>***</ex:MarkupExtensionProperties.TrailingElement>
<ex:MarkupExtensionProperties.Header>Enter your password :)</ex:MarkupExtensionProperties.Header>
</PasswordBox>
</Grid> </Grid>
</GroupBox> </GroupBox>
</ContentControl> </ContentControl>
@@ -104,8 +188,24 @@
</MenuItem> </MenuItem>
</Menu> </Menu>
<ToolBar ToolBar.OverflowMode="Never"> <ToolBar ToolBar.OverflowMode="Never">
<Button Content="EXEC" /> <Button Content="BUTTON" />
<Button Content="View" /> <ToggleButton Margin="5,0,0,0" Content="TBUTTON" />
<Separator />
<Menu Background="Transparent" Foreground="{DynamicResource UiForegroundBrush}">
<MenuItem Header="Menu ▼">
<MenuItem Header="MenuItem1"/>
<MenuItem Header="MenuItem2"/>
</MenuItem>
</Menu>
<TextBox Margin="5,0,0,0" Width="60" />
<ComboBox Margin="5,0,0,0" Width="60" SelectedIndex="0">
<ComboBoxItem>1 Combobox Item</ComboBoxItem>
<ComboBoxItem>2 Combobox Item</ComboBoxItem>
</ComboBox>
<Separator />
<RadioButton Content="R1" IsChecked="True" />
<RadioButton Content="R2" />
<RadioButton Content="R3" />
</ToolBar> </ToolBar>
</StackPanel> </StackPanel>
<ListView ItemsSource="{Binding Source={StaticResource coll1}}" SelectedIndex="5" Margin="2,54,10,190"> <ListView ItemsSource="{Binding Source={StaticResource coll1}}" SelectedIndex="5" Margin="2,54,10,190">
@@ -123,11 +223,18 @@
<ListBoxItem Content="789"/> <ListBoxItem Content="789"/>
</ListBox> </ListBox>
<TreeView Margin="204,0,10,10" Height="175" VerticalAlignment="Bottom"> <TreeView Margin="204,0,10,10" Height="175" VerticalAlignment="Bottom">
<TreeViewItem Header="1"> <TreeViewItem IsExpanded="True" Header="First" Foreground="Black" Background="AliceBlue">
<TreeViewItem Header="12"> <TreeViewItem Header="F-12" IsExpanded="True" Background="Pink">
<TreeViewItem Header="123"/> <TreeViewItem Header="F-123" />
<TreeViewItem Header="123"/> <TreeViewItem Header="F-123" IsSelected="True" />
<TreeViewItem Header="123"/> <TreeViewItem Header="F-123" />
</TreeViewItem>
</TreeViewItem>
<TreeViewItem Header="Second">
<TreeViewItem Header="S-12" ex:MarkupExtensionProperties.SpecialWidth="50">
<TreeViewItem Header="S-123"/>
<TreeViewItem Header="S-123"/>
<TreeViewItem Header="S-123"/>
</TreeViewItem> </TreeViewItem>
</TreeViewItem> </TreeViewItem>
</TreeView> </TreeView>
@@ -137,7 +244,7 @@
<ContentControl Style="{StaticResource DesignerItemStyle}" bsDiag:VisualExtensions.CanRotate="False" <ContentControl Style="{StaticResource DesignerItemStyle}" bsDiag:VisualExtensions.CanRotate="False"
Padding="2,27,2,2" Padding="2,27,2,2"
Canvas.Left="850" Canvas.Left="850"
Canvas.Top="20" Width="733" Height="475"> Canvas.Top="20" Width="700" Height="450">
<GroupBox Margin="0,-25,0,0" Style="{StaticResource ExpandrStyleGroupBox}" > <GroupBox Margin="0,-25,0,0" Style="{StaticResource ExpandrStyleGroupBox}" >
<GroupBox.Header> <GroupBox.Header>
<Label Content="Xaml RichTextBox (CanRotate=false)"/> <Label Content="Xaml RichTextBox (CanRotate=false)"/>
@@ -150,6 +257,8 @@
<Paragraph TextAlignment="Justify"> <Paragraph TextAlignment="Justify">
<Run Text="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."/> <Run Text="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."/>
<Run Text=" "/> <Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Figure HorizontalAnchor="ColumnRight" Width="205"> <Figure HorizontalAnchor="ColumnRight" Width="205">
<BlockUIContainer> <BlockUIContainer>
<Image UseLayoutRounding="True" d:DesignUseLayoutRounding="True"> <Image UseLayoutRounding="True" d:DesignUseLayoutRounding="True">
@@ -160,6 +269,8 @@
</BlockUIContainer> </BlockUIContainer>
</Figure> </Figure>
<Run Text=" "/> <Run Text=" "/>
<Run Text=" "/>
<Run Text=" "/>
<Figure HorizontalAnchor="ColumnRight" Width="230"> <Figure HorizontalAnchor="ColumnRight" Width="230">
<BlockUIContainer> <BlockUIContainer>
<Image UseLayoutRounding="True" d:DesignUseLayoutRounding="True"> <Image UseLayoutRounding="True" d:DesignUseLayoutRounding="True">
@@ -201,7 +312,7 @@
Padding="2,27,2,2" Padding="2,27,2,2"
Canvas.Left="350" Canvas.Left="350"
Canvas.Top="550"> Canvas.Top="550">
<Expander Margin="0,-25,0,0"> <Expander Margin="0,-25,0,0" IsExpanded="True">
<Expander.Header> <Expander.Header>
<Label Background="Transparent" Content="Grid (MaxWidth,MaxHeight)"/> <Label Background="Transparent" Content="Grid (MaxWidth,MaxHeight)"/>
</Expander.Header> </Expander.Header>
@@ -209,26 +320,25 @@
</Expander> </Expander>
</ContentControl> </ContentControl>
<ContentControl Width="294" Height="133" Background="Pink" Canvas.Left="1050" Canvas.Top="550" Style="{StaticResource DesignerItemStyle}"> <ContentControl Width="294" Height="133" Background="{DynamicResource LightBrush}" Canvas.Left="850" Canvas.Top="550" Style="{StaticResource DesignerItemStyle}">
<Border> <Border>
<StackPanel> <StackPanel>
<TextBlock FontStyle="Italic">(Some elements hidden by LODZoom extension)</TextBlock> <TextBlock FontStyle="Italic"><Run Text="(Some elements hidden by LODZoom extension)"/></TextBlock>
<Separator /> <Separator />
<TextBlock TextWrapping="Wrap" bsDiag:VisualExtensions.LODZoom=" A1-5">1. Element use LODZoom Functionality A1-5</TextBlock> <TextBlock TextWrapping="Wrap" bsDiag:VisualExtensions.LODZoom=" A1-5"><Run Text="1. Element use LODZoom Functionality A1-5"/></TextBlock>
<TextBlock TextWrapping="Wrap" bsDiag:VisualExtensions.LODZoom="A -5.1">2. Element use LODZoom Functionality A -5.1</TextBlock> <TextBlock TextWrapping="Wrap" bsDiag:VisualExtensions.LODZoom="A -5.1"><Run Text="2. Element use LODZoom Functionality A -5.1"/></TextBlock>
<TextBlock TextWrapping="Wrap" bsDiag:VisualExtensions.LODZoom="a 2-8.3">3. Element use LODZoom Functionality a 2-8.3</TextBlock> <TextBlock TextWrapping="Wrap" bsDiag:VisualExtensions.LODZoom="a 2-8.3"><Run Text="3. Element use LODZoom Functionality a 2-8.3"/></TextBlock>
<TextBlock TextWrapping="Wrap" bsDiag:VisualExtensions.LODZoom="a 1.5-">4. Element use LODZoom Functionality a 1.5-</TextBlock> <TextBlock TextWrapping="Wrap" bsDiag:VisualExtensions.LODZoom="a 1.5-"><Run Text="4. Element use LODZoom Functionality a 1.5-"/></TextBlock>
<TextBlock TextWrapping="Wrap" bsDiag:VisualExtensions.LODZoom="1-5">5. Element use LODZoom Functionality 1-5</TextBlock> <TextBlock TextWrapping="Wrap" bsDiag:VisualExtensions.LODZoom="1-5"><Run Text="5. Element use LODZoom Functionality 1-5"/></TextBlock>
</StackPanel> </StackPanel>
</Border> </Border>
</ContentControl> </ContentControl>
</bsDiag:ZoomControl> </bsDiag:ZoomControl>
<CheckBox VerticalAlignment="Bottom" HorizontalAlignment="Left" Margin="0,0,0,20" IsChecked="{Binding ElementName=zc, Path=UseAnimation}">UseAnimation</CheckBox> <Label VerticalAlignment="Bottom" HorizontalAlignment="Left" Margin="0,0,0,40">Middle Mouse Button To Pan. Hold Ctrl to force zoom.</Label>
<TextBlock VerticalAlignment="Bottom" HorizontalAlignment="Left"> <CheckBox VerticalAlignment="Bottom" HorizontalAlignment="Left" Margin="0,0,0,20" IsChecked="{Binding UseAnimation, ElementName=zc}" Content="UseAnimation"/>
<Run>RenderZoom: </Run><Run Text="{Binding ElementName=zc, Path=RenderZoom}" /> <TextBlock VerticalAlignment="Bottom" HorizontalAlignment="Left"><Run Text="RenderZoom:"/><Run Text="{Binding RenderZoom, ElementName=zc, StringFormat={} {0:N2}}" /></TextBlock>
</TextBlock>
</Grid> </Grid>

View File

@@ -1,6 +1,7 @@
using BrightSharp.Converters; using BrightSharp.Converters;
using Diagrams; using Diagrams;
using System; using System;
using System.Text.RegularExpressions;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
@@ -15,6 +16,7 @@ namespace BrightSharp.Ui.Tests
{ {
InitializeComponent(); InitializeComponent();
SelectionBehavior.Attach(innerCanvas); SelectionBehavior.Attach(innerCanvas);
//ThemeManager.Theme = ColorThemes.DarkBlue;
tb.Text = ThemeManager.Theme.ToString(); tb.Text = ThemeManager.Theme.ToString();
} }
@@ -46,11 +48,11 @@ namespace BrightSharp.Ui.Tests
private void DataGrid_AutoGeneratedColumns(object sender, EventArgs e) private void DataGrid_AutoGeneratedColumns(object sender, EventArgs e)
{ {
var dg = (DataGrid)sender; var dg = (DataGrid)sender;
var stringHelper = new StringHelpConverter();
foreach (var col in dg.Columns) foreach (var col in dg.Columns)
{ {
col.Header = stringHelper.Convert(col.Header, null, "SpaceBetweenCaps", null); col.Header = Regex.Replace(col.Header.ToString(), "([a-z])([A-Z])", "$1 $2");
} }
} }
} }
} }

View File

@@ -0,0 +1,22 @@
<Page x:Class="BrightSharp.Ui.Tests.TestPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
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:BrightSharp.Ui.Tests"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300"
Title="TestPage">
<Grid>
<StackPanel>
<Label>
Hello World!
</Label>
<TextBlock>
<Hyperlink NavigateUri="TestPage2.xaml">Go to TestPage2</Hyperlink>
</TextBlock>
</StackPanel>
</Grid>
</Page>

View File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace BrightSharp.Ui.Tests
{
/// <summary>
/// Interaction logic for TestPage.xaml
/// </summary>
public partial class TestPage : Page
{
public TestPage()
{
InitializeComponent();
}
}
}

View File

@@ -0,0 +1,16 @@
<Page x:Class="BrightSharp.Ui.Tests.TestPage2"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
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:BrightSharp.Ui.Tests"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300"
Title="TestPage">
<Grid>
<Label>
Hello World From Test 2!!!
</Label>
</Grid>
</Page>

View File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace BrightSharp.Ui.Tests
{
/// <summary>
/// Interaction logic for TestPage.xaml
/// </summary>
public partial class TestPage2 : Page
{
public TestPage2()
{
InitializeComponent();
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 476 KiB

View File

@@ -1,12 +1,34 @@
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14 # Visual Studio 15
VisualStudioVersion = 14.0.25420.1 VisualStudioVersion = 15.0.26730.10
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BrightSharp", "BrightSharp\BrightSharp.csproj", "{ACC3C556-F8E4-4F2A-A23D-8E8749679A1B}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BrightSharp", "BrightSharp\BrightSharp.csproj", "{ACC3C556-F8E4-4F2A-A23D-8E8749679A1B}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BrightSharp.Ui.Tests", "BrightSharp.Ui.Tests\BrightSharp.Ui.Tests.csproj", "{0D6E1828-8D07-4701-B98A-65DBF1604D3F}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BrightSharp.Ui.Tests", "BrightSharp.Ui.Tests\BrightSharp.Ui.Tests.csproj", "{0D6E1828-8D07-4701-B98A-65DBF1604D3F}"
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Subitems", "Subitems", "{D7917F1F-55F7-440E-82BF-1F5ADE0AAD3C}"
ProjectSection(SolutionItems) = preProject
docs\logo-small.png = docs\logo-small.png
README.md = README.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Docs", "Docs", "{21BBA955-8560-43B2-8ED7-275861A2DF11}"
ProjectSection(SolutionItems) = preProject
docs\BrushesList.png = docs\BrushesList.png
docs\classic-theme.png = docs\classic-theme.png
docs\htmleditor.png = docs\htmleditor.png
docs\logo.png = docs\logo.png
docs\help\zoomcontrol.md = docs\help\zoomcontrol.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Help", "Help", "{8097BF6E-FB5B-4DF3-BB75-DCA1A7313D33}"
ProjectSection(SolutionItems) = preProject
docs\help\apply-themes.md = docs\help\apply-themes.md
docs\help\brushes.md = docs\help\brushes.md
docs\help\htmleditor.md = docs\help\htmleditor.md
EndProjectSection
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@@ -25,4 +47,11 @@ Global
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{21BBA955-8560-43B2-8ED7-275861A2DF11} = {D7917F1F-55F7-440E-82BF-1F5ADE0AAD3C}
{8097BF6E-FB5B-4DF3-BB75-DCA1A7313D33} = {21BBA955-8560-43B2-8ED7-275861A2DF11}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {8F1E742F-10FA-44EA-999B-66B79F991220}
EndGlobalSection
EndGlobal EndGlobal

View File

@@ -56,7 +56,6 @@
<Compile Include="Commands\AsyncCommand.cs" /> <Compile Include="Commands\AsyncCommand.cs" />
<Compile Include="Commands\RelayCommand.cs" /> <Compile Include="Commands\RelayCommand.cs" />
<Compile Include="Converters\InverseBooleanToVisibilityConverter.cs" /> <Compile Include="Converters\InverseBooleanToVisibilityConverter.cs" />
<Compile Include="Converters\StringHelpConverter.cs" />
<Compile Include="Diagrams\Adorners\ResizeRotateAdorner.cs" /> <Compile Include="Diagrams\Adorners\ResizeRotateAdorner.cs" />
<Compile Include="Diagrams\Adorners\ResizeRotateChrome.cs" /> <Compile Include="Diagrams\Adorners\ResizeRotateChrome.cs" />
<Compile Include="Diagrams\Adorners\SizeAdorner.cs" /> <Compile Include="Diagrams\Adorners\SizeAdorner.cs" />
@@ -68,7 +67,6 @@
<Compile Include="Diagrams\Thumbs\ResizeThumb.cs" /> <Compile Include="Diagrams\Thumbs\ResizeThumb.cs" />
<Compile Include="Diagrams\Thumbs\RotateThumb.cs" /> <Compile Include="Diagrams\Thumbs\RotateThumb.cs" />
<Compile Include="Extensions\WpfExtensions.cs" /> <Compile Include="Extensions\WpfExtensions.cs" />
<Compile Include="Mvvm\ViewModelBase.cs" />
<Compile Include="ThemeManager.cs" /> <Compile Include="ThemeManager.cs" />
<Compile Include="ZoomControl.cs"> <Compile Include="ZoomControl.cs">
<SubType>Code</SubType> <SubType>Code</SubType>

View File

@@ -1,32 +0,0 @@
using System;
using System.Globalization;
using System.Text.RegularExpressions;
using System.Windows.Data;
namespace BrightSharp.Converters
{
public class StringHelpConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (parameter is string && value is string)
{
var parStr = (string)parameter;
switch (parStr)
{
case "SpaceBetweenCaps":
var src = (value ?? string.Empty).ToString();
return Regex.Replace(src, "([a-z])([A-Z])", "$1 $2");
default:
break;
}
}
return value;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

View File

@@ -20,7 +20,7 @@ namespace Diagrams
{ {
if (e.Source is DependencyObject) if (e.Source is DependencyObject)
{ {
var clickedElement = ((DependencyObject)e.OriginalSource).Ancestors<ContentControl>().FirstOrDefault(el => el.Style == designerStyle && WpfExtensions.GetItemsPanel(el.GetParent(true)) == fe); var clickedElement = ((DependencyObject)e.OriginalSource).GetAncestors<ContentControl>().FirstOrDefault(el => el.Style == designerStyle && WpfExtensions.GetItemsPanel(el.GetParent(true)) == fe);
if (clickedElement == null) if (clickedElement == null)
{ {
foreach (DependencyObject item in fePanel.Children) foreach (DependencyObject item in fePanel.Children)
@@ -49,7 +49,7 @@ namespace Diagrams
{ {
if (e.Source is DependencyObject) if (e.Source is DependencyObject)
{ {
var clickedElement = ((DependencyObject)e.Source).Ancestors<ContentControl>().FirstOrDefault(el => el.Style == designerStyle && el.Parent == fe); var clickedElement = ((DependencyObject)e.Source).GetAncestors<ContentControl>().FirstOrDefault(el => el.Style == designerStyle && el.Parent == fe);
if (clickedElement == null) if (clickedElement == null)
{ {
foreach (DependencyObject item in feItemsControl.Items) foreach (DependencyObject item in feItemsControl.Items)

View File

@@ -1,8 +1,8 @@
using System.ComponentModel; using System;
using System.ComponentModel;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Controls.Primitives; using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Windows.Media; using System.Windows.Media;
namespace Diagrams namespace Diagrams
@@ -12,32 +12,35 @@ namespace Diagrams
{ {
private RotateTransform rotateTransform; private RotateTransform rotateTransform;
private ContentControl designerItem; private ContentControl designerItem;
private static int? zIndex = null;
public MoveThumb() public MoveThumb() {
{ DragStarted += MoveThumb_DragStarted;
DragStarted += new DragStartedEventHandler(this.MoveThumb_DragStarted); DragDelta += MoveThumb_DragDelta;
DragDelta += new DragDeltaEventHandler(this.MoveThumb_DragDelta); DragCompleted += MoveThumb_DragCompleted;
} }
private void MoveThumb_DragCompleted(object sender, DragCompletedEventArgs e) {
//TODO Need think about ZIndex changes
}
private void MoveThumb_DragStarted(object sender, DragStartedEventArgs e) private void MoveThumb_DragStarted(object sender, DragStartedEventArgs e) {
{
this.designerItem = DataContext as ContentControl; this.designerItem = DataContext as ContentControl;
if (this.designerItem != null) if (this.designerItem != null) {
{
this.rotateTransform = this.designerItem.RenderTransform as RotateTransform; this.rotateTransform = this.designerItem.RenderTransform as RotateTransform;
if (designerItem.GetBindingExpression(Panel.ZIndexProperty) == null) {
zIndex = Math.Max(zIndex ?? 0, Panel.GetZIndex(designerItem));
Panel.SetZIndex(designerItem, zIndex.Value + 1);
}
} }
} }
private void MoveThumb_DragDelta(object sender, DragDeltaEventArgs e) private void MoveThumb_DragDelta(object sender, DragDeltaEventArgs e) {
{ if (this.designerItem != null) {
if (this.designerItem != null)
{
Point dragDelta = new Point(e.HorizontalChange, e.VerticalChange); Point dragDelta = new Point(e.HorizontalChange, e.VerticalChange);
if (this.rotateTransform != null) if (this.rotateTransform != null) {
{
dragDelta = this.rotateTransform.Transform(dragDelta); dragDelta = this.rotateTransform.Transform(dragDelta);
} }
if (double.IsNaN(Canvas.GetLeft(this.designerItem))) Canvas.SetLeft(this.designerItem, 0); if (double.IsNaN(Canvas.GetLeft(this.designerItem))) Canvas.SetLeft(this.designerItem, 0);
@@ -45,6 +48,8 @@ namespace Diagrams
Canvas.SetLeft(this.designerItem, Canvas.GetLeft(this.designerItem) + dragDelta.X); Canvas.SetLeft(this.designerItem, Canvas.GetLeft(this.designerItem) + dragDelta.X);
Canvas.SetTop(this.designerItem, Canvas.GetTop(this.designerItem) + dragDelta.Y); Canvas.SetTop(this.designerItem, Canvas.GetTop(this.designerItem) + dragDelta.Y);
} }
} }
} }

View File

@@ -9,6 +9,12 @@ namespace BrightSharp.Extensions
{ {
public static class WpfExtensions public static class WpfExtensions
{ {
/// <summary>
/// Returns Parent item of DependencyObject
/// </summary>
/// <param name="obj">Child object</param>
/// <param name="useLogicalTree">Prefer LogicalTree when need.</param>
/// <returns>Found item</returns>
public static DependencyObject GetParent(this DependencyObject obj, bool useLogicalTree = false) public static DependencyObject GetParent(this DependencyObject obj, bool useLogicalTree = false)
{ {
if (!useLogicalTree && (obj is Visual || obj is Visual3D)) if (!useLogicalTree && (obj is Visual || obj is Visual3D))
@@ -16,7 +22,8 @@ namespace BrightSharp.Extensions
else else
return LogicalTreeHelper.GetParent(obj); return LogicalTreeHelper.GetParent(obj);
} }
public static IEnumerable<T> Ancestors<T>(this DependencyObject obj, bool useLogicalTree = false) where T : DependencyObject
public static IEnumerable<T> GetAncestors<T>(this DependencyObject obj, bool useLogicalTree = false) where T : DependencyObject
{ {
if (obj == null) yield break; if (obj == null) yield break;
@@ -30,7 +37,7 @@ namespace BrightSharp.Extensions
yield return x as T; yield return x as T;
else else
yield break; yield break;
foreach (var item in Ancestors<T>(x, useLogicalTree)) foreach (var item in GetAncestors<T>(x, useLogicalTree))
{ {
yield return item; yield return item;
} }
@@ -38,34 +45,97 @@ namespace BrightSharp.Extensions
public static T FindAncestor<T>(this DependencyObject obj) where T : DependencyObject public static T FindAncestor<T>(this DependencyObject obj) where T : DependencyObject
{ {
return Ancestors<T>(obj).FirstOrDefault(); return GetAncestors<T>(obj).FirstOrDefault();
} }
/// <summary>
/// Try find ItemsPanel of ItemsControl
/// </summary>
/// <param name="itemsControl">Where to search</param>
/// <returns>Panel of ItemsControl</returns>
public static Panel GetItemsPanel(DependencyObject itemsControl) public static Panel GetItemsPanel(DependencyObject itemsControl)
{ {
if (itemsControl is Panel) return (Panel)itemsControl; if (itemsControl is Panel) return (Panel)itemsControl;
ItemsPresenter itemsPresenter = GetVisualChild<ItemsPresenter>(itemsControl); ItemsPresenter itemsPresenter = FindVisualChildren<ItemsPresenter>(itemsControl).FirstOrDefault();
if (itemsPresenter == null) return null;
var itemsPanel = VisualTreeHelper.GetChild(itemsPresenter, 0) as Panel; var itemsPanel = VisualTreeHelper.GetChild(itemsPresenter, 0) as Panel;
return itemsPanel; return itemsPanel;
} }
public static T GetVisualChild<T>(DependencyObject parent) where T : Visual
{
T child = default(T);
int numVisuals = VisualTreeHelper.GetChildrenCount(parent); /// <summary>
for (int i = 0; i < numVisuals; i++) /// Check if object is valid (no errors found in logical children)
{ /// </summary>
Visual v = (Visual)VisualTreeHelper.GetChild(parent, i); /// <param name="obj">Object to search</param>
child = v as T; /// <returns>True if no errors found</returns>
if (child == null) public static bool IsValid(this DependencyObject obj) {
{ if (obj == null) return true;
child = GetVisualChild<T>(v); if (Validation.GetHasError(obj)) return false;
foreach (var child in LogicalTreeHelper.GetChildren(obj).OfType<DependencyObject>()) {
if (child == null) continue;
if (child is UIElement ui) {
if (!ui.IsVisible || !ui.IsEnabled) continue;
}
if (!IsValid(child)) return false;
}
return true;
}
/// <summary>
/// Search all textboxes to update invalid with UpdateSource(). For ex. when need update validation messages.
/// </summary>
/// <param name="obj">Object where to search TextBoxes</param>
public static void UpdateSources(this DependencyObject obj) {
if (obj == null) return;
if (Validation.GetHasError(obj)) {
//TODO Any types?
if (obj is TextBox tb) tb.GetBindingExpression(TextBox.TextProperty)?.UpdateSource();
}
foreach (var item in FindLogicalChildren<DependencyObject>(obj)) {
UpdateSources(item);
}
}
/// <summary>
/// Find all visual children of type T
/// </summary>
/// <typeparam name="T">Type to search</typeparam>
/// <param name="depObj">Object where to search</param>
/// <returns>Enumerator for items</returns>
public static IEnumerable<T> FindVisualChildren<T>(this DependencyObject depObj) where T : DependencyObject {
if (depObj != null && (depObj is Visual || depObj is Visual3D)) {
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(depObj); i++) {
DependencyObject child = VisualTreeHelper.GetChild(depObj, i);
if (child != null && child is T) {
yield return (T)child;
}
foreach (T childOfChild in FindVisualChildren<T>(child)) {
yield return childOfChild;
}
}
}
}
/// <summary>
/// Find all logical children of type T
/// </summary>
/// <typeparam name="T">Type to search</typeparam>
/// <param name="depObj">Object where to search</param>
/// <returns>Enumerator for items</returns>
public static IEnumerable<T> FindLogicalChildren<T>(this DependencyObject depObj) where T : DependencyObject {
if (depObj != null) {
foreach (object rawChild in LogicalTreeHelper.GetChildren(depObj)) {
if (rawChild is DependencyObject child) {
if (child is T) {
yield return (T)child;
}
foreach (T childOfChild in FindLogicalChildren<T>(child)) {
yield return childOfChild;
}
} }
if (child != null)
{
break;
} }
} }
return child;
} }
} }

File diff suppressed because it is too large Load Diff

View File

@@ -1,99 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Windows;
namespace BrightSharp.Mvvm
{
public class ObservableObject : INotifyPropertyChanged
{
static readonly DependencyObject designTimeObject = new DependencyObject();
public static bool IsInDesignTime
{
get
{
try
{
return DesignerProperties.GetIsInDesignMode(designTimeObject);
}
catch(Exception)
{
return true;
}
}
}
protected PropertyChangedEventHandler PropertyChangedHandler
{
get
{
return PropertyChanged;
}
}
public ObservableObject()
{
}
protected static string GetPropertyName<T>(Expression<Func<T>> propertyExpression)
{
if(propertyExpression == null)
{
throw new ArgumentNullException("propertyExpression");
}
MemberExpression body = propertyExpression.Body as MemberExpression;
if(body == null)
{
throw new ArgumentException("Invalid argument", "propertyExpression");
}
PropertyInfo property = body.Member as PropertyInfo;
if(property == null)
{
throw new ArgumentException("Argument is not a property", "propertyExpression");
}
return property.Name;
}
protected virtual void RaisePropertyChanged<T>(Expression<Func<T>> propertyExpression)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(GetPropertyName(propertyExpression)));
}
protected Boolean Set<T>(Expression<Func<T>> propertyExpression, ref T field, T newValue)
{
if(EqualityComparer<T>.Default.Equals(field, newValue))
{
return false;
}
field = newValue;
this.RaisePropertyChanged(propertyExpression);
return true;
}
protected bool Set<T>(string propertyName, ref T field, T newValue)
{
if(EqualityComparer<T>.Default.Equals(field, newValue))
{
return false;
}
field = newValue;
RaisePropertyChanged(propertyName);
return true;
}
protected void RaisePropertyChanged([CallerMemberName]string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
protected void RaisePropertyChangedAll()
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(null));
}
public event PropertyChangedEventHandler PropertyChanged;
}
}

View File

@@ -52,8 +52,8 @@ using System.Windows.Markup;
// 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("1.0.0.0")] [assembly: AssemblyVersion("2.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyFileVersion("2.0.0.0")]
[assembly: XmlnsPrefix("http://schemas.brightsharp.com/developer", "bs")] [assembly: XmlnsPrefix("http://schemas.brightsharp.com/developer", "bs")]
[assembly: XmlnsDefinition("http://schemas.brightsharp.com/developer", "BrightSharp")] [assembly: XmlnsDefinition("http://schemas.brightsharp.com/developer", "BrightSharp")]
[assembly: XmlnsDefinition("http://schemas.brightsharp.com/developer", "BrightSharp.Extensions")] [assembly: XmlnsDefinition("http://schemas.brightsharp.com/developer", "BrightSharp.Extensions")]

View File

@@ -19,7 +19,7 @@ namespace BrightSharp.Properties {
// class via a tool like ResGen or Visual Studio. // class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen // To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project. // with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources { internal class Resources {

View File

@@ -12,7 +12,7 @@ namespace BrightSharp.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.3.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));

View File

@@ -276,7 +276,7 @@
<SolidColorBrush x:Key="ScrollBarBackgroundBrush" Color="#F0F0F0" /> <SolidColorBrush x:Key="ScrollBarBackgroundBrush" Color="#F0F0F0" />
<SolidColorBrush x:Key="SynWindowBackgroundBrush" Color="#FFD1D1D1" /> <SolidColorBrush x:Key="SynWindowBackgroundBrush" Color="#FFD1D1D1" />
<Color x:Key="SelectedBackgroundColor">#FFE6D745</Color> <Color x:Key="SelectedBackgroundColor">#FFFFF8B8</Color>
<SolidColorBrush x:Key="OnWindowForegroundBrush" Color="{DynamicResource OnWindowForegroundColor}" /> <SolidColorBrush x:Key="OnWindowForegroundBrush" Color="{DynamicResource OnWindowForegroundColor}" />
<SolidColorBrush x:Key="HighLightForegroundBrush" Color="#FF500000" /> <SolidColorBrush x:Key="HighLightForegroundBrush" Color="#FF500000" />
<Color x:Key="UiForegroundColor">Black</Color> <Color x:Key="UiForegroundColor">Black</Color>

View File

@@ -20,7 +20,7 @@
<Color x:Key="ControlMediumColor" >#FF10405B</Color> <Color x:Key="ControlMediumColor" >#FF10405B</Color>
<Color x:Key="ControlDarkColor" >#FF2B404B</Color> <Color x:Key="ControlDarkColor" >#FF2B404B</Color>
<Color x:Key="ControlMouseOverColor" >#FFA5A7BA</Color> <Color x:Key="ControlMouseOverColor" >#FF414888</Color>
<Color x:Key="ControlPressedColor" >#FF47909B</Color> <Color x:Key="ControlPressedColor" >#FF47909B</Color>
<Color x:Key="ValidationErrorColor" >#FF3333</Color> <Color x:Key="ValidationErrorColor" >#FF3333</Color>
@@ -36,10 +36,36 @@
<SolidColorBrush x:Key="LightBorderBrush" Color="DarkGray" /> <SolidColorBrush x:Key="LightBorderBrush" Color="DarkGray" />
<SolidColorBrush x:Key="MainMenuForegroundBrush" Color="White"/> <SolidColorBrush x:Key="MainMenuForegroundBrush" Color="White"/>
<LinearGradientBrush x:Key="WindowBackgroundBrush"> <SolidColorBrush x:Key="WindowBackgroundBrush" Color="#444444" />
<GradientStop Color="#444444" />
<LinearGradientBrush x:Key="GradientWindowBackgroundBrush" EndPoint="1,1" StartPoint="0,0">
<GradientStop Color="#FF35373C" Offset="0"/>
<GradientStop Color="#FF32353C" Offset="0.2"/>
<GradientStop Color="#FF242629" Offset="0.75"/>
<GradientStop Color="#FF222326" Offset="1"/>
</LinearGradientBrush> </LinearGradientBrush>
<LinearGradientBrush x:Key="WindowHeaderBrush" EndPoint="0,1">
<GradientStop Color="#FF556176" />
<GradientStop Color="#FF282B32" Offset="0.2" />
<GradientStop Color="#FF262634" Offset="0.8" />
<GradientStop Color="#FF15212C" Offset="1" />
</LinearGradientBrush>
<LinearGradientBrush x:Key="WindowBorderBrush" EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#FF2E2E2E" Offset="0"/>
<GradientStop Color="#FF1B1B1B" Offset="1"/>
</LinearGradientBrush>
<LinearGradientBrush x:Key="WindowInnerBorderBrush" StartPoint="0,0" EndPoint="0,1">
<GradientStop Color="#181818" Offset="1" />
<GradientStop Color="#1D1C21" />
</LinearGradientBrush>
<LinearGradientBrush x:Key="WindowHeaderInactiveBrush" EndPoint="0,1">
<GradientStop Color="#5E5E5E" />
<GradientStop Color="#FF3B3B3B" Offset="0.2" />
<GradientStop Color="#FF3B3B3B" Offset="0.8" />
<GradientStop Color="#5E5E5E" Offset="1" />
</LinearGradientBrush>
<SolidColorBrush x:Key="GlyphBrush" Color="#ffffff" /> <SolidColorBrush x:Key="GlyphBrush" Color="#ffffff" />
<SolidColorBrush x:Key="LightColorBrush" Color="#FF57575F" /> <SolidColorBrush x:Key="LightColorBrush" Color="#FF57575F" />
@@ -124,27 +150,28 @@
<LinearGradientBrush x:Key="PressedBrush" StartPoint="0,0" EndPoint="0,1"> <LinearGradientBrush x:Key="PressedBrush" StartPoint="0,0" EndPoint="0,1">
<GradientBrush.GradientStops> <GradientBrush.GradientStops>
<GradientStopCollection> <GradientStopCollection>
<GradientStop Color="#FF7599AA" Offset="0.0"/> <GradientStop Color="#FF368BB4" Offset="0.0"/>
<GradientStop Color="#FF37738F" Offset="1.0"/>
<GradientStop Color="#FF306178" Offset="0.55"/> <GradientStop Color="#FF306178" Offset="0.55"/>
<GradientStop Color="#FF37738F" Offset="1.0"/>
</GradientStopCollection> </GradientStopCollection>
</GradientBrush.GradientStops> </GradientBrush.GradientStops>
</LinearGradientBrush> </LinearGradientBrush>
<LinearGradientBrush x:Key="TogglePressedBrush" StartPoint="0,0" EndPoint="0,1"> <LinearGradientBrush x:Key="TogglePressedBrush" StartPoint="0,0" EndPoint="0,1">
<GradientBrush.GradientStops> <GradientBrush.GradientStops>
<GradientStopCollection> <GradientStopCollection>
<GradientStop Color="#FF7599AA" Offset="0.0"/> <GradientStop Color="#FF156489" Offset="0.0"/>
<GradientStop Color="#FF37738F" Offset="1.0"/> <GradientStop Color="#FF2B86B2" Offset="0.2"/>
<GradientStop Color="#FF306178" Offset="0.55"/> <GradientStop Color="#FF2187B8" Offset="0.55"/>
<GradientStop Color="#FF358FB9" Offset="1.0"/>
</GradientStopCollection> </GradientStopCollection>
</GradientBrush.GradientStops> </GradientBrush.GradientStops>
</LinearGradientBrush> </LinearGradientBrush>
<LinearGradientBrush x:Key="VerticalPressedBrush" StartPoint="0,0" EndPoint="1,0"> <LinearGradientBrush x:Key="VerticalPressedBrush" StartPoint="0,0" EndPoint="1,0">
<GradientBrush.GradientStops> <GradientBrush.GradientStops>
<GradientStopCollection> <GradientStopCollection>
<GradientStop Color="#FF7599AA" Offset="0.0"/> <GradientStop Color="#FF368BB4" Offset="0.0"/>
<GradientStop Color="#FF37738F" Offset="1.0"/>
<GradientStop Color="#FF306178" Offset="0.55"/> <GradientStop Color="#FF306178" Offset="0.55"/>
<GradientStop Color="#FF37738F" Offset="1.0"/>
</GradientStopCollection> </GradientStopCollection>
</GradientBrush.GradientStops> </GradientBrush.GradientStops>
</LinearGradientBrush> </LinearGradientBrush>

View File

@@ -222,13 +222,13 @@
<SolidColorBrush x:Key="AlternatingRowBackgroundBrush" Color="White" /> <SolidColorBrush x:Key="AlternatingRowBackgroundBrush" Color="White" />
<Color x:Key="SelectedBackgroundColor">#C5C5C5</Color> <Color x:Key="SelectedBackgroundColor">#E3E3E3</Color>
<Color x:Key="SelectedUnfocusedColor">#FFB6B6B6</Color> <Color x:Key="SelectedUnfocusedColor">#FFB6B6B6</Color>
<Color x:Key="ControlLightColor">#FFFFFFFF</Color> <Color x:Key="ControlLightColor">#FFFFFFFF</Color>
<Color x:Key="ControlMediumColor">#FFC5C5C5</Color> <Color x:Key="ControlMediumColor">#FFC5C5C5</Color>
<Color x:Key="ControlDarkColor">#FF6B6B6B</Color> <Color x:Key="ControlDarkColor">#FF6B6B6B</Color>
<Color x:Key="ControlMouseOverColor">#FFA5A7BA</Color> <Color x:Key="ControlMouseOverColor">#FFEEEEEE</Color>
<Color x:Key="ControlPressedColor">#FF47909B</Color> <Color x:Key="ControlPressedColor">#FF47909B</Color>

View File

@@ -260,9 +260,14 @@
</LinearGradientBrush> </LinearGradientBrush>
<SolidColorBrush x:Key="ScrollBarBackgroundBrush" Color="#F0F0F0" /> <SolidColorBrush x:Key="ScrollBarBackgroundBrush" Color="#F0F0F0" />
<SolidColorBrush x:Key="SynWindowBackgroundBrush" Color="#FFE4E4E4" /> <LinearGradientBrush x:Key="GradientWindowBackgroundBrush" EndPoint="1,1" StartPoint="0,0">
<GradientStop Color="White" Offset="0"/>
<GradientStop Color="#FFF8F8F8" Offset="0.2"/>
<GradientStop Color="#FFE3E3E3" Offset="0.75"/>
<GradientStop Color="White" Offset="1"/>
</LinearGradientBrush>
<SolidColorBrush x:Key="HighLightForegroundBrush" Color="DarkRed" /> <SolidColorBrush x:Key="HighLightForegroundBrush" Color="#410000" />
<Color x:Key="UiForegroundColor">Black</Color> <Color x:Key="UiForegroundColor">Black</Color>
<SolidColorBrush x:Key="UiForegroundBrush" Color="{DynamicResource UiForegroundColor}" /> <SolidColorBrush x:Key="UiForegroundBrush" Color="{DynamicResource UiForegroundColor}" />
@@ -270,13 +275,13 @@
<Color x:Key="SelectedBackgroundColor">SkyBlue</Color> <Color x:Key="SelectedBackgroundColor">#DEDEDE</Color>
<Color x:Key="SelectedUnfocusedColor">#FFB6B6B6</Color> <Color x:Key="SelectedUnfocusedColor">#FFB6B6B6</Color>
<Color x:Key="ControlLightColor">#FFFFFFFF</Color> <Color x:Key="ControlLightColor">#FFFFFFFF</Color>
<Color x:Key="ControlMediumColor">#FFC5C5C5</Color> <Color x:Key="ControlMediumColor">#FFC5C5C5</Color>
<Color x:Key="ControlDarkColor">#FF6B6B6B</Color> <Color x:Key="ControlDarkColor">#FF6B6B6B</Color>
<Color x:Key="ControlMouseOverColor">#FFA5A7BA</Color> <Color x:Key="ControlMouseOverColor">#FFCED0E1</Color>
<Color x:Key="ControlPressedColor">#FF47909B</Color> <Color x:Key="ControlPressedColor">#FF47909B</Color>

View File

@@ -125,7 +125,9 @@ namespace Diagrams
} }
else else
{ {
RenderZoom = newValue; DoubleAnimation anim = new DoubleAnimation(newValue, TimeSpan.FromSeconds(0));
anim.EasingFunction = new SineEase() { EasingMode = EasingMode.EaseInOut };
this.BeginAnimation(ZoomControl.RenderZoomProperty, anim);
} }
RaiseZoomChangedEvent(); RaiseZoomChangedEvent();
@@ -144,7 +146,13 @@ namespace Diagrams
} }
else else
{ {
TranslateX = translateXTo; TranslateY = translateYTo; DoubleAnimation anim = new DoubleAnimation(translateXTo, TimeSpan.FromSeconds(0));
anim.EasingFunction = new SineEase() { EasingMode = EasingMode.EaseInOut };
this.BeginAnimation(ZoomControl.TranslateXProperty, anim);
anim = new DoubleAnimation(translateYTo, TimeSpan.FromSeconds(0));
anim.EasingFunction = new SineEase() { EasingMode = EasingMode.EaseInOut };
this.BeginAnimation(ZoomControl.TranslateYProperty, anim);
} }
e.Handled = true; e.Handled = true;

View File

@@ -3,32 +3,46 @@
------------------------ ------------------------
# BrightSharp.Toolkit # BrightSharp.Toolkit
## Free WPF Professional Themes and User Controls
### version 1.0.0 Professional WPF Themes and User Controls. It requires `.NET 4.5`.
### Install **basic** from nuget package manager (requires .NET 4.0 AnyCPU) ### Current Version 2.0
### Nuget
```batch ```batch
PM > Install-Package BrightSharp.Toolkit > Install-Package BrightSharp.Toolkit
``` ```
### Install **extra** from nuget package manager (requires .NET 4.5.2 - x86 or x64)
```batch
PM > Install-Package BrightSharp.Toolkit.Extra.64
```
NOTE: Extra controls use [CefSharp package](https://github.com/cefsharp/CefSharp) (x86 or x64 architecture required).
In future we will add many different controls, that use HTML5 technologies. Extra package does not depend on basic.
## How To ## How To
1. [How to Apply Themes](docs/help/apply-themes.md) 1. [How to Apply Themes](docs/help/apply-themes.md)
2. [How to Use HtmlEditor](docs/help/htmleditor.md) 2. [How to Use HtmlEditor](docs/help/htmleditor.md)
3. [Brushes/Colors List](docs/help/brushes.md) 3. [Brushes List](docs/help/brushes.md)
## See presentation screenshots
Classic:
## Classic Theme
![classic-theme](docs/classic-theme.png) ![classic-theme](docs/classic-theme.png)
DevLab:
## HtmlEditor (CKEditor) Screenshot (Extra package) ![classic-theme](docs/devlab-theme.png)
![CKEditor](docs/htmleditor.png)
Silver:
![classic-theme](docs/silver-theme.png)
Blue:
![classic-theme](docs/blue-theme.png)
DarkBlue:
![classic-theme](docs/darkblue-theme.png)
____________
#### Created by Vitaly.S (Minsk, Skype)

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
</configuration>

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
</configuration>

View File

@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

BIN
docs/blue-theme.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 132 KiB

BIN
docs/darkblue-theme.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

BIN
docs/devlab-theme.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 KiB

View File

@@ -13,23 +13,22 @@
# Change themes by ThemeManager # Change themes by ThemeManager
Change by static property Change by `ThemeManager`
```c# ```c#
ThemeManager.CurrentTheme = ColorThemes.Classic; ThemeManager.CurrentTheme = ColorThemes.Classic;
``` ```
# Change themes by ResourceDictionary # Change themes by ResourceDictionary
Also you can change theme by adding resource dictionary after generic.xaml. Use one of them: As default we use Classic theme.
You also can change theme by adding resource dictionary after generic.xaml. Use one of them:
```xml ```xml
<ResourceDictionary Source="/brightsharp;component/style.devlab.xaml" /> <ResourceDictionary Source="/brightsharp;component/style.devlab.xaml" />
or
<ResourceDictionary Source="/brightsharp;component/style.blue.xaml" /> <ResourceDictionary Source="/brightsharp;component/style.blue.xaml" />
or
<ResourceDictionary Source="/brightsharp;component/style.darkblue.xaml" /> <ResourceDictionary Source="/brightsharp;component/style.darkblue.xaml" />
or
<ResourceDictionary Source="/brightsharp;component/style.silver.xaml" /> <ResourceDictionary Source="/brightsharp;component/style.silver.xaml" />
``` ```
## NOTE ## NOTE
It is recommended use `Background="{DynamicResource WindowBackgroundBrush}"` for Window markup You can use custom window style named `BrightSharpWindowStyle`.
Also defined additional useful styles and extensions. For more info see Demo source code.

View File

@@ -1,109 +1,5 @@
## Brushes List ## Brushes List
![brushes](../BrushesList.png) Here you can see set of brushes and colors we are use (Classic set). In demo application you can press `Brushes Explorer` button to see theme-specific brushes.
## List of names ![Brushes list](../BrushesList.png)
AlternatingRowBackgroundBrush<br/>
BorderGapMaskConverter<br/>
ButtonEllipseFocusVisual<br/>
ButtonFocusVisual<br/>
CalendarButtonStyle<br/>
CalendarDayButtonStyle<br/>
CalendarItemStyle<br/>
CFocusVisual<br/>
ComboBoxFocusVisual<br/>
ComboBoxToggleButton<br/>
DarkBrush<br/>
DecoPasswordBoxContextMenu<br/>
DecoTextBoxContextMenu<br/>
DefaultedBorderBrush<br/>
DefaultRadiusNormal<br/>
DefaultRadiusSmall<br/>
DevLabFrameStyle<br/>
DisabledBackgroundBrush<br/>
DisabledBorderBrush<br/>
DisabledForegroundBrush<br/>
ExpandCollapseToggleStyle<br/>
ExpanderToggleButton<br/>
Expandr2StyleGroupBox<br/>
ExpandrStyleGroupBox<br/>
FileItemStyle<br/>
GlassButton<br/>
GlyphBrush<br/>
GridViewColumnHeaderGripper<br/>
HighLightForegroundBrush<br/>
HorizontalLightBrush<br/>
HorizontalNormalBorderBrush<br/>
HorizontalScrollBar<br/>
HorizontalSlider<br/>
JournalEntryUnifiedViewConverter<br/>
LightBorderBrush<br/>
LightBrush<br/>
LightColorBrush<br/>
MainMenuForegroundBrush<br/>
NormalBorderBrush<br/>
NormalBrush<br/>
NormalProgressBrush<br/>
OnWindowForegroundBrush<br/>
OptionMarkFocusVisualBottom<br/>
OptionMarkFocusVisualLeft<br/>
OptionMarkFocusVisualRight<br/>
OptionMarkFocusVisualTop<br/>
OptionRadioButtonStyle<br/>
PressedBorderBrush<br/>
PressedBrush<br/>
ProgressBarIndeterminateFillBrush<br/>
ProgressBarIndeterminateRootBrush<br/>
ProgressBarIndicatorAnimatedFill<br/>
RadioButtonFocusVisual<br/>
RoundedTabItemStyle<br/>
RowBackgroundBrush<br/>
ScrollBarBackgroundBrush<br/>
ScrollBarLineButton<br/>
ScrollBarPageButtonHoriz<br/>
ScrollBarPageButtonHorizBrush<br/>
ScrollBarPageButtonVert<br/>
ScrollBarPageButtonVertBrush<br/>
ScrollBarThumb<br/>
SelectedBackgroundBrush<br/>
SliderButtonStyle<br/>
SliderThumbStyle<br/>
SliderThumbStyleDirected<br/>
SliderThumbStyleDirectedHor<br/>
SolidBorderBrush<br/>
SubMenuItemRadioButtonTemplate<br/>
SwitchButtonFocusVisual<br/>
SwitchCheckBoxStyle<br/>
SynWindowBackgroundBrush<br/>
TabItemRadius<br/>
TabItemSelectedBackgroundBrush<br/>
TabRadiusBottom<br/>
TabRadiusLeft<br/>
TabRadiusRight<br/>
TabRadiusTop<br/>
TestWindowStyle<br/>
TextBoxBorder<br/>
ThickConv<br/>
TogglePressedBrush<br/>
TopLevelMenuBackgroundHover<br/>
UiForegroundBrush<br/>
VerticalDarkBrush<br/>
VerticalNormalBrush<br/>
VerticalPressedBrush<br/>
VerticalScrollBar<br/>
VerticalScrollBarThumb<br/>
VerticalSlider<br/>
WindowBackgroundBrush<br/>
WindowSolidBrush<br/>
ControlDarkColor<br/>
ControlLightColor<br/>
ControlMediumColor<br/>
ControlMouseOverColor<br/>
ControlPressedColor<br/>
OnWindowForegroundColor<br/>
SelectedBackgroundColor<br/>
SelectedUnfocusedColor<br/>
UiForegroundColor<br/>
ValidationErrorColor<br/>
WindowBackgroundHoverColor<br/>

View File

@@ -1,6 +1,6 @@
# CKEditor (HtmlEditor) usage example # CKEditor (HtmlEditor) usage example
Documentation in progress... Extra package contains first experimental HtmlEditor
For more info see `BrightSharp.Demo` project. How to setup video https://youtu.be/fQvdY69fQDw For more info see `BrightSharp.Demo` project. How to setup video https://youtu.be/fQvdY69fQDw

BIN
docs/silver-theme.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB