Windows 8 如何在Popup.MessageDialog(Metro)中从右向左使用

Windows 8 如何在Popup.MessageDialog(Metro)中从右向左使用,windows-8,microsoft-metro,windows-runtime,right-to-left,messagedialog,Windows 8,Microsoft Metro,Windows Runtime,Right To Left,Messagedialog,我想显示MessageDialog。 但这种选择似乎并不存在 我看到了这样一个问题(),但我认为RTL是另一个问题 唯一的解决办法是写我自己的“RTLPopup”?如果是,怎么做 先谢谢你 我尝试使用以下代码: 但结果不是RTL: 您可以在ur方法中使用下面的消息对话框 var messageDialog = new MessageDialog(" You Can Show Message Here"); messageDialog.Title = "Alert

我想显示MessageDialog。 但这种选择似乎并不存在

我看到了这样一个问题(),但我认为RTL是另一个问题

唯一的解决办法是写我自己的“RTLPopup”?如果是,怎么做

先谢谢你

我尝试使用以下代码:

但结果不是RTL:
您可以在ur方法中使用下面的消息对话框

var messageDialog = new MessageDialog(" You Can Show Message Here");
                messageDialog.Title = "Alert";
                // Add commands and set their callbacks; both buttons use the same callback function instead of inline event handlers
                messageDialog.Commands.Add(new UICommand(
                    "OK",
                    new UICommandInvokedHandler(this.CommandInvokedHandlerAddPics)));

                messageDialog.Commands.Add(new UICommand(
                    "No",
                    new UICommandInvokedHandler(this.CommandInvokedHandlerback)));

                // Set the command that will be invoked by default
                messageDialog.DefaultCommandIndex = 0;

                // Set the command to be invoked when escape is pressed
                messageDialog.CancelCommandIndex = 1;

                // Show the message dialog
                await messageDialog.ShowAsync();
“确定”或“否”按钮的名称和方法

private void CommandInvokedHandlerAddPics(IUICommand command)
    {
        if (command.Label.Equals("OK"))
        {

        }
        else if (command.Label.Equals("No"))
        {

        }
    }
我不知道任何C#,但是也许你可以重写
messageDialog.OnPaint
方法。我在VB中这样做是为了在enabled设置为false时在按钮上获得不同颜色的文本

Protected Overrides子OnPaint(ByVal pevent As System.Windows.Forms.PaintEventArgs)
如果MyBase.Enabled,则
如果我是。Text=“”,那么
MyBase.OnPaint(pevent)
Dim sf As SizeF=pevent.Graphics.MeasureString(“Login”,Me.Font,Me.Width)
将点作为新点进行调暗((Me.Width/2)-(sf.Width/2),(Me.Height/2)-(sf.Height/2))
pevent.Graphics.DrawString(“Login”,Me.Font,brush.Black,ThePoint)
其他的
MyBase.OnPaint(pevent)
如果结束
其他的
Me.Text=“”
MyBase.OnPaint(pevent)
Dim sf As SizeF=pevent.Graphics.MeasureString(“未准备好…”,Me.Font,Me.Width)
将点作为新点进行调暗((Me.Width/2)-(sf.Width/2),(Me.Height/2)-(sf.Height/2))
pevent.Graphics.DrawString(“未准备好…”,Me.Font,BRUSKS.Red,ThePoint)
如果结束
端接头

由于
MessageDialog
类是密封的,并且当前无法设置属性来将方向更改为rtl,因此最好的选择是创建自己的。一种方法是将
网格
设置为页面上的最后一项,将
可见性
设置为
折叠
,然后在需要时使其可见。一种居中的方法如下:

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition/>
        <RowDefinition Height="Auto"/>
        <RowDefinition/>
    </Grid.RowDefinitions>
    <Border Grid.RowSpan="3" Background="Gray" Opacity="0.3"/> <!-- this locks the controls behind-->
    <Border HorizontalAlignment="Stretch" Background="White" Grid.Row="1" Height="300">
        <TextBlock Text="Test" HorizontalAlignment="Center" Width="300"/>
    </Border>
</Grid>


这将使您的内容垂直居中,水平居中,并防止用户与任何背景内容交互,直到它再次被
折叠。

我已将图片添加到我的问题中。MessageDialog是一个密封类。啊。快速谷歌搜索解释了什么是密封类,相当于vb.net
notheritable
。。。我不知道,对不起。啊,对不起。用C#术语来说。好的,这将涵盖UI部分,但是ShowAsync()呢?意思-该零件将位于何处?哪种类型的控件?啊,你想要一个布局控件?我还有什么其他选项?@itsho似乎有一些我以前没有见过的应用程序级设置可能达到你想要的效果:默认语言可以确定UI是否从右向左翻转。1。我没有接受你的回答,因为它不是一个实际的
对话框。2.所以基本上,你是说不改变windows语言是不可能实现的?