Home » Silverlight

Silverlight 4 & Datagrid Header Binding

Hi guys,

I'm wondering if we can use DataBinding with Datagrids ColumnHeaders in Silverlight 4? Since SL4 allows us to bind on DependencyObjects it should be possible, right? I haven't tried it yet because I'm still using SL3 but maybe anyone else has done it?



6 Answers Found


Answer 1

I do not understand what you are trying to databind.  Could you explain what you are trying to do a little better?


Answer 2

Sure! I want to databind a resource string to the header  property of a datragridcolumn. Like <data:DataGridTextColumn Header={Binding StaticResource={myResource}} />



Answer 3


    It seems your speculation is correct. But i just tested in silverlight4 beta, it wont work.

    There are two concern here.


    As we know, control use a same static resource will share a same instance. So here , this usage maybe not very practical.


    The header  in the static resource was loaded before the datagrid. And it's an Framework element. So after it's loaded the parent value of it should be set. Apparently you can not set a control can only has one parent.

Best REgards


Answer 4

Thank you for your reply! Well, it seems I have to keep the workaround...



<< Previous      Next >>

Microsoft   |   Windows   |   Visual Studio   |   Sharepoint   |   Azure