Click here to Skip to main content
15,881,204 members
Articles / Desktop Programming / WPF

GoalBook - A Hybrid Smart Client

Rate me:
Please Sign up or sign in to vote.
4.86/5 (24 votes)
25 Sep 2009CPOL10 min read 79K   834   69  
A WPF hybrid smart client that synchronises your goals with the Toodledo online To-do service.
<UserControl x:Class="GoalBook.Notes.Views.NotesView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:sys="clr-namespace:System;assembly=mscorlib"
    xmlns:ModuleProperties="clr-namespace:GoalBook.Notes.Properties"
    xmlns:gbConverters="clr-namespace:GoalBook.Infrastructure.Converters;assembly=GoalBook.Infrastructure"
    xmlns:gbComparers="clr-namespace:GoalBook.Infrastructure.Comparers;assembly=GoalBook.Infrastructure"
    xmlns:refData="clr-namespace:GoalBook.Notes.Views"
    xmlns:igDP="http://infragistics.com/DataPresenter"
    xmlns:igEditors="http://infragistics.com/Editors" 
    Background="White"
    Loaded="UserControl_Loaded"
    FocusManager.IsFocusScope="True">
	<UserControl.Resources>
		<gbConverters:GuidForeignKeyConverter x:Key="guidForeignKeyConverter" />
		<gbConverters:BoolToPendingConverter x:Key="boolToPendingConverter" />
		<gbConverters:DateTimeConverter x:Key="dateTimeConverter" />
		<gbComparers:DateComparer x:Key="dateTimeComparer" />		
		<ObjectDataProvider x:Key="folderReferenceData" MethodName="GetFolderList" ObjectType="{x:Type refData:ReferenceData}"/>
	</UserControl.Resources>
	<DockPanel Name="dockPanelNotes" LastChildFill="True">
		<Grid Name="notesGrid">
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="*"></ColumnDefinition>
			</Grid.ColumnDefinitions>
			<Grid.RowDefinitions>				
				<RowDefinition Height="2*"></RowDefinition>
				<RowDefinition Height="5"></RowDefinition>
				<RowDefinition Height="*"></RowDefinition>
			</Grid.RowDefinitions>
			<!-- XamDataGrid -->
			<igDP:XamDataGrid DataSource="{Binding Path=Notes, Mode=OneWay}"				
				Name="xamDataGridNotes"
				Grid.Row="0"
				AutoFit="True"												
				GroupByAreaLocation="None"								
				KeyUp="XamDataGridNotes_KeyUp"				
				RecordsDeleting="XamDataGridNotes_RecordsDeleting"
				SelectedItemsChanged="XamDataGridNotes_SelectedItemsChanged"
				MouseDoubleClick="XamDataGridNotes_MouseDoubleClick" >				
				<igDP:XamDataGrid.FieldSettings>
					<igDP:FieldSettings AllowEdit="False" CellClickAction="SelectRecord" AllowResize="False"/>
				</igDP:XamDataGrid.FieldSettings>
				<igDP:XamDataGrid.FieldLayoutSettings>
					<igDP:FieldLayoutSettings 
						SelectionTypeRecord="Single" 
						AutoGenerateFields="False" 
						AllowAddNew="False" 
						HighlightAlternateRecords="True" />
				</igDP:XamDataGrid.FieldLayoutSettings>
				<igDP:XamDataGrid.FieldLayouts>
					<igDP:FieldLayout>
						<igDP:FieldLayout.SortedFields>
							<igDP:FieldSortDescription FieldName="FolderID" Direction="Ascending" IsGroupBy="False"/>
							<igDP:FieldSortDescription FieldName="Title" Direction="Ascending" IsGroupBy="False"/>													
						</igDP:FieldLayout.SortedFields>
						<igDP:FieldLayout.Fields>
							<igDP:Field Name="NoteID" Visibility="Collapsed"/>
							<igDP:Field Name="Title" Label="{x:Static ModuleProperties:Resources.LabelTitle}" IsScrollTipField="True" />								
							<igDP:Field Name="Added" Label="{x:Static ModuleProperties:Resources.LabelAdded}" Visibility="Collapsed" 
								Converter="{StaticResource dateTimeConverter}" 
								ConverterParameter="G">
								<igDP:Field.Settings>									
									<igDP:FieldSettings EditAsType="{x:Type sys:String}" 
										SortComparer="{StaticResource dateTimeComparer}" 
										LabelMaxWidth="125" 
										CellMaxWidth="125"
										CellMinWidth="125"/>
								</igDP:Field.Settings>
							</igDP:Field>
							<igDP:Field Name="FolderID" Label="{x:Static ModuleProperties:Resources.LabelFolder}" Visibility="Visible" 
								Converter="{StaticResource guidForeignKeyConverter}" 
								ConverterParameter="{StaticResource folderReferenceData}">
								<igDP:Field.Settings>
									<igDP:FieldSettings EditAsType="{x:Type sys:String}" 
										LabelMaxWidth="125" 
										CellMaxWidth="125" 
										CellMinWidth="125"/>
								</igDP:Field.Settings>
							</igDP:Field>
						</igDP:FieldLayout.Fields>
					</igDP:FieldLayout>
				</igDP:XamDataGrid.FieldLayouts>
			</igDP:XamDataGrid>	
			<GridSplitter Grid.Row="1" Height="5" VerticalAlignment="Center" HorizontalAlignment="Stretch" IsTabStop="False" ></GridSplitter>
			<FlowDocumentScrollViewer Name="previewDocumentScrollViewer"				 
				Focusable="True" 
				IsEnabled="True" 
				IsTabStop="False"				 
				IsToolBarVisible="False" 
				IsSelectionEnabled="True"				
				Zoom="10"				
				Grid.Row="2">
			</FlowDocumentScrollViewer>		
		</Grid>
	</DockPanel>
</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)
Australia Australia
I've been working as a software developer since 2000 and hold a Bachelor of Business degree from The Open Polytechnic of New Zealand. Computers are for people and I aim to build applications for people that they would want to use.

Comments and Discussions