-
Notifications
You must be signed in to change notification settings - Fork 263
WPF Application Support
WPF provides a framework for application support in the Sce.Atf.Wpf
and Sce.Atf.Wpf.Applications
namespaces.
MainWindow
is a MEF component that provides an application's main window. It is defined in MainWindow.xaml
and MainWindow.xaml.cs
.
MainWindow
is used in the ATF Simple DOM Editor WPF Sample, as seen in its App
class's TypeCatalog
. That's all you need to do to use MainWindow
.
You can use this component as is, or modify it to suit your application.
Here is MainWindow.xaml
:
<Window x:Class="Sce.Atf.Wpf.Controls.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="clr-namespace:Sce.Atf.Wpf"
xmlns:b="clr-namespace:Sce.Atf.Wpf.Behaviors"
Height="600" Width="600"
WindowStartupLocation="Manual"
AllowDrop="False"
Style="{DynamicResource {x:Type Window}}"
b:CS4Options.DisplayMode="True"
b:CS4Options.UseLayoutRounding="True"
Name="me"
>
<DockPanel Name="dockPanel">
<Menu DockPanel.Dock="Top" Name="menuBar"
ItemsSource="{Binding MainMenuViewModel.Menus, ElementName=me}"
Style="{StaticResource ResourceKey={x:Static l:Resources.MenuStyleKey}}"/>
<ToolBarTray DockPanel.Dock="Top" Name="toolBarTray"
Style="{StaticResource ResourceKey={x:Static l:Resources.ToolBarTrayStyleKey}}"/>
<StatusBar DockPanel.Dock="Bottom" Name="statusBar"
MinHeight="16"
ItemsSource="{Binding StatusItems, ElementName=me}"
Style="{StaticResource ResourceKey={x:Static l:Resources.StatusBarStyleKey}}"/>
</DockPanel>
</Window>
This XAML shows that MainWindow
is a System.Windows.Window
containing a System.Windows.Controls.DockPanel
holding System.Windows.Controls.Menu
, System.Windows.Controls.ToolBarTray
, and System.Windows.Controls.Primitives.StatusBar
controls. Each control has a dependency property for its style, defined in Sce.Atf.Wpf.Resources
.
MainWindow.xaml
specifies initial values for several Window
properties: Height
, Width
, WindowStartupLocation
, and AllowDrop
.
MainWindow.xaml
also sets several TextOptions
dependency properties true: DisplayMode
and LayoutRounding
. Display Mode uses GDI compatible text metrics; for more information, see
WPF 4.0 Text Stack Improvements. Layout Rounding forces the WPF layout system to position elements on pixel boundaries, eliminating many negative side effects of sub-pixel positioning; for details, see Layout Rounding.
MainWindow.xaml.cs has properties for view models of the application's toolbar and menu. ToolBarViewModel
provides various toolbar utilities, such as enumerating items for a given toolbar. MainMenuViewModel
has a similar offering for menus. For more information on view models in ATF, see WPF ViewModels in ATF.
The StatusItems
property gets and sets items in the StatusBar.
The MainContent
property gets or sets the control that represents the main content of the window.
- ATF and WPF Overview: Overview of what ATF offers for WPF.
- WPF Application: Discuss how WPF applications differ from WinForms ones in basic application structure.
- Parallels in WPF and WinForms Support: Discusses features WPF offers that are similar to WinForms.
- WPF Application Support: Discussion of classes generally supporting applications.
- WPF Dialogs in ATF: WPF dialogs you can use.
- WPF Behaviors in ATF: ATF support for WPF behaviors.
- WPF Markup Extensions in ATF: ATF support for WPF Markup extensions.
- WPF ViewModels in ATF: Discuss WPF ViewModel support in ATF.
- Converting from WinForms to WPF: Tells how to convert a WinForms ATF-based application to WPF.
- Home
- Getting Started
- Features & Benefits
- Requirements & Dependencies
- Gallery
- Technology & Samples
- Adoption
- News
- Release Notes
- ATF Community
- Searching Documentation
- Using Documentation
- Videos
- Tutorials
- How To
- Programmer's Guide
- Reference
- Code Samples
- Documentation Files
© 2014-2015, Sony Computer Entertainment America LLC