Class TitleBar
Custom navigation buttons for the window.
[TemplatePart(Name = "PART_MainGrid", Type = typeof(Grid))]
[TemplatePart(Name = "PART_Icon", Type = typeof(Image))]
[TemplatePart(Name = "PART_HelpButton", Type = typeof(TitleBarButton))]
[TemplatePart(Name = "PART_MinimizeButton", Type = typeof(TitleBarButton))]
[TemplatePart(Name = "PART_MaximizeButton", Type = typeof(TitleBarButton))]
[TemplatePart(Name = "PART_RestoreButton", Type = typeof(TitleBarButton))]
[TemplatePart(Name = "PART_CloseButton", Type = typeof(TitleBarButton))]
public class TitleBar : Control, IAnimatable, IFrameworkInputElement, IInputElement, ISupportInitialize, IQueryAmbient, IThemeControl
- Inheritance
-
TitleBar
- Implements
- Inherited Members
Constructors
TitleBar()
public TitleBar()
Fields
ApplicationThemeProperty
Identifies the ApplicationTheme dependency property.
public static readonly DependencyProperty ApplicationThemeProperty
Field Value
ButtonsBackgroundProperty
Identifies the ButtonsBackground dependency property.
public static readonly DependencyProperty ButtonsBackgroundProperty
Field Value
ButtonsForegroundProperty
Identifies the ButtonsForeground dependency property.
public static readonly DependencyProperty ButtonsForegroundProperty
Field Value
CanMaximizeProperty
Identifies the CanMaximize dependency property.
public static readonly DependencyProperty CanMaximizeProperty
Field Value
CloseClickedEvent
Identifies the CloseClicked routed event.
public static readonly RoutedEvent CloseClickedEvent
Field Value
CloseWindowByDoubleClickOnIconProperty
Identifies the CloseWindowByDoubleClickOnIcon dependency property.
public static readonly DependencyProperty CloseWindowByDoubleClickOnIconProperty
Field Value
ForceShutdownProperty
Identifies the ForceShutdown dependency property.
public static readonly DependencyProperty ForceShutdownProperty
Field Value
HeaderProperty
Identifies the Header dependency property.
public static readonly DependencyProperty HeaderProperty
Field Value
HelpClickedEvent
Identifies the HelpClicked routed event.
public static readonly RoutedEvent HelpClickedEvent
Field Value
IconProperty
Identifies the Icon dependency property.
public static readonly DependencyProperty IconProperty
Field Value
IsMaximizedProperty
Identifies the IsMaximized dependency property.
public static readonly DependencyProperty IsMaximizedProperty
Field Value
MaximizeClickedEvent
Identifies the MaximizeClicked routed event.
public static readonly RoutedEvent MaximizeClickedEvent
Field Value
MinimizeClickedEvent
Identifies the MinimizeClicked routed event.
public static readonly RoutedEvent MinimizeClickedEvent
Field Value
ShowCloseProperty
Identifies the ShowClose dependency property.
public static readonly DependencyProperty ShowCloseProperty
Field Value
ShowHelpProperty
Identifies the ShowHelp dependency property.
public static readonly DependencyProperty ShowHelpProperty
Field Value
ShowMaximizeProperty
Identifies the ShowMaximize dependency property.
public static readonly DependencyProperty ShowMaximizeProperty
Field Value
ShowMinimizeProperty
Identifies the ShowMinimize dependency property.
public static readonly DependencyProperty ShowMinimizeProperty
Field Value
TemplateButtonCommandProperty
Identifies the TemplateButtonCommand dependency property.
public static readonly DependencyProperty TemplateButtonCommandProperty
Field Value
TitleProperty
Identifies the Title dependency property.
public static readonly DependencyProperty TitleProperty
Field Value
Properties
ApplicationTheme
Gets the theme that is currently set.
public ApplicationTheme ApplicationTheme { get; set; }
Property Value
ButtonsBackground
Gets or sets the background of the navigation buttons when hovered.
[Bindable(true)]
public Brush ButtonsBackground { get; set; }
Property Value
ButtonsForeground
Gets or sets the foreground of the navigation buttons.
[Bindable(true)]
public Brush ButtonsForeground { get; set; }
Property Value
CanMaximize
Gets or sets a value indicating whether the maximize functionality is enabled. If disabled the MaximizeActionOverride action won't be called
public bool CanMaximize { get; set; }
Property Value
CloseWindowByDoubleClickOnIcon
Gets or sets a value indicating whether the window can be closed by double clicking on the icon
public bool CloseWindowByDoubleClickOnIcon { get; set; }
Property Value
ForceShutdown
Gets or sets a value indicating whether the controls affect main application window.
public bool ForceShutdown { get; set; }
Property Value
Header
Gets or sets the content displayed in the TitleBar.
public object? Header { get; set; }
Property Value
Icon
Gets or sets the titlebar icon.
public IconElement? Icon { get; set; }
Property Value
IsMaximized
Gets a value indicating whether the current window is maximized.
public bool IsMaximized { get; }
Property Value
MaximizeActionOverride
Gets or sets the Action that should be executed when the Maximize button is clicked."/>
public Action<TitleBar, Window>? MaximizeActionOverride { get; set; }
Property Value
MinimizeActionOverride
Gets or sets what Action should be executed when the Minimize button is clicked.
public Action<TitleBar, Window>? MinimizeActionOverride { get; set; }
Property Value
ShowClose
Gets or sets a value indicating whether to show the close button.
public bool ShowClose { get; set; }
Property Value
ShowHelp
Gets or sets a value indicating whether to show the help button
public bool ShowHelp { get; set; }
Property Value
ShowMaximize
Gets or sets a value indicating whether to show the maximize button.
public bool ShowMaximize { get; set; }
Property Value
ShowMinimize
Gets or sets a value indicating whether to show the minimize button.
public bool ShowMinimize { get; set; }
Property Value
TemplateButtonCommand
Gets the command triggered when clicking the titlebar button.
public IRelayCommand TemplateButtonCommand { get; }
Property Value
Title
Gets or sets title displayed on the left.
public string? Title { get; set; }
Property Value
Methods
OnApplyTemplate()
Invoked whenever application code or an internal process, such as a rebuilding layout pass, calls the ApplyTemplate method.
public override void OnApplyTemplate()
OnInitialized(EventArgs)
Raises the Initialized event. This method is invoked whenever IsInitialized is set to true
internally.
protected override void OnInitialized(EventArgs e)
Parameters
e
EventArgsThe RoutedEventArgs that contains the event data.
OnLoaded(object, RoutedEventArgs)
protected virtual void OnLoaded(object sender, RoutedEventArgs e)
Parameters
sender
objecte
RoutedEventArgs
OnThemeChanged(ApplicationTheme, Color)
This virtual method is triggered when the app's theme changes.
protected virtual void OnThemeChanged(ApplicationTheme currentApplicationTheme, Color systemAccent)
Parameters
currentApplicationTheme
ApplicationThemesystemAccent
Color
Events
CloseClicked
Event triggered after clicking close button.
public event TypedEventHandler<TitleBar, RoutedEventArgs> CloseClicked
Event Type
HelpClicked
Event triggered after clicking help button
public event TypedEventHandler<TitleBar, RoutedEventArgs> HelpClicked
Event Type
MaximizeClicked
Event triggered after clicking maximize or restore button.
public event TypedEventHandler<TitleBar, RoutedEventArgs> MaximizeClicked
Event Type
MinimizeClicked
Event triggered after clicking minimize button.
public event TypedEventHandler<TitleBar, RoutedEventArgs> MinimizeClicked