Background:
I have a configuration file completely in XAML
and classes which represents this markup.
My xaml-file looks like this:
<RootConfiguration
xmlns="clr-namespace:Configuration;assembly=Configuration"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<RootConfiguration.Elements>
<ElementList x:Name="completeElementDefinition">
<Element Type="X" Show="True" Refresh="30">
<Element.Name>A1</Element.Name>
</Element>
<Element Type="Y" Show="True" Refresh="30">
<Element.Name>B1</Element.Name>
</Element>
</ElementList>
</RootConfiguration.Elements>
<RootConfiguration.ElementGroups>
<ElementGroupList>
<ElementGroup Name="All Elements">
<ElementGroup.Elements>
<!-- How to reference the ElementList "completeElementDefinition" defined above -->
</ElementGroup.Elements>
</ElementGroup>
<ElementGroup Name="Type X Elements">
<ElementGroup.Elements>
<ElementList>
<!-- How to reference single Elements from the list "completeElementDefinition" -->
</ElementList>
</ElementGroup.Elements>
</ElementGroup>
<ElementGroup Name="Type Y Elements">
<ElementGroup.Elements>
<ElementList>
<!-- How to reference single Elements from the list "completeElementDefinition" -->
</ElementList>
</ElementGroup.Elements>
</ElementGroup>
</ElementGroupList>
</RootConfiguration.ElementGroups>
</RootConfiguration>
I tried first to implement a second ElementList
and Element
class in an extra namespace, so that i could define the grouped elements in the ElementGoup-Property of the configuration by using the different namespace. But this approach seems to be inelegant and redundant to me.
I've read about x:Reference
and I think it would be possible to implement a DependencyProperty
but I'm not sure whats the best approach for what i'm needing here. Since this is just a configuration and is parsed only once at the application start-up. So there is no real need for Bindings or am I wrong?
How can I realize what I'm looking for? Is there a better way to reference objects in my xaml-markup than I was able to find?