2010-03-17 6 views
1

표준 WPF 응용 프로그램이 있다고 가정하면 기본 응용 프로그램 창 외에도 왼쪽에 일부 UI 요소를 표시하려고합니다.WPF가 요소를 내 보냅니다.

"테두리 넘어"가서 기본 창 이외의 왼쪽에 단추가있는 시각적 요소를 표시하는 방법이 있습니까? 있다면, 그것을 할 수있는 튜토리얼/비디오/힌트를 가르쳐 줄 수 있습니까?

답변

2

코드 나 XAML에서이 모든 작업을 수행하려고하지만 팝업을 사용하는 경우이 작업을 수행 할 수 있는지 확실하지 않은가요? 이 도움이

<Window 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    x:Class="ButtonsOnPopup.MainWindow" 
    x:Name="Window" 
    Title="MainWindow" 
    Width="400" Height="300"> 
<Window.Resources> 
    <Storyboard x:Key="OnMouseLeftButtonDown1"> 
     <BooleanAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetName="popup" Storyboard.TargetProperty="(Popup.IsOpen)"> 
      <DiscreteBooleanKeyFrame KeyTime="0" Value="True"/> 
     </BooleanAnimationUsingKeyFrames> 
    </Storyboard> 
    <Storyboard x:Key="OnClick1"> 
     <BooleanAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetName="popup" Storyboard.TargetProperty="(Popup.IsOpen)"> 
      <DiscreteBooleanKeyFrame KeyTime="0" Value="True"/> 
      <DiscreteBooleanKeyFrame KeyTime="00:00:00.2" Value="False"/> 
     </BooleanAnimationUsingKeyFrames> 
    </Storyboard> 
</Window.Resources> 
<Window.Triggers> 
    <EventTrigger RoutedEvent="UIElement.MouseLeftButtonDown" SourceName="textBlock"> 
     <BeginStoryboard Storyboard="{StaticResource OnMouseLeftButtonDown1}"/> 
    </EventTrigger> 
    <EventTrigger RoutedEvent="ButtonBase.Click" SourceName="button"> 
     <BeginStoryboard x:Name="OnClick1_BeginStoryboard" Storyboard="{StaticResource OnClick1}"/> 
    </EventTrigger> 
</Window.Triggers> 

<Grid x:Name="LayoutRoot"> 
    <Popup x:Name="popup" Placement="Left"> 
     <StackPanel Background="White"> 
      <TextBlock Text="Outside Window" TextWrapping="Wrap"/> 
      <Button x:Name="button" Width="75" Content="Close this"/> 
     </StackPanel> 
    </Popup> 
    <TextBlock x:Name="textBlock" HorizontalAlignment="Center" VerticalAlignment="Center" Text="MouseDown here" TextWrapping="Wrap" Background="#FFBFFFBD"/> 
</Grid> 

희망.

0

어쩌면 팝업.

간단한 예 :

<Window x:Class="WpfPopupTest.Window1" 
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
Title="Window1" Height="300" Width="300"> 
<Grid> 
    <Popup HorizontalOffset="{Binding Path=ActualWidth, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" IsOpen="True"> 
     <StackPanel Background="HotPink"> 
      <TextBlock Text="Hey from outside!" Foreground="Gold" /> 
      <Button>Button!</Button> 
     </StackPanel> 
    </Popup> 
</Grid> 
아마하지 당신이 원하는,하지만 난 당신을 위해 일할 수 있다고 생각.

0

창 경계가없는 넌 모달 대화 상자를 사용할 수 있습니다. 원한다면 우주에서 떠 다니는 것처럼 보일 수도 있습니다.

코리

관련 문제