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
55
Two parent FieldLayouts with same Child FieldLayouts
posted

I have an issue where I have a Three tier hierarchy and a two tier hierarchy.  The field layouts are described for each tier, However one FieldLayout is repeated in both hierarchys. This causes the FieldLayout display to only work for one: either the 3 tier hierarchy  or the two tier hierarchy . Never both of them at the same time.

So my question is can you have a FieldLayout with two different ParentFieldLayoutKey

Current solution is to describe the same FieldLayout twice, giving each FieldLayout a different ParentFieldLayoutKey. which works:

<DataPresenter:FieldLayout Key="DadModel">            <!--  DadModel can be two different classes DadModel or GroupModel -->
 ...
	<DataPresenter:Field Name="GroupComponentModels" />      
	<DataPresenter:Field Name="SonModels" />
</DataPresenter:FieldLayout>

<DataPresenter:FieldLayout Key="GroupComponentModel">
 ...
	<DataPresenter:Field Name="SonModels" />
</DataPresenter:FieldLayout>


<DataPresenter:FieldLayout Key="SonModel" ParentFieldLayoutKey="DadModel">
 ...
</DataPresenter:FieldLayout>

<DataPresenter:FieldLayout Key="SonModel" ParentFieldLayoutKey="GroupComponentModel">
 ...
</DataPresenter:FieldLayout>


<!--  All the classes -->
<!-- 
Class DadBase, 
Class DadModel:DadBase, 
Class GroupModel:DadBase,
Class GroupComponentModel:TModel, 
Class SonModel
-->

However I don't like this as the FieldLayout has to be repeated twice. Duplicate xaml, Is there a better solution ?