Click here to Skip to main content
15,896,111 members
Articles / Desktop Programming / WPF

WPF CRUD Generator (Scaffolding)

Rate me:
Please Sign up or sign in to vote.
4.89/5 (11 votes)
4 Jun 2009LGPL35 min read 88.3K   6.3K   61  
Semi-automatic GUI generation from Domain Models.
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:crud="clr-namespace:Technewlogic.Crud.Controls"
	xmlns:controls="clr-namespace:Technewlogic.WpfShell.UI.Controls"
	xmlns:converter="clr-namespace:Technewlogic.WpfShell.UI.Converter">

	<ResourceDictionary.MergedDictionaries>
		<ResourceDictionary Source="/Technewlogic.WpfShell;component/Resources/ShellResources.xaml" />
	</ResourceDictionary.MergedDictionaries>
	
	<Style x:Key="{x:Type crud:CrudDisplay}" TargetType="{x:Type crud:CrudDisplay}">
		<Setter Property="MasterDefaultTemplate">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type crud:MasterView}">
					<controls:SortListView x:Name="PART_EntityList" Margin="5">
						<controls:SortListView.View>
							<GridView>
								<GridView.ColumnHeaderTemplate>
									<DataTemplate>
										<TextBlock Text="{Binding}" Margin="4,2,4,2" />
									</DataTemplate>
								</GridView.ColumnHeaderTemplate>
							</GridView>
						</controls:SortListView.View>
					</controls:SortListView>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type crud:CrudDisplay}">
					<DockPanel Margin="5" LastChildFill="True">

						<controls:HeadingContentView IsSuperiorContainer="True" Margin="5" DockPanel.Dock="Top">
							<UniformGrid Rows="2">
								<StackPanel Orientation="Horizontal">
									<TextBlock FontWeight="Bold" Text="Navigation:" Margin="5" VerticalAlignment="Center" />
									<StackPanel x:Name="PART_BreadcrumpList" Margin="5" Orientation="Horizontal" VerticalAlignment="Center">
										<StackPanel.Resources>
											<Style BasedOn="{StaticResource LinkButtonStyle}" TargetType="{x:Type Button}" />
										</StackPanel.Resources>
									</StackPanel>
								</StackPanel>

								<!--<Border Margin="5,0,5,0" BorderBrush="Gray" BorderThickness="0.5" />-->

								<StackPanel Orientation="Horizontal">
									<TextBlock FontWeight="Bold" Margin="5" Text="Menu:" VerticalAlignment="Center" />
									<WrapPanel Orientation="Horizontal" x:Name="PART_EntityPanel" Margin="5" />
								</StackPanel>
							</UniformGrid>
						</controls:HeadingContentView>

						<controls:HeadingContentView Header="Details" Margin="5" Height="200" DockPanel.Dock="Bottom">
							<Grid>
								<Grid.Resources>
									<Style TargetType="{x:Type FrameworkElement}">
										<Setter Property="VerticalAlignment" Value="Center" />
									</Style>
								</Grid.Resources>
								<crud:DetailsPanel x:Name="PART_DetailsPanel" />
								<crud:ModificationPanel x:Name="PART_ModificationPanel" />
							</Grid>
						</controls:HeadingContentView>

						<controls:HeadingContentView IsSuperiorContainer="True" Margin="5">
							<crud:MasterView x:Name="PART_MasterView" />
							<!-- Styling: siehe oben bei CrudDisplay.Setter -->
						</controls:HeadingContentView>

					</DockPanel>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

</ResourceDictionary>

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 GNU Lesser General Public License (LGPLv3)


Written By
Software Developer (Senior) www.technewlogic.de
Germany Germany
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions