This project is read-only.

Change from TabControl to HeaderedContentControl?

Apr 12, 2010 at 8:39 PM

Would it be possible to move it up one level in the control hierarchy? This would allow using the GroupBox, or other 3rd party controls, in place of the TabControl and still allows the ControlTemplate for customization.

i.e.  IView GetViewContent(TabControl tabControl) { ... } would become IView GetViewContent(HeaderedContentControl contentControl) { ... }

Was there a specific design decision for the Tab?

Coordinator
Apr 12, 2010 at 10:08 PM

Could you do me up a modified ShellView template please?

 

Apr 13, 2010 at 5:17 PM

I am happy to provide a new template but I'm not sure how you're expecting it to would work since tabControl_Workspace.SelectedContent is the IView, and the TemplateParts for items like "PART_TabControl_Workspace" are specifically declared as [TemplatePart(Name = PART_TabControl_Workspace, Type = typeof(TabControl))]

My goal is to use a docking library with the corresponding regions. Perhaps I missed something you could point out?

 

Coordinator
Apr 13, 2010 at 8:52 PM

Just ignore that constraint for now. I would like to examine your idea in XAML form. :)

 

Apr 13, 2010 at 11:35 PM
within App.xaml, add this to the application header as well: xmlns:docking="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Docking"
<ControlTemplate TargetType="{x:Type Gui:ShellView}">
    <Grid x:Name="PART_Grid_Root" Background="{DynamicResource WindowBackgroundBrush}">
        <docking:RadDocking x:Name="DockingManager">
            <!-- workspace -->
            <docking:RadDocking.DocumentHost>
                <docking:RadSplitContainer>
                    <docking:RadPaneGroup>
                    
                        <docking:RadPane x:Name="PART_Pane_Workspace">
                            <docking:RadPane.Content>
                                <TabControl x:Name="PART_TabControl_Workspace"
			                    cal:RegionManager.RegionName="{x:Static Calcium:RegionNames.Workspace}"
			                    IsSynchronizedWithCurrentItem="True"  
			                    Width="Auto" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" 
			                    Margin="0,0,0,0"/>
                            </docking:RadPane.Content>
                        </docking:RadPane>
                    </docking:RadPaneGroup>
                </docking:RadSplitContainer>
            </docking:RadDocking.DocumentHost>

            <docking:RadSplitContainer docking:DockingPanel.InitialSize="150,150" MaxWidth="600"
                Name="LeftContainer" InitialPosition="DockedLeft">
                <docking:RadPaneGroup x:Name="Group1">
                    <docking:RadPane x:Name="Pane1" Header="Server Explorer">
                        <docking:RadPane.Content>
                            <TabControl x:Name="PART_TabControl_Left" 
						        cal:RegionManager.RegionName="{x:Static Calcium:RegionNames.Tools}"							
						        MinWidth="0" Margin="10,0,1,0"
						        HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
						        IsSynchronizedWithCurrentItem="True" BorderThickness="0,0,0,0"/>
                        </docking:RadPane.Content>
                    </docking:RadPane>
                </docking:RadPaneGroup>
            </docking:RadSplitContainer>

            <docking:RadSplitContainer docking:DockingPanel.InitialSize="200,200" MaxWidth="679"
                x:Name="RightContainer" InitialPosition="DockedRight">
                <docking:RadPaneGroup x:Name="Group2">
                    <docking:RadPane x:Name="Pane4" Header="Properties">
                        <docking:RadPane.Content>
                            <TabControl x:Name="PART_TabControl_Right" 
				                cal:RegionManager.RegionName="{x:Static Calcium:RegionNames.Properties}"
				                MinWidth="0" Margin="1,0,10,0"
				                HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
				                IsSynchronizedWithCurrentItem="True" BorderThickness="0,0,0,0" 
				                Background="{x:Null}" Foreground="{x:Null}" BorderBrush="{x:Null}"/>
                        </docking:RadPane.Content>
                    </docking:RadPane>
                </docking:RadPaneGroup>
            </docking:RadSplitContainer>

            <docking:RadSplitContainer docking:DockingPanel.InitialSize="200,200"
                x:Name="BottomContainer" InitialPosition="DockedBottom">
                <docking:RadPaneGroup x:Name="Group3">
                    <docking:RadPane x:Name="Pane5" Header="Output">
                        <docking:RadPane.Content>
                            <TabControl x:Name="PART_TabControl_Bottom" 
						        cal:RegionManager.RegionName="{x:Static Calcium:RegionNames.Footer}"
						        MinHeight="80" 
						        HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
						        IsSynchronizedWithCurrentItem="True" Margin="0,1,0,10" />
						</docking:RadPane.Content>
                    </docking:RadPane>
                </docking:RadPaneGroup>
            </docking:RadSplitContainer>
        </docking:RadDocking>
    </Grid>
</ControlTemplate>

Wondering why I couldn't simply set the RegionName to the RadPane, I found:

tabControl_Workspace = Template.FindName(PART_TabControl_Workspace, this) as TabControl;

The original suggestion came after reading MSDN's overview on the HeaderedContentControl, and examining both docking solutions from Telerik and DevExpress.

// Telerik
public class RadPane : RadTabItem, IPane, IDocumentHostAware, IToolWindowAware
{ ... }
// Telerik
public class RadTabItem : HeaderedContentControl
{ ... }

// DevExpress
public class DockPane : HeaderedContentControl, IUIElement 
{ ... }

Starting to ramble here and it's been a long day; hopefully this all makes some sort of sense. :)