public static void HookupEvents(InstanceWidget widget) { #if WINRT throw new NotImplementedException(); #else var type = widget.GetType(); if (type.Assembly == etoAssembly) { return; } widget.HandleDefaultEvents(GetEvents(type)); #endif }
internal static void OnStyleWidgetDefaults(InstanceWidget widget) { if (widget != null) { var styleHandlers = GetStyleList(widget.GetType(), false); if (styleHandlers != null) { foreach (var styleHandler in styleHandlers) { styleHandler(widget); } } } }
public static bool IsDefault(InstanceWidget widget, string identifier) { #if WINRT throw new NotImplementedException(); #else var type = widget.GetType(); if (type.Assembly == etoAssembly) { return(false); } var events = GetEvents(type); return(Array.IndexOf(events, identifier) >= 0); #endif }
/// <summary> /// Adds a new binding with the widget and the the widget's current data context /// </summary> /// <remarks> /// This binds to a property of the <see cref="InstanceWidget.DataContext"/>, which will return the topmost value /// up the control hierarchy. For example, you can set the DataContext of your form or panel, and then bind to properties /// of that context on any of the child controls such as a text box, etc. /// </remarks> /// <param name="widget">Widget to add the binding to</param> /// <param name="widgetPropertyName">Property on the widget to update</param> /// <param name="dataContextPropertyName">Property on the widget's <see cref="InstanceWidget.DataContext"/> to bind to the widget</param> /// <param name="mode">Mode of the binding</param> /// <returns>A new instance of the DualBinding class that is used to control the binding</returns> public static DualBinding Bind(this InstanceWidget widget, string widgetPropertyName, string dataContextPropertyName, DualBindingMode mode = DualBindingMode.TwoWay) { var contextBinding = new ObjectBinding(widget, "DataContext"); var valueBinding = new ObjectBinding(contextBinding.DataValue, dataContextPropertyName); contextBinding.DataValueChanged += delegate { valueBinding.DataItem = contextBinding.DataValue; }; var binding = new DualBinding( valueBinding, new ObjectBinding(widget, widgetPropertyName), mode ); widget.Bindings.Add(contextBinding); widget.Bindings.Add(binding); return(binding); }
internal static void OnStyleWidget(InstanceWidget widget) { if (widget != null && !string.IsNullOrEmpty(widget.Style)) { var styles = widget.Style.Split(' '); foreach (var style in styles) { var styleHandlers = GetStyleList(style, false); if (styleHandlers != null) { foreach (var styleHandler in styleHandlers) { styleHandler(widget); } } } } if (StyleWidget != null) { StyleWidget(widget); } }
/// <summary> /// Initializes a new instance of the <see cref="Eto.PropertyStore"/> class. /// </summary> /// <param name="parent">Parent to attach the properties to</param> internal PropertyStore(InstanceWidget parent) { this.Parent = parent; }