横向方向的ContentDialog行为 [英] ContentDialog behavior in landscape orientation

查看:51
本文介绍了横向方向的ContentDialog行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为win Phone 8.1开发一个应用程序,并面临新引入的"ContentDialog"的特殊问题。控制。

I am developing an application for win Phone 8.1 and facing a peculiar issue with the newly introduced "ContentDialog" control.

我们使用ContentDialog获取调用应用程序中下一步所需的任何用户输入。我们的应用程序支持纵向和横向,以提高可用性。我们已经为
纵向模式设计了我们的ContentDialog并且所有这些工作都很好,但是,在横向模式下,ContentDialog正在裁剪实际内容并仅显示部分内容。我们用于显示内容对话框的体系结构涉及ContentDialog作为用户控件
,它在全屏模式下呈现另一个用户控件。这在我们处于纵向模式之前工作正常,但是在切换到横向方向时,用户控件的内容(ContentDialog显示在其自身上方)根据
调整到新维度,但ContentDialog会裁剪显示控制到更小的宽度。例如,如果我们尝试使用屏幕的完整可用宽度(减去应用栏区域),则最终内容显示仅在指定的实际
宽度的一半之内。

We use the ContentDialog for getting any user input that is required for invoking the next step in the application. Our application supports Portrait as well as landscape orientations for better usability. We've worked on designs of our ContentDialog for portrait mode and all of these work just fine, however, in the landscape mode the ContentDialog is cropping the actual content and displaying only a part of the content. Our architecture for displaying content dialogs involves ContentDialog as a user control that presents another user control over itself in Full Screen mode. This works fine till we are in portrait mode, but on switching to landscape orientation, the content of the user control, that ContentDialog is displaying atop itself, resizes itself according to new dimension, but the ContentDialog crops the display of the control to a much smaller width. For instance, if we are trying to use the complete available width (minus the app bar area) of screen, the final content display is only within half the actual width specified.

现有实现将任何所需内容作为用户控件添加到托管ContentDialog的用户控件上。示例如下:

The existing implementation adds any desired content as a usercontrol over user control hosting the ContentDialog. Sample given below:

public enum MyDialogResult
{
    None = 0,
    Primary = 1,
    Secondary = 2
};


public class MyDialog
{
    private ContentDialog mContentDialog;
    public async Task<MyDialogResult> ShowAsync(object dialogContent, String primaryButtonText, String secondaryButtonText)
        {
            MyDialogResult genericDialogResult = MyDialogResult.None;
            ScrollViewer scroller = new ScrollViewer();

            try
            {
                ContentDialogResult dialogResult = ContentDialogResult.None;

                mContentDialog = new ContentDialog();
                mContentDialog.Background = new SolidColorBrush(Color.FromArgb(255, 255, 255, 255));
                mContentDialog.FullSizeDesired = true;
                mContentDialog.Content = dialogContent;
                mContentDialog.PrimaryButtonText = primaryButtonText;
                mContentDialog.SecondaryButtonText = secondaryButtonText;
                //mContentDialog.SizeChanged += mContentDialog_SizeChanged; //To handle changes in width, but doesn't work

                dialogResult = await mContentDialog.ShowAsync();

                mContentDialog.Content = null;

                switch (dialogResult)
                {
                    case ContentDialogResult.None:
                        genericDialogResult = MyDialogResult.None;
                        break;
                    case ContentDialogResult.Primary:
                        genericDialogResult = MyDialogResult.Primary;
                        break;
                    case ContentDialogResult.Secondary:
                        genericDialogResult = MyDialogResult.Secondary;
                        break;
                    default:
                        break;
                }


            }
            catch (Exception e)
            {
                Logger.LogFlow(e.ToString());
            }
            finally
            {
                RemoveInputPaneEvents();
            }
            return genericDialogResult;
        }
}

我们可以将任何控件添加到MyDialog类中,但方向更改会重新解决另一个问题控制。我急需帮助......谢谢!

We can add any control to the MyDialog class but orientation change would relveal another issue in the control. I need urgent help... Thanks!

推荐答案

嗨Rahgav,

Hi Rahgav,

我是不完全确定这是否是你遇到的问题(下次请提供一个完整的复制样本,在预期和实际状态之间有更清晰的定义),但我认为你遇到了一个已知的问题,其中的大小是在纵向和横向之间旋转时,对话框不会重新计算
。正在针对下一版本的Windows Phone调查此问题。

I'm not completely sure if this is what you're running into or not (next time please provide a full repro sample with clearer definition between the expected and actual states), but I think you're running into a known issue where the size of the dialog doesn't get recalculated when rotating between portrait and landscape. This issue is being investigated for the next version of Windows Phone.


这篇关于横向方向的ContentDialog行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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