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
35
PaneHeaderPresenter template
posted

HI All,

i wanted to change the header of the contentPane, after searching i did it by changing the template of the header of the contentpane and it works fine BUT

when the contentPane becomes a floating  window a pantoolwindow appears and an additional windows border appears , and the point is, The paneheaderpresenter disappears.

i knew that the visibility of the paneheaderpresenter is depend on  the panelocation property and in this state the header disappears.

i had an option to catch the toolwinowloaded event and then apply my template to the window but i dont like this because, if i did, and that window has more than one contentpane the header of each one will appear so i would have another top header for the window and i make buttons that operate on the content pane, so it will be miss leading, which content pane to apply the action?!

 

SO what i need now is:

the PaneHeaderPresenter is always Visible in any state

my final solutions that i reached now have problems

1- apply an style to the  paneheaderpresenter element,

if i did it for any property like background, it works But

if i write

 <Style  TargetType="{x:Type igDock:PaneHeaderPresenter}">
        <Setter Property="Control.Visibility" Value="Visible"></Setter>
    </Style>

to make the paneheaderpresenter visible in any case,

it fails!

and it seems that the binding is overriding my style

does anybody have a solution to this?

2- retemplating the contentpane (the header and the content)

i got this template from DockManagerGeneric.Xaml

<ControlTemplate TargetType="{x:Type igDock:ContentPane}">
                    <AdornerDecorator>
                        <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                            <DockPanel Margin="{TemplateBinding Padding}">
                                <igDock:PaneHeaderPresenter
                                    DockPanel.Dock="Top"
                                    Content="{TemplateBinding Header}"
                                    ContentTemplate="{TemplateBinding HeaderTemplate}"
                                    ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}"
                                    DataContext="{Binding RelativeSource={x:Static RelativeSource.TemplatedParent}}"
                                    Visibility="{TemplateBinding HeaderVisibility}"
                                   />
                                <ContentPresenter
                                    HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                    VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                    Visibility="{TemplateBinding ContentVisibility}"
                                    Content="{TemplateBinding Content}"
                                    ContentTemplate="{TemplateBinding ContentTemplate}"
                                    ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"/>
                            </DockPanel>
                        </Border>
                    </AdornerDecorator>
                </ControlTemplate>

and i changed the line that contains the PaneHeaderPresenter Visibility binding :

instead of

    Visibility="{TemplateBinding HeaderVisibility}"

i made it

    Visibility="Visible"

and then i applied it to the contentpane

it worked !

the Pane header is visible in any case But

the content pane lost:

1- draging

2-context menu that change its stat (dockable, floating,hide...)

 

does anybody have a solution to this?

thank you .

 

Mahmoud ElShazly