2012-10-20 4 views
0

http://wpfmdi.codeplex.com/ 라이브러리를 사용하여 WPF 응용 프로그램의 MDI를 처리하고 있습니다.제목 표시 줄 사용 또는 숨기기

하위 컨테이너가 들어있는 하위 컨테이너가있는 Canvas가 있습니다. 하위 컨테이너에는 여러 개의 작은 창이 있습니다.

내 자식 창에서 제목 표시 줄을 사용하지 않도록 설정하고 싶습니다. 이것이 가능한가? 나는 특히 MdiChild 객체가 Window이 아닌 Control 유형이기 때문에 이것을 달성하는 단일 속성을 찾지 못했습니다.

TableWindow 클래스의 개체를 포함하는 MDIChild를 만들기위한 코드입니다.

  MdiChild child = new MdiChild() 
      { 
       MaximizeBox = false, 
       MinimizeBox = false, 
       Resizable = true, 
       ShowIcon = false, 
       Content = tableWindow.Content as UIElement 
      }; 

      mainContainer.Children.Add(child); 

편집합니다 Control 그래서 당신이 override 기본 템플릿 (ControlTemplate)에있는 그 이후

enter image description here

+0

당신이'WindowStyle 설정을 해봤 '없음'으로 .. ?? –

+0

물론 MdiChild는 Window가 아닌 ​​Control이기 때문에 WindowStyle 속성은 없습니다. –

답변

1

.

소스 코드에서 MdiChild 컨트롤의 스타일을 포함하는 Aero.xamlLuna.xaml 두 개의 xaml을 볼 수 있습니다. 소스 코드는 here으로 볼 수 있습니다. 버튼이 포함 된 StackPanel(ButtonsPanel)Grid(HeaderContent)을 제거하면됩니다.

WPF에서 제공하는 기능 덕분에 ControlTemplate을 재정 의하여 원하는대로 컨트롤을 사용자 지정할 수 있습니다.

편집

당신이 당신의 XAML에서 다시 정의해야하는 템플릿을 무시합니다. 당신이해야 할 일은 create a style again in your Window resources, set the template for the control이며 자동으로 기본 컨트롤 템플릿을 덮어 씁니다. 단순히 전체 템플릿을 복사하여 here에서 복사하고 위에서 언급 한 StackPanel과 Grid를 제거하십시오.

<Window.Resources> 
    <Style TargetType="{x:Type mdi:MdiChild}"> 
     <Setter Property="Template"> 
      <Setter.Value> 
       <ControlTemplate> 
        <!-- Copy paste entire template here and 
         just remove the StackPanel and Grid --> 
       </ControlTemplate> 
      </Setter.Value> 
     </Setter> 
    </Style> 
</Window.Resources> 

EDIT2

제목 표시 줄을 사용 중지하지만 여전히 컨트롤의 드래그 조작 및 크기 조정 작업을 사용하려면이와 ControlTemplate 교체 -

<ControlTemplate TargetType="{x:Type mdi:MdiChild}"> 
    <Border Name="BaseBorder" BorderThickness="1" CornerRadius="5,5,0,0" 
      Background="{StaticResource BackBorderBackgroundBrush}" 
      BorderBrush="{StaticResource BackBorderBrush}"> 
       <Grid> 
        <Border Name="ContentBorder" 
          Background="{TemplateBinding Background}" 
          BorderBrush="{TemplateBinding BorderBrush}" 
          BorderThickness="{TemplateBinding BorderThickness}"> 
         <ContentControl Content="{TemplateBinding Content}" /> 
        </Border> 
        <Thumb Name="DragThumb" Height="20" Margin="0,0,40,0" 
         VerticalAlignment="Top" Opacity="0"/> 

        <Rectangle Name="LeftBorder" Width="1" HorizontalAlignment="Left" 
           RadiusX="9" RadiusY="9" 
           Fill="{StaticResource NearBorderBrush}" /> 
        <Rectangle Name="TopBorder" Height="1" VerticalAlignment="Top" 
           RadiusX="9" RadiusY="9" 
           Fill="{StaticResource NearBorderBrush}" /> 
        <Rectangle Name="RightBorder" Width="1" HorizontalAlignment="Right" 
           RadiusX="9" RadiusY="9" 
           Fill="{StaticResource FarBorderBrush}" /> 
        <Rectangle Name="BottomBorder" Height="1" VerticalAlignment="Bottom" 
           RadiusX="9" RadiusY="9" 
           Fill="{StaticResource FarBorderBrush}" /> 

        <Thumb Name="ResizeLeft" Width="6" HorizontalAlignment="Left" 
          Margin="0,6,0,6" Opacity="0" Cursor="SizeWE" 
          IsHitTestVisible="{TemplateBinding Resizable}" /> 
        <Thumb Name="ResizeTop" Height="4" VerticalAlignment="Top" 
          Margin="6,0,6,0" Opacity="0" Cursor="SizeNS" 
          IsHitTestVisible="{TemplateBinding Resizable}" /> 
        <Thumb Name="ResizeRight" Width="6" HorizontalAlignment="Right" 
          Margin="0,6,0,6" Opacity="0" Cursor="SizeWE" 
          IsHitTestVisible="{TemplateBinding Resizable}" /> 
        <Thumb Name="ResizeBottom" Height="6" VerticalAlignment="Bottom" 
          Margin="6,0,6,0" Opacity="0" Cursor="SizeNS" 
          IsHitTestVisible="{TemplateBinding Resizable}" /> 
        <Thumb Name="ResizeTopLeft" Width="6" Height="6" 
          HorizontalAlignment="Left" VerticalAlignment="Top" Opacity="0" 
          Cursor="SizeNWSE" 
          IsHitTestVisible="{TemplateBinding Resizable}" /> 
        <Thumb Name="ResizeTopRight" Width="6" Height="6" 
          HorizontalAlignment="Right" VerticalAlignment="Top" 
          Opacity="0" Cursor="SizeNESW" 
          IsHitTestVisible="{TemplateBinding Resizable}" /> 
        <Thumb Name="ResizeBottomRight" Width="6" Height="6" 
          HorizontalAlignment="Right" VerticalAlignment="Bottom" 
          Opacity="0" Cursor="SizeNWSE" 
          IsHitTestVisible="{TemplateBinding Resizable}" /> 
        <Thumb Name="ResizeBottomLeft" Width="6" Height="6" 
          HorizontalAlignment="Left" VerticalAlignment="Bottom" 
          Opacity="0" Cursor="SizeNESW" 
          IsHitTestVisible="{TemplateBinding Resizable}" /> 
      </Grid> 
     </Border> 
</ControlTemplate> 
+0

답장을 보내 주셔서 감사합니다.이 문제는 나를 미치게했습니다. 나는 이것을 시험해보고 당신에게 알려 줄 것이다. –

+0

이 클래스의 ControlTemplate을 어떻게 무시할 수 있는지 친절하게 설명해 주시겠습니까? –

+0

수정 된 답변보기 –

관련 문제