Goffo.WpfModernWindow 1.4.0

dotnet add package Goffo.WpfModernWindow --version 1.4.0                
NuGet\Install-Package Goffo.WpfModernWindow -Version 1.4.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Goffo.WpfModernWindow" Version="1.4.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Goffo.WpfModernWindow --version 1.4.0                
#r "nuget: Goffo.WpfModernWindow, 1.4.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Goffo.WpfModernWindow as a Cake Addin
#addin nuget:?package=Goffo.WpfModernWindow&version=1.4.0

// Install Goffo.WpfModernWindow as a Cake Tool
#tool nuget:?package=Goffo.WpfModernWindow&version=1.4.0                

README

What is this repository for?

  • Customizable Window Component
  • NuGet Package: Goffo.WpfModernWindow
  • Learn Markdown

How do I get set up?

How to use in app

  • Replace MainWindow in XAML
<modernWindow:ModernWindow x:Class="WPFModernWindow.WPF.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:local="clr-namespace:WPFModernWindow.WPF"
                           xmlns:modernWindow="clr-namespace:WPFModernWindow.CustomControl;assembly=WPFModernWindow.CustomControl"
                           mc:Ignorable="d"
                           Title="MainWindow" 
                           Height="450" 
                           Width="800"
                           WindowBorderBrush="White"
                           WindowBorderCornerRadius="25"
                           WindowBorderThickness="20">
    
    
        
</modernWindow:ModernWindow>

  • Change to Inheret from ModernWindow in Code Behind

using WPFModernWindow.CustomControl;

namespace WPFModernWindow.WPF
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : ModernWindow
    {
        public MainWindow()
        {
            InitializeComponent();
        }
    }
}

Source Code of Custom Control

  • Window Style in Resource Dictionary

<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:WPFModernWindow.CustomControl">

    <Style TargetType="{x:Type local:ModernWindow}">
        <Style.Resources>
            <local:MaximizeVisibilityConverter x:Key="MaximizeVisibilityConverter"></local:MaximizeVisibilityConverter>
            <local:MinimizeVisibilityConverter x:Key="MinimizeVisibilityConverter"></local:MinimizeVisibilityConverter>
            <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"></BooleanToVisibilityConverter>
            <Style x:Key="MenuBarButton" TargetType="Button">
                <Style.Resources>
                    <Style TargetType="Border">
                        <Setter Property="CornerRadius" Value="{Binding CaptionButtonsCornerRadius, RelativeSource={RelativeSource AncestorType={x:Type local:ModernWindow}}}"></Setter>
                    </Style>
                </Style.Resources>
            </Style>
        </Style.Resources>
        <Setter Property="Background" Value="White"></Setter>
        <Setter Property="AllowsTransparency" Value="True"></Setter>
        <Setter Property="MinWidth" Value="100"></Setter>
        <Setter Property="MinHeight" Value="100"></Setter>
        <Setter Property="WindowStyle" Value="None"></Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:ModernWindow" x:Name="PART_WindowTemplate">
                    <Border x:Name="PART_WindowBorder" 
                            CornerRadius="{TemplateBinding WindowBorderCornerRadius}" 
                            BorderThickness="{TemplateBinding WindowBorderThickness}" 
                            BorderBrush="{TemplateBinding WindowBorderBrush}">
                        <Grid x:Name="PART_WindowFrame" >
                            <Grid.Resources>
                                <Style TargetType="Border">
                                    <Setter Property="CornerRadius" Value="0"></Setter>
                                    <Setter Property="Background" Value="Black"></Setter>
                                </Style>
                            </Grid.Resources>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="{TemplateBinding WindowLeftBorderWidth}"></ColumnDefinition>
                                <ColumnDefinition Width="*"></ColumnDefinition>
                                <ColumnDefinition Width="{TemplateBinding WindowRightBorderWidth}"></ColumnDefinition>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="{TemplateBinding WindowTopBorderHeight}"></RowDefinition>
                                <RowDefinition Height="Auto"></RowDefinition>
                                <RowDefinition Height="*"></RowDefinition>
                                <RowDefinition Height="{TemplateBinding WindowBottomBorderHeight}"></RowDefinition>
                            </Grid.RowDefinitions>
                            <Border Background="{TemplateBinding WindowBordersBackground}" x:Name="PART_WindowBorderLeft" Grid.Column="0" Grid.Row="1" Grid.RowSpan="2"></Border>
                            <Border Background="{TemplateBinding WindowBordersBackground}" x:Name="PART_WindowBorderTopLeft" Grid.Column="0" Grid.Row="0" CornerRadius="{TemplateBinding WindowTopLeftBorderCornerRadius}"></Border>
                            <Border Background="{TemplateBinding WindowBordersBackground}" x:Name="PART_WindowBorderTop" Grid.Column="1" Grid.Row="0"></Border>
                            <Border Background="{TemplateBinding WindowBordersBackground}" x:Name="PART_WindowBorderTopRight" Grid.Column="2" Grid.Row="0" CornerRadius="{TemplateBinding WindowTopRightCornerRadius}" ></Border>
                            <Border Background="{TemplateBinding WindowBordersBackground}" x:Name="PART_WindowBorderRight" Grid.Column="2" Grid.Row="1" Grid.RowSpan="2"></Border>
                            <Border Background="{TemplateBinding WindowBordersBackground}" x:Name="PART_WindowBorderBottomRight" Grid.Column="2" Grid.Row="3" CornerRadius="{TemplateBinding WindowBottomRightCornerRadius}" ></Border>
                            <Border Background="{TemplateBinding WindowBordersBackground}" x:Name="PART_WindowBorderBottom" Grid.Column="1" Grid.Row="3"></Border>
                            <Border Background="{TemplateBinding WindowBordersBackground}" x:Name="PART_WindowBorderBottomLeft" Grid.Column="0" Grid.Row="3" CornerRadius="{TemplateBinding WindowBottomLeftCornerRadius}" ></Border>
                            <Rectangle Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="1" Fill="{TemplateBinding WindowBordersBackground}"></Rectangle>
                            <Border x:Name="PART_WindowCaption" 
                                    Grid.Column="1" 
                                    Grid.Row="1" 
                                    Background="{TemplateBinding CaptionBackgroundBrush}"
                                    CornerRadius="{TemplateBinding CaptionCornerRadius}">
                                <DockPanel LastChildFill="True">
                                    <ContentPresenter ContentSource="WindowCaptionButtons"></ContentPresenter>
                                    <StackPanel DockPanel.Dock="Right" 
                                                Orientation="Horizontal" 
                                                VerticalAlignment="Center" 
                                                Margin="5"
                                                Visibility="{Binding DefaultCaptionButtonsIsVisible, RelativeSource={RelativeSource AncestorType={x:Type local:ModernWindow}}, Converter={StaticResource BooleanToVisibilityConverter}}">
                                        <Button x:Name="PART_WindowCaptionMinimizeButton"
                                                Content="{TemplateBinding MinimizeButtonContent}"
                                                Background="{TemplateBinding MinimizeButtonBackground}"
                                                Height="{TemplateBinding CaptionButtonsHeight}"
                                                Width="{TemplateBinding CaptionButtonsWidth}"
                                                Margin="{TemplateBinding CaptionButtonsMargin}"
                                                Padding="{TemplateBinding CaptionButtonsPadding}"
                                                FontWeight="{TemplateBinding CaptionButtonsFontWeight}"
                                                ToolTip="{TemplateBinding MinimizeCaptionButtonToolTip}"
                                                FontSize="{TemplateBinding CaptionButtonsFontSize}"
                                                Style="{DynamicResource MenuBarButton}"
                                                Visibility="{TemplateBinding ResizeMode, Converter={StaticResource MinimizeVisibilityConverter}}">
                                        </Button>
                                        <Button x:Name="PART_WindowCaptionMaximizeButton" 
                                                Content="{TemplateBinding MaximizeButtonContent}"
                                                Background="{TemplateBinding MaximizeButtonBackground}"
                                                Height="{TemplateBinding CaptionButtonsHeight}"
                                                Width="{TemplateBinding CaptionButtonsWidth}"
                                                Margin="{TemplateBinding CaptionButtonsMargin}"
                                                Padding="{TemplateBinding CaptionButtonsPadding}"
                                                FontWeight="{TemplateBinding CaptionButtonsFontWeight}"
                                                FontSize="{TemplateBinding CaptionButtonsFontSize}"
                                                ToolTip="{TemplateBinding MaximizeCaptionButtonToolTip}"
                                                Style="{DynamicResource MenuBarButton}"
                                                Visibility="{TemplateBinding ResizeMode, Converter={StaticResource MaximizeVisibilityConverter}}">
                                        </Button>
                                        <Button x:Name="PART_WindowCaptionCloseButton"
                                                Content="{TemplateBinding CloseButtonConent}"
                                                Background="{TemplateBinding CloseButtonBackground}"
                                                Height="{TemplateBinding CaptionButtonsHeight}"
                                                Width="{TemplateBinding CaptionButtonsWidth}"
                                                Margin="{TemplateBinding CaptionButtonsMargin}"
                                                Padding="{TemplateBinding CaptionButtonsPadding}"
                                                FontWeight="{TemplateBinding CaptionButtonsFontWeight}"
                                                FontSize="{TemplateBinding CaptionButtonsFontSize}"
                                                ToolTip="{TemplateBinding CloseButtonToolTip}"
                                                Style="{DynamicResource MenuBarButton}">
                                        </Button>
                                        <StackPanel.Style>
                                            <Style TargetType="StackPanel">
                                                <Style.Triggers>
                                                    <Trigger Property="IsMouseOver" Value="True">
                                                        <Setter Property="Cursor" Value="{Binding CaptionButtonsCursor, RelativeSource={RelativeSource AncestorType={x:Type local:ModernWindow}}}"></Setter>
                                                    </Trigger>
                                                </Style.Triggers>
                                            </Style>
                                        </StackPanel.Style>
                                    </StackPanel>
                                    <TextBlock x:Name="PART_WindowCaptionText" DockPanel.Dock="Left" HorizontalAlignment="Left" VerticalAlignment="Center" Padding="{TemplateBinding CaptionTextPadding}" Margin="{TemplateBinding CaptionTextMargin}">
                                        <Image x:Name="PART_WindowCaptionIcon" Width="{TemplateBinding IconWidth}" Height="{TemplateBinding IconHeight}" Margin="{TemplateBinding IconMargin}" HorizontalAlignment="Center" VerticalAlignment="Center"
                                               Source="{TemplateBinding Icon}" SnapsToDevicePixels="True" RenderOptions.EdgeMode="Aliased">
                                        </Image>
                                        <Run BaselineAlignment="Center"
                                             Text="{TemplateBinding Title}"                                            
                                             Foreground="{TemplateBinding CaptionForegroundBrush}">
                                        </Run>
                                    </TextBlock>
                                </DockPanel>
                                <Border.Style>
                                    <Style TargetType="Border">
                                        <Style.Triggers>
                                            <Trigger Property="IsMouseOver" Value="True">
                                                <Setter Property="Cursor" Value="{Binding CaptionCursor, RelativeSource={RelativeSource AncestorType={x:Type local:ModernWindow}}}"></Setter>
                                            </Trigger>
                                        </Style.Triggers>
                                    </Style>
                                </Border.Style>
                            </Border>
                            <DockPanel x:Name="PART_Content" Grid.Row="2" Grid.Column="1" Background="{TemplateBinding Background}">
                                <ContentPresenter></ContentPresenter>
                            </DockPanel>
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger SourceName="PART_WindowCaptionIcon" Property="Source" Value="{x:Null}">
                            <Setter TargetName="PART_WindowCaptionIcon" Property="Visibility" Value="Collapsed"></Setter>
                            <Setter TargetName="PART_WindowCaptionText" Property="Margin" Value="0"></Setter>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>


  • Dependency Properties

        #region Dependency Properties

        public CornerRadius WindowBorderCornerRadius
        {
            get { return (CornerRadius)GetValue(WindowBorderCornerRadiusProperty); }
            set { SetValue(WindowBorderCornerRadiusProperty, value); }
        }

        public Thickness WindowBorderThickness
        {
            get { return (Thickness)GetValue(WindowBorderThicknessProperty); }
            set { SetValue(WindowBorderThicknessProperty, value); }
        }

        // Using a DependencyProperty as the backing store for WindowBorderThickness.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty WindowBorderThicknessProperty =
            DependencyProperty.Register("WindowBorderThickness", typeof(Thickness), typeof(ModernWindow), new PropertyMetadata(new Thickness(0)));


        public Brush WindowBorderBrush
        {
            get { return (Brush)GetValue(WindowBorderBrushProperty); }
            set { SetValue(WindowBorderBrushProperty, value); }
        }

        // Using a DependencyProperty as the backing store for MyProperty.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty WindowBorderBrushProperty =
            DependencyProperty.Register("WindowBorderBrush", typeof(Brush), typeof(ModernWindow), new PropertyMetadata(Brushes.White));



        // Using a DependencyProperty as the backing store for WindowBorderCornerRadius.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty WindowBorderCornerRadiusProperty =
            DependencyProperty.Register("WindowBorderCornerRadius", typeof(CornerRadius), typeof(ModernWindow), new PropertyMetadata(new CornerRadius(0)));


        public Brush WindowBordersBackground
        {
            get { return (Brush)GetValue(WindowBordersBackgroundProperty); }
            set { SetValue(WindowBordersBackgroundProperty, value); }
        }

        // Using a DependencyProperty as the backing store for WindowBordersBackground.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty WindowBordersBackgroundProperty =
            DependencyProperty.Register("WindowBordersBackground", typeof(Brush), typeof(ModernWindow), new PropertyMetadata(Brushes.White));


        public CornerRadius WindowTopLeftBorderCornerRadius
        {
            get { return (CornerRadius)GetValue(WindowTopLeftBorderCornerRadiusProperty); }
            set { SetValue(WindowTopLeftBorderCornerRadiusProperty, value); }
        }

        // Using a DependencyProperty as the backing store for WindowTopLeftBorderCornerRadius.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty WindowTopLeftBorderCornerRadiusProperty =
            DependencyProperty.Register("WindowTopLeftBorderCornerRadius", typeof(CornerRadius), typeof(ModernWindow), new PropertyMetadata(new CornerRadius(25, 0, 0, 0)));


        public CornerRadius WindowTopRightCornerRadius
        {
            get { return (CornerRadius)GetValue(WindowTopRightCornerRadiusProperty); }
            set { SetValue(WindowTopRightCornerRadiusProperty, value); }
        }

        // Using a DependencyProperty as the backing store for WindowTopRightCornerRadius.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty WindowTopRightCornerRadiusProperty =
            DependencyProperty.Register("WindowTopRightCornerRadius", typeof(CornerRadius), typeof(ModernWindow), new PropertyMetadata(new CornerRadius(0, 25, 0, 0)));


        public CornerRadius WindowBottomRightCornerRadius
        {
            get { return (CornerRadius)GetValue(WindowBottomRightCornerRadiusProperty); }
            set { SetValue(WindowBottomRightCornerRadiusProperty, value); }
        }

        // Using a DependencyProperty as the backing store for WindowBottomRightCornerRadius.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty WindowBottomRightCornerRadiusProperty =
            DependencyProperty.Register("WindowBottomRightCornerRadius", typeof(CornerRadius), typeof(ModernWindow), new PropertyMetadata(new CornerRadius(0, 0, 25, 0)));


        public CornerRadius WindowBottomLeftCornerRadius
        {
            get { return (CornerRadius)GetValue(WindowBottomLeftCornerRadiusProperty); }
            set { SetValue(WindowBottomLeftCornerRadiusProperty, value); }
        }

        // Using a DependencyProperty as the backing store for WindowBottomLeftCornerRadius.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty WindowBottomLeftCornerRadiusProperty =
            DependencyProperty.Register("WindowBottomLeftCornerRadius", typeof(CornerRadius), typeof(ModernWindow), new PropertyMetadata(new CornerRadius(0, 0, 0, 25)));


        public object WindowCaptionButtons
        {
            get { return (object)GetValue(WindowCaptionButtonsProperty); }
            set { SetValue(WindowCaptionButtonsProperty, value); }
        }

        // Using a DependencyProperty as the backing store for WindowCaptionButtons.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty WindowCaptionButtonsProperty =
            DependencyProperty.Register("WindowCaptionButtons", typeof(object), typeof(ModernWindow), new PropertyMetadata(null));


        public Brush CaptionBackgroundBrush
        {
            get { return (Brush)GetValue(CaptionBackgroundBrushProperty); }
            set { SetValue(CaptionBackgroundBrushProperty, value); }
        }

        // Using a DependencyProperty as the backing store for CaptionBackgroundBrush.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty CaptionBackgroundBrushProperty =
            DependencyProperty.Register("CaptionBackgroundBrush", typeof(Brush), typeof(ModernWindow), new PropertyMetadata(Brushes.White));


        public Brush CaptionForegroundBrush
        {
            get { return (Brush)GetValue(CaptionForegroundBrushProperty); }
            set { SetValue(CaptionForegroundBrushProperty, value); }
        }

        // Using a DependencyProperty as the backing store for CaptionForegroundBrush.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty CaptionForegroundBrushProperty =
            DependencyProperty.Register("CaptionForegroundBrush", typeof(Brush), typeof(ModernWindow), new PropertyMetadata(Brushes.Black));


        public CornerRadius CaptionCornerRadius
        {
            get { return (CornerRadius)GetValue(CaptionCornerRadiusProperty); }
            set { SetValue(CaptionCornerRadiusProperty, value); }
        }

        // Using a DependencyProperty as the backing store for CaptionCornerRadius.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty CaptionCornerRadiusProperty =
            DependencyProperty.Register("CaptionCornerRadius", typeof(CornerRadius), typeof(ModernWindow), new PropertyMetadata(new CornerRadius(0)));


        public GridLength WindowLeftBorderWidth
        {
            get { return (GridLength)GetValue(WindowLeftBorderWidthProperty); }
            set { SetValue(WindowLeftBorderWidthProperty, value); }
        }

        // Using a DependencyProperty as the backing store for WindowLeftBorderWidth.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty WindowLeftBorderWidthProperty =
            DependencyProperty.Register("WindowLeftBorderWidth", typeof(GridLength), typeof(ModernWindow), new PropertyMetadata(new GridLength(5.0)));


        public GridLength WindowRightBorderWidth
        {
            get { return (GridLength)GetValue(WindowRightBorderWidthProperty); }
            set { SetValue(WindowRightBorderWidthProperty, value); }
        }

        // Using a DependencyProperty as the backing store for WindowRightBorderWidth.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty WindowRightBorderWidthProperty =
            DependencyProperty.Register("WindowRightBorderWidth", typeof(GridLength), typeof(ModernWindow), new PropertyMetadata(new GridLength(5.0)));


        public GridLength WindowTopBorderHeight
        {
            get { return (GridLength)GetValue(WindowTopBorderHeightProperty); }
            set { SetValue(WindowTopBorderHeightProperty, value); }
        }

        // Using a DependencyProperty as the backing store for WindowTopBorderWidth.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty WindowTopBorderHeightProperty =
            DependencyProperty.Register("WindowTopBorderHeight", typeof(GridLength), typeof(ModernWindow), new PropertyMetadata(new GridLength(5.0)));


        public GridLength WindowBottomBorderHeight
        {
            get { return (GridLength)GetValue(WindowBottomBorderHeightProperty); }
            set { SetValue(WindowBottomBorderHeightProperty, value); }
        }

        // Using a DependencyProperty as the backing store for WindowBottomBorderWidth.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty WindowBottomBorderHeightProperty =
            DependencyProperty.Register("WindowBottomBorderHeight", typeof(GridLength), typeof(ModernWindow), new PropertyMetadata(new GridLength(5.0)));


        public Brush MinimizeButtonBackground
        {
            get { return (Brush)GetValue(MinimizeButtonBackgroundProperty); }
            set { SetValue(MinimizeButtonBackgroundProperty, value); }
        }

        // Using a DependencyProperty as the backing store for MinimizeButtonBackground.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty MinimizeButtonBackgroundProperty =
            DependencyProperty.Register("MinimizeButtonBackground", typeof(Brush), typeof(ModernWindow), new PropertyMetadata(Brushes.White));


        public Brush MaximizeButtonBackground
        {
            get { return (Brush)GetValue(MaximizeButtonBackgroundProperty); }
            set { SetValue(MaximizeButtonBackgroundProperty, value); }
        }

        // Using a DependencyProperty as the backing store for MaximizeButtonBackground.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty MaximizeButtonBackgroundProperty =
            DependencyProperty.Register("MaximizeButtonBackground", typeof(Brush), typeof(ModernWindow), new PropertyMetadata(Brushes.Yellow));


        public Brush CloseButtonBackground
        {
            get { return (Brush)GetValue(CloseButtonBackgroundProperty); }
            set { SetValue(CloseButtonBackgroundProperty, value); }
        }

        // Using a DependencyProperty as the backing store for CloseButtonBackground.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty CloseButtonBackgroundProperty =
            DependencyProperty.Register("CloseButtonBackground", typeof(Brush), typeof(ModernWindow), new PropertyMetadata(Brushes.Red));


        public object MinimizeButtonContent
        {
            get { return (object)GetValue(MinimizeButtonContentProperty); }
            set { SetValue(MinimizeButtonContentProperty, value); }
        }

        // Using a DependencyProperty as the backing store for MinimizeButtonContent.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty MinimizeButtonContentProperty =
            DependencyProperty.Register("MinimizeButtonContent", typeof(object), typeof(ModernWindow), new PropertyMetadata(null));


        public object MaximizeButtonContent
        {
            get { return (object)GetValue(MaximizeButtonContentProperty); }
            set { SetValue(MaximizeButtonContentProperty, value); }
        }

        // Using a DependencyProperty as the backing store for MaximizeButtonContent.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty MaximizeButtonContentProperty =
            DependencyProperty.Register("MaximizeButtonContent", typeof(object), typeof(ModernWindow), new PropertyMetadata(null));


        public object CloseButtonConent
        {
            get { return (object)GetValue(CloseButtonConentProperty); }
            set { SetValue(CloseButtonConentProperty, value); }
        }

        // Using a DependencyProperty as the backing store for CloseButtonConent.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty CloseButtonConentProperty =
            DependencyProperty.Register("CloseButtonConent", typeof(object), typeof(ModernWindow), new PropertyMetadata(null));


        public CornerRadius CaptionButtonsCornerRadius
        {
            get { return (CornerRadius)GetValue(CaptionButtonsCornerRadiusProperty); }
            set { SetValue(CaptionButtonsCornerRadiusProperty, value); }
        }

        // Using a DependencyProperty as the backing store for CaptionButtonsCornerRadius.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty CaptionButtonsCornerRadiusProperty =
            DependencyProperty.Register("CaptionButtonsCornerRadius", typeof(CornerRadius), typeof(ModernWindow), new PropertyMetadata(new CornerRadius(10.0)));


        public double CaptionButtonsWidth
        {
            get { return (double)GetValue(CaptionButtonsWidthProperty); }
            set { SetValue(CaptionButtonsWidthProperty, value); }
        }

        // Using a DependencyProperty as the backing store for CaptionButtonsWidth.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty CaptionButtonsWidthProperty =
            DependencyProperty.Register("CaptionButtonsWidth", typeof(double), typeof(ModernWindow), new PropertyMetadata(20.0));


        public double CaptionButtonsHeight
        {
            get { return (double)GetValue(CaptionButtonsHeightProperty); }
            set { SetValue(CaptionButtonsHeightProperty, value); }
        }

        // Using a DependencyProperty as the backing store for CaptionButtonsHeight.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty CaptionButtonsHeightProperty =
            DependencyProperty.Register("CaptionButtonsHeight", typeof(double), typeof(ModernWindow), new PropertyMetadata(20.0));


        public Thickness CaptionButtonsMargin
        {
            get { return (Thickness)GetValue(CaptionButtonsMarginProperty); }
            set { SetValue(CaptionButtonsMarginProperty, value); }
        }

        // Using a DependencyProperty as the backing store for CaptionButtonsMargin.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty CaptionButtonsMarginProperty =
            DependencyProperty.Register("CaptionButtonsMargin", typeof(Thickness), typeof(ModernWindow), new PropertyMetadata(new Thickness(5, 0, 0, 0)));


        public Thickness CaptionButtonsPadding
        {
            get { return (Thickness)GetValue(CaptionButtonsPaddingProperty); }
            set { SetValue(CaptionButtonsPaddingProperty, value); }
        }

        // Using a DependencyProperty as the backing store for CaptionButtonsPadding.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty CaptionButtonsPaddingProperty =
            DependencyProperty.Register("CaptionButtonsPadding", typeof(Thickness), typeof(ModernWindow), new PropertyMetadata(new Thickness(0)));


        public FontWeight CaptionButtonsFontWeight
        {
            get { return (FontWeight)GetValue(CaptionButtonsFontWeightProperty); }
            set { SetValue(CaptionButtonsFontWeightProperty, value); }
        }

        // Using a DependencyProperty as the backing store for CaptionButtonsFontWeight.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty CaptionButtonsFontWeightProperty =
            DependencyProperty.Register("CaptionButtonsFontWeight", typeof(FontWeight), typeof(ModernWindow), new PropertyMetadata(FontWeights.Normal));



        public object MinimizeCaptionButtonToolTip
        {
            get { return (object)GetValue(MinimizeCaptionButtonToolTipProperty); }
            set { SetValue(MinimizeCaptionButtonToolTipProperty, value); }
        }

        // Using a DependencyProperty as the backing store for MinimizeCaptionButtonToolTip.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty MinimizeCaptionButtonToolTipProperty =
            DependencyProperty.Register("MinimizeCaptionButtonToolTip", typeof(object), typeof(ModernWindow), new PropertyMetadata("Minimize"));


        public object MaximizeCaptionButtonToolTip
        {
            get { return (object)GetValue(MaximizeCaptionButtonToolTipProperty); }
            set { SetValue(MaximizeCaptionButtonToolTipProperty, value); }
        }

        // Using a DependencyProperty as the backing store for MaximizeCaptionButtonToolTip.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty MaximizeCaptionButtonToolTipProperty =
            DependencyProperty.Register("MaximizeCaptionButtonToolTip", typeof(object), typeof(ModernWindow), new PropertyMetadata("Maximize"));


        public object CloseButtonToolTip
        {
            get { return (object)GetValue(CloseButtonToolTipProperty); }
            set { SetValue(CloseButtonToolTipProperty, value); }
        }

        // Using a DependencyProperty as the backing store for CloseButtonToolTip.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty CloseButtonToolTipProperty =
            DependencyProperty.Register("CloseButtonToolTip", typeof(object), typeof(ModernWindow), new PropertyMetadata("Close"));



        public double CaptionButtonsFontSize
        {
            get { return (double)GetValue(CaptionButtonsFontSizeProperty); }
            set { SetValue(CaptionButtonsFontSizeProperty, value); }
        }

        // Using a DependencyProperty as the backing store for CaptionButtonsFontSize.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty CaptionButtonsFontSizeProperty =
            DependencyProperty.Register("CaptionButtonsFontSize", typeof(double), typeof(ModernWindow), new PropertyMetadata(12.0));


        public double IconWidth
        {
            get { return (double)GetValue(IconWidthProperty); }
            set { SetValue(IconWidthProperty, value); }
        }

        // Using a DependencyProperty as the backing store for IconWidth.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty IconWidthProperty =
            DependencyProperty.Register("IconWidth", typeof(double), typeof(ModernWindow), new PropertyMetadata(20.0));


        public double IconHeight
        {
            get { return (double)GetValue(IconHeightProperty); }
            set { SetValue(IconHeightProperty, value); }
        }

        // Using a DependencyProperty as the backing store for IconHeight.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty IconHeightProperty =
            DependencyProperty.Register("IconHeight", typeof(double), typeof(ModernWindow), new PropertyMetadata(20.0));


        public Thickness IconMargin
        {
            get { return (Thickness)GetValue(IconMarginProperty); }
            set { SetValue(IconMarginProperty, value); }
        }

        // Using a DependencyProperty as the backing store for IconMargin.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty IconMarginProperty =
            DependencyProperty.Register("IconMargin", typeof(Thickness), typeof(ModernWindow), new PropertyMetadata(new Thickness(5.0)));


        public Thickness CaptionTextPadding
        {
            get { return (Thickness)GetValue(CaptionTextPaddingProperty); }
            set { SetValue(CaptionTextPaddingProperty, value); }
        }

        // Using a DependencyProperty as the backing store for CaptionTextPadding.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty CaptionTextPaddingProperty =
            DependencyProperty.Register("CaptionTextPadding", typeof(Thickness), typeof(ModernWindow), new PropertyMetadata(new Thickness(5, 0, 5, 0)));


        public Thickness CaptionTextMargin
        {
            get { return (Thickness)GetValue(CaptionTextMarginProperty); }
            set { SetValue(CaptionTextMarginProperty, value); }
        }

        // Using a DependencyProperty as the backing store for CaptionTextMargin.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty CaptionTextMarginProperty =
            DependencyProperty.Register("CaptionTextMargin", typeof(Thickness), typeof(ModernWindow), new PropertyMetadata(new Thickness(0)));

                public Cursor CaptionCursor
        {
            get { return (Cursor)GetValue(CaptionCursorProperty); }
            set { SetValue(CaptionCursorProperty, value); }
        }

        // Using a DependencyProperty as the backing store for CaptionCursor.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty CaptionCursorProperty =
            DependencyProperty.Register("CaptionCursor", typeof(Cursor), typeof(ModernWindow), new PropertyMetadata(Cursors.Arrow));


        public Cursor CaptionButtonsCursor
        {
            get { return (Cursor)GetValue(CaptionButtonsCursorProperty); }
            set { SetValue(CaptionButtonsCursorProperty, value); }
        }

        // Using a DependencyProperty as the backing store for CaptionButtonsCursor.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty CaptionButtonsCursorProperty =
            DependencyProperty.Register("CaptionButtonsCursor", typeof(Cursor), typeof(ModernWindow), new PropertyMetadata(Cursors.Arrow));


        public bool DefaultCaptionButtonsIsVisible { get; private set; }

        #endregion

        #endregion

Contribution guidelines

  • Contact Repo owner

Who do I talk to?

  • Repo owner or admin
  • Other community or team contact
Product Compatible and additional computed target framework versions.
.NET net6.0-windows7.0 is compatible.  net7.0-windows was computed.  net7.0-windows7.0 is compatible.  net8.0-windows was computed.  net8.0-windows7.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0-windows7.0

    • No dependencies.
  • net7.0-windows7.0

    • No dependencies.
  • net8.0-windows7.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.4.0 155 1/24/2024
1.3.0 213 11/28/2023
1.2.0 140 11/14/2023
1.1.0 149 11/13/2023
1.0.0 139 11/13/2023

Targets mutlitple .NET versions.