Hi all
I'm currently evaluating the grid for one of our main applications, and hit a few early bumps. Generally, I'm struggling a bit with the avaliability of the DataContext in cells, columns etc.
The Microsoft grid, while being a very nice control IMO is a bit of a letdown here. What I would be expecting from a grid is this:
This feels just natural and enables proper MVVM without any dirty hacks. Much to my delight, I could easily bind the IsVisible property of the column to a boolean property of my view model. When I tried the same thing with the header: fail. I then created a simple template and did the binding and discovered that the data context of my header is not just empty, but actually an instance of system.object. I have no idea what the reason behind this is. I sure didn't set this.
There's a few threads on the issue, in part with workarounds that make me *really* cringe:
http://www.telerik.com/community/forums/wpf/gridview/column-header-binding.aspx
I can't help but wonder why we have a distinction of cases, and why I end up with a random data context for the header instead of the grid's data context. After all, it just works for other dependency properties and attached properties.
I'm near certain that this will become a problem for us somewhere down the road - because one of our devs wants to set a header dynamically, we do need localization, have custom templating for headers, or another reason I currently don't think about.
What's Telerik's point on this? Is this a know issue that might get fixed? Is it a deliberate choice made for a good reason I don't see? Is it a bug?
Thanks in advance,
Philipp
I'm currently evaluating the grid for one of our main applications, and hit a few early bumps. Generally, I'm struggling a bit with the avaliability of the DataContext in cells, columns etc.
The Microsoft grid, while being a very nice control IMO is a bit of a letdown here. What I would be expecting from a grid is this:
<
telerik:GridViewDataColumn
DataMemberBinding="{Binding DisplayName}"
IsVisible="{Binding IsVisible}"
Header="{Binding HeaderText}"
My.AttachedProperty="{Binding Foo}"
/>
This feels just natural and enables proper MVVM without any dirty hacks. Much to my delight, I could easily bind the IsVisible property of the column to a boolean property of my view model. When I tried the same thing with the header: fail. I then created a simple template and did the binding and discovered that the data context of my header is not just empty, but actually an instance of system.object. I have no idea what the reason behind this is. I sure didn't set this.
There's a few threads on the issue, in part with workarounds that make me *really* cringe:
http://www.telerik.com/community/forums/wpf/gridview/column-header-binding.aspx
I can't help but wonder why we have a distinction of cases, and why I end up with a random data context for the header instead of the grid's data context. After all, it just works for other dependency properties and attached properties.
I'm near certain that this will become a problem for us somewhere down the road - because one of our devs wants to set a header dynamically, we do need localization, have custom templating for headers, or another reason I currently don't think about.
What's Telerik's point on this? Is this a know issue that might get fixed? Is it a deliberate choice made for a good reason I don't see? Is it a bug?
Thanks in advance,
Philipp