If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

This works fine but it seem to me a little wasteful to have a data template for each property. Optimally I'd like to have a way to define a "style" or a control template or somehow change existing "stock" column (e.g. DataGridTextColumn) and only change the binding on each column.

I've search a lot online but didn't find the right path to follow. I am new to WPF and trying to read but there's much to read and I am not sure what subject I need to learn.

Thanks!

Last edited by tomercagan; August 22nd, 2011 at 07:28 AM.
Reason: Mistake in ItemSource used

Then in your datagrid you just set the style of the columm:
<DataGridTextColumn Header="Value" Binding="{Binding Value, Mode=OneWay, NotifyOnTargetUpdated=True}" ElementStyle="{StaticResource MyStyle}"/>

A few things to note:
* In the style you must set the background with a solid brush instance. Transperant color may be a good choice.
* In the story board you update the target property using the full qualification. Note the end is SolidColorBrush.Color. Have we not set it before an exception would have been thrown - that's becuase the initial value of the background wasn't a solid brush and the cast required in the target property would have faild.
* For a "complete" animation it is advisable to set BeginStoryboard's HandoffBehavior to "Compose". This prevents the background color to eventually stay red in case of many consecutive events being triggered. Another approach I've seen was using StopStoryBoard before BeginStoryBoard but didn't try.
* In the DataGridTextColumn Binding you must set NotifyOnTargetUpdated=True or the event doesn't fire...

* The Perfect Platform for Game Developers: Android
Developing rich, high performance Android games from the ground up is a daunting task. Intel has provided Android developers with a number of tools that can be leveraged by Android game developers.

* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.