Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
50
Design Time column layout with binding to View Model
posted

Hi

I have a XamDataGrid which I want to bind to a custom collection exposed by my view model. This works fine at runtime if I specify my binding in the usual way (DataSource="{Binding Path=MyCollection}"), but this doesn't give me any design-time indication of the column layout.

I can get my columns to appear at design time by specifying the datasource collection type like so:

<Custom:XamDataGrid.DataSource>
  <data:MyCollectionType xmlns:data="clr-namespace:MyNamespace" />
</Custom:XamDataGrid.DataSource>

However, then I can't declare my binding in XAML, as the designer complains that the DataSource is set more than once.

I can get around this by resetting the DataSource in code, but I'd prefer to keep everything declarative... Can it be done?

Parents Reply Children
No Data