本文介绍了如何使windows 8 metro类型的PopUp始终位于顶部,就像showDilog选项一样的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试为我的应用程序制作一个metro样式弹出框,即在WPF中。对于其他用户我试过这个。只为其他编码器在那里。但是如何像showdialog一样开放?



I tried to make a metro Style popup for my application i.e. in WPF. For rest of the user i tried this.Just for Other coder out there. But how to make open like showdialog??

<Grid>
      <Grid.RowDefinitions>
          <RowDefinition Height="Auto"/>
          <RowDefinition/>
      </Grid.RowDefinitions>
      <StackPanel Name="SP" Orientation="Horizontal" Background="Black">
          <TextBox x:Name="txtSearch" Width="100" Margin="2,2,10,2" Text="msdn pejl"/>
          <Button Width="100" Content="Go!" Margin="2" Click="Button_Click" />
      </StackPanel>

      <Popup x:Name="ProfilePopup"  Height="Auto" Width="{Binding ActualWidth, ElementName=SP}" Placement="Center" >
          <StackPanel Background="SteelBlue">
              <StackPanel HorizontalAlignment="Center"  >
              <Grid Background="SteelBlue">
                  <Grid.ColumnDefinitions>
                      <ColumnDefinition Width="100" />
                      <ColumnDefinition Width="100" />
                      <ColumnDefinition Width="150" />
                      <ColumnDefinition Width="50" />
                  </Grid.ColumnDefinitions>
                  <Grid.RowDefinitions>
                      <RowDefinition />
                      <RowDefinition />
                      <RowDefinition />
                      <RowDefinition />
                  </Grid.RowDefinitions>

                  <Label Grid.Column="0" Foreground="White" Grid.Row="0" Grid.ColumnSpan="3" FontSize="18" Margin="10">Please Login To Access This Application</Label>
                  <Label Grid.Column="1" Foreground="White" Grid.Row="1">User Name</Label>
                  <TextBox Grid.Column="2" Foreground="Black" Background="White" Grid.Row="1" ToolTip="Enter Your User Name" Name="txtUserName" />
                  <Label Grid.Column="1" Foreground="White" Grid.Row="2">Password</Label>
                  <PasswordBox Grid.Column="2" Grid.Row="2" ToolTip="Enter Your Password" Name="txtPassword" />


                  <StackPanel Grid.Column="2" Grid.Row="3" Margin="10" HorizontalAlignment="Center" Orientation="Horizontal">

                      <Button Name="btnCancel" IsCancel="True" Content="Cancel" Click="btnCancel_Click" />
                      <Button Name="btnLogin" IsDefault="True" Content="Login" Click="btnLogin_Click" />


                  </StackPanel>
              </Grid>
          </StackPanel>
              </StackPanel>
      </Popup>

  </Grid>

推荐答案


这篇关于如何使windows 8 metro类型的PopUp始终位于顶部,就像showDilog选项一样的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 11:08