-
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
346 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<Application x:Class="WindowExample.App" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="clr-namespace:WindowExample" | ||
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern" | ||
StartupUri="MainWindow.xaml"> | ||
<Application.Resources> | ||
<ResourceDictionary> | ||
<ResourceDictionary.MergedDictionaries> | ||
<ui:ThemeResources/> | ||
<ui:XamlControlsResources /> | ||
</ResourceDictionary.MergedDictionaries> | ||
</ResourceDictionary> | ||
</Application.Resources> | ||
</Application> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System.Configuration; | ||
using System.Data; | ||
using System.Windows; | ||
|
||
namespace WindowExample | ||
{ | ||
/// <summary> | ||
/// Interaction logic for App.xaml | ||
/// </summary> | ||
public partial class App : Application | ||
{ | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
<Window x:Class="WindowExample.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:ui="http://schemas.inkore.net/lib/ui/wpf/modern" | ||
xmlns:local="clr-namespace:WindowExample" xmlns:sys="clr-namespace:System;assembly=netstandard" | ||
mc:Ignorable="d" | ||
ui:WindowHelper.UseModernWindowStyle="True" ui:TitleBar.Height="36" | ||
FontSize="14" | ||
Title="MainWindow" Height="540" Width="800"> | ||
<FrameworkElement.Resources> | ||
<ResourceDictionary> | ||
|
||
<Style x:Key="TitleBarButtonAvailabilitySelector" TargetType="ComboBox" BasedOn="{StaticResource {x:Static ui:ThemeKeys.DefaultComboBoxStyleKey}}"> | ||
<Setter Property="Margin" Value="2" /> | ||
<Setter Property="Grid.Row" Value="2"/> | ||
<Setter Property="HorizontalAlignment" Value="Stretch"/> | ||
<EventSetter Event="Loaded" Handler="TitleBarButtonAvailabilitySelector_Loaded"/> | ||
<EventSetter Event="SelectionChanged" Handler="TitleBarButtonAvailabilitySelector_SelectionChanged"/> | ||
</Style> | ||
|
||
</ResourceDictionary> | ||
</FrameworkElement.Resources> | ||
<ui:SimpleStackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Spacing="20"> | ||
<TextBlock Text="Window Example" FontWeight="Bold" FontSize="24" TextAlignment="Center"/> | ||
<Grid> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="Auto"/> | ||
<ColumnDefinition/> | ||
</Grid.ColumnDefinitions> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="Auto"/> | ||
<RowDefinition Height="Auto"/> | ||
<RowDefinition Height="Auto"/> | ||
<RowDefinition Height="Auto"/> | ||
<RowDefinition Height="Auto"/> | ||
</Grid.RowDefinitions> | ||
|
||
<TextBlock Text="WindowStyle" Grid.Row="0" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10"/> | ||
<ui:SimpleStackPanel Grid.Row="0" Grid.Column="1" Spacing="8" Orientation="Horizontal"> | ||
<RadioButton x:Name="RadioButton_WindowStyle_None" Content="None" MinWidth="0" Click="RadioButton_WindowStyle_Click"/> | ||
<RadioButton x:Name="RadioButton_WindowStyle_SingleBorder" Content="SingleBorder" MinWidth="0" IsChecked="True" Click="RadioButton_WindowStyle_Click"/> | ||
<RadioButton x:Name="RadioButton_WindowStyle_ThreeDBorder" Content="ThreeDBorder" MinWidth="0" Click="RadioButton_WindowStyle_Click"/> | ||
<RadioButton x:Name="RadioButton_WindowStyle_Tool" Content="Tool" MinWidth="0" Click="RadioButton_WindowStyle_Click"/> | ||
</ui:SimpleStackPanel> | ||
|
||
<TextBlock Text="ResizeMode" Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10"/> | ||
<ui:SimpleStackPanel Grid.Row="1" Grid.Column="1" Spacing="4" Orientation="Horizontal"> | ||
<RadioButton x:Name="RadioButton_ResizeMode_NoResize" Content="NoResize" MinWidth="0" Click="RadioButton_ResizeMode_Click"/> | ||
<RadioButton x:Name="RadioButton_ResizeMode_CanMinimize" Content="CanMinimize" MinWidth="0" Click="RadioButton_ResizeMode_Click"/> | ||
<RadioButton x:Name="RadioButton_ResizeMode_CanResize" Content="CanResize" MinWidth="0" IsChecked="True" Click="RadioButton_ResizeMode_Click"/> | ||
<RadioButton x:Name="RadioButton_ResizeMode_CanResizeWithGrip" Content="CanResizeWithGrip" MinWidth="0" Click="RadioButton_ResizeMode_Click"/> | ||
</ui:SimpleStackPanel> | ||
|
||
<TextBlock Text="(ui) BackdropType" Grid.Row="2" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10"/> | ||
<ui:SimpleStackPanel Grid.Row="2" Grid.Column="1" Spacing="8" Orientation="Horizontal"> | ||
<RadioButton x:Name="RadioButton_SystemBackdropType_Acrylic" Content="Acrylic" MinWidth="0" Click="RadioButton_SystemBackdropType_Click"/> | ||
<RadioButton x:Name="RadioButton_SystemBackdropType_Mica" Content="Mica" MinWidth="0" Click="RadioButton_SystemBackdropType_Click"/> | ||
<RadioButton x:Name="RadioButton_SystemBackdropType_None" Content="None" MinWidth="0" IsChecked="True" Click="RadioButton_SystemBackdropType_Click"/> | ||
<RadioButton x:Name="RadioButton_SystemBackdropType_Tabbed" Content="Tabbed" MinWidth="0" Click="RadioButton_SystemBackdropType_Click"/> | ||
</ui:SimpleStackPanel> | ||
|
||
<ui:SimpleStackPanel Grid.Row="3" Grid.ColumnSpan="2" Spacing="10" Orientation="Horizontal" Margin="10"> | ||
<CheckBox x:Name="CheckBox_UseModernWindowStyle" Content="(ui) ModernStyle" IsChecked="True" IsEnabled="False" Click="CheckBox_UseModernWindowStyle_Click"/> | ||
<CheckBox x:Name="CheckBox_ApplyBackground" Content="(ui) ApplyBackground" IsChecked="False" Click="CheckBox_ApplyBackground_Click"/> | ||
<CheckBox x:Name="CheckBox_ApplyNoise" Content="(ui) ApplyNoise" IsChecked="False" Click="CheckBox_ApplyNoise_Click"/> | ||
</ui:SimpleStackPanel> | ||
|
||
<Grid Grid.Row="4" Grid.ColumnSpan="2" Margin="6"> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition/> | ||
<ColumnDefinition/> | ||
<ColumnDefinition/> | ||
</Grid.ColumnDefinitions> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="Auto"/> | ||
<RowDefinition Height="Auto"/> | ||
</Grid.RowDefinitions> | ||
|
||
<TextBlock Text="Minimize button" Grid.Column="0" Margin="4"/> | ||
<ComboBox x:Name="ComboBox_TitleBarButtonMinimizeAvailability_Minimize" Grid.Column="0" Tag="{x:Static ui:TitleBar.ButtonMinimizeAvailabilityProperty}" Style="{StaticResource TitleBarButtonAvailabilitySelector}"/> | ||
|
||
<TextBlock Text="Maximize button" Grid.Column="1" Margin="4"/> | ||
<ComboBox x:Name="ComboBox_TitleBarButtonMaximizeAvailability_Minimize" Grid.Column="1" Tag="{x:Static ui:TitleBar.ButtonMaximizeAvailabilityProperty}" Style="{StaticResource TitleBarButtonAvailabilitySelector}"/> | ||
|
||
<TextBlock Text="Close button" Grid.Column="2" Margin="4"/> | ||
<ComboBox x:Name="ComboBox_TitleBarButtonCloseAvailability_Minimize" Grid.Column="2" Tag="{x:Static ui:TitleBar.ButtonCloseAvailabilityProperty}" Style="{StaticResource TitleBarButtonAvailabilitySelector}"/> | ||
|
||
|
||
</Grid> | ||
|
||
</Grid> | ||
</ui:SimpleStackPanel> | ||
</Window> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
using iNKORE.UI.WPF.Modern.Controls.Helpers; | ||
using iNKORE.UI.WPF.Modern.Controls.Primitives; | ||
using iNKORE.UI.WPF.Modern.Helpers.Styles; | ||
using System.Text; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using System.Windows.Data; | ||
using System.Windows.Documents; | ||
using System.Windows.Input; | ||
using System.Windows.Media; | ||
using System.Windows.Media.Animation; | ||
using System.Windows.Media.Imaging; | ||
using System.Windows.Navigation; | ||
using System.Windows.Shapes; | ||
|
||
namespace WindowExample | ||
{ | ||
/// <summary> | ||
/// Interaction logic for MainWindow.xaml | ||
/// </summary> | ||
public partial class MainWindow : Window | ||
{ | ||
public MainWindow() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
private void RadioButton_WindowStyle_Click(object sender, RoutedEventArgs e) | ||
{ | ||
if (sender is RadioButton btn && btn.Content is string val) | ||
{ | ||
try | ||
{ | ||
this.WindowStyle = (WindowStyle)Enum.Parse(typeof(WindowStyle), val); | ||
} | ||
catch | ||
{ | ||
try | ||
{ | ||
this.WindowStyle = (WindowStyle)Enum.Parse(typeof(WindowStyle), val + "Window"); | ||
} | ||
catch (Exception ex) | ||
{ | ||
MessageBox.Show(ex.ToString()); | ||
} | ||
} | ||
} | ||
} | ||
|
||
private void RadioButton_ResizeMode_Click(object sender, RoutedEventArgs e) | ||
{ | ||
if (sender is RadioButton btn && btn.Content is string val) | ||
{ | ||
try | ||
{ | ||
this.ResizeMode = (ResizeMode)Enum.Parse(typeof(ResizeMode), val); | ||
} | ||
catch (Exception ex) | ||
{ | ||
MessageBox.Show(ex.ToString()); | ||
} | ||
} | ||
} | ||
|
||
private void CheckBox_UseModernWindowStyle_Click(object sender, RoutedEventArgs e) | ||
{ | ||
WindowHelper.SetUseModernWindowStyle(this, CheckBox_UseModernWindowStyle.IsChecked ?? false); | ||
} | ||
|
||
private void RadioButton_SystemBackdropType_Click(object sender, RoutedEventArgs e) | ||
{ | ||
if (sender is RadioButton btn && btn.Content is string val) | ||
{ | ||
try | ||
{ | ||
WindowHelper.SetSystemBackdropType(this, (BackdropType)Enum.Parse(typeof(BackdropType), val)); | ||
} | ||
catch (Exception ex) | ||
{ | ||
MessageBox.Show(ex.ToString()); | ||
} | ||
} | ||
|
||
} | ||
|
||
private void CheckBox_ApplyBackground_Click(object sender, RoutedEventArgs e) | ||
{ | ||
WindowHelper.SetApplyBackground(this, CheckBox_ApplyBackground.IsChecked ?? false); | ||
} | ||
|
||
private void CheckBox_ApplyNoise_Click(object sender, RoutedEventArgs e) | ||
{ | ||
WindowHelper.SetApplyNoise(this, CheckBox_ApplyBackground.IsChecked ?? false); | ||
} | ||
|
||
private void TitleBarButtonAvailabilitySelector_Loaded(object sender, RoutedEventArgs e) | ||
{ | ||
if(sender is ComboBox comboBox) | ||
{ | ||
comboBox.ItemsSource = new string[] | ||
{ | ||
"Auto", | ||
"Collapsed", | ||
"Disabled", | ||
"Enabled" | ||
}; | ||
|
||
comboBox.SelectedIndex = 0; | ||
} | ||
} | ||
|
||
private void TitleBarButtonAvailabilitySelector_SelectionChanged(object sender, SelectionChangedEventArgs e) | ||
{ | ||
if(sender is ComboBox box && box.Tag is DependencyProperty prop && box.SelectedItem is string val) | ||
{ | ||
try | ||
{ | ||
this.SetValue(prop, (TitleBarButtonAvailability)Enum.Parse(typeof(TitleBarButtonAvailability), val)); | ||
} | ||
catch (Exception ex) | ||
{ | ||
MessageBox.Show(ex.ToString()); | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>WinExe</OutputType> | ||
<TargetFramework>net6.0-windows</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<UseWPF>true</UseWPF> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\source\Inkore.UI.WPF.Modern\iNKORE.UI.WPF.Modern.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.