UWP MVVMCross绑定属性到方法

时间:2018-08-26 21:10:19

标签: mvvm binding uwp cross-platform mvvmcross

如何根据带有MVVPCross的第一个按钮的方法更改第二个按钮的内容?

类似这样的东西:

MainPage.xaml:

obj.geometry = new THREE.Geometry().fromBufferGeometry( obj.geometry );
obj.geometry.mergeVertices();

PhonewordTranslatorViewModel.cs:

<Button Content="Translate" Click="{x:Bind PhonewordTranslator.Translate}" />
<Button Content="{x:Bind PhonewordTranslatorViewModel.CallButtonText, Mode=TwoWay}" Click="{x:Bind PhonewordTranslatorViewModel.Call}" />

2 个答案:

答案 0 :(得分:1)

尝试一下:

 public void Translate()
{
  CallButtonText = "NewText"; 
  RaisePropertyChanged(() => CallButtonText);     
}  

答案 1 :(得分:0)

请如下修改您的翻译方法:

 public void Translate()
 {
    CallButtonText = "test123";            
 }