Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

The Situation

So I have a Infragistics DockManager inside of an Infragistics Ribbon Window.

Inside my dock manager I have a number of separate user controls. Some of which have ribbon tab items specific to them.

enter image description here

When the content pane undocks from the dock manager and floats, it's tab is removed from the ribbon.

This happens because it is essentially being spawned into a new window. When it's added to a new window, it's being removed from the main ribbon windows' visual tree. Thus, it removes it's ribbon because it thinks it's gone.

The Proposed Solution

So to overcome this issue I have decided the best course of action would be to restyle the PanelToolWindow to be another ribbon window that would only display its children controls' ribbons.

The Problem

Every time I attempt to restyle the PanelToolWindow it doesn't work. I'm not sure why it's not working and there is practically zero documentation regarding restyling this window (please see links below for what documentation I did find).

The Sample Code

I've tried a few different solutions. Maybe it's how I am implementing the style.

Here is the basic template I have used.

<ControlTemplate TargetType="{x:Type igDock:PaneToolWindow}" 
                 x:Key="documentViewerToolWindow">
 <Border 
   Background="{TemplateBinding Background}"
   BorderBrush="{TemplateBinding BorderBrush}"
   BorderThickness="{TemplateBinding BorderThickness}">
  <Grid>
    <Grid.RowDefinitions>
       <RowDefinition Height="Auto" />
       <RowDefinition/>
    </Grid.RowDefinitions>
    <DockPanel Grid.Row="0" >
        <ContentPresenter Content="{TemplateBinding Title}" />
    </DockPanel>
        <ContentPresenter Content="{TemplateBinding Content}" Grid.Row="1"/>
   </Grid>
  </Border>
</ControlTemplate>

I have attempted:

  • Adding the above control template into the User Control Resources just above the dock manager in a style that targets igDock:PaneToolWindow. The hope here was that it would just restyle every PaneToolWindow that's floating. This didn't work

  • Adding the above control template into the App.XAML Resources. This didn't work.

  • I then attempted to restyle the dock manager explicitly with the below code

     <Style TargetType="igDock:PaneToolWindow">
           <Setter Property="Style" 
           Value="{StaticResource ResourceKey=documentViewerToolWindow}"/>
     </Style>
    
  • I have also attempting setting UseOSNonClientArea = false within the ToolWindowLoaded event AND by hard coding it into the DockManager's XAML tag. Neither of which worked.

  • I have tried pulling the Window.Content out of the PaneToolWindowEventArgs.Window.Content property and spawning them into my custom Window.ContentControl.Content property. This works but with VERY bad behaviors like duplicate windows on loading.

Refrences

http://www.infragistics.com/community/forums/t/60620.aspx

http://www.infragistics.com/community/blogs/alex_fidanov/archive/2009/11/10/customizing-xamdockmanager-s-floating-panes.aspx

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
151 views
Welcome To Ask or Share your Answers For Others

1 Answer

In order to restyle the PaneToolWindow you must do three things.

First, create your style. I did mine in XAML

<Window.Resources>
        <Style TargetType="{x:Type igDock:PaneToolWindow}" x:Key="DockPTW">

            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type igDock:PaneToolWindow}">

                        <igRibbon:RibbonWindowContentHost Initialized="RibbonWindowContentHost_Initialized">

                            <igRibbon:RibbonWindowContentHost.Ribbon>
                                <igRibbon:XamRibbon x:Name="MAIN_RIBBON" DockPanel.Dock="Top">

                                </igRibbon:XamRibbon>
                            </igRibbon:RibbonWindowContentHost.Ribbon>
                            <Grid Width="1000" Height="500">


                            </Grid>
                        </igRibbon:RibbonWindowContentHost>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

    </Window.Resources>

Second, you need to listen to the XamDockManager ToolWindow_Loaded Event.

Finally, within that event you set two properties.

First you set UseOSNonClientArea = false so your PaneToolWindow knows to use custom Chrome.

  e.Window.UseOSNonClientArea = false;

Then you set the Style property to the style you declared in the XAML.

  e.Window.Style = this.Resources["DockPTW"] as Style;

Note

This is not a complete solution. You still need to reimplement the dragging capabilities of the PaneToolWindow, which I am currently discussing here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...