Enabling Word Wrap in the WPF DataGrid Column Headers

To enable Word Wrapping in the WPF Data Grid Column Header, simply add the following code snippet to your Application.xaml file; [code lang="XML"] <Style TargetType="{x:Type DataGridColumnHeader}"> <Setter Property="ContentTemplate"> <Setter.Value> <DataTemplate> <TextBlock TextWrapping="Wrap" Text="{Binding}"></TextBlock> </DataTemplate> </Setter.Value> </Setter> </Style> [/code]

By |2014-07-08T09:34:14+01:00November 7th, 2012|.Net Framework, WPF|0 Comments

WPF DataGrid CheckBox Column requires two clicks to change state

While using a WPF DataGrid and a CheckBox column I realised that it was taking two Mouse clicks to change the state of the CheckBox. I found a good post by Mike Borozdin which explains how to work around this ‘issue’; http://www.mikeborozdin.com/post/WPF-DataGrid-CheckBox-Single-Click-CheckingUnchecking.aspx Basically, if instead of adding a CheckBox column, you add a TemplateColumn, and [...]

By |2012-10-22T16:50:00+01:00October 22nd, 2012|.Net Framework, Bugs, WPF|0 Comments

WPF MVVM DataGrid Column Collection Binding

In my efforts to “MVVM-ify” my WPF application as much as possible, I ran into the need to Data Bind the Columns Collection of a DataGrid. After some searching on StackOverflow, I found a neat solution by David Osborn; http://stackoverflow.com/questions/3065758/wpf-mvvm-datagrid-dynamic-columns This solution was in C#, so I converted it to VB; [fusion_builder_container hundred_percent="yes" overflow="visible"][fusion_builder_row][fusion_builder_column type="1_1" [...]

By |2017-07-24T08:33:19+01:00September 24th, 2012|MVVM, VB.net, WPF|0 Comments