Click here to Skip to main content
15,891,845 members
Articles / Programming Languages / C#

ObjectLounge - An Object-Oriented Database Framework

Rate me:
Please Sign up or sign in to vote.
4.07/5 (8 votes)
30 Jul 2009LGPL310 min read 43.9K   425   45  
Host your Domain Models "Out Of The Box" + No storage or schema needed + Transactions on Domain Models + Validation
<Window x:Class="GettingStartedDemo.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:domainModel="clr-namespace:GettingStartedDemo.DomainModel"
	Closing="mainWindow_Closing"
    Title="Window1" Height="600" Width="800"
	x:Name="mainWindow" WindowStartupLocation="CenterScreen">
	
	<Window.Background>
		<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
			<GradientStop Color="#202020" Offset="0" />
			<GradientStop Color="#505050" Offset="1" />
		</LinearGradientBrush>
	</Window.Background>
	
	<Window.Resources>
		<Style TargetType="{x:Type Border}" x:Key="sectionBorderStyle">
			<Setter Property="BorderBrush" Value="Gray" />
			<Setter Property="BorderThickness" Value="1" />
			<Setter Property="CornerRadius" Value="3" />
			<Setter Property="Background">
				<Setter.Value>
					<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
						<GradientStop Color="#A0A0A0FF" Offset="0" />
						<GradientStop Color="#30FFFFFF" Offset="1" />
					</LinearGradientBrush>
				</Setter.Value>
			</Setter>
		</Style>
	</Window.Resources>

	<ScrollViewer VerticalScrollBarVisibility="Auto">
		<StackPanel DataContext="{Binding ElementName=mainWindow}">

			<!-- Post Category -->
			<Border Style="{StaticResource sectionBorderStyle}" Margin="15">
				<DockPanel Margin="10" LastChildFill="True">
					<TextBlock DockPanel.Dock="Top" Margin="5" FontSize="12" FontWeight="Bold" Text="Post Categories" />
					<StackPanel Margin="5" DockPanel.Dock="Left">
						<Button x:Name="btnCreatePostCategory" Click="btnCreatePostCategory_Click" Content="Create Post Category..." />
						<Button x:Name="btnDeletePostCategory" Click="btnDeletePostCategory_Click" Content="Delete Post Category" />
					</StackPanel>
					<ListBox ItemsSource="{Binding Context.PostCategorys}" SelectedItem="{Binding SelectedPostCategory}" Margin="5">
						<ListBox.ItemTemplate>
							<DataTemplate>
								<StackPanel Orientation="Horizontal">
									<TextBlock Text="Name:" FontWeight="Bold" Margin="3" />
									<TextBlock Text="{Binding Name}" Margin="3" />
								</StackPanel>
							</DataTemplate>
						</ListBox.ItemTemplate>
					</ListBox>
				</DockPanel>
			</Border>

			<!-- Authors -->
			<Border Style="{StaticResource sectionBorderStyle}" Margin="15">
				<DockPanel Margin="5" LastChildFill="True">
					<TextBlock DockPanel.Dock="Top" Margin="5" FontSize="12" FontWeight="Bold" Text="Authors" />
					<StackPanel Margin="5" DockPanel.Dock="Left">
						<Button x:Name="btnCreateAuthor" Click="btnCreateAuthor_Click" Content="Create Author..." />
						<Button x:Name="btnDeleteAuthor" Click="btnDeleteAuthor_Click" Content="Delete Author" />
						<Button x:Name="btnCreateBlog" Click="btnCreateBlog_Click" Content="Add Blog to Author..." />
						<Button x:Name="btnRemoveBlog" Click="btnRemoveBlog_Click" Content="Remove Blog from Author" />
					</StackPanel>
					<ListBox ItemsSource="{Binding Context.Authors}" SelectedItem="{Binding SelectedAuthor}" Margin="5">
						<ListBox.ItemTemplate>
							<DataTemplate>
								<StackPanel>
									<StackPanel Orientation="Horizontal">
										<TextBlock Text="Name:" FontWeight="Bold" Margin="3" />
										<TextBlock Text="{Binding Name}" Margin="3" />
									</StackPanel>
									<StackPanel Orientation="Horizontal">
										<TextBlock Text="Blogname:" FontWeight="Bold" Margin="3" />
										<TextBlock Text="{Binding Blog.Name}" Margin="3" />
									</StackPanel>
									<Border BorderBrush="Gray" Margin="5" BorderThickness="0.5" />
								</StackPanel>
							</DataTemplate>
						</ListBox.ItemTemplate>
					</ListBox>
				</DockPanel>
			</Border>

			<!-- Posts -->
			<Border Style="{StaticResource sectionBorderStyle}" Margin="15">
				<DockPanel Margin="10" LastChildFill="True">
					<TextBlock DockPanel.Dock="Top" Margin="5" FontSize="12" FontWeight="Bold" Text="Posts" />
					<StackPanel DockPanel.Dock="Left" Margin="5">
						<Button x:Name="btnCreatePost" Click="btnCreatePost_Click" Content="Create New Post..." />
						<Button x:Name="btnPublishPost" Click="btnPublishPost_Click" Content="Publish Post" />
						<Button x:Name="btnDeletePost" Click="btnDeletePost_Click" Content="Delete Post" />
					</StackPanel>
					<ListBox ItemsSource="{Binding SelectedBlog.Posts}" SelectedItem="{Binding SelectedPost}" Margin="5">
						<ListBox.ItemTemplate>
							<DataTemplate>
								<StackPanel>
									<StackPanel Orientation="Horizontal">
										<TextBlock Text="Name:" FontWeight="Bold" Margin="3" />
										<TextBlock Text="{Binding Heading}" Margin="3" />
									</StackPanel>
									<StackPanel Orientation="Horizontal">
										<TextBlock Text="Category:" FontWeight="Bold" Margin="3" />
										<TextBlock Text="{Binding PostCategory.Name}" Margin="3" />
									</StackPanel>
									<StackPanel Orientation="Horizontal">
										<TextBlock Text="Created:" FontWeight="Bold" Margin="3" />
										<TextBlock Text="{Binding CreationDate}" Margin="3" />
									</StackPanel>
									<StackPanel Orientation="Horizontal">
										<TextBlock Text="Published:" FontWeight="Bold" Margin="3" />
										<TextBlock Text="{Binding IsPublished}" Margin="3" />
									</StackPanel>
									<TextBlock Text="{Binding Content}" Margin="3" TextWrapping="Wrap" />
								</StackPanel>
							</DataTemplate>
						</ListBox.ItemTemplate>
					</ListBox>
				</DockPanel>
			</Border>

		</StackPanel>
	</ScrollViewer>

</Window>

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