Class ApplicationMenu
Represents an application menu control.
Inheritance
Implements
Namespace: Sartorius.SAF.Presentation.Controls
Assembly: Sartorius.SAF.Presentation.Controls.dll
Syntax
[TemplatePart(Name = "PART_ScrollViewer", Type = typeof(ScrollViewer))]
public class ApplicationMenu : ItemsControl, IAnimatable, ISupportInitialize, IFrameworkInputElement, IInputElement, IQueryAmbient, IContainItemStorage, IAddChild
Examples
This example illustrates how to use the ApplicationMenu by creating ApplicationMenuItem in xaml.
<SAF:MainWindow.ApplicationMenu>
<SAF:ApplicationMenu>
<!-- #region ApplicationMenuItems -->
<SAF:ApplicationMenuItem Caption="Administration"
Description="Provides basic administration functionality."
ImageSource="AdminPreviewImage.png"
IconSource="AdminIcon.png"
Command="{Binding ActivateAdministrationCommand}" />
<SAF:ApplicationMenuItem Caption="Monitoring"
Description="Provides monitoring functionality for the running process."
ImageSource="MonitoringPreviewImage.png"
IconSource="MonitoringIcon.png"
Command="{Binding ActivateMonitoringCommand}" />
<SAF:ApplicationMenuItem Caption="Analysis"
Description="Provides functionality to analyze the completed processes."
ImageSource="AnalysisPreviewImage.png"
IconSource="AnalysisIcon.png"
Command="{Binding ActivateMonitoringCommand}" />
This example illustrates how to use the ApplicationMenu by binding a list of objects that implement IApplicationMenuItem.
<SAF:MainWindow x:Class="Sartorius.SAF.Documentation.Examples.Controls.MainWindow.ApplicationMenuExample"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:SAF="http://www.sartorius.com/SAF"
Title="Example App">
<SAF:MainWindow.ApplicationMenu>
<SAF:ApplicationMenu BackgroundImage="pack://application:,,,/MyAssemblyName;component/Resources/Images/Image"
ItemsSource="{Binding ApplicationMenuItems}">
<SAF:ApplicationMenu.AuxiliaryPane>
<SAF:AuxiliaryPaneItem Header="About"
Command="{Binding ShowAboutDialogCommand}">
<TextBlock TextTrimming="CharacterEllipsis"
LineHeight="16"
TextWrapping="Wrap"
Text="Display information about the SAF SampleApp application and its installed modules." />
</SAF:AuxiliaryPaneItem>
<SAF:AuxiliaryPaneItem Header="Help"
Command="{Binding ShowHelpCommand}">
<TextBlock TextTrimming="CharacterEllipsis"
LineHeight="16"
TextWrapping="Wrap"
Text="Open the help window to get more information on how to use this application." />
</SAF:AuxiliaryPaneItem>
</SAF:ApplicationMenu.AuxiliaryPane>
<SAF:ApplicationMenu.FooterPaneContent>
<TextBlock Text="Copyright 2016 by Sartorius"
Style="{SAF:Style TextBlock}"
VerticalAlignment="Bottom"
Foreground="{SAF:Brush Foreground06}"
Margin="20,0,0,18" />
</SAF:ApplicationMenu.FooterPaneContent>
</SAF:ApplicationMenu>
</SAF:MainWindow.ApplicationMenu>
</SAF:MainWindow>
Constructors
View SourceApplicationMenu()
Creates a new instance of the ApplicationMenu class.
Declaration
public ApplicationMenu()
Fields
View SourceAuxiliaryPaneProperty
The DependencyProperty for the AuxiliaryPane property.
Declaration
public static readonly DependencyProperty AuxiliaryPaneProperty
Field Value
| Type | Description |
|---|---|
| DependencyProperty |
BackgroundImageProperty
The DependencyProperty for the BackgroundImage property.
Declaration
public static readonly DependencyProperty BackgroundImageProperty
Field Value
| Type | Description |
|---|---|
| DependencyProperty |
BackgroundImageTemplateProperty
Defines the DependencyProperty for the BackgroundImage property.
Declaration
public static readonly DependencyProperty BackgroundImageTemplateProperty
Field Value
| Type | Description |
|---|---|
| DependencyProperty |
FooterPaneContentProperty
The DependencyProperty for the FooterPaneContent property.
Declaration
public static readonly DependencyProperty FooterPaneContentProperty
Field Value
| Type | Description |
|---|---|
| DependencyProperty |
VisibleItemCountProperty
Identifies the VisibleItemCount dependency property.
Declaration
public static readonly DependencyProperty VisibleItemCountProperty
Field Value
| Type | Description |
|---|---|
| DependencyProperty |
Properties
View SourceAuxiliaryPane
Gets or sets the auxiliary pane.
Declaration
[SuppressMessage("Usage", "CA2227:Collection properties should be read only", Justification = "Used as dependency property in Xaml.")]
public IList AuxiliaryPane { get; set; }
Property Value
| Type | Description |
|---|---|
| IList |
BackgroundImage
Gets or sets the background image for the application menu.
Declaration
public object BackgroundImage { get; set; }
Property Value
| Type | Description |
|---|---|
| object |
Remarks
You can directly set an Uri of an image. You can also set any FrameworkElement or any object for which an implicit DataTemplate exists.
BackgroundImageTemplate
Gets or sets the DataTemplate for the BackgroundImage.
Declaration
public DataTemplate BackgroundImageTemplate { get; set; }
Property Value
| Type | Description |
|---|---|
| DataTemplate |
FooterPaneContent
Gets or sets the content of the footer pane.
Declaration
public object FooterPaneContent { get; set; }
Property Value
| Type | Description |
|---|---|
| object |
VisibleItemCount
Gets the visible item count.
Declaration
public int VisibleItemCount { get; }
Property Value
| Type | Description |
|---|---|
| int |
Methods
View SourceClearContainerForItemOverride(DependencyObject, object)
Declaration
protected override void ClearContainerForItemOverride(DependencyObject element, object item)
Parameters
| Type | Name | Description |
|---|---|---|
| DependencyObject | element | |
| object | item |
Overrides
View SourceGetContainerForItemOverride()
Creates or identifies the element that is used to display the given item.
Declaration
protected override DependencyObject GetContainerForItemOverride()
Returns
| Type | Description |
|---|---|
| DependencyObject | The element that is used to display the given item. |
Overrides
View SourceIsItemItsOwnContainerOverride(object)
Determines if the specified item is (or is eligible to be) its own container.
Declaration
protected override bool IsItemItsOwnContainerOverride(object item)
Parameters
| Type | Name | Description |
|---|---|---|
| object | item | The item to check. |
Returns
| Type | Description |
|---|---|
| bool | true if the item is (or is eligible to be) its own container; otherwise, false. |
Overrides
View SourceOnApplyTemplate()
Invoked whenever application code or internal processes call ApplyTemplate().
Declaration
public override void OnApplyTemplate()
Overrides
View SourceOnItemsChanged(NotifyCollectionChangedEventArgs)
Invoked when the Items property changes.
Declaration
protected override void OnItemsChanged(NotifyCollectionChangedEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| NotifyCollectionChangedEventArgs | e | Information about the change. |
Overrides
View SourcePrepareContainerForItemOverride(DependencyObject, object)
Declaration
protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
Parameters
| Type | Name | Description |
|---|---|---|
| DependencyObject | element | |
| object | item |