none
当改变窗口大小,Ribbon control消失了 RRS feed

  • 问题

  • 系统:windows 7 64bit

    vs2012

    当我缩小窗口大小到一定程度的时候,ribbon 消失了。 即使设置了minheight也无济于事

    <Window x:Class="ShipAntSystem.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            xmlns:sys="clr-namespace:System;assembly=mscorlib" 
            xmlns:avalonDock="http://avalondock.codeplex.com"
            xmlns:WindowsFormsControlLibrary1="clr-namespace:WindowsFormsControlLibrary1;assembly=MyUserControl" 
            Title="ShipAntSystem" Height="600" Width="800" >
        <Window.Resources>
            <DataTemplate x:Key="NodeDateTemplate">
                <StackPanel Orientation="Horizontal">
                    <CheckBox Focusable="False"
                          IsChecked="{Binding IsChecked,Mode=TwoWay}"
                          VerticalAlignment="Center" Margin="5" />
                    <TextBlock Text="{Binding Name}"
                           VerticalAlignment="Center" Margin="5" />
                </StackPanel>
            </DataTemplate>

            <HierarchicalDataTemplate x:Key="NodeTemplate" 
                                      >
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="{Binding Path=Name}"/>
                </StackPanel>

            </HierarchicalDataTemplate>
        </Window.Resources>
        <Grid x:Name="LayoutRoot">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="24"/>
            </Grid.RowDefinitions>
            <Ribbon x:Name="Ribbon" Title="ShipAntSystem" Height="300" >
                <Ribbon.HelpPaneContent>
                    <RibbonButton SmallImageSource="Images/Temp_16.png" />
                </Ribbon.HelpPaneContent>
                <Ribbon.QuickAccessToolBar>
                    <RibbonQuickAccessToolBar >
                        <RibbonButton x:Name="QATButton1" 
                                             SmallImageSource="Images/Temp_16.png" />
                        <RibbonButton x:Name="QATButton2" 
                                             SmallImageSource="Images/Temp_16.png" />
                    </RibbonQuickAccessToolBar>
                </Ribbon.QuickAccessToolBar>
                <Ribbon.ApplicationMenu>
                    <RibbonApplicationMenu SmallImageSource="Images\Temp_16.png">
                        <RibbonApplicationMenuItem Header="保存"
                                                          x:Name="MenuItem1"
                                                          ImageSource="Images\Open_32.png"/>
                    </RibbonApplicationMenu>
                </Ribbon.ApplicationMenu>
                <RibbonTab x:Name="Observe" 
                                  Header="观察">
                    <RibbonGroup x:Name="ZoomGroup" Header="缩放">
                        <RibbonButton x:Name="Button1"
                                             LargeImageSource="Images\ZoomFit_32.png"
                                             Label="缩放到合适大小" />
                        <RibbonButton x:Name="Button2"
                                             LargeImageSource="Images\ZoomWindow_32.png"
                                             Label="缩放到指定范围" />
                        <RibbonButton x:Name="Button3"
                                             LargeImageSource="Images\Temp_32.png"
                                             Label="缩放" />
                    </RibbonGroup>

                    <RibbonGroup Header="位移">
                        <RibbonButton x:Name="Button4"
                                             LargeImageSource="Images\Rotate_32.png"
                                             Label="旋转" />
                        <RibbonButton x:Name="Button5"
                                             LargeImageSource="Images\Translation_32.png"
                                             Label="平移" />
                    </RibbonGroup>

                    <RibbonGroup x:Name="ViewGroup" Header="视图">
                        <RibbonButton x:Name="btnFrontView"
                                             LargeImageSource="Images\Temp_32.png"
                                             Label="前视图" />
                        <RibbonButton x:Name="btnBackView"
                                             LargeImageSource="Images\Temp_32.png"
                                             Label="后视图" />
                        <RibbonButton x:Name="btnTopView"
                                             LargeImageSource="Images\Temp_32.png"
                                             Label="顶视图" />
                        <RibbonButton x:Name="btnBottomView"
                                             LargeImageSource="Images\Temp_32.png"
                                             Label="底视图" />
                        <RibbonButton x:Name="btnLeftView"
                                             LargeImageSource="Images\Temp_32.png"
                                             Label="左视图" />
                        <RibbonButton x:Name="btnRightView"
                                             LargeImageSource="Images\Temp_32.png"
                                             Label="右视图" />
                    </RibbonGroup>

                </RibbonTab>

                <RibbonTab  Header="计算">
                </RibbonTab>

                <RibbonTab  Header="结果">
                </RibbonTab>

                <RibbonTab  Header="帮助">
                </RibbonTab>

            </Ribbon>


        </Grid>
    </Window>


    <window height="600" title="ShipAntSystem" width="800" x:class="ShipAntSystem.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:avalondock="http://avalondock.codeplex.com" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:windowsformscontrollibrary1="clr-namespace:WindowsFormsControlLibrary1;assembly=MyUserControl" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"><window.resources><datatemplate x:key="NodeDateTemplate"><stackpanel orientation="Horizontal"><checkbox focusable="False" ischecked="{Binding IsChecked,Mode=TwoWay}" margin="5" verticalalignment="Center"><textblock margin="5" text="{Binding Name}" verticalalignment="Center"></textblock></checkbox></stackpanel> </datatemplate> <hierarchicaldatatemplate x:key="NodeTemplate"><stackpanel orientation="Horizontal"><textblock text="{Binding Path=Name}"></textblock></stackpanel> </hierarchicaldatatemplate> </window.resources> <grid x:name="LayoutRoot"><grid.rowdefinitions><rowdefinition height="Auto"><rowdefinition height="*"><rowdefinition height="24"></rowdefinition></rowdefinition></rowdefinition></grid.rowdefinitions> <ribbon height="300" title="ShipAntSystem" x:name="Ribbon"><ribbon.helppanecontent><ribbonbutton smallimagesource="Images/Temp_16.png"></ribbonbutton></ribbon.helppanecontent> <ribbon.quickaccesstoolbar><ribbonquickaccesstoolbar><ribbonbutton smallimagesource="Images/Temp_16.png" x:name="QATButton1"><ribbonbutton smallimagesource="Images/Temp_16.png" x:name="QATButton2"></ribbonbutton></ribbonbutton></ribbonquickaccesstoolbar> </ribbon.quickaccesstoolbar> <ribbon.applicationmenu><ribbonapplicationmenu smallimagesource="Images\Temp_16.png"><ribbonapplicationmenuitem header="保存" imagesource="Images\Open_32.png" x:name="MenuItem1"></ribbonapplicationmenuitem></ribbonapplicationmenu> </ribbon.applicationmenu> <ribbontab header="观察" x:name="Observe"><ribbongroup header="缩放" x:name="ZoomGroup"><ribbonbutton label="缩放到合适大小" largeimagesource="Images\ZoomFit_32.png" x:name="Button1"><ribbonbutton label="缩放到指定范围" largeimagesource="Images\ZoomWindow_32.png" x:name="Button2"><ribbonbutton label="缩放" largeimagesource="Images\Temp_32.png" x:name="Button3"></ribbonbutton></ribbonbutton></ribbonbutton></ribbongroup> <ribbongroup header="位移"><ribbonbutton label="旋转" largeimagesource="Images\Rotate_32.png" x:name="Button4"><ribbonbutton label="平移" largeimagesource="Images\Translation_32.png" x:name="Button5"></ribbonbutton></ribbonbutton></ribbongroup> <ribbongroup header="视图" x:name="ViewGroup"><ribbonbutton label="前视图" largeimagesource="Images\Temp_32.png" x:name="btnFrontView"><ribbonbutton label="后视图" largeimagesource="Images\Temp_32.png" x:name="btnBackView"><ribbonbutton label="顶视图" largeimagesource="Images\Temp_32.png" x:name="btnTopView"><ribbonbutton label="底视图" largeimagesource="Images\Temp_32.png" x:name="btnBottomView"><ribbonbutton label="左视图" largeimagesource="Images\Temp_32.png" x:name="btnLeftView"><ribbonbutton label="右视图" largeimagesource="Images\Temp_32.png" x:name="btnRightView"></ribbonbutton></ribbonbutton></ribbonbutton></ribbonbutton></ribbonbutton></ribbonbutton></ribbongroup> </ribbontab> <ribbontab header="计算"></ribbontab> <ribbontab header="结果"></ribbontab> <ribbontab header="帮助"></ribbontab> </ribbon> </grid> </window>

    2012年12月20日 18:22

答案

全部回复

  • 你应该设置主窗体的最小大小。

    你可以打开 work 2010,缩小一定大小时,ribbon也会消失。

    2012年12月21日 2:14
  • 是的,Rinbbon确实是这样的,你应该设置最小大小值。

    Bob Bao

    Do you still use the same Windows 8 LockScreen always? Download Chameleon Win8 App quickly, that changes your LockScreen constantly.
    你是否还在看着一成不变的Windows 8锁屏而烦恼,赶紧下载这个 百变锁屏 应用,让你的锁屏不断地变化起来。

    2012年12月28日 3:01
    版主