I want to create multiple groups of control(s) within a rectangular border. where each group will be containing control within it, surrounded by rectangular border and a header (optional) is to be placed over each child group's top-left above its border. So, I created a class GroupLayout, each child element within this have to create its own new group. I created Header as an attached property.
Syntax making use of template is as:-
<GroupLayout Orientation = "Vertical">
<DataGrid GroupLayout.Header= "Group 1" />
<Grid GroupLayout.Header= "Group 2" />
-------So On--------
</GroupLayout>
as above given, DataGrid and Grid both should form there own two groups with vertical orientation. each child element should create its own new group. So, I tried this as User Control:-
<Style TargetType = "GroupLayout">
<setter.property>
<controltemplate targettype="GroupLayout">
<stackpanel>
<border x:name="MainParentGroupBorder" xmlns:x="#unknown">
<stackpanel>
<contentpresenter content="{TemplateBinding HeaderLabel}" />
<border x:name="ChildGroupBorder">
<contentpresenter content="{TemplateBinding Content}" />
</border>
</stackpanel>
</border>
</stackpanel>
</controltemplate>
</setter.property>
</Style>
In code behind I'm driving from ItemsControl. But, this is not working as required. I can't even implement ItemTemplate in Xaml here. because my template class is is a List, UIElements already have ItemTemplate defined, Can I override this ? or do need something else to do ?. Please help me, any answer would be appreciable.
Thanks,
GK Prajapati