Click here to Skip to main content
15,893,622 members
Articles / Web Development / HTML

Signum Framework Tutorials Part 3 - Southwind Load

Rate me:
Please Sign up or sign in to vote.
4.62/5 (7 votes)
21 Nov 2012CPOL23 min read 24.5K   319   10  
In this part we'll write the loading application to move data from Northwind to Southwind.
<m:EntityListBase
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:m="clr-namespace:Signum.Windows"
    x:Class="Signum.Windows.EntityList"
    x:Name="me" 
	Style="{DynamicResource toolTip}"
	MinHeight="32">
	<m:EntityListBase.Resources>
		<ResourceDictionary>
			<ResourceDictionary.MergedDictionaries>
				<ResourceDictionary Source="../Resources.xaml"/>
			</ResourceDictionary.MergedDictionaries>
			<Style x:Key="AllBlueListBoxItem" TargetType="{x:Type ListBoxItem}">
				<Setter Property="Background" Value="Transparent"/>
				<Setter Property="HorizontalContentAlignment" Value="{Binding Path=HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ListBox}}}"/>
				<Setter Property="VerticalContentAlignment" Value="{Binding Path=VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ListBox}}}"/>
				<Setter Property="Padding" Value="2,0,0,0"/>
				<Setter Property="Template">
					<Setter.Value>
						<ControlTemplate TargetType="{x:Type ListBoxItem}">
							<Border SnapsToDevicePixels="true" x:Name="Bd" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
								<ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
							</Border>
							<ControlTemplate.Triggers>
								<Trigger Property="IsSelected" Value="true">
									<Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
									<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}"/>
								</Trigger>
								<MultiTrigger>
									<MultiTrigger.Conditions>
										<Condition Property="IsSelected" Value="true"/>
										<Condition Property="Selector.IsSelectionActive" Value="false"/>
									</MultiTrigger.Conditions>
									<Setter Property="Background" TargetName="Bd" Value="#FF74B9FF"/>
								</MultiTrigger>
								<Trigger Property="IsEnabled" Value="false">
									<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
								</Trigger>
							</ControlTemplate.Triggers>
						</ControlTemplate>
					</Setter.Value>
				</Setter>
			</Style>
		</ResourceDictionary>
	</m:EntityListBase.Resources>

	<Grid>
		<Grid.ColumnDefinitions>
			<ColumnDefinition/>
			<ColumnDefinition Width="Auto"/>
		</Grid.ColumnDefinitions>
		<Border BorderBrush="{DynamicResource BlueBorder}" BorderThickness="1,1,1,1" CornerRadius="2,2,2,2" Padding="0,0,0,0" SnapsToDevicePixels="True">
			<ListBox 
			x:Name="listBox"
			IsSynchronizedWithCurrentItem="True" 
			Background="{DynamicResource BlueBackground}" 
			BorderBrush="{DynamicResource BlueBorder}" BorderThickness="0,0,0,0" 
			SelectionMode="{Binding Path=SelectionMode, ElementName=me, Mode=Default}" 
			SelectedItem="{Binding Path=Entity, ElementName=me, Mode=Default}" 
            ItemsSource="{Binding Path=Entities, ElementName=me, Mode=Default}" 
			ItemTemplate="{Binding Path=EntityTemplate, ElementName=me, Mode=Default}" 
            ItemContainerStyle="{StaticResource AllBlueListBoxItem}"
			HorizontalContentAlignment="Stretch"
            MouseDoubleClick="listBox_MouseDoubleClick"/>
		</Border>
		<StackPanel Orientation="Vertical" HorizontalAlignment="Left" Grid.Column="1">
			<Button Focusable="False" x:Name="btCreate" Click="btCreate_Click" Style="{DynamicResource RoundButton}" Content="{StaticResource Create}" ToolTip="{m:Loc Create}"/>
			<Button Focusable="False" x:Name="btFind" Click="btFind_Click" Style="{DynamicResource RoundButton}" Content="{StaticResource Find}" ToolTip="{m:Loc Find}"/>
			<Button Focusable="False" x:Name="btView" Style="{DynamicResource RoundButton}" Click="btView_Click" Content="{DynamicResource View}" ToolTip="{m:Loc View}"/>
			<Button Focusable="False" x:Name="btRemove" Style="{DynamicResource RoundButton}" Click="btRemove_Click" Content="{DynamicResource Remove}" ToolTip="{m:Loc Remove}"/>
			<Button Focusable="False" x:Name="btUp" Style="{DynamicResource RoundButton}" Click="btUp_Click"  Content="{DynamicResource Up}" ToolTip="{m:Loc MoveUp}"/>
			<Button Focusable="False" x:Name="btDown" Style="{DynamicResource RoundButton}" Click="btDown_Click"  Content="{DynamicResource Down}" ToolTip="{m:Loc MoveDown}"/>
		</StackPanel>
	</Grid>
</m:EntityListBase>

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) Signum Software
Spain Spain
I'm Computer Scientist, one of the founders of Signum Software, and the lead developer behind Signum Framework.

www.signumframework.com

I love programming in C#, Linq, Compilers, Algorithms, Functional Programming, Computer Graphics, Maths...

Comments and Discussions