码迷,mamicode.com
首页 > Windows程序 > 详细

WPF PlacementTarget用户

时间:2015-10-13 10:38:43      阅读:285      评论:0      收藏:0      [点我收藏+]

标签:

<Window x:Class="WpfApplication1.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>
        <Button x:Name="btn1"  Content="Button" HorizontalAlignment="Left" Margin="42,77,0,0" VerticalAlignment="Top" Width="75" Click="btn1_Click"/>

        <!--AllowsTransparency="True"
           PopupAnimation="Fade"
           HorizontalOffset="5"
           VerticalOffset="-120"-->
        
        <Popup x:Name="popusBottom2"   PlacementTarget="{Binding ElementName=btn1}"  StaysOpen="False" >
            <Border Height="200" Width="200" Background="AliceBlue"></Border>
        </Popup>
    </Grid>
</Window>

 

private void btn1_Click(object sender, RoutedEventArgs e)
        {
            popusBottom2.IsOpen = false;
            popusBottom2.IsOpen = true;
            popusBottom2.PopupAnimation = System.Windows.Controls.Primitives.PopupAnimation.Scroll;

            if (popusBottom2.IsOpen == false)
            {
                popusBottom2.IsOpen = true;
            }
        }

 

WPF PlacementTarget用户

标签:

原文地址:http://www.cnblogs.com/xcj26/p/4873697.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!