2013-01-16 2 views
2

일부 코드를 발견했으며 어떻게 작동하는지 설명 할 수 있는지 궁금합니다.전체 화면 응용 프로그램을 시작하는 방법은 무엇입니까?

<Window x:Class="FullScreenDemo.MainWindow" 
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
     xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" 
     xmlns:Einstein="clr-namespace:FullScreenDemo" 
     Title="FullScreenBehavior Demo" Width="640" Height="480" 
     Einstein:FullScreenBehavior.IsFullScreen="{Binding Path=IsChecked, ElementName=FullScreenButton, Mode=TwoWay}"> 

    <i:Interaction.Behaviors> 
     <Einstein:FullScreenBehavior 
      FullScreenOnDoubleClick="{Binding IsChecked, ElementName=FullOnDoubleClick}" 
      FullScreenOnMaximize="{Binding IsChecked, ElementName=FullOnMaximize}" 
      RestoreOnEscape="{Binding IsChecked, ElementName=ExitOnEscape}"/> 
    </i:Interaction.Behaviors> 

    <Viewbox Stretch="Uniform"> 

     <Grid Width="640" Height="480"> 

      <StackPanel Margin="20"> 

       <TextBlock Text="Full Screen Demo" FontSize="32" /> 

       <TextBlock TextWrapping="Wrap"> 

        <LineBreak /> 
        <LineBreak /> 

        <Run> 
         The FullScreenBehavior makes it easy to create a WPF window that can &quot;go full screen&quot;. 
         By default, the full screen setting can only be changed programmatically. Try pressing the 
         ToggleButton in the upper right hand corner which is Two-Way bound to the IsFullScreen 
         property of the Window. 
        </Run> 

        <LineBreak /> 
        <LineBreak /> 

        <Run> 
         This demo uses a ViewBox to scale the content with the Window but that is not required. 
         You can use whatever layout strategy you want. 
        </Run> 

        <LineBreak /> 
        <LineBreak /> 

        <Run> 
         There are properties that can be set that can be used to enable automatic full screen behavior 
         in response to common user actions. Play around with the options below which control how the 
         Window reacts to user gestures. 
        </Run> 

        <LineBreak /> 

       </TextBlock> 

       <CheckBox x:Name="FullOnMaximize" Margin="5" Content="Maximizing enters full screen"/> 
       <CheckBox x:Name="FullOnDoubleClick" Margin="5" Content="Double clicking enters/exits full screen" /> 
       <CheckBox x:Name="ExitOnEscape" Margin="5" Content="Pressing escape exits full screen"/> 

      </StackPanel> 

      <ToggleButton x:Name="FullScreenButton" Content="Full Screen" 
          Margin="8" VerticalAlignment="Top" HorizontalAlignment="Right" 
          Height="50" Width="120" Checked="FullScreenButton_Checked"/> 

     </Grid> 

    </Viewbox> 

</Window> 

코드를 FULL XAML 코드로 업데이트했습니다. 원래 관련 부분을 게시했지만 요청시 전체 코드를 게시하고 있습니다.

나는 창을 만드는 "코드"가 없음을 알고있다. FullScreen. 내 질문은 어떻게 그것을 "전체 화면"창을 만드는 것입니다?

+3

무엇? 'Einstein'은 네임 스페이스이고'FullScreenBehavior'는 클래스입니다. 코드를보기 위해 그 정의를보세요. –

답변

2

내가 몇 가지 코드를 발견하고 사람이 어떻게 작동하는지 설명 할 수 있을지 궁금

아무도 할 수있는 당신이 행동에 대 한 아인슈타인 :: FullScreenBehavior

동작이 정의되어 XAML 요소를 놓치지 때문에 코드가 누락되었습니다. 페이지에 통합 만 있습니다.

시작에 관한 것이 아니라 일부 버튼을 위로하고 이벤트 연결을하면 아무 것도 창이 전체 화면으로 시작됩니다. FullscrrenButton_Checked가 선택되어 있지 않는 한 아무 것도 표시되지 않습니다.

그러나 작동 방법을 보려면 동작 코드를 제공해야합니다.

+0

전체 XAML 코드 –

+0

으로 코드를 업데이트했습니다.이 코드는 XAML 코드가 아니며, xaml에 NT가있는 코드입니다. 당신은 Xaml에서 Einstein : FullScreenBehavior를 사용하는데, 이것은 .NET 클래스이며 그 코드가 필요합니다. – TomTom

관련 문제