Showing posts with label C# Heirarchical DataGrid. Show all posts
Showing posts with label C# Heirarchical DataGrid. Show all posts
Friday, June 21, 2013
PROJECT: Plant Hire Management System
Full management system to manage the hire of plant for a renowned Plant Hire Company in Western Australia.
This project covered the entire life cycle of a project, from initial client consultation, business and requirements analysis, Database Design, Application Design, Implementations and testing, training and support.
The client was using a product that was not fitting their needs for flexibility in pricing and invoicing terms, there were a number of other issues that the application failed to meet the clients needs including integration of the accounting system.
Functionality is still being developed and the main features are:
JOB MANAGEMENT
Follows and manages the management of projects from initial quotation and estimation, plant and labour resource management and allocation. Recording dockets with time and plant usage including sundry items such as fuel and tip fees, and management of Quarry stock piles. Customer management also included in this module.
PROCUREMENT
Managing Purchase orders from request through to supplier payment via integration with the external accounting system. This module assists in recording costs against plant and job as well as including the inventory orders.
INVENTORY
This module manages the inventory items from delivery through to usage, including stock takes, and adjustments, And updating cost pricing from purchase history.
MAINTENANCE
This module records maintenance and time spent on maintenance of the plant items, this module assists in recording costs against plant and jobs.
INVOICING
Combining all the information from Job Management, On charged purchase orders and inventory, and maintenance costs to charge to the client via flexible rates to job level, and ensuring all information is presented for invoicing.
REPORTING
Using Crystal reports this module allows for custom reports to be developed outside the system if required, and then integrated to allow inclusion within the application.
This product is commercially available. Details can be found here: http://www.phoenixsoftware.com.au/
Thursday, June 20, 2013
Create a Hierarchical DataGrid in WPF (MVVM Capable)
There are Many Occasions when I wanted to have the ability to have a hierarchical DataGrid for simple recursive tables.
Tree Views did not come up to scratch because they are not easy to two way bind to data and fail on being able to send notifications of changes.
With a lot of gritting teeth I managed to do it in XAML Alone (YAY).
I achieved this by creating an HierarchicalDataTemplate which refers to itself via DynamicResource. the IDE does give me a warning that a loop is detected but, other than that it works fine.
So what does it look Like?
With time it will be prettied up :-).
<UserControl.Resources>
Now for the data grid
Tree Views did not come up to scratch because they are not easy to two way bind to data and fail on being able to send notifications of changes.
With a lot of gritting teeth I managed to do it in XAML Alone (YAY).
I achieved this by creating an HierarchicalDataTemplate which refers to itself via DynamicResource. the IDE does give me a warning that a loop is detected but, other than that it works fine.
So what does it look Like?
With time it will be prettied up :-).
<UserControl.Resources>
<ResourceDictionary> <HierarchicalDataTemplate x:Key="HeiachyTemplate" DataType="{x:Type data:InventoryItemGroup}" ItemsSource="{Binding InventoryItemGroups}" > <DataGrid
ItemsSource="{Binding InventoryItemGroups,Mode=TwoWay,NotifyOnSourceUpdated=True,NotifyOnTargetUpdated=True,NotifyOnValidationError=True,UpdateSourceTrigger=PropertyChanged}" bhv:DataGridEndEditCommandBehaviour.Command="{Binding ElementName=EditInventoryItemGroupUserControl,Path=DataContext.DataGridEndEditCommand}" CanUserAddRows="True" AutoGenerateColumns="False" AreRowDetailsFrozen="False"
HorizontalAlignment="Stretch" VerticalContentAlignment="Top"
RowDetailsVisibilityMode="Visible" AlternatingRowBackground="WhiteSmoke"
HeadersVisibility="Row" RowDetailsTemplate="{DynamicResource HeiachyTemplate}" > <DataGrid.RowHeaderTemplate> <DataTemplate> <ContentControl VerticalContentAlignment="Top" VerticalAlignment="Top"> <TextBlock FontFamily="Wingdings" Text="Ä" Margin="15,0,0,0" VerticalAlignment="Top" /> </ContentControl> </DataTemplate> </DataGrid.RowHeaderTemplate> <DataGrid.Columns> <DataGridTextColumn Header="Name" Binding="{Binding InventoryItemGroupName, Mode=TwoWay, NotifyOnSourceUpdated=True, NotifyOnTargetUpdated=True, NotifyOnValidationError=True,UpdateSourceTrigger=PropertyChanged}" Width="*" MinWidth="400"></DataGridTextColumn> </DataGrid.Columns> </DataGrid>
</HierarchicalDataTemplate> </ResourceDictionary> </UserControl.Resources>
Now for the data grid
<DataGrid
ItemsSource="{Binding InventoryItemGroupList,Mode=TwoWay,NotifyOnSourceUpdated=True,NotifyOnTargetUpdated=True,NotifyOnValidationError=True,UpdateSourceTrigger=PropertyChanged}" CanUserAddRows="True" AutoGenerateColumns="False" AreRowDetailsFrozen="False" RowDetailsVisibilityMode="Visible" AlternatingRowBackground="LightGray" RowDetailsTemplate="{StaticResource HeiachyTemplate}" > <DataGrid.RowHeaderTemplate> <DataTemplate> <TextBlock Text=" " Margin="15,0,0,0" VerticalAlignment="Top" /> </DataTemplate> </DataGrid.RowHeaderTemplate> <DataGrid.Columns> <DataGridTextColumn Header="Name" Binding="{Binding InventoryItemGroupName, Mode=TwoWay, NotifyOnSourceUpdated=True, NotifyOnTargetUpdated=True, NotifyOnValidationError=True,UpdateSourceTrigger=PropertyChanged}" Width="*" ></DataGridTextColumn> </DataGrid.Columns> </DataGrid>
Now That's All she Wrote....
I cannot say if this will work for all situations nor large record sets but it worked for me..
This is my first post, so please if I am missing any information leave a comment.
Source Code
Subscribe to:
Posts (Atom)
