绑定到不在UWP上工作的页面的Title属性

时间:2017-07-01 16:46:41

标签: c# xamarin data-binding xamarin.forms xamarin.uwp

我使用的是Xamarin表单,我遇到了绑定到Title TabbedPage属性的问题。这是我的观看代码:

<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
         x:Class="App.View.Pages.MyPage"
         xmlns:pages="clr-namespace:App.View.Page; assembly=App.View.Pages"
         Title="{Binding Title}">

和我的ViewModel代码:

private string _Title;
public string Title
{
    get { return _Title; }
    set { Set(() => Title, ref _Title, value); }
}

我使用此代码更改ViewModel中的标题:

Title = "My new title"

适用于Android,但不适用于UWP。在Android上,这个页面的标题实时更改,当我在UWP上执行此代码时,我必须重新加载&#34;页面切换到另一个页面,然后返回到此页面。有谁知道为什么会这样或者如何修复它?

编辑:当用户从DialogBox中选择一个项目时,我会切换标题。

0 个答案:

没有答案