2014-05-09 2 views
0

Ribbon Control이있는 WPF 응용 프로그램이 있습니다. ComboBox을 추가하여 로그인 한 사용자를 도움말 버튼 옆에 표시하고 싶습니다. 그러나 ComboBox을 추가하려고하면 Tab으로 생성됩니다.XAML의 리본 컨트롤에 콤보 상자 추가

<Grid> 
    <Grid.RowDefinitions> 
     <RowDefinition Height="Auto"/> 
     <RowDefinition></RowDefinition> 
    </Grid.RowDefinitions> 
    <Ribbon x:Name="RibbonWin" SelectedIndex="0" Margin="0,0,0,113"> 
     <Ribbon.HelpPaneContent> 
      <RibbonButton SmallImageSource="Images\help.png"></RibbonButton> 
     </Ribbon.HelpPaneContent> 
     <RibbonComboBox> 
      <ComboBoxItem Content="Test1"/> 
     </RibbonComboBox> 
     <RibbonTab Header="Home" KeyTip="H" Margin="0,0,0,-1" > 
      <RibbonGroup x:Name="ClipboardGroup" Header="Clipboard"> 
       <RibbonMenuButton LargeImageSource="Images\paste.jpg" Label="Paste" KeyTip="V"> 
        <RibbonMenuItem ImageSource="Images\paste.jpg" Header="Keep Text Only" KeyTip="T"/> 
        <RibbonMenuItem ImageSource="Images\paste.jpg" Header="Paste Special..." KeyTip="S"/> 
       </RibbonMenuButton> 
       <RibbonButton SmallImageSource="Images\cut.jpg" Label="Cut" KeyTip="X" /> 
       <RibbonButton SmallImageSource="Images\copy.jpg" Label="Copy" KeyTip="C" /> 
      </RibbonGroup> 
      <RibbonGroup x:Name="Questions" Header="Questions And Answers"> 
       <RibbonMenuButton LargeImageSource="Images\Question.jpg" Label="Questions" KeyTip="V"> 
        <RibbonMenuItem ImageSource="Images\paste.jpg" Header="Add Question" KeyTip="T"/> 
        <RibbonMenuItem ImageSource="Images\paste.jpg" Header="Paste Special..." KeyTip="S"/> 
       </RibbonMenuButton> 
       <RibbonButton SmallImageSource="Images\Save.jpg" Label="Save" KeyTip="X" /> 
       <RibbonButton SmallImageSource="Images\Add.jpg" Label="Add" KeyTip="C" /> 
      </RibbonGroup> 
     </RibbonTab> 
     <RibbonTab Header="Insert" KeyTip="I"> 
     </RibbonTab> 
     <RibbonTab Header="PageLayout" KeyTip="L"> 
     </RibbonTab> 
    </Ribbon> 
</Grid> 

또한 기본적으로 만들어집니다 왼쪽하여 Application Menu ComboBox을 제거하는 방법이있다.

답변

0

ApplicationMenu 속성에 RibbonApplicationMenu를 넣고 Visibility를 'Collapsed'로 설정합니다. 응용 프로그램 메뉴가 제거되지는 않지만 최소한 보이지는 않습니다. 그것을 숨길 다른 방법은 없습니다.

ComboBox를 리본 탭에 삽입해야하므로 아무 것도 지정하지 않으면 RibbonTab이 암시 적으로 만들어집니다.

<Ribbon> 
    <Ribbon.ApplicationMenu> 
     <RibbonApplicationMenu Visibility="Collapsed"></RibbonApplicationMenu> 
    </Ribbon.ApplicationMenu> 
    <RibbonTab> 
     <RibbonGroup> 
      <RibbonComboBox></RibbonComboBox> 
     </RibbonGroup> 
    </RibbonTab> 
</Ribbon> 
0

내 친구에서 그것을 가지고, 이 자신의 템플릿을 생성 도움 리본 HelpPaneContentTempalte에 추가 할 수 있습니다

다음 예제 응용 프로그램 메뉴를 숨기고 콤보 상자를 삽입하는 방법을 보여줍니다

<Ribbon.HelpPaneContentTemplate> 
       <DataTemplate> 
        <StackPanel Orientation="Horizontal" Height="24"> 
         <ToggleButton x:Name="btn" > 
          <TextBlock Text="Operator"/> 
         </ToggleButton> 

         <Popup IsOpen="{Binding IsChecked, ElementName=btn}" x:Name="Popup" StaysOpen="False" Placement="Bottom" 
            PlacementTarget="{Binding ElementName=btn}" Height="120" Width="150" HorizontalOffset="-90" > 
          <Popup.Resources> 
           <Style x:Key="LinkButton" TargetType="Button"> 
            <Setter Property="Template"> 
             <Setter.Value> 
              <ControlTemplate TargetType="Button"> 
               <TextBlock> 
                 <ContentPresenter /> 
               </TextBlock> 
              </ControlTemplate> 
             </Setter.Value> 
            </Setter> 
            <Setter Property="Foreground" Value="Blue" /> 
            <Style.Triggers> 
             <Trigger Property="IsMouseOver" Value="true"> 
              <Setter Property="Foreground" Value="Red" /> 
             </Trigger> 
            </Style.Triggers> 
           </Style> 
          </Popup.Resources> 
          <Border BorderBrush="Gray" BorderThickness="2" Background="White" > 
           <StackPanel Orientation="Vertical"> 
            <StackPanel Orientation="Horizontal" Height="50"> 
             <Image Source="Images\UserPhoto.png" Height="30"/> 
             <StackPanel VerticalAlignment="Center"> 
              <TextBlock Text="Operator" FontSize="16" Margin="10,0,0,0"/> 
              <TextBlock Text="[email protected]" FontSize="10" Foreground="DarkGray" Margin="10,0,0,0"/> 
             </StackPanel> 
            </StackPanel> 
            <Separator Background="LightGray"/> 
            <StackPanel Height="30"> 
             <Button x:Name="btnAccountSettings" Content="Account Settings" Style="{StaticResource LinkButton}" Width="100" Margin="10,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Center"></Button> 
            </StackPanel> 
            <Separator Background="LightGray"/> 
            <StackPanel Height="30"> 
             <Button x:Name="btnSwitchAccount" Content="Switch Account" Style="{StaticResource LinkButton}" Width="100" Margin="10,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Center"></Button> 
            </StackPanel> 
           </StackPanel> 
          </Border> 
         </Popup> 
         <ContentPresenter Content="{TemplateBinding Property= ContentControl.Content}" /> 
        </StackPanel> 

       </DataTemplate> 
      </Ribbon.HelpPaneContentTemplate> 

      <Ribbon.HelpPaneContent> 
       <RibbonButton x:Name="btnHelp" SmallImageSource="Images\help.png" /> 
      </Ribbon.HelpPaneContent> 
관련 문제