English 中文(简体)
利用MVVER-Light对后导航重新具有约束力
原标题:Refresh bindings on back navigation using MVVM-Light

设想: 我从我的主页开始。 I navigate to sub-page A, change a Value, at the Back button and the limit TextBlock in the main page don t change. 如果Iavigate to sub-page B, a textBlock using that same binding change. 同样,如果我再看A页,我就会看到价值的变化。 如果我离职,新价值就出现在主页上。 只是在使用背纽州时,才开始复习。

我一遍,我所有的英勇于工作。 和我一样,除了重回主页外,在每一种情况下都开展了具有约束力的工作。 我如何发出信息,或以其他方式恢复该页的约束力? 感谢!

<><>Edit>:

根据大家接受的诺梅尔的答复,我这样做了:

My MainPage.xaml文档有这一标记:

<TextBlock Text="{Binding Title, Mode=OneWay}" />

我的主要意见是:

       public string Title
    {
        get { return ProfileModel.Instance.DescriptionProfile.Title; }
    }

我在《主文》中加入:

Messenger.Default.Register<PropertyChangedMessage<string>>(this,
        (action) => DispatcherHelper.CheckBeginInvokeOnUI(
        () => RaisePropertyChanged("Title")));

在另一种观点中,我有以下标记:

<TextBox Grid.Row="1" Width="250" Height="100" Text="{Binding TitleEdit, Mode=TwoWay}" />

在它看来,模式一在获得/确定指示时使用:

        public string TitleEdit
    {
        get { return ProfileModel.Instance.DescriptionProfile.Title; }

        set
        {
            if (ProfileModel.Instance.DescriptionProfile.Title == value) return;

            string oldValue = ProfileModel.Instance.DescriptionProfile.Title;


            ProfileModel.Instance.DescriptionProfile.Title = value;

            RaisePropertyChanged("Title", oldValue, value, true);
        }
    }
最佳回答

阁下认为,如果儿童一页变更财产,你就希望修改模式。 (此处注,该财产为一类毛毯,但可以是任何东西)

  Messenger.Default.Register<PropertyChangedMessage<bool>>(this,
    (action) => DispatcherHelper.CheckBeginInvokeOnUI(
   () =>
      {
         MessageBox.Show(action.newValue.ToString());
         //do what you want here (i.e. RaisePropertyChanged on a value they share)
     }));

当你使用<条码>儿童班级的RaisePropertyChanged时,使用超载广播。

RaisePropertyChanged("Preference", oldValue, value, true);

最后,请注意,为了使用<代码>DisplerHelper,你需要将以下内容添加到App 构造者(App.xaml.cs)上。

DispatcherHelper.Initialize();
问题回答

暂无回答




相关问题
Get DynamicResource Binding in WPF

Can any one help me to get DynamicResource Binding in WPF by code? I have set binding Like follow, TextBlock Background={DynamicResource ColorA} Name="TB" in Xaml. and i need to get the - TB s ...

WPF Binding to specific items in collection

I m currently trying to bind to certain items in a collection in wpf. This is best explained by an example. My XAML is below: <Canvas Name="TaskCanvas" Width="467.667" Height="414"> <...

WPF Dynamic Binding X and Y Co-ordinates

I have a question on WPF dynamic positioning. I want to place Elipses on the screen based on X and Y co-ordinates that i have stored in a collection in C#. I have been made aware of the drawing ...

WPF Data Binding Error in ListBox

I have a ListBox: <ListBox x:Name="HistogramListBox" Grid.Column="1" Margin="8,2,8,0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Template="{StaticResource ...

WCF binding error

So I got into work early today and got the latest from source control. When I try to launch our ASP.NET application, I get this exception: "The binding at system.serviceModel/bindings/wsHttpBinding ...

silverlight 3 collection binding

Someone please help me understand why this binding does not work... I have a class called SelectionManager with a property called dates which is populated by a WCF service. The property is an ...

热门标签