WPF – Jay R. Wren – lazy dawg evarlast http://jrwren.wrenfam.com/blog babblings of a computer loving fool Wed, 15 Feb 2017 02:57:57 +0000 en-US hourly 1 https://wordpress.org/?v=4.7.2 Inheriting WPF DataGrid might cause defaulting to OneTime databinding http://jrwren.wrenfam.com/blog/2011/05/05/inheriting-wpf-datagrid-might-cause-defaulting-to-onetime-databinding/ Thu, 05 May 2011 15:31:16 +0000 http://jrwren.wrenfam.com/blog/2011/05/05/inheriting-wpf-datagrid-might-cause-defaulting-to-onetime-databinding/ Continue reading "Inheriting WPF DataGrid might cause defaulting to OneTime databinding"]]> I just ran into an annoying issue. I am extending WPF DataGrid copy and paste functionality similar to what is suggested by Vincent Sibal here.

public BetterDataGrid : DataGrid {…}

But when I did, data binding only worked against my initial view model. In my case a file load operation replaced the original view model and binding did not happen against the new view model.

I had to explicitly include Mode=TwoWay on the Binding, when using <this:BetterDataGrid … but this was not necessary when using <toolkit:Datagrid.

Just a warning, if you are going to extend DataGrid, be sure to explicitly set your binding mode.

]]>
XAML Comments in Attributes. http://jrwren.wrenfam.com/blog/2011/03/31/xaml-comments-in-attributes/ http://jrwren.wrenfam.com/blog/2011/03/31/xaml-comments-in-attributes/#comments Thu, 31 Mar 2011 18:53:55 +0000 http://jrwren.wrenfam.com/blog/2011/03/31/xaml-comments-in-attributes/ Continue reading "XAML Comments in Attributes."]]> Sometimes I wish that XML supported comments in attributes instead of just <!—style.

Almost always this is a XAML file that I wish had this.

Today I realized just how silly I was being.

xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"  xmlns:d="http://schemas.microsoft.com/expression/blend/2008"  mc:Ignorable="d"

And now I can just d:Anything=”any comment”.

Sure, I can’t nest my quotes there, but this is good enough for a lot of things.

<Grid d:Purpose=”this is the grid that contains the other grid that contains the things”>…

]]>
http://jrwren.wrenfam.com/blog/2011/03/31/xaml-comments-in-attributes/feed/ 1