Sunday, July 6, 2014


XAML to ViewModel creator.

This demo is in works. Currently it reads a XAML file (using XElement) and identifies Bindings and their controls.

Next i'll complete this by printing out a view model class with properties using the bindings that i've collected in a collection.

You may want to improve this; feel free!

Download Demo Code

Placeholder trial: Placeholder code
Update to placeholder: Handle events of a control within a datatemplate. Refer this link:
http://stackoverflow.com/questions/1800595/event-handler-in-datatemplate

Tuesday, July 1, 2014


WPF: Quick way to display columnar data for printing. The code below displays textblocks in 2 columns. You can bind this listview or place data in XAML as shown below.

<ListView SelectionChanged="ListView_SelectionChanged_1" x:Name="lview"> <ListViewItem></ListViewItem> <ListView.View> <GridView x:Name="gview"> <GridViewColumn Width="100"> <GridViewColumn.CellTemplate> <DataTemplate> <StackPanel> <TextBlock HorizontalAlignment="Stretch" Text="hello"/> <TextBlock HorizontalAlignment="Stretch" Text="hello"/> <TextBlock HorizontalAlignment="Stretch" Text="hello"/> <TextBlock HorizontalAlignment="Stretch" Text="hello"/> </StackPanel> </DataTemplate> </GridViewColumn.CellTemplate> </GridViewColumn> <GridViewColumn> <GridViewColumn.CellTemplate> <DataTemplate> <StackPanel> <TextBlock HorizontalAlignment="Stretch" Text="mangesh"/> <TextBlock HorizontalAlignment="Stretch" Text="mangesh"/> <TextBlock HorizontalAlignment="Stretch" Text="mangesh"/> <TextBlock HorizontalAlignment="Stretch" Text="mangesh"/> </StackPanel> </DataTemplate> </GridViewColumn.CellTemplate> </GridViewColumn> </GridView> </ListView.View> </ListView>


Things such as hiding column headers, setting column width if required need to be done.

2 column grid example