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
145
how do i reuse the same fieldlayout across multiple grids?
posted

does anyone know how to reuse a fieldlayout across multiple grids?  can someone post an example?

right now i have multple grids that have very similar behavior and have very similar field layouts.  i have managed to push the logic up into a base class, but xaml cannot be inherited (as far as i know).  so at the moment i am copying the same field layouts over and over again across multiple grids.  this seems like a poor architecture, and it is too cumbersome to maintain over time.

i am speculating that there may be a way to put a fieldlayout into a resourcedictionary, reference the fieldlayout as a dynamicresource in the xamdatagrid, save the resourcedictionary as a xaml file, read the resourcedictionary in at runtime, instantiate a MergedDictionaries, and using this pattern, reuse the same fieldlayout across multiple xamDataGrids.

at this point i can't even figure out how to reference a fieldlayout from the resources.

does anyone know how to reuse a fieldlayout across multiple grids?

can someone post an example of putting a fieldlayout into the resources area and referencing that resource in the xamdatagrid?  or post some other pattern i haven't thought of?  thanks.  -g

Parents
No Data
Reply
  • 69686
    Suggested Answer
    posted

    Hello Geoffrey,

    You can use the Save/LoadCustomizations method to achieve this. I am attaching a sample with this implemented.

    Rearrange some fields on the left  XamDataGrid and click the Save Button. Then click the Load button and these changed will be applied to the right XamDataGrid.

    Hope this helps.

    testFieldLayoutResource.zip
Children