【问题标题】:Windows Phone C# MediaElement or Image resizeingWindows Phone C# MediaElement 或图像大小调整
【发布时间】:2015-08-20 20:28:18
【问题描述】:

我需要一些帮助来解决这个问题:

我有纵向视图的页面。顶部 1/3 字段为 MediaElement 或 Image 保留,底部 2/3:有按钮和文本块。

我需要这样做:

  1. 如果元素被点击(完成)
  2. 暴力旋转手机视图(完成)
  3. 调整整个页面的宽度和高度 MediaElement 和 Image,而不刷新源

谢谢你的帮助

【问题讨论】:

    标签: c# xaml windows-phone-8 windows-phone-8.1


    【解决方案1】:

    只需提供您的 UI 元素名称并填写“PhoneApplicationPage_OrientationChanged”方法。 就像这样:

    <Image x:Name="IndexImage"></Image> //every Image needs an source so this code does not work 
    

    而c#中的方法是这样的:

    private void PhoneApplicationPage_OrientationChanged(object sender, OrientationChangedEventArgs e){
    if ((e.Orientation & PageOrientation.Portrait) == (PageOrientation.Portrait))
    {
        IndexImage.height = 100; //for example
    }
    
    else
    {
       IndexImage.height = 50; //for example
    }
    

    看看这个: Quickstart Screen orientation

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-08-04
      • 1970-01-01
      • 2012-02-13
      • 2011-07-13
      • 1970-01-01
      • 1970-01-01
      • 2018-05-18
      • 2012-06-23
      相关资源
      最近更新 更多