public static void Bind <Tfirst, Tsecond>(UIProperty <Tfirst> first, UIProperty <Tsecond> second, BindingOptions opts) { if (opts.Mode == BindingMode.OneWay) { second.OnChanged += (e) => { object value = e; if (opts.Converter != null) { value = opts.Converter.ConvertTo(e); } first.SetValue((Tfirst)value); }; } else { //ToDo: fix endless call loop second.OnChanged += (e) => { first.SetValue((Tfirst)e); }; first.OnChanged += (e) => { second.SetValue((Tsecond)e); }; } }
private void TreeViewActors_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (UITrees.SelectedIndex < 0) { return; } EditorCommon.TreeListView.TreeNode node = UITrees.SelectedItem as EditorCommon.TreeListView.TreeNode; if (node == null) { return; } BindData data = node.Tag as BindData; if (data == null) { return; } UIProperty.SetValue(data.Value); }