Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version
Go to top

Presentation Patterns for XAML based Applications

, 17 Sep 2013
Design patterns on the presentation layer for WPF, Silverlight and Windows Phone applications.
XamlPatterns_v1.1.0.0.zip
Program
App.Desktop.ico
App.Silverlight.png
App.WindowsPhone.png
Background.WindowsPhone.png
Examples
AssemblyBrowser
View
ViewModel
AssemblyBrowser.cd
CustomerAdmin
Editor
View
ViewModel
GridViewBinding
View
ViewModel
ListBoxBinding
View
ViewModel
MediaPlayer
Images
Pause.png
Play.png
Resume.png
Stop.png
View
ViewModel
OrderBrowser
Editor
Images
Companies.png
Company.png
Customer.png
Customers.png
Order.png
OrderItem.png
OrderItems.png
Orders.png
View
ViewModel
OrderBrowser.cd
Selection
View
ViewModel
obj
x86
Debug
TempPE
Presentation
ViewModel
Dependency
Notifiable
Program.Silverlight.suo
Properties
SplashScreenImage.jpg
Videos
SampleVideo.wmv
WMA_WMAV1_wmaV1.wma
Controls
obj
Debug
TempPE
Properties
Core
Actions
Data
Item
Media
Navigation
Collection
Commands
Data
Edit
Media
Navigation
Diagnostics
obj
Debug
TempPE
Presentation
Dependency
ItemModel.cd
Notifiable
Properties
Windows
Converter
Input
docu
Performance.xls
XamlPatterns_en.pdf
Pub
Desktop.Debug
Itenso.Community.XamlPatterns.Controls.dll
Itenso.Community.XamlPatterns.dll
Desktop.Release
Itenso.Community.XamlPatterns.Controls.dll
Itenso.Community.XamlPatterns.dll
Silverlight.Debug
Itenso.Community.XamlPatterns.Controls.dll
Itenso.Community.XamlPatterns.dll
Silverlight.Release
Itenso.Community.XamlPatterns.Controls.dll
Itenso.Community.XamlPatterns.dll
WindowsPhone.Debug
Itenso.Community.XamlPatterns.Controls.dll
Itenso.Community.XamlPatterns.dll
WindowsPhone.Release
Itenso.Community.XamlPatterns.Controls.dll
Itenso.Community.XamlPatterns.dll
XamlPatterns.Desktop.suo
XamlPatterns.Silverlight.suo
XamlPatterns.WindowsPhone.suo
<?xml version="1.0" encoding="UTF-8" ?>
<!-- == FILE ================================================================
== name       : CustomerAdminView.Desktop.xaml
== project    : Itenso Community
== created    : Jani Giannoudis - 2012.05.05
== language   : Microsoft eXtensible Application Markup Language
== environment: .NET 4.0
== copyright  : (c) 2004-2012 by Itenso GmbH, Switzerland
========================================================================= -->
<UserControl
	x:Class="Itenso.Community.XamlPatterns.Program.Examples.CustomerAdmin.View.CustomerAdminView"
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:XamlControls="clr-namespace:Itenso.Community.XamlPatterns.Controls;assembly=Itenso.Community.XamlPatterns.Controls">

	<Grid>

		<Grid.RowDefinitions>
			<RowDefinition
				Height="Auto" />
			<RowDefinition
				Height="*" />
			<RowDefinition
				Height="Auto" />
		</Grid.RowDefinitions>

		<StackPanel
			Grid.Row="0"
			Orientation="Horizontal">
			<Button
				Content="New"
				MinWidth="60"
				Margin="10,5,0,5"
				Command="{Binding Editor.ItemCreateCommand}" />
			<Button
				Content="Edit"
				MinWidth="60"
				Margin="10,5,0,5"
				Command="{Binding Editor.ItemEditCommand}" />
			<Button
				Content="Delete"
				MinWidth="60"
				Margin="10,5,0,5"
				Command="{Binding Editor.ItemDeleteCommand}" />
			<CheckBox
				Margin="10,0,0,0"
				Content="Sync to New"
				VerticalAlignment="Center"
				IsChecked="{Binding Editor.View.SyncCurrentToNewItem, Mode=TwoWay}" />
			<TextBlock
				Margin="10,0,0,0"
				VerticalAlignment="Center"
				Text="Insert Mode:" />
			<ComboBox
				Margin="5,0,0,0"
				VerticalAlignment="Center"
				ItemsSource="{Binding Editor.ItemInsertModes}"
				SelectedItem="{Binding Editor.InsertMode, Mode=TwoWay}" />
		</StackPanel>

		<XamlControls:ModelDataGrid
			Grid.Row="1"
			Margin="5,0"
			RowHeight="40"
			IsReadOnly="True"
			SelectionMode="Single"
			AutoGenerateColumns="False"
			HeadersVisibility="All"
			RowHeaderWidth="20"
			AlternatingRowBackground="#FFF3F3F3"
			IsSynchronizedWithCurrentItem="True"
			ItemsSource="{Binding Customers}"
			SelectedItem="{Binding Editor.Item, Mode=TwoWay}"
			ItemCreateCommand="{Binding Editor.ItemCreateCommand}"
			ItemEditCommand="{Binding Editor.ItemEditCommand}"
			ItemDeleteCommand="{Binding Editor.ItemDeleteCommand}">

			<DataGrid.Columns>
				<DataGridTextColumn
					Header="First Name"
					Binding="{Binding FirstName}" />
				<DataGridTextColumn
					Header="Last Name"
					Binding="{Binding LastName}" />
				<DataGridTextColumn
					Header="Address"
					Binding="{Binding Address}" />
				<DataGridCheckBoxColumn
					Header="New"
					Binding="{Binding IsNew}" />
				<DataGridCheckBoxColumn
					Header="Subscribed"
					Binding="{Binding IsSubscribed}"
					IsThreeState="True" />
				<DataGridTextColumn
					Header="Last Modified"
					Binding="{Binding LastModified, StringFormat=\{0:dd/MM/yyyy HH:mm:ss\}}" />
				<DataGridTemplateColumn
					Header="Actions">
					<DataGridTemplateColumn.CellTemplate>
						<DataTemplate>
							<StackPanel
								HorizontalAlignment="Center"
								Orientation="Horizontal">
								<Button
									Content="Edit"
									Height="25"
									Command="{Binding RelativeSource={RelativeSource AncestorType={x:Type XamlControls:ModelDataGrid}}, Path=ItemEditCommand}" />
							</StackPanel>
						</DataTemplate>
					</DataGridTemplateColumn.CellTemplate>
				</DataGridTemplateColumn>

			</DataGrid.Columns>

		</XamlControls:ModelDataGrid>

		<!-- status bar -->
		<Grid
			Grid.Row="2">
			<Grid.ColumnDefinitions>
				<ColumnDefinition
					Width="*" />
				<ColumnDefinition
					Width="*" />
				<ColumnDefinition
					Width="*" />
				<ColumnDefinition
					Width="Auto" />
				<ColumnDefinition
					Width="Auto" />
				<ColumnDefinition
					Width="Auto" />
			</Grid.ColumnDefinitions>

			<TextBlock
				Grid.Column="0"
				Margin="5,0,0,0"
				VerticalAlignment="Center"
				Text="{Binding Editor.Item.FirstName}" />

			<TextBlock
				Grid.Column="1"
				Margin="5,0,0,0"
				VerticalAlignment="Center"
				Text="{Binding Editor.Item.LastName}" />

			<TextBlock
				Grid.Column="2"
				Margin="5,0,0,0"
				VerticalAlignment="Center"
				Text="{Binding Editor.Item.Address}" />

			<TextBlock
				Grid.Column="3"
				Margin="5,0,0,0"
				MinWidth="80"
				VerticalAlignment="Center"
				HorizontalAlignment="Right"
				Text="{Binding Editor.Item.IsNew, StringFormat=IsNew: \{0\}}" />

			<TextBlock
				Grid.Column="4"
				Margin="5,0,0,0"
				MinWidth="100"
				VerticalAlignment="Center"
				HorizontalAlignment="Right"
				Text="{Binding Editor.Item.IsSubscribed, StringFormat=IsSubscribed: \{0\}}" />

			<TextBlock
				Grid.Column="5"
				Margin="5,0,5,0"
				MinWidth="70"
				VerticalAlignment="Center"
				HorizontalAlignment="Right"
				Text="{Binding Editor.CurrentPosition, StringFormat=Record #\{0\}}" />

		</Grid>

	</Grid>

</UserControl>
<!-- == EOF ============================================================= -->

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Jani Giannoudis
Software Developer (Senior)
Switzerland Switzerland
Jani is Co-founder of Meerazo.com, a free service which allows to share resources like locations, things, persons and their services in a cooperating group of people.

| Advertise | Privacy | Mobile
Web04 | 2.8.140926.1 | Last Updated 18 Sep 2013
Article Copyright 2012 by Jani Giannoudis
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid