如何使windows 8 metro类型的PopUp始终位于顶部,就像showDilog选项一样 [英] How To make a windows 8 metro type PopUp always on top ,Just like showDilog option

查看:61
本文介绍了如何使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>

推荐答案





要做到这一点,你必须使用另一个窗口,并可能创建一个新的用户控件来存储你的WPF代码...



窗口必须将WindowStyle设置为none才能隐藏WpF窗口中的三个默认按钮和设置为CenterOwner的WindowStartupLocation。 (我很抱歉,但我现在不记得该物业的确切名称,但名称与我所写的名称非常相似)

然后,在另一个窗口内,实例化你的窗口和调用方法ShowDialog。



有关WpF中对话框的更多信息,请参阅msdn或google中的WPF对话框Windows ...您将找到许多有用的信息。



希望这有帮助



LG
Hi,

to do that, you have to use another Window and maybe create a new usercontrol to store your WPF code...

The window has to have the WindowStyle set to none in order to hide the three default buttons in WpF windows and WindowStartupLocation set to CenterOwner. (I'm sorry, but I cannot remember the exact name of the property right now, but the names are really similar to the ones I have written)
Then, inside another window, instantiate your window and call the method ShowDialog.

For more information about dialogs in WpF, see WPF dialog Windows in msdn or google... you'll find a lot of useful information.

Hope this helps

LG


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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆