我正在重构示例中的代码:
而排除技能等级后,与相应的变化
在MainWindow.xaml
<local:Team>
<local:Employee Name="Larry" Age="21">
<local:Employee.Skills>
<!-- local:Skills -->
<local:Skills>
Run Code Online (Sandbox Code Playgroud)
在MainWindow1.xaml.cs中:
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Windows;
namespace WpfApplication
{
public class Skill
{//I'd like to exclude class Skill having moved it into class Employee as nested one
public string Description { get; set; }
}
public class Employee
{
public string Name { get ; set; }
public int Age { get; set; } …
Run Code Online (Sandbox Code Playgroud) 我正在为Xamarin Forms中的数据绑定而苦苦挣扎.这就是为什么,我期望从以下XAML语句中发生的事情:
IsVisible="{Binding Path=UserContext.IsLoggedOut}"
Run Code Online (Sandbox Code Playgroud)
是 - 该属性绑定到视图模型的子对象.现在要么在Xamarin Forms中不支持,要么我错过了一个技巧.
如果在支持WPF的Xamarin中不支持,那么我们应该做些什么来传播嵌套对象?展平视图模型正在让我写出令人难以置信的代码和大量代码.