Popup 控件

Popup:在一个单独的窗口中显示内容,该窗口浮动在当前应用程序窗口之上。

<Window x:Class="MaterialStorage.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="20"></RowDefinition>
            <RowDefinition Height="*"></RowDefinition>
            <RowDefinition Height="20"></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" ></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <DockPanel Grid.Row="0" Grid.Column="1" Height="20" HorizontalAlignment="Stretch" Name="dockPanel1" Margin="0" VerticalAlignment="Top">
            <Menu Name="menu1" Width="Auto" DockPanel.Dock="Top"
VerticalAlignment="Center"  >
                <MenuItem Header="文件">
                    <MenuItem Header="报表导出" Name="newMember" />
                    <MenuItem Header="数据备份" Name="saveMember" />
                    <Separator/>
                    <MenuItem Header="关闭" Name="exit" />
                </MenuItem>
                <MenuItem Header="关于"  />
            </Menu>
        </DockPanel>
        <Grid Grid.Row="1" Grid.Column="1" Background="Beige">
            <Image Name="image1" Source="http://i.ssimg.cn/ssupload/2013/02/28/c92380f19fbb4127861c8ec3c836eb48.jpg" Height="200" Width="200"/>
            <Popup IsOpen="False" PlacementTarget="{Binding ElementName=image1}" Placement="Bottom">
                <TextBlock FontSize="14" Background="LightGreen">Placement=Bottom</TextBlock>
            </Popup>
            <Popup IsOpen="True" PlacementTarget="{Binding ElementName=image1}" Placement="Top">
                <TextBlock FontSize="14" Background="LightGreen">Placement=Top</TextBlock>
            </Popup>
            <Popup IsOpen="True" PlacementTarget="{Binding ElementName=image1}" Placement="Left">
                <TextBlock FontSize="14" Background="LightGreen">Placement=Left</TextBlock>
            </Popup>
            <Popup IsOpen="True" PlacementTarget="{Binding ElementName=image1}" Placement="Right">
                <TextBlock FontSize="14" Background="LightGreen">Placement=Right</TextBlock>
            </Popup>
        </Grid>
        <DockPanel Grid.Row="2" Grid.Column="1"  Height="20" HorizontalAlignment="Stretch" Name="dockPanel2" Margin="0" VerticalAlignment="Bottom">
            <StatusBar Height="20" Name="statusBar1" Width="Auto" DockPanel.Dock="Top" VerticalAlignment="Center"   >
                <TextBlock Name="statusValue">fff</TextBlock>
            </StatusBar>
        </DockPanel>
    </Grid>
</Window>

转载于:https://www.cnblogs.com/zhuzhenyu/archive/2013/02/28/2937313.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值