Infragistics PanelToolWindow放下功能区窗口选项卡 [英] Infragistics PanelToolWindow drops Ribbon Window Tab

查看:78
本文介绍了Infragistics PanelToolWindow放下功能区窗口选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

情况

因此,我在Infragistics功能区窗口中有一个Infragistics DockManager.

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.

当内容窗格从停靠管理器中撤出并漂浮时,其选项卡将从功能区中删除.

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.

建议的解决方案

因此,为了克服此问题,我决定最好的操作方法是将PanelToolWindow样式更改为另一个仅显示其子控件的功能区的功能区窗口.

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.

问题

每次我尝试重新调整PanelToolWindow的样式时,它都无法正常工作.我不确定为什么它不起作用,并且关于重新设置此窗口的样式的文档几乎为零(请参阅下面的链接,以获取我找到的文档).

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).

示例代码

我尝试了几种不同的解决方案.也许这就是我实现样式的方式.

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>

我尝试过:

  • 以面向igDock:PaneToolWindow的样式将上述控件模板添加到停靠管理器上方的用户控件资源中.希望这里只是重新设置每个浮动的PaneToolWindow的样式.这没用

  • 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

将以上控件模板添加到App.XAML资源中.这没用.

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>

  • 我还尝试在ToolWindowLoaded事件中设置UseOSNonClientArea = false,并将其硬编码到DockManager的XAML标记中.两者都不起作用.

  • 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.

    我尝试过从PaneToolWindowEventArgs.Window.Content属性中拉出Window.Content并将它们生成到我的自定义Window.ContentControl.Content属性中.这是可行的,但是有非常糟糕的行为,例如在加载时出现重复的窗口.

    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.

    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

    推荐答案

    要重新设置PaneToolWindow的样式,您必须做三件事.

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

    首先,创建您的样式.我在XAML中确实是我的

    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>
    

    第二,您需要收听XamDockManager ToolWindow_Loaded事件.

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

    最后,在该事件中,您设置了两个属性.

    Finally, within that event you set two properties.

    首先,您设置UseOSNonClientArea = false,以便您的PaneToolWindow知道使用自定义Chrome.

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

      e.Window.UseOSNonClientArea = false;
    

    然后将Style属性设置为您在XAML中声明的样式.

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

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

    注意

    这不是一个完整的解决方案. 您仍然需要重新实现PaneToolWindow的拖动功能,我目前正在这里讨论

    这篇关于Infragistics PanelToolWindow放下功能区窗口选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆