项目结构调整
16
Others/Fluent.Ribbon/.editorconfig
Normal file
@@ -0,0 +1,16 @@
|
||||
[*.cs]
|
||||
|
||||
# SA1601: Partial elements should be documented
|
||||
dotnet_diagnostic.SA1601.severity = none
|
||||
|
||||
# SA1600: Elements should be documented
|
||||
dotnet_diagnostic.SA1600.severity = none
|
||||
|
||||
# SA1200: Using directives should be placed correctly
|
||||
dotnet_diagnostic.SA1200.severity = none
|
||||
|
||||
# SA1124: Do not use regions
|
||||
dotnet_diagnostic.SA1124.severity = none
|
||||
|
||||
# SA1201: Elements should appear in the correct order
|
||||
dotnet_diagnostic.SA1201.severity = none
|
||||
1
Others/Fluent.Ribbon/.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
github: [batzen]
|
||||
10
Others/Fluent.Ribbon/.github/ISSUE_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
**Place your issue description here.**
|
||||
|
||||
**Please do not include large amounts of code in your issue. Please attach a zip file containing a repro instead.**
|
||||
|
||||
---
|
||||
### Environment
|
||||
|
||||
- Fluent.Ribbon __v?.?.?__
|
||||
- Windows __?__
|
||||
- .NET Framework __?.?__
|
||||
62
Others/Fluent.Ribbon/.gitignore
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
# User-specific files
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
*.ide
|
||||
*.vs
|
||||
*.idea
|
||||
launchSettings\.json
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
build/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
|
||||
# Test results
|
||||
TestResults
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# Publishing directory
|
||||
publish/
|
||||
package/
|
||||
|
||||
# Tools directory
|
||||
tools/
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
|
||||
# Generated files
|
||||
Fluent.Ribbon/Themes/**/Styles.xaml
|
||||
Fluent.Ribbon/Themes/Themes/*.xaml
|
||||
packages/
|
||||
.tmp
|
||||
*_wpftmp.csproj
|
||||
|
||||
# Result files
|
||||
TestResult.xml
|
||||
|
||||
# cache and local files
|
||||
*.cached
|
||||
*.local
|
||||
|
||||
# Allowed files
|
||||
!Fluent.Ribbon/Themes/XamlCombine.exe
|
||||
!Fluent.Ribbon/Themes/Theme.Template.xaml
|
||||
BIN
Others/Fluent.Ribbon/Doc/Features.xlsx
Normal file
@@ -0,0 +1,61 @@
|
||||
namespace FluentTest.Adorners
|
||||
{
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Media;
|
||||
|
||||
public class SimpleControlAdorner : Adorner
|
||||
{
|
||||
private FrameworkElement child;
|
||||
|
||||
public SimpleControlAdorner(UIElement adornedElement)
|
||||
: base(adornedElement)
|
||||
{
|
||||
}
|
||||
|
||||
protected override int VisualChildrenCount => 1;
|
||||
|
||||
protected override Visual GetVisualChild(int index)
|
||||
{
|
||||
if (index != 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(index), index, "There is only one visual child.");
|
||||
}
|
||||
|
||||
return this.child;
|
||||
}
|
||||
|
||||
public FrameworkElement Child
|
||||
{
|
||||
get => this.child;
|
||||
|
||||
set
|
||||
{
|
||||
if (this.child != null)
|
||||
{
|
||||
this.RemoveVisualChild(this.child);
|
||||
}
|
||||
|
||||
this.child = value;
|
||||
|
||||
if (this.child != null)
|
||||
{
|
||||
this.AddVisualChild(this.child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override Size MeasureOverride(Size constraint)
|
||||
{
|
||||
this.child.Measure(constraint);
|
||||
return this.child.DesiredSize;
|
||||
}
|
||||
|
||||
protected override Size ArrangeOverride(Size finalSize)
|
||||
{
|
||||
this.child.Arrange(new Rect(new Point(0, 0), finalSize));
|
||||
return new Size(this.child.ActualWidth, this.child.ActualHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
6
Others/Fluent.Ribbon/Fluent.Ribbon.Showcase/App.config
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<!--<runtime>
|
||||
<AppContextSwitchOverrides value="Switch.System.Windows.DoNotScaleForDpiChanges=false" />
|
||||
</runtime>-->
|
||||
</configuration>
|
||||
17
Others/Fluent.Ribbon/Fluent.Ribbon.Showcase/App.xaml
Normal file
@@ -0,0 +1,17 @@
|
||||
<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="FluentTest.App"
|
||||
ShutdownMode="OnMainWindowClose"
|
||||
StartupUri="TestWindow.xaml">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/Fluent;component/Themes/Generic.xaml" />
|
||||
|
||||
<!--<ResourceDictionary Source="pack://application:,,,/Fluent;component/Themes/Themes/Light.Green.xaml" />-->
|
||||
|
||||
<!--<ResourceDictionary Source="pack://application:,,,/Fluent;component/Themes/Themes/Dark.Green.xaml" />-->
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
46
Others/Fluent.Ribbon/Fluent.Ribbon.Showcase/App.xaml.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
namespace FluentTest
|
||||
{
|
||||
using System.Windows;
|
||||
using ControlzEx.Theming;
|
||||
|
||||
public partial class App : Application
|
||||
{
|
||||
public App()
|
||||
{
|
||||
//System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("ru");
|
||||
|
||||
//System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("fa");
|
||||
//System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("ru");
|
||||
//System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("de");
|
||||
//System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("hu");
|
||||
//System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("cs");
|
||||
//System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("fr");
|
||||
//System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("pl");
|
||||
//System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("ja");
|
||||
//System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("nl");
|
||||
//System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("pt");
|
||||
//System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("pt-br");
|
||||
//System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("es");
|
||||
//System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh");
|
||||
//System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("sv");
|
||||
//System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("sk");
|
||||
//System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("uk");
|
||||
//System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("ro");
|
||||
//System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("it");
|
||||
//System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("ar");
|
||||
//System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("da");
|
||||
//System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("az");
|
||||
|
||||
System.Threading.Thread.CurrentThread.CurrentCulture = System.Threading.Thread.CurrentThread.CurrentUICulture;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void OnStartup(StartupEventArgs e)
|
||||
{
|
||||
ThemeManager.Current.ThemeSyncMode = ThemeSyncMode.SyncWithAppMode;
|
||||
ThemeManager.Current.SyncTheme();
|
||||
|
||||
base.OnStartup(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace FluentTest.Commanding
|
||||
{
|
||||
using System;
|
||||
using System.Windows.Input;
|
||||
|
||||
public interface IRelayCommand : ICommand
|
||||
{
|
||||
event EventHandler Executed;
|
||||
|
||||
event EventHandler Executing;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
#pragma warning disable SA1402
|
||||
|
||||
namespace FluentTest.Commanding
|
||||
{
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Windows.Input;
|
||||
|
||||
public class RelayCommand : IRelayCommand
|
||||
{
|
||||
private readonly Action action;
|
||||
private readonly Func<bool> canExecute;
|
||||
|
||||
protected RelayCommand()
|
||||
{
|
||||
}
|
||||
|
||||
public RelayCommand(Action execute)
|
||||
{
|
||||
this.action = execute;
|
||||
}
|
||||
|
||||
public RelayCommand(Action execute, Func<bool> canExecute)
|
||||
: this(execute)
|
||||
{
|
||||
this.canExecute = canExecute;
|
||||
}
|
||||
|
||||
#region IRelayCommand Members
|
||||
|
||||
[DebuggerStepThrough]
|
||||
public virtual bool CanExecute(object parameter)
|
||||
{
|
||||
return this.canExecute is null
|
||||
|| this.canExecute();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public event EventHandler CanExecuteChanged
|
||||
{
|
||||
add { CommandManager.RequerySuggested += value; }
|
||||
remove { CommandManager.RequerySuggested -= value; }
|
||||
}
|
||||
|
||||
public event EventHandler Executed;
|
||||
|
||||
public event EventHandler Executing;
|
||||
|
||||
protected void OnExecuted()
|
||||
{
|
||||
this.Executed?.Invoke(this, null);
|
||||
}
|
||||
|
||||
protected void OnExecuting()
|
||||
{
|
||||
this.Executing?.Invoke(this, null);
|
||||
}
|
||||
|
||||
public void Execute(object parameter)
|
||||
{
|
||||
this.OnExecuting();
|
||||
|
||||
this.InvokeAction(parameter);
|
||||
|
||||
this.OnExecuted();
|
||||
}
|
||||
|
||||
protected virtual void InvokeAction(object parameter)
|
||||
{
|
||||
this.action();
|
||||
}
|
||||
|
||||
#endregion // IRelayCommand Members
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A command whose sole purpose is to
|
||||
/// relay its functionality to other
|
||||
/// objects by invoking delegates. The
|
||||
/// default return value for the CanExecute
|
||||
/// method is 'true'.
|
||||
/// </summary>
|
||||
public class RelayCommand<T> : RelayCommand
|
||||
{
|
||||
private readonly Action<T> action;
|
||||
private readonly Func<T, bool> canExecute;
|
||||
|
||||
protected RelayCommand()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="RelayCommand{T}"/> class.
|
||||
/// </summary>
|
||||
/// <param name="action">The execution logic.</param>
|
||||
public RelayCommand(Action<T> action)
|
||||
: this(action, null)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="RelayCommand{T}"/> class.
|
||||
/// </summary>
|
||||
/// <param name="action">The execution logic.</param>
|
||||
/// <param name="canExecute">The execution status logic.</param>
|
||||
public RelayCommand(Action<T> action, Func<T, bool> canExecute)
|
||||
{
|
||||
this.action = action;
|
||||
this.canExecute = canExecute;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines the method that determines whether the command can execute in its current state.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// true if this command can be executed; otherwise, false.
|
||||
/// </returns>
|
||||
/// <param name="parameter">Data used by the command. If the command does not require data to be passed, this object can be set to null.</param>
|
||||
public override bool CanExecute(object parameter)
|
||||
{
|
||||
return this.canExecute is null
|
||||
|| this.canExecute((T)parameter);
|
||||
}
|
||||
|
||||
protected override void InvokeAction(object parameter)
|
||||
{
|
||||
this.action((T)parameter);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
namespace FluentTest.Converters
|
||||
{
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
public class BackgroundImageViewportConverter : IValueConverter
|
||||
{
|
||||
#region IValueConverter Members
|
||||
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return new Rect(0, 0, (double)value, 46);
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
namespace FluentTest.Converters
|
||||
{
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
/// <summary>
|
||||
/// Converter which generates unique group names for example for a group of toggle buttons.
|
||||
/// This is done by using the hash code of the value, an underscore and the converter parameter as a string.
|
||||
/// </summary>
|
||||
[ValueConversion(typeof(object), typeof(string))]
|
||||
public class UniqueGroupNameConverter : IValueConverter
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return $"{value?.GetHashCode()}_{(string)parameter}";
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return Binding.DoNothing;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net472</TargetFrameworks>
|
||||
<UseWPF>true</UseWPF>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<RootNamespace>FluentTest</RootNamespace>
|
||||
<AssemblyName>Fluent.Ribbon.Showcase</AssemblyName>
|
||||
|
||||
<NoWarn>$(NoWarn);SA0001</NoWarn>
|
||||
<InlcudeMahAppsMetro>true</InlcudeMahAppsMetro>
|
||||
<InlcudeMahAppsMetro Condition="$(TargetFramework) == 'net452'">false</InlcudeMahAppsMetro>
|
||||
|
||||
<DefineConstants Condition="$(InlcudeMahAppsMetro)">$(DefineConstants);MahApps_Metro</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<StartupObject>FluentTest.Program</StartupObject>
|
||||
<ApplicationIcon>Icons\App.ico</ApplicationIcon>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<None Remove="Icons\App.ico" />
|
||||
<None Remove="Images\banner.png" />
|
||||
<None Remove="Images\Blue.png" />
|
||||
<None Remove="Images\BlueLarge.png" />
|
||||
<None Remove="Images\Bold.png" />
|
||||
<None Remove="Images\Box.png" />
|
||||
<None Remove="Images\Brown.png" />
|
||||
<None Remove="Images\BrownLarge.png" />
|
||||
<None Remove="Images\ChangeCase.png" />
|
||||
<None Remove="Images\ClearFormatting.png" />
|
||||
<None Remove="Images\FontColor.png" />
|
||||
<None Remove="Images\FormatPainter.png" />
|
||||
<None Remove="Images\GalleryLarge.png" />
|
||||
<None Remove="Images\Gray.png" />
|
||||
<None Remove="Images\GrayLarge.png" />
|
||||
<None Remove="Images\Green.png" />
|
||||
<None Remove="Images\GreenLarge.png" />
|
||||
<None Remove="Images\GrowFont.png" />
|
||||
<None Remove="Images\Italic.png" />
|
||||
<None Remove="Images\Orange.png" />
|
||||
<None Remove="Images\OrangeLarge.png" />
|
||||
<None Remove="Images\PasteFormating.png" />
|
||||
<None Remove="Images\PasteImage.png" />
|
||||
<None Remove="Images\PasteSourceFormating.png" />
|
||||
<None Remove="Images\PasteText.png" />
|
||||
<None Remove="Images\PasteTextOnly.png" />
|
||||
<None Remove="Images\Pink.png" />
|
||||
<None Remove="Images\PinkLarge.png" />
|
||||
<None Remove="Images\Red.png" />
|
||||
<None Remove="Images\RedLarge.png" />
|
||||
<None Remove="Images\SampleImageForScreenTip.png" />
|
||||
<None Remove="Images\ShrinkFont.png" />
|
||||
<None Remove="Images\Strikethrough.png" />
|
||||
<None Remove="Images\Subscript.png" />
|
||||
<None Remove="Images\Superscript.png" />
|
||||
<None Remove="Images\Test16.png" />
|
||||
<None Remove="Images\Test32.png" />
|
||||
<None Remove="Images\TextEffects.png" />
|
||||
<None Remove="Images\TextHighlightColor.png" />
|
||||
<None Remove="Images\Underline.png" />
|
||||
<None Remove="Images\Yellow.png" />
|
||||
<None Remove="Images\YellowLarge.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Remove="Images\VectorIcons.xaml" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="..\.editorconfig" Link=".editorconfig" />
|
||||
<None Include="app.manifest" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="$(InlcudeMahAppsMetro) == false">
|
||||
<Page Remove="MahMetro*" />
|
||||
<Compile Remove="MahMetro*" />
|
||||
<None Include="MahMetro*" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="JetBrains.Annotations" Version="2020.3.0" />
|
||||
<PackageReference Include="MahApps.Metro" Version="2.3.4" />
|
||||
<PackageReference Include="MahApps.Metro.IconPacks.Material" Version="4.8.0" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.8.0" />
|
||||
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.261">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="WpfAnalyzers" Version="3.2.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Fluent.Ribbon\Fluent.Ribbon.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="$(DefineConstants.Contains(NETCOREAPP)) == false">
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="WindowsFormsIntegration" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Resource Include="Icons\App.ico" />
|
||||
<Resource Include="Images\banner.png" />
|
||||
<Resource Include="Images\Blue.png" />
|
||||
<Resource Include="Images\BlueLarge.png" />
|
||||
<Resource Include="Images\Bold.png" />
|
||||
<Resource Include="Images\Box.png" />
|
||||
<Resource Include="Images\Brown.png" />
|
||||
<Resource Include="Images\BrownLarge.png" />
|
||||
<Resource Include="Images\ChangeCase.png" />
|
||||
<Resource Include="Images\ClearFormatting.png" />
|
||||
<Resource Include="Images\FontColor.png" />
|
||||
<Resource Include="Images\FormatPainter.png" />
|
||||
<Resource Include="Images\GalleryLarge.png" />
|
||||
<Resource Include="Images\Gray.png" />
|
||||
<Resource Include="Images\GrayLarge.png" />
|
||||
<Resource Include="Images\Green.png" />
|
||||
<Resource Include="Images\GreenLarge.png" />
|
||||
<Resource Include="Images\GrowFont.png" />
|
||||
<Resource Include="Images\Italic.png" />
|
||||
<Resource Include="Images\Orange.png" />
|
||||
<Resource Include="Images\OrangeLarge.png" />
|
||||
<Resource Include="Images\PasteFormating.png" />
|
||||
<Resource Include="Images\PasteImage.png" />
|
||||
<Resource Include="Images\PasteSourceFormating.png" />
|
||||
<Resource Include="Images\PasteText.png" />
|
||||
<Resource Include="Images\PasteTextOnly.png" />
|
||||
<Resource Include="Images\Pink.png" />
|
||||
<Resource Include="Images\PinkLarge.png" />
|
||||
<Resource Include="Images\Red.png" />
|
||||
<Resource Include="Images\RedLarge.png" />
|
||||
<Resource Include="Images\SampleImageForScreenTip.png" />
|
||||
<Resource Include="Images\ShrinkFont.png" />
|
||||
<Resource Include="Images\Strikethrough.png" />
|
||||
<Resource Include="Images\Subscript.png" />
|
||||
<Resource Include="Images\Superscript.png" />
|
||||
<Resource Include="Images\Test16.png" />
|
||||
<Resource Include="Images\Test32.png" />
|
||||
<Resource Include="Images\TextEffects.png" />
|
||||
<Resource Include="Images\TextHighlightColor.png" />
|
||||
<Resource Include="Images\Underline.png" />
|
||||
<Resource Include="Images\VectorIcons.xaml" />
|
||||
<Resource Include="Images\Yellow.png" />
|
||||
<Resource Include="Images\YellowLarge.png" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<LangVersion>8.0</LangVersion>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
|
||||
<Costura DisableCompression="false" />
|
||||
</Weavers>
|
||||
111
Others/Fluent.Ribbon/Fluent.Ribbon.Showcase/FodyWeavers.xsd
Normal file
@@ -0,0 +1,111 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
|
||||
<xs:element name="Weavers">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="Costura" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element minOccurs="0" maxOccurs="1" name="ExcludeAssemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element minOccurs="0" maxOccurs="1" name="IncludeAssemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged32Assemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with line breaks.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged64Assemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of unmanaged 64 bit assembly names to include, delimited with line breaks.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element minOccurs="0" maxOccurs="1" name="PreloadOrder" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>The order of preloaded assemblies, delimited with line breaks.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
</xs:all>
|
||||
<xs:attribute name="CreateTemporaryAssemblies" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>This will copy embedded files to disk before loading them into memory. This is helpful for some scenarios that expected an assembly to be loaded from a physical file.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="IncludeDebugSymbols" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Controls if .pdbs for reference assemblies are also embedded.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="DisableCompression" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="DisableCleanup" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="LoadAtModuleInit" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Costura by default will load as part of the module initialization. This flag disables that behavior. Make sure you call CosturaUtility.Initialize() somewhere in your code.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="IgnoreSatelliteAssemblies" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Costura will by default use assemblies with a name like 'resources.dll' as a satellite resource and prepend the output path. This flag disables that behavior.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="ExcludeAssemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with |</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="IncludeAssemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="Unmanaged32Assemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with |.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="Unmanaged64Assemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of unmanaged 64 bit assembly names to include, delimited with |.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="PreloadOrder" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>The order of preloaded assemblies, delimited with |.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:all>
|
||||
<xs:attribute name="VerifyAssembly" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="GenerateXsd" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
@@ -0,0 +1,6 @@
|
||||
// This file is used by Code Analysis to maintain SuppressMessage
|
||||
// attributes that are applied to this project.
|
||||
// Project-level suppressions either have no target or are given
|
||||
// a specific target and scoped to a namespace, type, member, etc.
|
||||
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1652:Enable XML documentation output", Justification = "No xml documentation is needed for showcase projects.")]
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace FluentTest.Helpers
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
|
||||
/// <summary> Holds a collection of <see cref="DataTemplate"/> items for application as a control's DataTemplate. </summary>
|
||||
public class TemplateCollection : List<DataTemplate>
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
namespace FluentTest.Helpers
|
||||
{
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Markup;
|
||||
using System.Windows.Media;
|
||||
using System.Xml;
|
||||
using ControlzEx.Theming;
|
||||
|
||||
public static class ThemeHelper
|
||||
{
|
||||
public static Tuple<string, Theme> CreateTheme(string baseColorScheme, Color accentBaseColor, bool changeImmediately = false)
|
||||
{
|
||||
var theme = RuntimeThemeGenerator.Current.GenerateRuntimeTheme(baseColorScheme, accentBaseColor, false);
|
||||
|
||||
// Apply theme
|
||||
if (changeImmediately)
|
||||
{
|
||||
var changedTheme = ThemeManager.Current.ChangeTheme(Application.Current, theme);
|
||||
|
||||
Debug.Assert(changedTheme == theme, "Theme must have been changed.");
|
||||
}
|
||||
|
||||
return new Tuple<string, Theme>(string.Join(Environment.NewLine, theme.GetAllResources().Select(GetResourceDictionaryContent)), theme);
|
||||
}
|
||||
|
||||
public static string GetResourceDictionaryContent(ResourceDictionary resourceDictionary)
|
||||
{
|
||||
using (var sw = new StringWriter())
|
||||
{
|
||||
using (var writer = XmlWriter.Create(sw, new XmlWriterSettings
|
||||
{
|
||||
Indent = true,
|
||||
IndentChars = " "
|
||||
}))
|
||||
{
|
||||
XamlWriter.Save(resourceDictionary, writer);
|
||||
|
||||
return sw.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
Others/Fluent.Ribbon/Fluent.Ribbon.Showcase/Icons/App.ico
Normal file
|
After Width: | Height: | Size: 142 KiB |
BIN
Others/Fluent.Ribbon/Fluent.Ribbon.Showcase/Images/Blue.png
Normal file
|
After Width: | Height: | Size: 185 B |
BIN
Others/Fluent.Ribbon/Fluent.Ribbon.Showcase/Images/BlueLarge.png
Normal file
|
After Width: | Height: | Size: 230 B |
BIN
Others/Fluent.Ribbon/Fluent.Ribbon.Showcase/Images/Bold.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
Others/Fluent.Ribbon/Fluent.Ribbon.Showcase/Images/Box.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
Others/Fluent.Ribbon/Fluent.Ribbon.Showcase/Images/Brown.png
Normal file
|
After Width: | Height: | Size: 185 B |
|
After Width: | Height: | Size: 230 B |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
BIN
Others/Fluent.Ribbon/Fluent.Ribbon.Showcase/Images/FontColor.png
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
BIN
Others/Fluent.Ribbon/Fluent.Ribbon.Showcase/Images/Gray.png
Normal file
|
After Width: | Height: | Size: 185 B |
BIN
Others/Fluent.Ribbon/Fluent.Ribbon.Showcase/Images/GrayLarge.png
Normal file
|
After Width: | Height: | Size: 228 B |
BIN
Others/Fluent.Ribbon/Fluent.Ribbon.Showcase/Images/Green.png
Normal file
|
After Width: | Height: | Size: 185 B |
|
After Width: | Height: | Size: 229 B |
BIN
Others/Fluent.Ribbon/Fluent.Ribbon.Showcase/Images/GrowFont.png
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
Others/Fluent.Ribbon/Fluent.Ribbon.Showcase/Images/Italic.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
Others/Fluent.Ribbon/Fluent.Ribbon.Showcase/Images/Orange.png
Normal file
|
After Width: | Height: | Size: 185 B |
|
After Width: | Height: | Size: 231 B |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
BIN
Others/Fluent.Ribbon/Fluent.Ribbon.Showcase/Images/PasteText.png
Normal file
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
BIN
Others/Fluent.Ribbon/Fluent.Ribbon.Showcase/Images/Pink.png
Normal file
|
After Width: | Height: | Size: 185 B |
BIN
Others/Fluent.Ribbon/Fluent.Ribbon.Showcase/Images/PinkLarge.png
Normal file
|
After Width: | Height: | Size: 225 B |
BIN
Others/Fluent.Ribbon/Fluent.Ribbon.Showcase/Images/Red.png
Normal file
|
After Width: | Height: | Size: 185 B |
BIN
Others/Fluent.Ribbon/Fluent.Ribbon.Showcase/Images/RedLarge.png
Normal file
|
After Width: | Height: | Size: 229 B |
|
After Width: | Height: | Size: 6.7 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
BIN
Others/Fluent.Ribbon/Fluent.Ribbon.Showcase/Images/Subscript.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
BIN
Others/Fluent.Ribbon/Fluent.Ribbon.Showcase/Images/Test16.png
Normal file
|
After Width: | Height: | Size: 199 B |
BIN
Others/Fluent.Ribbon/Fluent.Ribbon.Showcase/Images/Test32.png
Normal file
|
After Width: | Height: | Size: 241 B |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
BIN
Others/Fluent.Ribbon/Fluent.Ribbon.Showcase/Images/Underline.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
@@ -0,0 +1,86 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<!--
|
||||
|
||||
*** How to create XAML vector images
|
||||
|
||||
Probably the best application to create XAML vector images is Microsoft Expression Design.
|
||||
It's a free tool that could be downloaded from http://www.microsoft.com/expression/eng/
|
||||
|
||||
When you have installed Expression Design, launch it and select Edit -> Options ->
|
||||
Clipboards (XAML). Change "Clipboard format" to "XAML WPF Resource Dictionary". Also
|
||||
change "Group By" to "Document" (otherwise each layer will be an image).
|
||||
|
||||
Edit your image in Expression Design. When you are done, select everything and open the
|
||||
Edit menu and then "Copy XAML". Then paste the content into a file like this. Remove the
|
||||
outer ResourceDictionary tag. Change the root tag from DrawingImage to DrawingBrush.
|
||||
|
||||
When you are drawing the image set the document size to the size you want in your WPF-
|
||||
application (like 32x32 size). It not necessary but make the work easier. Before copy the
|
||||
image to XAML you probably want to make a transparent rectangle that has the same size as
|
||||
the document (otherwise the margins could be wrong). Or you could add this manually in the
|
||||
drawing group children:
|
||||
|
||||
<GeometryDrawing Brush="#00FFFFFF" Geometry="M 0,0L 32,0L 32,32L 0,32L 0,0 Z " />
|
||||
|
||||
|
||||
|
||||
*** If you are using Inkscape
|
||||
|
||||
Inkscape has support to generate XAML-files. However - this is probably not the format you
|
||||
want! WPF has two different ways to handle graphics in XAML - shapes and geometries. You can
|
||||
find more details about this here: http://www.intertech.com/Blog/WPF-Shapes-vs-WPF-Geometries/.
|
||||
But in short shapes has support for inputs, while geometries is just pure drawing and therefor
|
||||
more lightweight.
|
||||
|
||||
Inkscape generate files in shape-format, which is good for some cases but not for images that
|
||||
should be used in buttons and similar. So what you want is to get your images into Expression
|
||||
Design. You could do that by saving your image as a PDF-file, change the file extension to AI
|
||||
and then in Expression Design use "File", "Import Adobe Illustrator File". Using EPS is another
|
||||
option.
|
||||
|
||||
Most things could be imported to Expression Design. But it might be some issues with borders
|
||||
for instance. When you have got what you want to Expression Design it's probably better to do
|
||||
all the work in there. If needed you could export your images to SVG which could be used in
|
||||
Inkscape, that normally works without any problems.
|
||||
|
||||
-->
|
||||
|
||||
<DrawingImage x:Key="VectorImageSample">
|
||||
<DrawingImage.Drawing>
|
||||
<DrawingGroup>
|
||||
<DrawingGroup.Children>
|
||||
<GeometryDrawing Geometry="F1 M 0,-3.8147e-006L 32,-3.8147e-006L 32,19.1563L 20.0625,19.0938L 20,32L 0,32L 0,-3.8147e-006 Z ">
|
||||
<GeometryDrawing.Pen>
|
||||
<Pen LineJoin="Round"
|
||||
Brush="#FF000000" />
|
||||
</GeometryDrawing.Pen>
|
||||
<GeometryDrawing.Brush>
|
||||
<LinearGradientBrush StartPoint="-0.015625,0.5"
|
||||
EndPoint="1.01562,0.5">
|
||||
<LinearGradientBrush.GradientStops>
|
||||
<GradientStop Color="#FFC01000"
|
||||
Offset="0" />
|
||||
<GradientStop Color="#FFC4C245"
|
||||
Offset="0.297674" />
|
||||
<GradientStop Color="#FF43B240"
|
||||
Offset="0.553488" />
|
||||
<GradientStop Color="#FF35A8B9"
|
||||
Offset="0.744186" />
|
||||
<GradientStop Color="#FF0A13B2"
|
||||
Offset="1" />
|
||||
</LinearGradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
</GeometryDrawing.Brush>
|
||||
</GeometryDrawing>
|
||||
<GeometryDrawing Brush="#D0C80FA0"
|
||||
Geometry="F1 M 17.3404,9.61637L 1.5,18.869L 17.4332,27.9608L 17.3404,9.61637 Z " />
|
||||
<GeometryDrawing Brush="#FFFFFFFF"
|
||||
Geometry="F1 M 17.2034,18.2831L 14.3995,19.9076L 13.575,18.4845L 13.537,18.5065C 13.5276,19.9491 12.9028,21.0298 11.6624,21.7484C 10.7473,22.2786 9.87606,22.4347 9.0488,22.2166C 8.22155,21.9985 7.55555,21.4539 7.05082,20.5827C 5.98488,18.7429 6.45311,17.053 8.45551,15.513L 10.8182,13.6858C 10.2674,12.7351 9.43411,12.5829 8.31839,13.2293C 7.19488,13.8803 6.31124,14.8173 5.66747,16.0404L 4.3676,13.7968C 4.6501,13.3462 5.098,12.8344 5.7113,12.2612C 6.3246,11.688 6.92138,11.2333 7.50163,10.8971C 10.2082,9.32905 12.3451,9.8975 13.9123,12.6025L 17.2034,18.2831 Z M 12.1751,16.0279L 11.8139,15.4043L 10.1934,16.634C 9.29679,17.3129 9.05647,18.0114 9.47247,18.7294C 9.66031,19.0536 9.93175,19.2517 10.2868,19.3236C 10.6419,19.3955 11.0199,19.3152 11.4211,19.0828C 11.9799,18.7591 12.3274,18.3107 12.4635,17.7377C 12.5997,17.1646 12.5035,16.5947 12.1751,16.0279 Z " />
|
||||
<GeometryDrawing Brush="#FFFFFFFF"
|
||||
Geometry="F1 M 27.6854,12.2101L 19.2737,17.0836L 18.6082,15.935L 19.685,6.89886L 15.52,9.31194L 14.3031,7.21157L 22.1541,2.66294L 22.9544,4.04429L 21.9911,12.7038L 26.4685,10.1097L 27.6854,12.2101 Z " />
|
||||
</DrawingGroup.Children>
|
||||
</DrawingGroup>
|
||||
</DrawingImage.Drawing>
|
||||
</DrawingImage>
|
||||
</ResourceDictionary>
|
||||
BIN
Others/Fluent.Ribbon/Fluent.Ribbon.Showcase/Images/Yellow.png
Normal file
|
After Width: | Height: | Size: 185 B |
|
After Width: | Height: | Size: 225 B |
BIN
Others/Fluent.Ribbon/Fluent.Ribbon.Showcase/Images/banner.png
Normal file
|
After Width: | Height: | Size: 39 KiB |
@@ -0,0 +1,62 @@
|
||||
<Metro:MetroWindow x:Class="FluentTest.MahMetroWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:Fluent="clr-namespace:Fluent;assembly=Fluent"
|
||||
xmlns:Metro="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
xmlns:fluentTest="clr-namespace:FluentTest"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
Title="{Binding WindowTitle, ElementName=TestContent}"
|
||||
Height="768"
|
||||
Width="1024"
|
||||
x:Name="window"
|
||||
WindowState="Normal"
|
||||
TitleCharacterCasing="Normal"
|
||||
WindowTransitionsEnabled="False"
|
||||
GlowBrush="{DynamicResource MahApps.Brushes.Accent}"
|
||||
ShowIconOnTitleBar="False"
|
||||
ShowTitleBar="True"
|
||||
ShowSystemMenuOnRightClick="False">
|
||||
<Metro:MetroWindow.LayoutTransform>
|
||||
<!-- todo: netcore => was using x:Reference before -->
|
||||
<ScaleTransform ScaleX="{Binding DataContext.Zoom, ElementName=TestContent}"
|
||||
ScaleY="{Binding DataContext.Zoom, ElementName=TestContent}" />
|
||||
</Metro:MetroWindow.LayoutTransform>
|
||||
|
||||
<Metro:MetroWindow.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Themes/Light.Blue.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<Style x:Key="{x:Type Fluent:BackstageTabControl}"
|
||||
TargetType="{x:Type Fluent:BackstageTabControl}"
|
||||
BasedOn="{StaticResource {x:Type Fluent:BackstageTabControl}}">
|
||||
<Setter Property="SelectedContentMargin"
|
||||
Value="0" />
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
</Metro:MetroWindow.Resources>
|
||||
|
||||
<Metro:MetroWindow.TitleTemplate>
|
||||
<DataTemplate>
|
||||
<Fluent:RibbonTitleBar x:Name="RibbonTitleBar"
|
||||
Header="{Binding Path=Title, RelativeSource={RelativeSource AncestorType=Window}}"/>
|
||||
</DataTemplate>
|
||||
</Metro:MetroWindow.TitleTemplate>
|
||||
|
||||
<Metro:MetroWindow.LeftWindowCommands>
|
||||
<Metro:WindowCommands>
|
||||
<Button>Left</Button>
|
||||
</Metro:WindowCommands>
|
||||
</Metro:MetroWindow.LeftWindowCommands>
|
||||
|
||||
<Metro:MetroWindow.RightWindowCommands>
|
||||
<Metro:WindowCommands>
|
||||
<Button>Right</Button>
|
||||
</Metro:WindowCommands>
|
||||
</Metro:MetroWindow.RightWindowCommands>
|
||||
|
||||
<fluentTest:TestContent x:Name="TestContent" />
|
||||
</Metro:MetroWindow>
|
||||
@@ -0,0 +1,69 @@
|
||||
namespace FluentTest
|
||||
{
|
||||
using System;
|
||||
using System.Windows;
|
||||
using ControlzEx.Theming;
|
||||
using Fluent;
|
||||
using MahApps.Metro.Controls;
|
||||
|
||||
public partial class MahMetroWindow : MetroWindow, IRibbonWindow
|
||||
{
|
||||
public MahMetroWindow()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
|
||||
this.TestContent.Backstage.UseHighestAvailableAdornerLayer = false;
|
||||
|
||||
this.Loaded += this.MahMetroWindow_Loaded;
|
||||
this.Closed += this.MahMetroWindow_Closed;
|
||||
}
|
||||
|
||||
private void MahMetroWindow_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.TitleBar = this.FindChild<RibbonTitleBar>("RibbonTitleBar");
|
||||
this.TitleBar.InvalidateArrange();
|
||||
this.TitleBar.UpdateLayout();
|
||||
|
||||
// We need this inside this window because MahApps.Metro is not loaded globally inside the Fluent.Ribbon Showcase application.
|
||||
// This code is not required in an application that loads the MahApps.Metro styles globally.
|
||||
ThemeManager.Current.ChangeTheme(this, ThemeManager.Current.DetectTheme(Application.Current));
|
||||
ThemeManager.Current.ThemeChanged += this.SyncThemes;
|
||||
}
|
||||
|
||||
private void SyncThemes(object sender, ThemeChangedEventArgs e)
|
||||
{
|
||||
if (e.Target == this)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ThemeManager.Current.ChangeTheme(this, e.NewTheme);
|
||||
}
|
||||
|
||||
private void MahMetroWindow_Closed(object sender, EventArgs e)
|
||||
{
|
||||
ThemeManager.Current.ThemeChanged -= this.SyncThemes;
|
||||
}
|
||||
|
||||
#region TitelBar
|
||||
|
||||
/// <summary>
|
||||
/// Gets ribbon titlebar
|
||||
/// </summary>
|
||||
public RibbonTitleBar TitleBar
|
||||
{
|
||||
get { return (RibbonTitleBar)this.GetValue(TitleBarProperty); }
|
||||
private set { this.SetValue(TitleBarPropertyKey, value); }
|
||||
}
|
||||
|
||||
// ReSharper disable once InconsistentNaming
|
||||
private static readonly DependencyPropertyKey TitleBarPropertyKey = DependencyProperty.RegisterReadOnly(nameof(TitleBar), typeof(RibbonTitleBar), typeof(MahMetroWindow), new PropertyMetadata());
|
||||
|
||||
#pragma warning disable WPF0060
|
||||
/// <summary>Identifies the <see cref="TitleBar"/> dependency property.</summary>
|
||||
public static readonly DependencyProperty TitleBarProperty = TitleBarPropertyKey.DependencyProperty;
|
||||
#pragma warning restore WPF0060
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<fluent:RibbonWindow x:Class="FluentTest.MinimalWindowSample"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
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:fluent="urn:fluent-ribbon"
|
||||
x:Name="window"
|
||||
Title="{Binding WindowTitle, ElementName=TestContent}"
|
||||
FlowDirection="LeftToRight"
|
||||
Height="768"
|
||||
Width="1024"
|
||||
MinWidth="80"
|
||||
MinHeight="60"
|
||||
mc:Ignorable="d"
|
||||
WindowState="Normal">
|
||||
<fluent:RibbonWindow.Resources>
|
||||
<Style TargetType="{x:Type fluent:QuickAccessToolBar}"
|
||||
BasedOn="{StaticResource {x:Type fluent:QuickAccessToolBar}}">
|
||||
<Setter Property="MinWidth"
|
||||
Value="35" />
|
||||
</Style>
|
||||
</fluent:RibbonWindow.Resources>
|
||||
|
||||
<fluent:Ribbon>
|
||||
<fluent:Ribbon.QuickAccessItems>
|
||||
<!-- todo: netcore => was using x:Reference before -->
|
||||
<fluent:QuickAccessMenuItem Target="{Binding ElementName=button}"
|
||||
IsChecked="True" />
|
||||
</fluent:Ribbon.QuickAccessItems>
|
||||
|
||||
<fluent:Ribbon.ContextualGroups>
|
||||
<fluent:RibbonContextualTabGroup x:Name="contextGroup1"
|
||||
BorderBrush="Magenta"
|
||||
Background="Magenta"
|
||||
Foreground="Purple"
|
||||
Header="Generic context"
|
||||
Visibility="Visible" />
|
||||
</fluent:Ribbon.ContextualGroups>
|
||||
|
||||
<!-- todo: netcore => was using x:Reference before -->
|
||||
<fluent:RibbonTabItem Header="Generic tab header"
|
||||
Group="{Binding ElementName=contextGroup1}">
|
||||
<fluent:RibbonGroupBox Header="First group">
|
||||
<fluent:Button x:Name="button"
|
||||
Header="button"
|
||||
Icon="Images\Green.png"
|
||||
LargeIcon="Images\GreenLarge.png" />
|
||||
</fluent:RibbonGroupBox>
|
||||
</fluent:RibbonTabItem>
|
||||
</fluent:Ribbon>
|
||||
</fluent:RibbonWindow>
|
||||
@@ -0,0 +1,12 @@
|
||||
using Fluent;
|
||||
|
||||
namespace FluentTest
|
||||
{
|
||||
public partial class MinimalWindowSample : RibbonWindow
|
||||
{
|
||||
public MinimalWindowSample()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
17
Others/Fluent.Ribbon/Fluent.Ribbon.Showcase/Program.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
namespace FluentTest
|
||||
{
|
||||
using System;
|
||||
|
||||
public static class Program
|
||||
{
|
||||
[STAThread]
|
||||
public static int Main(string[] args)
|
||||
{
|
||||
var app = new App();
|
||||
app.InitializeComponent();
|
||||
app.Run();
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: AssemblyDescription("Showcase application for Fluent.Ribbon")]
|
||||
@@ -0,0 +1,17 @@
|
||||
<Window x:Class="FluentTest.RegularWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:Fluent="urn:fluent-ribbon"
|
||||
xmlns:fluentTest="clr-namespace:FluentTest"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
Title="{Binding WindowTitle, ElementName=TestContent}"
|
||||
Height="768"
|
||||
Width="1024"
|
||||
MinWidth="80"
|
||||
MinHeight="60"
|
||||
mc:Ignorable="d"
|
||||
WindowState="Normal"
|
||||
Background="{DynamicResource WhiteBrush}">
|
||||
<fluentTest:TestContent x:Name="TestContent" />
|
||||
</Window>
|
||||
@@ -0,0 +1,12 @@
|
||||
using System.Windows;
|
||||
|
||||
namespace FluentTest
|
||||
{
|
||||
public partial class RegularWindow : Window
|
||||
{
|
||||
public RegularWindow()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
<fluent:RibbonWindow x:Class="FluentTest.RibbonWindowColorized"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
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:FluentTest"
|
||||
xmlns:fluent="urn:fluent-ribbon"
|
||||
mc:Ignorable="d"
|
||||
Title="RibbonWindowColorized"
|
||||
Height="600"
|
||||
Width="800"
|
||||
TitleForeground="White"
|
||||
TitleBackground="Transparent">
|
||||
<fluent:RibbonWindow.Resources>
|
||||
<SolidColorBrush x:Key="Fluent.Ribbon.Brushes.RibbonTabItem.Foreground" Color="Red" />
|
||||
|
||||
<SolidColorBrush x:Key="Fluent.Ribbon.Brushes.RibbonTabControl.Background" Color="LightBlue" />
|
||||
<SolidColorBrush x:Key="Fluent.Ribbon.Brushes.RibbonTabControl.Foreground" Color="Black" />
|
||||
|
||||
<SolidColorBrush x:Key="Fluent.Ribbon.Brushes.RibbonTabControl.Content.Background" Color="LightGreen" />
|
||||
<SolidColorBrush x:Key="Fluent.Ribbon.Brushes.RibbonTabControl.Content.Foreground" Color="Black" />
|
||||
|
||||
<SolidColorBrush x:Key="Fluent.Ribbon.Brushes.RibbonTabControl.TabsGrid.Background" Color="LightCyan" />
|
||||
<SolidColorBrush x:Key="Fluent.Ribbon.Brushes.RibbonTabControl.TabsGrid.Foreground" Color="Black" />
|
||||
|
||||
<SolidColorBrush x:Key="Fluent.Ribbon.Brushes.WindowCommands.CaptionButton.Foreground" Color="White" />
|
||||
<SolidColorBrush x:Key="Fluent.Ribbon.Brushes.WindowCommands.CaptionButton.Background" Color="DarkSlateGray" />
|
||||
|
||||
<SolidColorBrush x:Key="Fluent.Ribbon.Brushes.WindowCommands.CaptionButton.MouseOver.Background" Color="Green" />
|
||||
<SolidColorBrush x:Key="Fluent.Ribbon.Brushes.WindowCommands.CaptionButton.Pressed.Background" Color="DarkGray" />
|
||||
|
||||
<SolidColorBrush x:Key="Fluent.Ribbon.Brushes.WindowCommands.CloseButton.MouseOver.Background" Color="Blue" />
|
||||
<SolidColorBrush x:Key="Fluent.Ribbon.Brushes.WindowCommands.CloseButton.Pressed.Background" Color="DarkBlue" />
|
||||
|
||||
<SolidColorBrush x:Key="Fluent.Ribbon.Brushes.GroupSeparator.Background" Color="Red" />
|
||||
<SolidColorBrush x:Key="Fluent.Ribbon.Brushes.RibbonTabItem.BorderBrush" Color="Red" />
|
||||
</fluent:RibbonWindow.Resources>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<fluent:Ribbon Background="Transparent">
|
||||
<fluent:Ribbon.Menu>
|
||||
<fluent:Backstage />
|
||||
</fluent:Ribbon.Menu>
|
||||
|
||||
<fluent:RibbonTabItem Header="First">
|
||||
<fluent:RibbonGroupBox Header="First">
|
||||
<fluent:Button Header="First" />
|
||||
</fluent:RibbonGroupBox>
|
||||
</fluent:RibbonTabItem>
|
||||
|
||||
<fluent:RibbonTabItem Header="Second">
|
||||
<fluent:RibbonGroupBox Header="Second">
|
||||
<fluent:Button Header="Second" />
|
||||
</fluent:RibbonGroupBox>
|
||||
</fluent:RibbonTabItem>
|
||||
</fluent:Ribbon>
|
||||
|
||||
<Grid Grid.Row="1">
|
||||
<TextBlock TextWrapping="Wrap"
|
||||
Margin="5">
|
||||
This sample shows how to use custom colors for various parts of the RibbonWindow, Ribbon, RibbonTitleBar and caption buttons inside WindowCommands.
|
||||
<LineBreak />
|
||||
The colors are chosen to be extreme by purpose.
|
||||
<LineBreak />
|
||||
Have a look at ColorizedRibbonWindow.xaml for details.
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</fluent:RibbonWindow>
|
||||
@@ -0,0 +1,12 @@
|
||||
using Fluent;
|
||||
|
||||
namespace FluentTest
|
||||
{
|
||||
public partial class RibbonWindowColorized : RibbonWindow
|
||||
{
|
||||
public RibbonWindowColorized()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
<fluent:RibbonWindow x:Class="FluentTest.RibbonWindowWithBackgroundImage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
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:fluent="urn:fluent-ribbon"
|
||||
xmlns:converters="clr-namespace:FluentTest.Converters"
|
||||
mc:Ignorable="d"
|
||||
Title="RibbonWindowWithBackgroundImage"
|
||||
Height="600"
|
||||
Width="800"
|
||||
TitleForeground="Black"
|
||||
TitleBackground="Transparent">
|
||||
<fluent:RibbonWindow.Resources>
|
||||
<converters:BackgroundImageViewportConverter x:Key="BackgroundImageViewportConverter" />
|
||||
|
||||
<SolidColorBrush x:Key="Fluent.Ribbon.Brushes.RibbonTabControl.Background" Color="Transparent" />
|
||||
<SolidColorBrush x:Key="Fluent.Ribbon.Brushes.RibbonTabControl.Foreground" Color="Black" />
|
||||
|
||||
<SolidColorBrush x:Key="Fluent.Ribbon.Brushes.RibbonTabControl.Content.Background" Color="{DynamicResource WhiteColor}" />
|
||||
<SolidColorBrush x:Key="Fluent.Ribbon.Brushes.RibbonTabControl.Content.Foreground" Color="Black" />
|
||||
<SolidColorBrush x:Key="Fluent.Ribbon.Brushes.WindowCommands.CaptionButton.Foreground" Color="Black" />
|
||||
</fluent:RibbonWindow.Resources>
|
||||
|
||||
<Window.Background>
|
||||
<ImageBrush ImageSource="pack://application:,,,/Fluent.Ribbon.Showcase;component/Images/banner.png"
|
||||
Stretch="Fill"
|
||||
Viewport="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType=Window}, Converter={StaticResource BackgroundImageViewportConverter}}"
|
||||
ViewportUnits="Absolute"
|
||||
TileMode="None"
|
||||
AlignmentX="Right"
|
||||
AlignmentY="Top" />
|
||||
</Window.Background>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<fluent:Ribbon Background="Transparent">
|
||||
<fluent:Ribbon.Menu>
|
||||
<fluent:Backstage />
|
||||
</fluent:Ribbon.Menu>
|
||||
|
||||
<fluent:RibbonTabItem Header="First">
|
||||
<fluent:RibbonGroupBox Header="First">
|
||||
<fluent:Button Header="First" />
|
||||
</fluent:RibbonGroupBox>
|
||||
</fluent:RibbonTabItem>
|
||||
|
||||
<fluent:RibbonTabItem Header="Second">
|
||||
<fluent:RibbonGroupBox Header="Second">
|
||||
<fluent:Button Header="Second" />
|
||||
</fluent:RibbonGroupBox>
|
||||
</fluent:RibbonTabItem>
|
||||
</fluent:Ribbon>
|
||||
|
||||
<Grid Background="{DynamicResource WhiteBrush}"
|
||||
Grid.Row="1">
|
||||
<TextBlock TextWrapping="Wrap"
|
||||
Margin="5">
|
||||
This sample shows how to use a background image for the titlebar.
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</fluent:RibbonWindow>
|
||||
@@ -0,0 +1,12 @@
|
||||
using Fluent;
|
||||
|
||||
namespace FluentTest
|
||||
{
|
||||
public partial class RibbonWindowWithBackgroundImage : RibbonWindow
|
||||
{
|
||||
public RibbonWindowWithBackgroundImage()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<fluent:RibbonWindow x:Class="FluentTest.RibbonWindowWithoutRibbon"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
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:fluent="urn:fluent-ribbon"
|
||||
mc:Ignorable="d"
|
||||
Title="RibbonWindowWithoutRibbon"
|
||||
Height="300"
|
||||
Width="300">
|
||||
<Grid>
|
||||
<TextBlock>There is no Ribbon in this Window.</TextBlock>
|
||||
</Grid>
|
||||
</fluent:RibbonWindow>
|
||||
@@ -0,0 +1,12 @@
|
||||
using Fluent;
|
||||
|
||||
namespace FluentTest
|
||||
{
|
||||
public partial class RibbonWindowWithoutRibbon : RibbonWindow
|
||||
{
|
||||
public RibbonWindowWithoutRibbon()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<fluent:RibbonWindow x:Class="FluentTest.RibbonWindowWithoutVisibleRibbon"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:fluent="urn:fluent-ribbon"
|
||||
Title="RibbonWindowWithoutRibbon"
|
||||
Height="300"
|
||||
Width="300">
|
||||
<Grid>
|
||||
<fluent:Ribbon IsMinimized="True"
|
||||
IsAutomaticCollapseEnabled="False"
|
||||
IsCollapsed="True"
|
||||
IsQuickAccessToolBarVisible="False"
|
||||
CanCustomizeQuickAccessToolBar="False"
|
||||
CanCustomizeRibbon="False"
|
||||
CanQuickAccessLocationChanging="False"
|
||||
ContentGapHeight="2" />
|
||||
</Grid>
|
||||
</fluent:RibbonWindow>
|
||||
@@ -0,0 +1,12 @@
|
||||
using Fluent;
|
||||
|
||||
namespace FluentTest
|
||||
{
|
||||
public partial class RibbonWindowWithoutVisibleRibbon : RibbonWindow
|
||||
{
|
||||
public RibbonWindowWithoutVisibleRibbon()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
namespace FluentTest.TemplateSelectors
|
||||
{
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using FluentTest.Helpers;
|
||||
|
||||
/// <summary>
|
||||
/// Provides a means to specify DataTemplates to be selected from within WPF code
|
||||
/// </summary>
|
||||
public class DynamicTemplateSelector : DataTemplateSelector
|
||||
{
|
||||
/// <summary> Generic attached property specifying <see cref="DataTemplate"/>s used by the <see cref="DynamicTemplateSelector"/></summary>
|
||||
/// <remarks>
|
||||
/// This attached property will allow you to set the templates you wish to be available whenever
|
||||
/// a control's TemplateSelector is set to an instance of <see cref="DynamicTemplateSelector"/>
|
||||
/// </remarks>
|
||||
public static readonly DependencyProperty TemplatesCollectionProperty =
|
||||
DependencyProperty.RegisterAttached("TemplatesCollection", typeof(TemplateCollection),
|
||||
typeof(DynamicTemplateSelector),
|
||||
new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.OverridesInheritanceBehavior));
|
||||
|
||||
/// <summary> Gets the value of the <paramref name="target"/>'s attached <see cref="TemplatesCollectionProperty"/> </summary>
|
||||
/// <param name="target">The <see cref="UIElement"/> who's attached template's property you wish to retrieve</param>
|
||||
/// <returns>The templates used by the givem <paramref name="target"/> when using the <see cref="DynamicTemplateSelector"/></returns>
|
||||
[AttachedPropertyBrowsableForType(typeof(ContentControl))]
|
||||
public static TemplateCollection GetTemplatesCollection(DependencyObject target)
|
||||
{
|
||||
return (TemplateCollection)target.GetValue(TemplatesCollectionProperty);
|
||||
}
|
||||
|
||||
/// <summary> Sets the value of the <paramref name="target"/>'s attached <see cref="TemplatesCollectionProperty"/> </summary>
|
||||
/// <param name="target">The element to set the property on</param>
|
||||
/// <param name="value">The collection of <see cref="DataTemplate"/>s to apply to this element</param>
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
|
||||
public static void SetTemplatesCollection(DependencyObject target, TemplateCollection value)
|
||||
{
|
||||
target.SetValue(TemplatesCollectionProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overriden base method to allow the selection of the correct DataTemplate
|
||||
/// </summary>
|
||||
/// <param name="item">The item for which the template should be retrieved</param>
|
||||
/// <param name="container">The object containing the current item</param>
|
||||
/// <returns>The <see cref="DataTemplate"/> to use when rendering the <paramref name="item"/></returns>
|
||||
public override DataTemplate SelectTemplate(object item, DependencyObject container)
|
||||
{
|
||||
//This should ensure that the item we are getting is in fact capable of holding our property
|
||||
//before we attempt to retrieve it.
|
||||
if (container != null)
|
||||
{
|
||||
var templates = GetTemplatesCollection(container);
|
||||
|
||||
if (templates != null
|
||||
&& templates.Count != 0)
|
||||
{
|
||||
foreach (var template in templates)
|
||||
{
|
||||
//In this case, we are checking whether the type of the item
|
||||
//is the same as the type supported by our DataTemplate
|
||||
var dataType = template.DataType as Type;
|
||||
if (dataType != null
|
||||
&& dataType.IsInstanceOfType(item))
|
||||
{
|
||||
//And if it is, then we return that DataTemplate
|
||||
return template;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//If all else fails, then we go back to using the default DataTemplate
|
||||
return new DataTemplate();
|
||||
}
|
||||
}
|
||||
}
|
||||
3501
Others/Fluent.Ribbon/Fluent.Ribbon.Showcase/TestContent.xaml
Normal file
622
Others/Fluent.Ribbon/Fluent.Ribbon.Showcase/TestContent.xaml.cs
Normal file
@@ -0,0 +1,622 @@
|
||||
#pragma warning disable SA1402 // File may only contain a single class
|
||||
namespace FluentTest
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using ControlzEx.Theming;
|
||||
using Fluent;
|
||||
using Fluent.Localization;
|
||||
using FluentTest.Adorners;
|
||||
using FluentTest.Helpers;
|
||||
using FluentTest.ViewModels;
|
||||
#if MahApps_Metro
|
||||
using MahApps.Metro.Controls;
|
||||
using MahApps.Metro.Controls.Dialogs;
|
||||
#endif
|
||||
using Button = Fluent.Button;
|
||||
|
||||
/// <summary>
|
||||
/// Test-Content
|
||||
/// </summary>
|
||||
public partial class TestContent : UserControl
|
||||
{
|
||||
private readonly MainViewModel viewModel;
|
||||
private string windowTitle;
|
||||
|
||||
public TestContent()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
|
||||
//RibbonLocalization.Current.Localization.Culture = new CultureInfo("ru-RU");
|
||||
|
||||
this.HookEvents();
|
||||
|
||||
this.viewModel = new MainViewModel();
|
||||
this.DataContext = this.viewModel;
|
||||
|
||||
ColorGallery.RecentColors.Add(((SolidColorBrush)Application.Current.Resources["Fluent.Ribbon.Brushes.AccentBaseColorBrush"]).Color);
|
||||
|
||||
this.Loaded += this.TestContent_Loaded;
|
||||
}
|
||||
|
||||
public string WindowTitle => this.windowTitle ?? (this.windowTitle = GetVersionText(Window.GetWindow(this).GetType().BaseType));
|
||||
|
||||
#pragma warning disable WPF0060
|
||||
/// <summary>Identifies the <see cref="Brushes"/> dependency property.</summary>
|
||||
public static readonly DependencyProperty BrushesProperty = DependencyProperty.Register(nameof(Brushes), typeof(List<KeyValuePair<string, Brush>>), typeof(TestContent), new PropertyMetadata(default(List<KeyValuePair<string, Brush>>)));
|
||||
#pragma warning restore WPF0060
|
||||
|
||||
public List<KeyValuePair<string, Brush>> Brushes
|
||||
{
|
||||
get { return (List<KeyValuePair<string, Brush>>)this.GetValue(BrushesProperty); }
|
||||
set { this.SetValue(BrushesProperty, value); }
|
||||
}
|
||||
|
||||
public List<RibbonLocalizationBase> Localizations { get; } = GetLocalizations();
|
||||
|
||||
private static List<RibbonLocalizationBase> GetLocalizations()
|
||||
{
|
||||
return RibbonLocalization.Current.LocalizationMap.Values
|
||||
.Select(x => (RibbonLocalizationBase)Activator.CreateInstance(x))
|
||||
.ToList();
|
||||
}
|
||||
|
||||
private static IEnumerable<KeyValuePair<string, Brush>> GetBrushes()
|
||||
{
|
||||
var brushes = typeof(Brushes)
|
||||
.GetProperties()
|
||||
.Where(prop =>
|
||||
typeof(Brush).IsAssignableFrom(prop.PropertyType))
|
||||
.Select(prop =>
|
||||
new KeyValuePair<string, Brush>(prop.Name, (Brush)prop.GetValue(null, null)));
|
||||
return ThemeManager.Current.Themes.GroupBy(x => x.ColorScheme)
|
||||
.Select(x => x.First())
|
||||
.Select(x => new KeyValuePair<string, Brush>(x.ColorScheme, x.ShowcaseBrush))
|
||||
.Concat(brushes)
|
||||
.OrderBy(x => x.Key);
|
||||
}
|
||||
|
||||
private static string GetVersionText(Type type)
|
||||
{
|
||||
var version = type.Assembly.GetName().Version;
|
||||
|
||||
var assemblyProductAttribute = type.Assembly.GetCustomAttribute<AssemblyProductAttribute>();
|
||||
|
||||
var assemblyInformationalVersionAttribute = type.Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>();
|
||||
|
||||
return $"{assemblyProductAttribute?.Product} {version} ({assemblyInformationalVersionAttribute?.InformationalVersion})";
|
||||
}
|
||||
|
||||
private string selectedMenu = "Backstage";
|
||||
|
||||
public string SelectedMenu
|
||||
{
|
||||
get => this.selectedMenu;
|
||||
set
|
||||
{
|
||||
this.selectedMenu = value;
|
||||
|
||||
switch (this.selectedMenu)
|
||||
{
|
||||
case "ApplicationMenu":
|
||||
this.ApplicationMenu.Visibility = Visibility.Visible;
|
||||
this.Backstage.Visibility = Visibility.Collapsed;
|
||||
break;
|
||||
|
||||
case "Backstage":
|
||||
this.ApplicationMenu.Visibility = Visibility.Collapsed;
|
||||
this.Backstage.Visibility = Visibility.Visible;
|
||||
break;
|
||||
|
||||
case "Empty menu":
|
||||
this.ApplicationMenu.Visibility = Visibility.Collapsed;
|
||||
this.Backstage.Visibility = Visibility.Collapsed;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void HookEvents()
|
||||
{
|
||||
this.Loaded += this.HandleTestContentLoaded;
|
||||
|
||||
this.buttonBold.Checked += (s, e) => Debug.WriteLine("Checked");
|
||||
this.buttonBold.Unchecked += (s, e) => Debug.WriteLine("Unchecked");
|
||||
|
||||
this.PreviewMouseWheel += this.OnPreviewMouseWheel;
|
||||
}
|
||||
|
||||
private void TestContent_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.Loaded -= this.TestContent_Loaded;
|
||||
|
||||
this.InitializeBrushes();
|
||||
}
|
||||
|
||||
private void InitializeBrushes()
|
||||
{
|
||||
var currentBrushes = new[]
|
||||
{
|
||||
new KeyValuePair<string, Brush>("None", null),
|
||||
new KeyValuePair<string, Brush>("Initial glow", GetCurrentGlowBrush()),
|
||||
new KeyValuePair<string, Brush>("Initial non active glow", GetCurrentNonActiveGlowBrush()),
|
||||
};
|
||||
|
||||
this.Brushes = currentBrushes.Concat(GetBrushes()).ToList();
|
||||
|
||||
Brush GetCurrentGlowBrush()
|
||||
{
|
||||
switch (Window.GetWindow(this))
|
||||
{
|
||||
case RibbonWindow x:
|
||||
return x.GlowBrush;
|
||||
#if MahApps_Metro
|
||||
case MetroWindow x:
|
||||
return x.GlowBrush;
|
||||
#endif
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
Brush GetCurrentNonActiveGlowBrush()
|
||||
{
|
||||
switch (Window.GetWindow(this))
|
||||
{
|
||||
case RibbonWindow x:
|
||||
return x.NonActiveGlowBrush;
|
||||
#if MahApps_Metro
|
||||
case MetroWindow x:
|
||||
return x.NonActiveGlowBrush;
|
||||
#endif
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static void OnScreenTipHelpPressed(object sender, ScreenTipHelpEventArgs e)
|
||||
{
|
||||
Process.Start((string)e.HelpTopic);
|
||||
}
|
||||
|
||||
private void HandleTestContentLoaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ScreenTip.HelpPressed += OnScreenTipHelpPressed;
|
||||
}
|
||||
|
||||
private void OnLauncherButtonClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var groupBox = (RibbonGroupBox)sender;
|
||||
|
||||
var wnd = new Window
|
||||
{
|
||||
Content = $"Launcher-Window for: {groupBox.Header}",
|
||||
Width = 300,
|
||||
Height = 100,
|
||||
Owner = Window.GetWindow(this),
|
||||
WindowStartupLocation = WindowStartupLocation.CenterOwner
|
||||
};
|
||||
|
||||
wnd.ShowDialog();
|
||||
}
|
||||
|
||||
private void OnSplitClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MessageBox.Show("Split Clicked!!!");
|
||||
}
|
||||
|
||||
private void OnEnlargeClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (this.InRibbonGallery.IsLoaded)
|
||||
{
|
||||
this.InRibbonGallery.Enlarge();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnReduceClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (this.InRibbonGallery.IsLoaded)
|
||||
{
|
||||
this.InRibbonGallery.Reduce();
|
||||
}
|
||||
}
|
||||
|
||||
private void SyncThemeNow_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ThemeManager.Current.SyncTheme();
|
||||
}
|
||||
|
||||
public Button CreateRibbonButton()
|
||||
{
|
||||
var fooCommand1 = new TestRoutedCommand();
|
||||
|
||||
var button = new Button
|
||||
{
|
||||
Command = fooCommand1.ItemCommand,
|
||||
Header = "Foo",
|
||||
Icon = new BitmapImage(new Uri("pack://application:,,,/Fluent.Ribbon.Showcase;component/Images/Green.png", UriKind.Absolute)),
|
||||
LargeIcon = new BitmapImage(new Uri("pack://application:,,,/Fluent.Ribbon.Showcase;component/Images/GreenLarge.png", UriKind.Absolute)),
|
||||
};
|
||||
|
||||
this.CommandBindings.Add(fooCommand1.ItemCommandBinding);
|
||||
return button;
|
||||
}
|
||||
|
||||
#region Logical tree
|
||||
|
||||
private void OnShowLogicalTreeClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.CheckLogicalTree(this.ribbon);
|
||||
this.logicalTreeView.Items.Clear();
|
||||
this.BuildLogicalTree(this.ribbon, this.logicalTreeView);
|
||||
}
|
||||
|
||||
private static string GetDebugInfo(DependencyObject element)
|
||||
{
|
||||
if (element is null)
|
||||
{
|
||||
return "NULL";
|
||||
}
|
||||
|
||||
var debugInfo = $"[{element}]";
|
||||
|
||||
if (element is IHeaderedControl headeredControl)
|
||||
{
|
||||
debugInfo += $" Header: \"{headeredControl.Header}\"";
|
||||
}
|
||||
|
||||
if (element is FrameworkElement frameworkElement
|
||||
&& string.IsNullOrEmpty(frameworkElement.Name) == false)
|
||||
{
|
||||
debugInfo += $" Name: \"{frameworkElement.Name}\"";
|
||||
}
|
||||
|
||||
return debugInfo;
|
||||
}
|
||||
|
||||
private void CheckLogicalTree(DependencyObject root)
|
||||
{
|
||||
var children = LogicalTreeHelper.GetChildren(root);
|
||||
foreach (var child in children.OfType<DependencyObject>())
|
||||
{
|
||||
if (ReferenceEquals(LogicalTreeHelper.GetParent(child), root) == false)
|
||||
{
|
||||
Debug.WriteLine($"Incorrect logical parent for {GetDebugInfo(child)}");
|
||||
Debug.WriteLine($"\tExpected: {GetDebugInfo(root)}");
|
||||
Debug.WriteLine($"\tFound: {GetDebugInfo(LogicalTreeHelper.GetParent(child))}");
|
||||
}
|
||||
|
||||
this.CheckLogicalTree(child);
|
||||
}
|
||||
}
|
||||
|
||||
private void BuildLogicalTree(DependencyObject current, ItemsControl parentControl)
|
||||
{
|
||||
var newItem = new TreeViewItem
|
||||
{
|
||||
Header = GetDebugInfo(current),
|
||||
Tag = current
|
||||
};
|
||||
|
||||
parentControl.Items.Add(newItem);
|
||||
|
||||
var children = LogicalTreeHelper.GetChildren(current);
|
||||
foreach (var child in children.OfType<DependencyObject>())
|
||||
{
|
||||
this.BuildLogicalTree(child, newItem);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTreeDoubleClick(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
var treeView = sender as TreeView;
|
||||
|
||||
var item = treeView?.SelectedItem as TreeViewItem;
|
||||
if (item is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var stringBuilder = new StringBuilder();
|
||||
this.BuildBackLogicalTree(item.Tag as DependencyObject, stringBuilder);
|
||||
|
||||
MessageBox.Show($"From buttom to top:\n{stringBuilder}");
|
||||
}
|
||||
|
||||
private void BuildBackLogicalTree(DependencyObject current, StringBuilder stringBuilder)
|
||||
{
|
||||
if (current is null
|
||||
|| ReferenceEquals(current, this.ribbon))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
stringBuilder.AppendFormat(" -> {0}\n", GetDebugInfo(current));
|
||||
|
||||
var parent = LogicalTreeHelper.GetParent(current);
|
||||
|
||||
this.BuildBackLogicalTree(parent, stringBuilder);
|
||||
}
|
||||
|
||||
#endregion Logical tree
|
||||
|
||||
private void OnFormatPainterClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MessageBox.Show("FP");
|
||||
}
|
||||
|
||||
private void OnHelpClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.viewModel.AreContextGroupsVisible = !this.viewModel.AreContextGroupsVisible;
|
||||
}
|
||||
|
||||
private void OnSpinnerValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
// MessageBox.Show(String.Format("Changed from {0} to {1}", e.OldValue, e.NewValue));
|
||||
}
|
||||
|
||||
private void OnMenuItemClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var wnd = new TestWindow
|
||||
{
|
||||
Owner = Window.GetWindow(this)
|
||||
};
|
||||
wnd.Show();
|
||||
}
|
||||
|
||||
private void AddRibbonTab_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var tab = new RibbonTabItem
|
||||
{
|
||||
Header = "Test"
|
||||
};
|
||||
|
||||
var group = new RibbonGroupBox();
|
||||
for (var i = 0; i < 20; i++)
|
||||
{
|
||||
group.Items.Add(this.CreateRibbonButton());
|
||||
}
|
||||
|
||||
tab.Groups.Add(group);
|
||||
|
||||
this.ribbon.Tabs.Add(tab);
|
||||
}
|
||||
|
||||
private async void HandleSaveAsClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var progressAdornerChild = new Border
|
||||
{
|
||||
VerticalAlignment = VerticalAlignment.Stretch,
|
||||
HorizontalAlignment = HorizontalAlignment.Stretch,
|
||||
Background = new SolidColorBrush(Colors.Black) { Opacity = 0.25 },
|
||||
IsHitTestVisible = true,
|
||||
Child = new ProgressBar
|
||||
{
|
||||
IsIndeterminate = true,
|
||||
Width = 300,
|
||||
Height = 20,
|
||||
VerticalAlignment = VerticalAlignment.Center,
|
||||
HorizontalAlignment = HorizontalAlignment.Center
|
||||
}
|
||||
};
|
||||
BindingOperations.SetBinding(progressAdornerChild, WidthProperty, new Binding(nameof(this.Backstage.AdornerLayer.ActualWidth)) { Source = this.Backstage.AdornerLayer });
|
||||
BindingOperations.SetBinding(progressAdornerChild, HeightProperty, new Binding(nameof(this.Backstage.AdornerLayer.ActualHeight)) { Source = this.Backstage.AdornerLayer });
|
||||
|
||||
var progressAdorner = new SimpleControlAdorner(this.Backstage.AdornerLayer)
|
||||
{
|
||||
Child = progressAdornerChild
|
||||
};
|
||||
|
||||
this.Backstage.AdornerLayer.Add(progressAdorner);
|
||||
|
||||
await Task.Delay(TimeSpan.FromSeconds(3));
|
||||
|
||||
this.Backstage.AdornerLayer.Remove(progressAdorner);
|
||||
|
||||
BindingOperations.ClearAllBindings(progressAdornerChild);
|
||||
}
|
||||
|
||||
private void OpenRegularWindow_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
new RegularWindow().Show();
|
||||
}
|
||||
|
||||
private void OpenMinimalRibbonWindowSample_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
new MinimalWindowSample().Show();
|
||||
}
|
||||
|
||||
private void OpenMahMetroWindow_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
#if MahApps_Metro
|
||||
new MahMetroWindow().Show();
|
||||
#else
|
||||
ShowMahAppsMetroNotAvailableMessageBox();
|
||||
#endif
|
||||
}
|
||||
|
||||
private void OpenRibbonWindowWithoutVisibileRibbon_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
new RibbonWindowWithoutVisibleRibbon().Show();
|
||||
}
|
||||
|
||||
private void OpenRibbonWindowWithoutRibbon_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
new RibbonWindowWithoutRibbon().Show();
|
||||
}
|
||||
|
||||
private void ZoomSlider_OnValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
var textFormattingMode = e.NewValue > 1.0 || Math.Abs(e.NewValue - 1.0) < double.Epsilon ? TextFormattingMode.Ideal : TextFormattingMode.Display;
|
||||
TextOptions.SetTextFormattingMode(this, textFormattingMode);
|
||||
}
|
||||
|
||||
private void OnPreviewMouseWheel(object sender, MouseWheelEventArgs e)
|
||||
{
|
||||
if (Keyboard.IsKeyDown(Key.LeftCtrl) == false
|
||||
&& Keyboard.IsKeyDown(Key.RightCtrl) == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var newZoomValue = this.zoomSlider.Value + (e.Delta > 0 ? 0.1 : -0.1);
|
||||
|
||||
this.zoomSlider.Value = Math.Max(Math.Min(newZoomValue, this.zoomSlider.Maximum), this.zoomSlider.Minimum);
|
||||
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void SleepButton_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Thread.Sleep(TimeSpan.FromSeconds(10));
|
||||
}
|
||||
|
||||
private void OpenModalRibbonWindow_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
new TestWindow().ShowDialog();
|
||||
}
|
||||
|
||||
private void OpenRibbonWindowOnNewThread_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var thread = new Thread(() =>
|
||||
{
|
||||
var testWindow = new TestWindow();
|
||||
testWindow.Closed += OnTestWindowOnClosed;
|
||||
testWindow.Show();
|
||||
System.Windows.Threading.Dispatcher.Run();
|
||||
|
||||
void OnTestWindowOnClosed(object o, EventArgs args)
|
||||
{
|
||||
testWindow.Closed -= OnTestWindowOnClosed;
|
||||
((Window)o).Dispatcher?.InvokeShutdown();
|
||||
}
|
||||
})
|
||||
{
|
||||
IsBackground = true
|
||||
};
|
||||
thread.SetApartmentState(ApartmentState.STA);
|
||||
|
||||
thread.Start();
|
||||
}
|
||||
|
||||
private void OpenRibbonWindowColorized_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
new RibbonWindowColorized().Show();
|
||||
}
|
||||
|
||||
private void OpenRibbonWindowWithBackgroundImage_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
new RibbonWindowWithBackgroundImage().Show();
|
||||
}
|
||||
|
||||
private void ShowStartScreen_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.startScreen.Shown = false;
|
||||
this.startScreen.IsOpen = true;
|
||||
}
|
||||
|
||||
private void HandleAddItemToFontsClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.viewModel.FontsViewModel.FontsData.Add($"Added item {this.viewModel.FontsViewModel.FontsData.Count}");
|
||||
}
|
||||
|
||||
private void CreateThemeResourceDictionaryButton_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.ThemeResourceDictionaryTextBox.Text = ThemeHelper.CreateTheme(ThemeManager.Current.DetectTheme()?.BaseColorScheme ?? "Dark", this.ThemeColorGallery.SelectedColor ?? this.viewModel.ColorViewModel.ThemeColor, changeImmediately: this.ChangeImmediatelyCheckBox.IsChecked ?? false).Item1;
|
||||
}
|
||||
|
||||
private void HandleResetSavedState_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.ribbon.AutomaticStateManagement = false;
|
||||
this.ribbon.RibbonStateStorage.Reset();
|
||||
|
||||
System.Windows.Forms.Application.Restart();
|
||||
Application.Current.Shutdown();
|
||||
}
|
||||
|
||||
private async void HandleShowMetroMessage(object sender, RoutedEventArgs e)
|
||||
{
|
||||
#if MahApps_Metro
|
||||
var metroWindow = Window.GetWindow(this) as MetroWindow;
|
||||
|
||||
if (metroWindow is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
await metroWindow.ShowMessageAsync("Test", "Message");
|
||||
#else
|
||||
ShowMahAppsMetroNotAvailableMessageBox();
|
||||
await Task.Yield();
|
||||
#endif
|
||||
}
|
||||
|
||||
private void Hyperlink_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
new Window().ShowDialog();
|
||||
}
|
||||
|
||||
private static void ShowMahAppsMetroNotAvailableMessageBox()
|
||||
{
|
||||
MessageBox.Show("MahApps.Metro is not available in this showcase version.");
|
||||
}
|
||||
|
||||
private void StartSnoop_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var snoopPath = "snoop";
|
||||
var alternativeSnoopPath = Environment.GetEnvironmentVariable("snoop_dev_path");
|
||||
|
||||
if (string.IsNullOrEmpty(alternativeSnoopPath) == false
|
||||
&& File.Exists(alternativeSnoopPath))
|
||||
{
|
||||
snoopPath = alternativeSnoopPath;
|
||||
}
|
||||
|
||||
var startInfo = new ProcessStartInfo(snoopPath, $"inspect --targetPID {Process.GetCurrentProcess().Id}")
|
||||
{
|
||||
UseShellExecute = true
|
||||
};
|
||||
try
|
||||
{
|
||||
using var p = Process.Start(startInfo);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"Error: {ex.Message}\n\nCommandline: {startInfo.FileName} {startInfo.Arguments}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class TestRoutedCommand
|
||||
{
|
||||
public static RoutedCommand TestPresenterCommand { get; } = new RoutedCommand(nameof(TestPresenterCommand), typeof(TestRoutedCommand));
|
||||
|
||||
public ICommand ItemCommand => TestPresenterCommand;
|
||||
|
||||
public CommandBinding ItemCommandBinding => new CommandBinding(TestPresenterCommand, OnTestCommandExecuted, CanExecuteTestCommand);
|
||||
|
||||
private static void CanExecuteTestCommand(object sender, CanExecuteRoutedEventArgs e)
|
||||
{
|
||||
e.CanExecute = true;
|
||||
}
|
||||
|
||||
private static void OnTestCommandExecuted(object sender, ExecutedRoutedEventArgs e)
|
||||
{
|
||||
MessageBox.Show("TestPresenterCommand");
|
||||
}
|
||||
}
|
||||
}
|
||||
30
Others/Fluent.Ribbon/Fluent.Ribbon.Showcase/TestWindow.xaml
Normal file
@@ -0,0 +1,30 @@
|
||||
<Fluent:RibbonWindow xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:Fluent="clr-namespace:Fluent;assembly=Fluent"
|
||||
xmlns:FluentTest="clr-namespace:FluentTest"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
x:Name="window"
|
||||
x:Class="FluentTest.TestWindow"
|
||||
Title="{Binding WindowTitle, ElementName=TestContent}"
|
||||
FlowDirection="LeftToRight"
|
||||
Height="768"
|
||||
Width="1024"
|
||||
MinWidth="80"
|
||||
MinHeight="60"
|
||||
WindowState="Normal"
|
||||
Style="{StaticResource RibbonWindowStyle}"
|
||||
DataContext="{Binding DataContext, ElementName=TestContent}">
|
||||
<Fluent:RibbonWindow.LayoutTransform>
|
||||
<!-- todo: netcore => was using x:Reference before -->
|
||||
<ScaleTransform ScaleX="{Binding DataContext.Zoom, ElementName=TestContent}"
|
||||
ScaleY="{Binding DataContext.Zoom, ElementName=TestContent}" />
|
||||
</Fluent:RibbonWindow.LayoutTransform>
|
||||
<Fluent:RibbonWindow.WindowCommands>
|
||||
<Fluent:WindowCommands>
|
||||
<Button Content="Test" Style="{DynamicResource Fluent.Ribbon.Styles.WindowCommands.Button}" />
|
||||
</Fluent:WindowCommands>
|
||||
</Fluent:RibbonWindow.WindowCommands>
|
||||
<FluentTest:TestContent x:Name="TestContent" />
|
||||
</Fluent:RibbonWindow>
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace FluentTest
|
||||
{
|
||||
using Fluent;
|
||||
|
||||
public partial class TestWindow : RibbonWindow
|
||||
{
|
||||
public TestWindow()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
#pragma warning disable SA1402 // File may only contain a single class
|
||||
|
||||
namespace FluentTest.ViewModels
|
||||
{
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Media;
|
||||
using ControlzEx.Theming;
|
||||
|
||||
public class ColorViewModel : ViewModel
|
||||
{
|
||||
private Color standardColor;
|
||||
private Color highlightColor;
|
||||
|
||||
public ColorViewModel()
|
||||
{
|
||||
this.StandardColor = Colors.Black;
|
||||
this.HighlightColor = Colors.Yellow;
|
||||
|
||||
CollectionViewSource.GetDefaultView(ThemeManager.Current.Themes).GroupDescriptions.Add(new PropertyGroupDescription(nameof(Theme.BaseColorScheme)));
|
||||
}
|
||||
|
||||
public Color StandardColor
|
||||
{
|
||||
get { return this.standardColor; }
|
||||
|
||||
set
|
||||
{
|
||||
if (value == this.standardColor)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.standardColor = value;
|
||||
this.OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public Color HighlightColor
|
||||
{
|
||||
get { return this.highlightColor; }
|
||||
|
||||
set
|
||||
{
|
||||
if (value == this.highlightColor)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.highlightColor = value;
|
||||
this.OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public Color[] ThemeColors { get; } = { Colors.Red, Colors.Green, Colors.Blue, Colors.White, Colors.Black, Colors.Purple };
|
||||
|
||||
#pragma warning disable INPC010 // The property sets a different field than it returns.
|
||||
public Color ThemeColor
|
||||
{
|
||||
get => ((SolidColorBrush)Application.Current.Resources["Fluent.Ribbon.Brushes.AccentBaseColorBrush"])?.Color ?? Colors.Pink;
|
||||
|
||||
set
|
||||
{
|
||||
var solidColorBrush = new SolidColorBrush(value);
|
||||
solidColorBrush.Freeze();
|
||||
Application.Current.Resources["Fluent.Ribbon.Brushes.AccentBaseColorBrush"] = solidColorBrush;
|
||||
this.OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
#pragma warning restore INPC010 // The property sets a different field than it returns.
|
||||
|
||||
public string CurrentBaseColor
|
||||
{
|
||||
get => this.CurrentTheme.BaseColorScheme;
|
||||
|
||||
set
|
||||
{
|
||||
if (value is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ThemeManager.Current.ChangeThemeBaseColor(Application.Current, value);
|
||||
this.OnPropertyChanged();
|
||||
this.OnPropertyChanged(nameof(this.CurrentTheme));
|
||||
}
|
||||
}
|
||||
|
||||
public Theme CurrentTheme
|
||||
{
|
||||
get => ThemeManager.Current.DetectTheme(Application.Current);
|
||||
|
||||
set
|
||||
{
|
||||
if (value is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ThemeManager.Current.ChangeTheme(Application.Current, value);
|
||||
this.OnPropertyChanged();
|
||||
this.OnPropertyChanged(nameof(this.CurrentBaseColor));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace FluentTest.ViewModels
|
||||
{
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
|
||||
public class FontsViewModel : ViewModel
|
||||
{
|
||||
public ObservableCollection<string> FontsData { get; } = new ObservableCollection<string>(System.Windows.Media.Fonts.SystemFontFamilies.Select(fontFamily => fontFamily.ToString()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
namespace FluentTest.ViewModels
|
||||
{
|
||||
public class GalleryItemViewModel : ViewModel
|
||||
{
|
||||
private string text;
|
||||
private string group;
|
||||
|
||||
public GalleryItemViewModel(string group, string text)
|
||||
{
|
||||
this.Group = group;
|
||||
this.Text = text;
|
||||
}
|
||||
|
||||
public string Text
|
||||
{
|
||||
get { return this.text; }
|
||||
|
||||
set
|
||||
{
|
||||
if (value == this.text)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.text = value;
|
||||
this.OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public string Group
|
||||
{
|
||||
get { return this.group; }
|
||||
|
||||
set
|
||||
{
|
||||
if (value == this.group)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.group = value;
|
||||
this.OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
namespace FluentTest.ViewModels
|
||||
{
|
||||
using System.Diagnostics;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using Fluent.Converters;
|
||||
using FluentTest.Commanding;
|
||||
|
||||
public class GallerySampleDataItemViewModel : ViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates new item
|
||||
/// </summary>
|
||||
/// <param name="icon">Icon</param>
|
||||
/// <param name="iconLarge">Large Icon</param>
|
||||
/// <param name="text">Text</param>
|
||||
/// <param name="group">Group</param>
|
||||
/// <returns>Item</returns>
|
||||
public static GallerySampleDataItemViewModel Create(string icon, string iconLarge, string text, string group)
|
||||
{
|
||||
var dataItem = new GallerySampleDataItemViewModel(icon, iconLarge, text, group);
|
||||
|
||||
return dataItem;
|
||||
}
|
||||
|
||||
private GallerySampleDataItemViewModel(string icon, string iconLarge, string text, string group)
|
||||
{
|
||||
this.Icon = (ImageSource)StaticConverters.ObjectToImageConverter.Convert(icon, typeof(BitmapImage), null, null);
|
||||
this.IconLarge = (ImageSource)StaticConverters.ObjectToImageConverter.Convert(iconLarge, typeof(BitmapImage), null, null);
|
||||
this.Text = text;
|
||||
this.Group = group;
|
||||
|
||||
this.Command = new RelayCommand(() => Trace.WriteLine("Command executed"));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets icon
|
||||
/// </summary>
|
||||
public ImageSource Icon { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets large icon
|
||||
/// </summary>
|
||||
public ImageSource IconLarge { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets text
|
||||
/// </summary>
|
||||
public string Text { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets group name
|
||||
/// </summary>
|
||||
public string Group { get; }
|
||||
|
||||
public ICommand Command { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
namespace FluentTest.ViewModels
|
||||
{
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Windows.Input;
|
||||
using FluentTest.Commanding;
|
||||
|
||||
public class GalleryViewModel : ViewModel
|
||||
{
|
||||
private ObservableCollection<GalleryItemViewModel> items;
|
||||
|
||||
public GalleryViewModel()
|
||||
{
|
||||
this.Items = new ObservableCollection<GalleryItemViewModel>();
|
||||
this.RefreshCommand = new RelayCommand(this.Refresh);
|
||||
|
||||
this.Refresh();
|
||||
}
|
||||
|
||||
public ObservableCollection<GalleryItemViewModel> Items
|
||||
{
|
||||
get { return this.items; }
|
||||
|
||||
private set
|
||||
{
|
||||
if (Equals(value, this.items))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.items = value;
|
||||
this.OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand RefreshCommand { get; private set; }
|
||||
|
||||
public void Refresh()
|
||||
{
|
||||
this.Items.Clear();
|
||||
|
||||
this.Items.Add(new GalleryItemViewModel("Group 1", "1"));
|
||||
this.Items.Add(new GalleryItemViewModel("Group 1", "2"));
|
||||
this.Items.Add(new GalleryItemViewModel("Group 1", "3"));
|
||||
this.Items.Add(new GalleryItemViewModel("Group 1", "4"));
|
||||
this.Items.Add(new GalleryItemViewModel("Group 1", "5"));
|
||||
this.Items.Add(new GalleryItemViewModel("Group 1", "6"));
|
||||
|
||||
this.Items.Add(new GalleryItemViewModel("Group 2", "10"));
|
||||
this.Items.Add(new GalleryItemViewModel("Group 2", "20"));
|
||||
this.Items.Add(new GalleryItemViewModel("Group 2", "30"));
|
||||
this.Items.Add(new GalleryItemViewModel("Group 2", "40"));
|
||||
this.Items.Add(new GalleryItemViewModel("Group 2", "50"));
|
||||
this.Items.Add(new GalleryItemViewModel("Group 2", "60"));
|
||||
|
||||
this.Items.Add(new GalleryItemViewModel("Group 3", "100"));
|
||||
this.Items.Add(new GalleryItemViewModel("Group 3", "200"));
|
||||
this.Items.Add(new GalleryItemViewModel("Group 3", "300"));
|
||||
this.Items.Add(new GalleryItemViewModel("Group 3", "400"));
|
||||
this.Items.Add(new GalleryItemViewModel("Group 3", "500"));
|
||||
this.Items.Add(new GalleryItemViewModel("Group 3", "600"));
|
||||
|
||||
this.Items.Add(new GalleryItemViewModel("Group 4", "1000"));
|
||||
this.Items.Add(new GalleryItemViewModel("Group 4", "2000"));
|
||||
this.Items.Add(new GalleryItemViewModel("Group 4", "3000"));
|
||||
this.Items.Add(new GalleryItemViewModel("Group 4", "4000"));
|
||||
this.Items.Add(new GalleryItemViewModel("Group 4", "5000"));
|
||||
this.Items.Add(new GalleryItemViewModel("Group 4", "6000"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
namespace FluentTest.ViewModels.IssueRepros
|
||||
{
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using ControlzEx.Theming;
|
||||
using Fluent.Extensions;
|
||||
using FluentTest.Commanding;
|
||||
|
||||
public class ThemeManagerFromThread
|
||||
{
|
||||
private int currentTheme;
|
||||
private CancellationTokenSource cancellationTokenSource;
|
||||
|
||||
public enum ThemeColors
|
||||
{
|
||||
Red,
|
||||
Amber,
|
||||
Emerald,
|
||||
}
|
||||
|
||||
public ThemeManagerFromThread()
|
||||
{
|
||||
this.StartStopCommand = new RelayCommand(this.StartStop);
|
||||
}
|
||||
|
||||
public RelayCommand StartStopCommand { get; set; }
|
||||
|
||||
private void Info(string info)
|
||||
{
|
||||
Trace.WriteLine($@"{DateTime.Now} {info}");
|
||||
}
|
||||
|
||||
private void StartStop()
|
||||
{
|
||||
if (this.cancellationTokenSource != null)
|
||||
{
|
||||
ThemeManager.Current.ThemeChanged -= this.ThemeManagerThemeChangedHandler;
|
||||
|
||||
this.cancellationTokenSource.Cancel();
|
||||
}
|
||||
else
|
||||
{
|
||||
ThemeManager.Current.ThemeChanged += this.ThemeManagerThemeChangedHandler;
|
||||
|
||||
Task.Factory.StartNew(async () =>
|
||||
{
|
||||
while (this.cancellationTokenSource.IsCancellationRequested == false)
|
||||
{
|
||||
this.ThreadProc();
|
||||
|
||||
await Task.Delay(TimeSpan.FromSeconds(2));
|
||||
}
|
||||
|
||||
this.cancellationTokenSource.Dispose();
|
||||
this.cancellationTokenSource = null;
|
||||
}, (this.cancellationTokenSource = new CancellationTokenSource()).Token);
|
||||
}
|
||||
}
|
||||
|
||||
private void ThreadProc()
|
||||
{
|
||||
if (this.currentTheme > 2)
|
||||
{
|
||||
this.currentTheme = 0;
|
||||
}
|
||||
|
||||
var newTheme = (ThemeColors)this.currentTheme;
|
||||
|
||||
this.Info("Changing theme to " + newTheme);
|
||||
this.ChangeTheme(newTheme);
|
||||
|
||||
this.currentTheme++;
|
||||
}
|
||||
|
||||
private void ChangeTheme(ThemeColors themeColor)
|
||||
{
|
||||
if (!Application.Current.Dispatcher.CheckAccess())
|
||||
{
|
||||
Application.Current.RunInDispatcherAsync(() => this.ChangeTheme(themeColor));
|
||||
}
|
||||
else
|
||||
{
|
||||
var newTheme = ThemeManager.Current.GetTheme("Light." + themeColor.ToString());
|
||||
if (newTheme != null)
|
||||
{
|
||||
ThemeManager.Current.ChangeTheme(Application.Current, newTheme);
|
||||
|
||||
this.Info($"Change theme: NewTheme: {newTheme.Name} Theme changed.");
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Info($"Change theme: Theme not found: {themeColor}.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ThemeManagerThemeChangedHandler(object sender, ThemeChangedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var theme = ThemeManager.Current.DetectTheme(Application.Current);
|
||||
this.Info($"Current theme from args: {e.NewTheme.Name}");
|
||||
this.Info($"Current theme from detection: {theme.Name}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Info(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace FluentTest.ViewModels
|
||||
{
|
||||
using FluentTest.ViewModels.IssueRepros;
|
||||
|
||||
public class IssueReprosViewModel
|
||||
{
|
||||
public IssueReprosViewModel()
|
||||
{
|
||||
this.ThemeManagerFromThread = new ThemeManagerFromThread();
|
||||
}
|
||||
|
||||
public ThemeManagerFromThread ThemeManagerFromThread { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,263 @@
|
||||
namespace FluentTest.ViewModels
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Timers;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using Fluent;
|
||||
using FluentTest.Commanding;
|
||||
#if MahApps_Metro
|
||||
|
||||
#endif
|
||||
|
||||
public class MainViewModel : ViewModel
|
||||
{
|
||||
private readonly Timer memoryTimer;
|
||||
|
||||
private int boundSpinnerValue;
|
||||
private ColorViewModel colorViewModel;
|
||||
private FontsViewModel fontsViewModel;
|
||||
private GalleryViewModel galleryViewModel;
|
||||
|
||||
private GallerySampleDataItemViewModel[] dataItems;
|
||||
|
||||
private RelayCommand exitCommand;
|
||||
private double zoom;
|
||||
private ICommand testCommand;
|
||||
|
||||
private IList<string> manyItems;
|
||||
private IList<string> stringItems;
|
||||
|
||||
private bool? isCheckedToggleButton3 = true;
|
||||
|
||||
private bool areContextGroupsVisible = true;
|
||||
|
||||
public MainViewModel()
|
||||
{
|
||||
this.Zoom = 1.0;
|
||||
|
||||
this.BoundSpinnerValue = 1;
|
||||
this.IsCheckedToggleButton3 = true;
|
||||
|
||||
this.ColorViewModel = new ColorViewModel();
|
||||
this.FontsViewModel = new FontsViewModel();
|
||||
this.GalleryViewModel = new GalleryViewModel();
|
||||
this.IssueReprosViewModel = new IssueReprosViewModel();
|
||||
|
||||
this.PreviewCommand = new RelayCommand<GalleryItem>(Preview);
|
||||
this.CancelPreviewCommand = new RelayCommand<GalleryItem>(CancelPreview);
|
||||
|
||||
this.GroupByAdvancedSample = x => ((GallerySampleDataItemViewModel)x).Text.Substring(0, 1);
|
||||
|
||||
this.memoryTimer = new Timer(TimeSpan.FromSeconds(5).TotalMilliseconds);
|
||||
this.memoryTimer.Elapsed += this.HandleMemoryTimer_Elapsed;
|
||||
this.memoryTimer.Start();
|
||||
}
|
||||
|
||||
#region Properties
|
||||
|
||||
public long UsedMemory => GC.GetTotalMemory(true) / 1014;
|
||||
|
||||
public double Zoom
|
||||
{
|
||||
get { return this.zoom; }
|
||||
|
||||
set
|
||||
{
|
||||
if (value.Equals(this.zoom))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.zoom = value;
|
||||
this.OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public bool AreContextGroupsVisible
|
||||
{
|
||||
get => this.areContextGroupsVisible;
|
||||
set
|
||||
{
|
||||
if (value == this.areContextGroupsVisible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.areContextGroupsVisible = value;
|
||||
this.OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public ColorViewModel ColorViewModel
|
||||
{
|
||||
get { return this.colorViewModel; }
|
||||
|
||||
private set
|
||||
{
|
||||
if (Equals(value, this.colorViewModel))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.colorViewModel = value;
|
||||
this.OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public FontsViewModel FontsViewModel
|
||||
{
|
||||
get { return this.fontsViewModel; }
|
||||
|
||||
private set
|
||||
{
|
||||
if (Equals(value, this.fontsViewModel))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.fontsViewModel = value;
|
||||
this.OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public GalleryViewModel GalleryViewModel
|
||||
{
|
||||
get { return this.galleryViewModel; }
|
||||
|
||||
private set
|
||||
{
|
||||
if (Equals(value, this.galleryViewModel))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.galleryViewModel = value;
|
||||
this.OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public IssueReprosViewModel IssueReprosViewModel { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets data items (uses as DataContext)
|
||||
/// </summary>
|
||||
public GallerySampleDataItemViewModel[] DataItems
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.dataItems ?? (this.dataItems = new[]
|
||||
{
|
||||
GallerySampleDataItemViewModel.Create("Images\\Blue.png", "Images\\BlueLarge.png", "Blue", "Group A"),
|
||||
GallerySampleDataItemViewModel.Create("Images\\Brown.png", "Images\\BrownLarge.png", "Brown", "Group A"),
|
||||
GallerySampleDataItemViewModel.Create("Images\\Gray.png", "Images\\GrayLarge.png", "Gray", "Group A"),
|
||||
GallerySampleDataItemViewModel.Create("Images\\Green.png", "Images\\GreenLarge.png", "Green", "Group A"),
|
||||
GallerySampleDataItemViewModel.Create("Images\\Orange.png", "Images\\OrangeLarge.png", "Orange", "Group A"),
|
||||
GallerySampleDataItemViewModel.Create("Images\\Pink.png", "Images\\PinkLarge.png", "Pink", "Group B"),
|
||||
GallerySampleDataItemViewModel.Create("Images\\Red.png", "Images\\RedLarge.png", "Red", "Group B"),
|
||||
GallerySampleDataItemViewModel.Create("Images\\Yellow.png", "Images\\YellowLarge.png", "Yellow", "Group B"),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public Func<object, string> GroupByAdvancedSample { get; private set; }
|
||||
|
||||
public IList<string> ManyItems
|
||||
{
|
||||
get { return this.manyItems ?? (this.manyItems = GenerateStrings(5000)); }
|
||||
}
|
||||
|
||||
public IList<string> StringItems
|
||||
{
|
||||
get { return this.stringItems ?? (this.stringItems = GenerateStrings(25)); }
|
||||
}
|
||||
|
||||
public bool? IsCheckedToggleButton3
|
||||
{
|
||||
get { return this.isCheckedToggleButton3; }
|
||||
|
||||
set
|
||||
{
|
||||
if (value == this.isCheckedToggleButton3)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.isCheckedToggleButton3 = value;
|
||||
this.OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand PreviewCommand { get; private set; }
|
||||
|
||||
public ICommand CancelPreviewCommand { get; private set; }
|
||||
|
||||
public int BoundSpinnerValue
|
||||
{
|
||||
get { return this.boundSpinnerValue; }
|
||||
|
||||
set
|
||||
{
|
||||
if (value == this.boundSpinnerValue)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.boundSpinnerValue = value;
|
||||
this.OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
#region Exit
|
||||
|
||||
/// <summary>
|
||||
/// Exit from the application
|
||||
/// </summary>
|
||||
public ICommand ExitCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.exitCommand is null)
|
||||
{
|
||||
this.exitCommand = new RelayCommand(Application.Current.Shutdown, () => this.BoundSpinnerValue > 0);
|
||||
}
|
||||
|
||||
return this.exitCommand;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public ICommand TestCommand
|
||||
{
|
||||
get { return this.testCommand ?? (this.testCommand = new RelayCommand(() => MessageBox.Show("Test-Command"))); }
|
||||
}
|
||||
|
||||
#endregion Properties
|
||||
|
||||
private static void Preview(GalleryItem galleryItem)
|
||||
{
|
||||
Trace.WriteLine($"Preview: {galleryItem}");
|
||||
}
|
||||
|
||||
private static void CancelPreview(GalleryItem galleryItem)
|
||||
{
|
||||
Trace.WriteLine($"CancelPreview: {galleryItem}");
|
||||
}
|
||||
|
||||
private static IList<string> GenerateStrings(int count)
|
||||
{
|
||||
return Enumerable.Range(0, count)
|
||||
.Select(x => "Item " + (x + 1).ToString())
|
||||
.ToList();
|
||||
}
|
||||
|
||||
private void HandleMemoryTimer_Elapsed(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
this.OnPropertyChanged(nameof(this.UsedMemory));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace FluentTest.ViewModels
|
||||
{
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
public class ViewModel : INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
[NotifyPropertyChangedInvocator]
|
||||
protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
59
Others/Fluent.Ribbon/Fluent.Ribbon.Showcase/app.manifest
Normal file
@@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<asmv1:assembly manifestVersion="1.0"
|
||||
xmlns="urn:schemas-microsoft-com:asm.v1"
|
||||
xmlns:asmv1="urn:schemas-microsoft-com:asm.v1"
|
||||
xmlns:asmv2="urn:schemas-microsoft-com:asm.v2"
|
||||
xmlns:asmv3="urn:schemas-microsoft-com:asm.v3"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<assemblyIdentity version="1.0.0.0"
|
||||
name="Fluent.Ribbon.Showcase"/>
|
||||
<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>
|
||||
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- A list of all Windows versions that this application is designed to work with. Windows will automatically select the most compatible environment.-->
|
||||
<!--The ID below indicates application support for Windows Vista -->
|
||||
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
|
||||
<!--The ID below indicates application support for Windows 7 -->
|
||||
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
|
||||
<!--The ID below indicates application support for Windows 8 -->
|
||||
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
|
||||
<!--The ID below indicates application support for Windows 8.1 -->
|
||||
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
|
||||
<!--The ID below indicates application support for Windows 10 -->
|
||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
|
||||
</application>
|
||||
</compatibility>
|
||||
|
||||
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<windowsSettings>
|
||||
<!-- Per Monitor V1 [OS >= Windows 8.1] Values: False, True, Per-monitor, True/PM -->
|
||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">True/PM</dpiAware>
|
||||
<!-- Per Monitor V1 [OS >= Windows 10 Anniversary Update (1607, 10.0.14393, Redstone 1)] Values: Unaware, System, PerMonitor -->
|
||||
<!-- Per Monitor V2 [OS >= Windows 10 Creators Update (1703, 10.0.15063, Redstone 2)] Value: PerMonitorV2 -->
|
||||
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor, System</dpiAwareness>
|
||||
<!-- If you want to see Windows crash with a kernel error trap, enable gdiScaling -->
|
||||
<!--<gdiScaling xmlns="http://schemas.microsoft.com/SMI/2017/WindowsSettings">true</gdiScaling>-->
|
||||
</windowsSettings>
|
||||
</application>
|
||||
|
||||
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity
|
||||
type="win32"
|
||||
name="Microsoft.Windows.Common-Controls"
|
||||
version="6.0.0.0"
|
||||
processorArchitecture="*"
|
||||
publicKeyToken="6595b64144ccf1df"
|
||||
language="*" />
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
</asmv1:assembly>
|
||||
17
Others/Fluent.Ribbon/Fluent.Ribbon.TestWindow/App.xaml
Normal file
@@ -0,0 +1,17 @@
|
||||
<Application x:Class="Fluent.Ribbon.TestWindow.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:Fluent.Ribbon.TestWindow"
|
||||
StartupUri="MainWindow.xaml">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/Fluent;component/Themes/Generic.xaml" />
|
||||
|
||||
<!--<ResourceDictionary Source="pack://application:,,,/Fluent;component/Themes/Themes/Light.Green.xaml" />
|
||||
|
||||
<ResourceDictionary Source="pack://application:,,,/Fluent;component/Themes/Themes/Dark.Green.xaml" />-->
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
17
Others/Fluent.Ribbon/Fluent.Ribbon.TestWindow/App.xaml.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace Fluent.Ribbon.TestWindow
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using System.Windows;
|
||||
|
||||
[assembly: ThemeInfo(
|
||||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||
//(used if a resource is not found in the page,
|
||||
// or application resource dictionaries)
|
||||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||
//(used if a resource is not found in the page,
|
||||
// app, or any theme specific resource dictionaries)
|
||||
)]
|
||||
@@ -0,0 +1,13 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<UseWPF>true</UseWPF>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Fluent.Ribbon\Fluent.Ribbon.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,14 @@
|
||||
<Fluent:RibbonWindow x:Class="Fluent.Ribbon.TestWindow.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
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:Fluent="clr-namespace:Fluent;assembly=Fluent"
|
||||
xmlns:local="clr-namespace:Fluent.Ribbon.TestWindow"
|
||||
mc:Ignorable="d"
|
||||
Style="{StaticResource RibbonWindowStyle}"
|
||||
Title="MainWindow" Height="450" Width="800">
|
||||
<Grid>
|
||||
|
||||
</Grid>
|
||||
</Fluent:RibbonWindow>
|
||||