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
65
Problems editing ContentPane's template
posted

Hi there,

I'm trying to modify the default template of a ContentPane to remove the default Close/Pin/Wnidow Position buttons inside PaneHeaderPresenter.

First, I create a style based on the default one by selecting [ContentPane] -> Edit Template -> Edit a Copy in Expression Blend 4.

I guess the second step would be to create a template for the inner PaneHeaderPresenter the same way.

However, once the template/style for ContentPane is created, the dragging out / floating functionality is lost. I can no longer click the header and drag it out to float the pane.

Is there a workaround?

 

Here's the style generated by Expression Blend 4.

 

        <Style x:Key="ContentPaneStyle1" TargetType="{x:Type igDock:ContentPane}">
            <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
            <Setter Property="BorderBrush" Value="{DynamicResource DockManagerBrushKeys.ContentPaneBorderFillKey}"/>
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="TabHeader">
                <Setter.Value>
                    <Binding Path="Header" RelativeSource="{RelativeSource Self}">
                        <Binding.Converter>
                            <igDock:ContentValidationConverter ErrorMessage="[Error: The Header of the ContentPane is set to an element. The Header is used as the default TabHeader and in the PaneNavigator. An element cannot be shown in multiple locations. Set the HeaderTemplate to the element that should be displayed in the pane caption and navigator and set the TabHeader or TabHeaderTemplate as needed.]"/>
                        </Binding.Converter>
                    </Binding>
                </Setter.Value>
            </Setter>
            <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type igDock:ContentPane}">
                        <AdornerDecorator>
                            <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
                                <DockPanel Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                                    <igDock:PaneHeaderPresenter ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" DockPanel.Dock="Top" Visibility="{TemplateBinding HeaderVisibility}"/>
                                    <ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Visibility="{TemplateBinding ContentVisibility}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                                </DockPanel>
                            </Border>
                        </AdornerDecorator>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

Parents
No Data
Reply
  • 54937
    Offline posted

    It's usually better to get a copy of the original template because Blend sometimes misses things when inferring the template from an instance of the element. The default xaml is provided in the DefaultStyles directory (e.g. C:\Program Files\Infragistics\NetAdvantage 2010.3\WPF\DefaultStyles\DockManager). In this case the PaneHeaderPresenter should have it's DataContext set to the ContentPane.

               <igDock:PaneHeaderPresenter 
                                        DockPanel.Dock="Top"
                                        Content="{TemplateBinding Header}"
                                        ContentTemplate="{TemplateBinding HeaderTemplate}"
                                        ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}"
                                        DataContext="{Binding RelativeSource={x:Static RelativeSource.TemplatedParent}}"
                                        Visibility="{TemplateBinding HeaderVisibility}"
                                       />

Children
No Data