Click here to Skip to main content
15,878,959 members
Articles / DevOps / Testing

Composite Application Reloaded

Rate me:
Please Sign up or sign in to vote.
4.88/5 (38 votes)
11 May 2011CPOL12 min read 117.5K   1.5K   95  
A much simpler composite application library.
<UserControl x:Class="MEFedMVVMDemo.Views.UsersScreen"
			 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
			 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
			 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
			 xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
			 xmlns:g="http://schemas.galador.net/xaml/libraries"
			 xmlns:models="clr-namespace:MEFedMVVMDemo.ViewModels"
			 xmlns:topns="clr-namespace:MEFedMVVMDemo"
			 mc:Ignorable="d" 
			 d:DesignHeight="300" d:DesignWidth="300"
			 g:Composition.DesignerDataContext="models:TestViewModel"
			 topns:VisualState.Name="{Binding ModelState}"
			 >
	<UserControl.Resources>
		<DataTemplate x:Key="UserTemplate">
			<Grid >
				<Grid.ColumnDefinitions>
					<ColumnDefinition Width="100"/>
					<ColumnDefinition Width="100"/>
					<ColumnDefinition Width="100"/>
				</Grid.ColumnDefinitions>
				<TextBlock Text="{Binding Name}"/>
				<TextBlock Text="{Binding Surname}" Grid.Column="1"/>
				<TextBlock Text="{Binding Age}" Grid.Column="2"/>
			</Grid >
		</DataTemplate>
	</UserControl.Resources>
	<Grid>
		<ListBox 
			ItemsSource="{Binding Users}" 
			SelectedItem="{Binding SelectedUser, Mode=TwoWay}" 
			ItemTemplate="{StaticResource UserTemplate}" 
			Margin="0,20,0,0"/>
		<TextBlock 
			x:Name="textBlock" 
			HorizontalAlignment="Center" 
			TextWrapping="Wrap" 
			Text="Welcome to MEFedMVVM" 
			VerticalAlignment="Top" 
			Opacity="0" 
			RenderTransformOrigin="0.5,0.5">
			<TextBlock.RenderTransform>
				<TransformGroup>
					<ScaleTransform/>
					<SkewTransform/>
					<RotateTransform/>
					<TranslateTransform Y="-38"/>
				</TransformGroup>
			</TextBlock.RenderTransform>
		</TextBlock>
		<VisualStateManager.VisualStateGroups>
			<VisualStateGroup x:Name="SomeStates">
				<VisualStateGroup.Transitions>
					<VisualTransition GeneratedDuration="0:0:2">
						<VisualTransition.GeneratedEasingFunction>
							<BounceEase EasingMode="EaseOut"/>
						</VisualTransition.GeneratedEasingFunction>
					</VisualTransition>
				</VisualStateGroup.Transitions>
				<VisualState x:Name="Welcome">
					<Storyboard>
						<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)" Storyboard.TargetName="textBlock">
							<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
						</DoubleAnimationUsingKeyFrames>
						<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="textBlock">
							<EasingDoubleKeyFrame KeyTime="0" Value="1"/>
						</DoubleAnimationUsingKeyFrames>
					</Storyboard>
				</VisualState>
				<VisualState x:Name="Normal"/>
			</VisualStateGroup>
		</VisualStateManager.VisualStateGroups>
	</Grid>
</UserControl>

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)


Written By
Software Developer (Senior) http://www.ansibleww.com.au
Australia Australia
The Australia born French man who went back to Australia later in life...
Finally got over life long (and mostly hopeless usually, yay!) chronic sicknesses.
Worked in Sydney, Brisbane, Darwin, Billinudgel, Darwin and Melbourne.

Comments and Discussions