本文整理汇总了C#中IControl.Bind方法的典型用法代码示例。如果您正苦于以下问题:C# IControl.Bind方法的具体用法?C# IControl.Bind怎么用?C# IControl.Bind使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IControl
的用法示例。
在下文中一共展示了IControl.Bind方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ApplyBindings
/// <summary>
/// Applies any delayed bindings to a control.
/// </summary>
/// <param name="control">The control.</param>
public static void ApplyBindings(IControl control)
{
List<Entry> bindings;
if (_entries.TryGetValue(control, out bindings))
{
foreach (var binding in bindings)
{
control.Bind(binding.Property, binding.Binding);
}
_entries.Remove(control);
}
}
示例2: Add
/// <summary>
/// Adds a delayed binding to a control.
/// </summary>
/// <param name="target">The control.</param>
/// <param name="property">The property on the control to bind to.</param>
/// <param name="binding">The binding.</param>
public static void Add(IControl target, AvaloniaProperty property, IBinding binding)
{
if (target.IsInitialized)
{
target.Bind(property, binding);
}
else
{
List<Entry> bindings;
if (!_entries.TryGetValue(target, out bindings))
{
bindings = new List<Entry>();
_entries.Add(target, bindings);
// TODO: Make this a weak event listener.
target.Initialized += ApplyBindings;
}
bindings.Add(new Entry(binding, property));
}
}