/// <summary> /// Creates an instance of the GridDefinitionBindingHack class. /// </summary> private GridDefinitionBindingHelper(GridSplitter s, BindableObject o, BindableProperty p, BindableProperty p2) { // preconditions Argument.IsNotNull("s", s); Argument.IsNotNull("o", o); Argument.IsNotNull("p", p); // implementation this.splitter = s; this.bindableObject = o; this.sizeProperty = p; this.visibleProperty = p2; // update the property if the column width/row height changes. s.MouseLeftButtonUp += delegate(object sender, MouseButtonEventArgs e) { this.AdjustPropertyValue(); }; // update the column width/row height if the property value changes. o.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == this.sizeProperty.Name || (this.visibleProperty != null && e.PropertyName == this.visibleProperty.Name)) { this.AdjustDefinationValue(); } }; }
public void TestOneTimeBinding() { var model = new ModelTestClass { Number = 1, Text = "First" }; var control = new ControlTestClass { Text = "Wrong", Number = -1 }; var propInfo = typeof(ModelTestClass).GetProperty("Text"); var textProp = new BindableProperty<ControlTestClass, string>(control, o => o.Text, (o, action) => o.TextChanged += (sender, args) => action()); int controlCount = 0; textProp.PropertyChanged += (sender, args) => controlCount++; int modelCount = 0; model.PropertyChanged += (sender, args) => modelCount ++; Assert.Equal("Wrong", control.Text); Assert.Equal("First", model.Text); var binding = new BindingOneTime<ModelTestClass, ControlTestClass, string, string>(model, propInfo, o => o.Text, textProp, DataConverter<string>.EmptyConverter); TestOneTimeBindingInfo(binding, model, control, ref modelCount, ref controlCount); }
public void AddHandler(BindableProperty property, PropertyHandler handler) { if (handler == null) throw new ArgumentNullException(); List<BindableProperty> propStore; if (!PropertiesByName.TryGetValue(property.PropertyName, out propStore)) { propStore = new List<BindableProperty> { property }; PropertiesByName.Add(property.PropertyName, propStore); } else { if (!propStore.Contains(property)) propStore.Add(property); } List<PropertyHandler> handlStore; if(!PropertyHandlers.TryGetValue(property, out handlStore)) { handlStore = new List<PropertyHandler>(); PropertyHandlers.Add(property, handlStore); } handlStore.Add(handler); if (_target != null) handler(property); }
public BindableContent() { Content = new GUIContent(); LabelProperty = new BindableProperty<BindableContent, String>(this); TooltipProperty = new BindableProperty<BindableContent, String>(this); }
public override View GetView(PropertyInfo property, object o, out BindableProperty targetProperty, out IValueConverter converter) { targetProperty = Label.TextProperty; converter = new ValueConverter(); return new Label(); }
void NotifyPropertyChanged(BindableProperty property) { List<PropertyHandler> handlers; if (!PropertyHandlers.TryGetValue(property, out handlers)) return; handlers.ForEach(h => h(property)); }
public void SetValue(BindableProperty property, object value) { if (property == null) throw new ArgumentNullException("property"); Bindings.Remove(property); Values[property] = value; }
internal static BindingMode GetRealizedMode(this BindingBase self, BindableProperty property) { if (self == null) throw new ArgumentNullException("self"); if (property == null) throw new ArgumentNullException("property"); return self.Mode != BindingMode.Default ? self.Mode : property.DefaultBindingMode; }
public ViewCellContainer(Context context, IVisualElementRenderer view, ViewCell viewCell, View parent, BindableProperty unevenRows, BindableProperty rowHeight) : base(context) { _view = view; _parent = parent; _unevenRows = unevenRows; _rowHeight = rowHeight; _viewCell = viewCell; AddView(view.ViewGroup); UpdateIsEnabled(); }
public override View GetView(PropertyInfo property, object o, out BindableProperty targetProperty, out IValueConverter converter) { targetProperty = Switch.IsToggledProperty; converter = null; return new Switch { HorizontalOptions = LayoutOptions.Start }; }
public override View GetView(PropertyInfo property, object o, out BindableProperty targetProperty, out IValueConverter converter) { targetProperty = Editor.TextProperty; converter = new ValueConverter(); return new Editor { HorizontalOptions = LayoutOptions.FillAndExpand }; }
public void SetBinding(BindableProperty property, BindingBase binding) { if (property == null) throw new ArgumentNullException("property"); if (binding == null) throw new ArgumentNullException("binding"); Values.Remove(property); Bindings[property] = binding; }
internal override async void Apply(object newContext, BindableObject bindObj, BindableProperty targetProperty) { var view = bindObj as Element; if (view == null) throw new InvalidOperationException(); base.Apply(newContext, bindObj, targetProperty); Element templatedParent = await TemplateUtilities.FindTemplatedParentAsync(view); ApplyInner(templatedParent, bindObj, targetProperty); }
public override View GetView(PropertyInfo property, object o, out BindableProperty targetProperty, out IValueConverter converter) { targetProperty = Entry.TextProperty; converter = null; return new Entry { Keyboard = Keyboard.Default, HorizontalOptions = LayoutOptions.FillAndExpand }; }
public void TestBinder() { var model = new ModelTestClass { Number = 1, Text = "First" }; var control = new ControlTestClass { Text = "Wrong", Number = -1 }; var textProp = new BindableProperty<ControlTestClass, string>(control, o => o.Text, (o, action) => o.TextChanged += (sender, args) => action()); int[] controlCounts = { 0 }; textProp.PropertyChanged += (sender, args) => controlCounts[0]++; int[] modelCounts = { 0 }; model.PropertyChanged += (sender, args) => modelCounts[0]++; var binder = new Binder<ModelTestClass, ControlTestClass, string, string>(m => m.Text, () => DataConverter<string>.EmptyConverter); var bInfo = binder.Bind(model, textProp, BindingMode.OneTime); TestOneTimeBindingInfo(bInfo, model, control, ref modelCounts[0], ref controlCounts[0]); bInfo.Unbind(); model.Text = "First"; modelCounts[0] = 0; control.Text = "Wrong"; controlCounts[0] = 0; textProp = new BindableProperty<ControlTestClass, string>(control, o => o.Text, (o, action) => o.TextChanged += (sender, args) => action()); bInfo = binder.Bind(model, textProp, BindingMode.OneWay); TestOneWayBindingInfo(bInfo, model, control, ref modelCounts[0], ref controlCounts[0]); bInfo.Unbind(); model.Text = "Wrong"; control.Text = "First"; modelCounts[0] = 0; controlCounts[0] = 0; textProp = new BindableProperty<ControlTestClass, string>(control, o => o.Text, (o, action) => o.TextChanged += (sender, args) => action()); bInfo = binder.Bind(model, textProp, BindingMode.OneWayToSource); TestOneWayToSourceBindingInfo(bInfo, model, control, modelCounts, controlCounts); bInfo.Unbind(); model.Text = "First"; modelCounts[0] = 0; control.Text = "Wrong"; controlCounts[0] = 0; textProp = new BindableProperty<ControlTestClass, string>(control, o => o.Text, (o, action) => o.TextChanged += (sender, args) => action()); bInfo = binder.Bind(model, textProp, BindingMode.TwoWay); TestTwoWayBindingInfo(bInfo, model, control, ref modelCounts[0], ref controlCounts[0]); bInfo.Unbind(); }
/// <summary> /// Creates an instance of the GridDefinitionBindingHack class. /// </summary> public GridDefinitionBindingHelper(RowDefinition r, RowDefinition rs, GridSplitter s, BindableObject o, BindableProperty p, BindableProperty p2) : this(s, o, p, p2) { // preconditions Argument.IsNotNull("r", r); Argument.IsNotNull("rs", rs); // implementation this.contentRowDef = r; this.splitRowDef = rs; this.cachedDefMin = r.MinHeight; this.AdjustDefinationValue(); }
/// <summary> /// Creates an instance of the GridDefinitionBindingHack class. /// </summary> public GridDefinitionBindingHelper(ColumnDefinition c, ColumnDefinition cs, GridSplitter s, BindableObject o, BindableProperty p, BindableProperty p2) : this(s, o, p, p2) { // preconditions Argument.IsNotNull("c", c); Argument.IsNotNull("cs", cs); // implementation this.contentColDef = c; this.splitColDef = cs; this.cachedDefMin = c.MinWidth; this.AdjustDefinationValue(); }
internal override async void Apply(object newContext, BindableObject bindObj, BindableProperty targetProperty) { var view = bindObj as VisualElement; if (view == null) throw new InvalidOperationException(); base.Apply(newContext, bindObj, targetProperty); Element dataSourceParent = await FindDataSourceParentAsync(view); var dataSourceProviderer = (IDataSourceProvider)dataSourceParent; if (dataSourceProviderer != null) _dataSourceRef = new WeakReference(dataSourceProviderer); dataSourceProviderer?.MaskKey(_path); ApplyInner(dataSourceParent, bindObj, targetProperty); }
/// <summary> /// Applies the binding expression to a new source or target. /// </summary> internal void Apply(object sourceObject, BindableObject target, BindableProperty property) { _targetProperty = property; BindableObject prevTarget; if (_weakTarget != null && _weakTarget.TryGetTarget(out prevTarget) && !ReferenceEquals(prevTarget, target)) throw new InvalidOperationException("Binding instances can not be reused"); object previousSource; if (_weakSource != null && _weakSource.TryGetTarget(out previousSource) && !ReferenceEquals(previousSource, sourceObject)) throw new InvalidOperationException("Binding instances can not be reused"); _weakSource = new WeakReference<object>(sourceObject); _weakTarget = new WeakReference<BindableObject>(target); ApplyCore(sourceObject, target, property); }
internal override void Apply(object newContext, BindableObject bindObj, BindableProperty targetProperty) { if (Mode != BindingMode.OneWay) throw new InvalidOperationException($"{nameof(MultiBinding)} only supports {nameof(Mode)}.{nameof(BindingMode.OneWay)}"); object source = Context ?? newContext; base.Apply(source, bindObj, targetProperty); _isApplying = true; foreach (BindingBase binding in Bindings) { var property = BindableProperty.Create($"{nameof(MultiBinding)}Property-{Guid.NewGuid().ToString("N")}", typeof(object), typeof(MultiBinding), default(object), propertyChanged: (bindableObj, o, n) => SetValue(bindableObj)); _properties.Add(property); binding.Apply(source, bindObj, property); } _isApplying = false; SetValue(bindObj); _bindingExpression.Apply(_internalValue, bindObj, targetProperty); }
public override View GetView(PropertyInfo property, object o, out BindableProperty targetProperty, out IValueConverter converter) { targetProperty = null; converter = null; Picker picker = new Picker { HorizontalOptions = LayoutOptions.FillAndExpand }; foreach (object item in _items) picker.Items.Add(item.ToString()); picker.SelectedIndex = _items.IndexOf(property.GetValue(o)); picker.SelectedIndexChanged += (oo, ee) => { if (picker.SelectedIndex >= 0) property.SetValue(o, _items[picker.SelectedIndex]); }; return picker; }
internal static byte[] SerializePropertyValue(BindableProperty property, DataRowEntity row) { using (var ms = new MemoryStream()) { using (var pw = ProtoBufExtention.CreateProtoWriterSimplely(ms)) { var o = property.GetValue(row); if (property.PropertyType == typeof(TimeSpan)) pw.WriteSimplely((TimeSpan)o); else { switch (Type.GetTypeCode(property.PropertyType)) { case TypeCode.Boolean: pw.WriteSimplely((bool)o); break; case TypeCode.Byte: pw.WriteSimplely((byte)o); break; case TypeCode.Char: pw.WriteSimplely((char)o); break; case TypeCode.DateTime: pw.WriteSimplely((DateTime)o); break; case TypeCode.Double: pw.WriteSimplely((double)o); break; case TypeCode.Int16: pw.WriteSimplely((short)o); break; case TypeCode.Int32: pw.WriteSimplely((int)o); break; case TypeCode.Int64: pw.WriteSimplely((long)o); break; case TypeCode.SByte: pw.WriteSimplely((sbyte)o); break; case TypeCode.Single: pw.WriteSimplely((float)o); break; case TypeCode.String: pw.WriteSimplely((string)o); break; case TypeCode.UInt16: pw.WriteSimplely((ushort)o); break; case TypeCode.UInt32: pw.WriteSimplely((uint)o); break; case TypeCode.UInt64: pw.WriteSimplely((ulong)o); break; } } } return ms.ToArray(); } }
public static void SetValue(this UIView target, BindableProperty targetProperty, object value) { NativeBindingHelpers.SetValue(target, targetProperty, value); }
protected override bool Handle_BackgroundColorProperty(BindableProperty property) { // Background color is set directly to the TextBox/PasswordBox with bindings. return true; }
public static void SetBinding(this UIView self, BindableProperty targetProperty, BindingBase binding) { NativeBindingHelpers.SetBinding(self, targetProperty, binding); }
public void TestCreate() { var instance = new ControlTestClass { Text = "First" }; var property = new BindableProperty<ControlTestClass, string>( instance, o => o.Text, (o, action) => o.TextChanged += (sender, args) => action()); Assert.Equal("First", property.Value); Assert.Equal(instance.Text, property.Value); instance.Text = "Second"; Assert.Equal("Second", property.Value); property.Value = "Third"; Assert.Equal("Third", instance.Text); int textChangedCount = 0; int propertyChangedCount = 0; instance.TextChanged += (sender, args) => textChangedCount++; property.PropertyChanged += (sender, args) => { Assert.Equal("Text", args.PropertyName); propertyChangedCount++; }; instance.Text = "Forth"; Assert.Equal(1, textChangedCount); Assert.Equal(1, propertyChangedCount); property.Value = "Fifth"; Assert.Equal(2, textChangedCount); Assert.Equal(2, propertyChangedCount); instance = new ControlTestClass { Number = 1 }; property = new BindableProperty<ControlTestClass, string>( instance, "Text", o => o.Number.ToText(), (o, s) => o.Number = s.ToInt32(), (o, action) => o.NumberChanged += (sender, args) => action()); Assert.Equal("First", property.Value); Assert.Equal(instance.Number, property.Value.ToInt32()); instance.Number = 2; Assert.Equal("Second", property.Value); property.Value = "Third"; Assert.Equal("Third", instance.Number.ToText()); textChangedCount = 0; propertyChangedCount = 0; instance.NumberChanged += (sender, args) => textChangedCount++; property.PropertyChanged += (sender, args) => { Assert.Equal("Text", args.PropertyName); propertyChangedCount++; }; instance.Number = 4; Assert.Equal(1, textChangedCount); Assert.Equal(1, propertyChangedCount); property.Value = "Fifth"; Assert.Equal(2, textChangedCount); Assert.Equal(2, propertyChangedCount); }
/// <summary> /// Routes the bindable properties /// </summary> /// <param name="sender">The object that contains the bindable property that changed.</param> /// <param name="property">The property that changed.</param> /// <param name="oldValue">The previous value of the property.</param> /// <param name="newValue">The new value of the property.</param> private static void WhenBindablePropertyChanged(BindableObject sender, BindableProperty property, object oldValue, object newValue) { FindAndReplaceViewModel vm = sender as FindAndReplaceViewModel; if (vm != null) { if (property == FindTextProperty) { vm.FindNextCommand.Refresh(); vm.ReplaceCommand.Refresh(); vm.ReplaceAllCommand.Refresh(); } } }
protected override bool Handle_BackgroundColorProperty(BindableProperty property) { // Background color is set directly to the TextBox/PasswordBox with bindings. return(true); }
public BindingCondition() { _boundProperty = BindableProperty.CreateAttached("Bound", typeof(object), typeof(DataTrigger), null, propertyChanged: OnBoundPropertyChanged); }
private void InitializeComponent() { if (ResourceLoader.ResourceProvider != null && ResourceLoader.ResourceProvider(typeof(SelectCell).GetTypeInfo().Assembly.GetName(), "Layout/SelectCell.xaml") != null) { this.__InitComponentRuntime(); return; } if (XamlLoader.XamlFileProvider != null && XamlLoader.XamlFileProvider(base.GetType()) != null) { this.__InitComponentRuntime(); return; } ColumnDefinition columnDefinition = new ColumnDefinition(); ColumnDefinition columnDefinition2 = new ColumnDefinition(); RowDefinition rowDefinition = new RowDefinition(); TapGestureRecognizer tapGestureRecognizer = new TapGestureRecognizer(); Label label = new Label(); NoBorderEntry noBorderEntry = new NoBorderEntry(); Label label2 = new Label(); SvgCachedImage svgCachedImage = new SvgCachedImage(); Grid grid = new Grid(); NameScope nameScope = new NameScope(); NameScope.SetNameScope(this, nameScope); NameScope.SetNameScope(grid, nameScope); ((INameScope)nameScope).RegisterName("view", grid); if (grid.StyleId == null) { grid.StyleId = "view"; } NameScope.SetNameScope(columnDefinition, nameScope); NameScope.SetNameScope(columnDefinition2, nameScope); NameScope.SetNameScope(rowDefinition, nameScope); NameScope.SetNameScope(tapGestureRecognizer, nameScope); NameScope.SetNameScope(label, nameScope); ((INameScope)nameScope).RegisterName("label", label); if (label.StyleId == null) { label.StyleId = "label"; } NameScope.SetNameScope(noBorderEntry, nameScope); ((INameScope)nameScope).RegisterName("entry", noBorderEntry); if (noBorderEntry.StyleId == null) { noBorderEntry.StyleId = "entry"; } NameScope.SetNameScope(label2, nameScope); ((INameScope)nameScope).RegisterName("placeLabel", label2); if (label2.StyleId == null) { label2.StyleId = "placeLabel"; } NameScope.SetNameScope(svgCachedImage, nameScope); ((INameScope)nameScope).RegisterName("arrow", svgCachedImage); if (svgCachedImage.StyleId == null) { svgCachedImage.StyleId = "arrow"; } this.view = grid; this.label = label; this.entry = noBorderEntry; this.placeLabel = label2; this.arrow = svgCachedImage; grid.SetValue(VisualElement.BackgroundColorProperty, Color.White); grid.SetValue(Grid.RowSpacingProperty, 5.0); grid.SetValue(Layout.PaddingProperty, new Thickness(10.0, 5.0, 10.0, 5.0)); columnDefinition.SetValue(ColumnDefinition.WidthProperty, new GridLengthTypeConverter().ConvertFromInvariantString("*")); grid.GetValue(Grid.ColumnDefinitionsProperty).Add(columnDefinition); columnDefinition2.SetValue(ColumnDefinition.WidthProperty, new GridLengthTypeConverter().ConvertFromInvariantString("3*")); grid.GetValue(Grid.ColumnDefinitionsProperty).Add(columnDefinition2); rowDefinition.SetValue(RowDefinition.HeightProperty, new GridLengthTypeConverter().ConvertFromInvariantString("Auto")); grid.GetValue(Grid.RowDefinitionsProperty).Add(rowDefinition); tapGestureRecognizer.Tapped += this.TapGestureRecognizer_Tapped; grid.GestureRecognizers.Add(tapGestureRecognizer); BindableObject bindableObject = label; BindableProperty fontSizeProperty = Label.FontSizeProperty; IExtendedTypeConverter extendedTypeConverter = new FontSizeConverter(); string value = "Default"; XamlServiceProvider xamlServiceProvider = new XamlServiceProvider(); Type typeFromHandle = typeof(IProvideValueTarget); object[] array = new object[0 + 3]; array[0] = label; array[1] = grid; array[2] = this; xamlServiceProvider.Add(typeFromHandle, new SimpleValueTargetProvider(array, Label.FontSizeProperty)); xamlServiceProvider.Add(typeof(INameScopeProvider), new NameScopeProvider { NameScope = nameScope }); Type typeFromHandle2 = typeof(IXamlTypeResolver); XmlNamespaceResolver xmlNamespaceResolver = new XmlNamespaceResolver(); xmlNamespaceResolver.Add("", "http://xamarin.com/schemas/2014/forms"); xmlNamespaceResolver.Add("x", "http://schemas.microsoft.com/winfx/2009/xaml"); xmlNamespaceResolver.Add("layout", "clr-namespace:RFID.Layout"); xmlNamespaceResolver.Add("svg", "clr-namespace:FFImageLoading.Svg.Forms;assembly=FFImageLoading.Svg.Forms"); xamlServiceProvider.Add(typeFromHandle2, new XamlTypeResolver(xmlNamespaceResolver, typeof(SelectCell).GetTypeInfo().Assembly)); xamlServiceProvider.Add(typeof(IXmlLineInfoProvider), new XmlLineInfoProvider(new XmlLineInfo(19, 20))); bindableObject.SetValue(fontSizeProperty, extendedTypeConverter.ConvertFromInvariantString(value, xamlServiceProvider)); label.SetValue(Label.TextColorProperty, new Color(0.501960813999176, 0.501960813999176, 0.501960813999176, 1.0)); label.SetValue(View.VerticalOptionsProperty, LayoutOptions.Center); label.SetValue(View.HorizontalOptionsProperty, LayoutOptions.FillAndExpand); label.SetValue(Label.HorizontalTextAlignmentProperty, new TextAlignmentConverter().ConvertFromInvariantString("Start")); label.SetValue(Grid.ColumnProperty, 0); grid.Children.Add(label); noBorderEntry.SetValue(VisualElement.BackgroundColorProperty, Color.White); noBorderEntry.SetValue(VisualElement.WidthRequestProperty, 1.0); BindableObject bindableObject2 = noBorderEntry; BindableProperty fontSizeProperty2 = Entry.FontSizeProperty; IExtendedTypeConverter extendedTypeConverter2 = new FontSizeConverter(); string value2 = "Default"; XamlServiceProvider xamlServiceProvider2 = new XamlServiceProvider(); Type typeFromHandle3 = typeof(IProvideValueTarget); object[] array2 = new object[0 + 3]; array2[0] = noBorderEntry; array2[1] = grid; array2[2] = this; xamlServiceProvider2.Add(typeFromHandle3, new SimpleValueTargetProvider(array2, Entry.FontSizeProperty)); xamlServiceProvider2.Add(typeof(INameScopeProvider), new NameScopeProvider { NameScope = nameScope }); Type typeFromHandle4 = typeof(IXamlTypeResolver); XmlNamespaceResolver xmlNamespaceResolver2 = new XmlNamespaceResolver(); xmlNamespaceResolver2.Add("", "http://xamarin.com/schemas/2014/forms"); xmlNamespaceResolver2.Add("x", "http://schemas.microsoft.com/winfx/2009/xaml"); xmlNamespaceResolver2.Add("layout", "clr-namespace:RFID.Layout"); xmlNamespaceResolver2.Add("svg", "clr-namespace:FFImageLoading.Svg.Forms;assembly=FFImageLoading.Svg.Forms"); xamlServiceProvider2.Add(typeFromHandle4, new XamlTypeResolver(xmlNamespaceResolver2, typeof(SelectCell).GetTypeInfo().Assembly)); xamlServiceProvider2.Add(typeof(IXmlLineInfoProvider), new XmlLineInfoProvider(new XmlLineInfo(20, 92))); bindableObject2.SetValue(fontSizeProperty2, extendedTypeConverter2.ConvertFromInvariantString(value2, xamlServiceProvider2)); noBorderEntry.SetValue(Grid.ColumnProperty, 1); noBorderEntry.SetValue(View.HorizontalOptionsProperty, LayoutOptions.End); noBorderEntry.SetValue(VisualElement.IsEnabledProperty, false); grid.Children.Add(noBorderEntry); BindableObject bindableObject3 = label2; BindableProperty fontSizeProperty3 = Label.FontSizeProperty; IExtendedTypeConverter extendedTypeConverter3 = new FontSizeConverter(); string value3 = "Default"; XamlServiceProvider xamlServiceProvider3 = new XamlServiceProvider(); Type typeFromHandle5 = typeof(IProvideValueTarget); object[] array3 = new object[0 + 3]; array3[0] = label2; array3[1] = grid; array3[2] = this; xamlServiceProvider3.Add(typeFromHandle5, new SimpleValueTargetProvider(array3, Label.FontSizeProperty)); xamlServiceProvider3.Add(typeof(INameScopeProvider), new NameScopeProvider { NameScope = nameScope }); Type typeFromHandle6 = typeof(IXamlTypeResolver); XmlNamespaceResolver xmlNamespaceResolver3 = new XmlNamespaceResolver(); xmlNamespaceResolver3.Add("", "http://xamarin.com/schemas/2014/forms"); xmlNamespaceResolver3.Add("x", "http://schemas.microsoft.com/winfx/2009/xaml"); xmlNamespaceResolver3.Add("layout", "clr-namespace:RFID.Layout"); xmlNamespaceResolver3.Add("svg", "clr-namespace:FFImageLoading.Svg.Forms;assembly=FFImageLoading.Svg.Forms"); xamlServiceProvider3.Add(typeFromHandle6, new XamlTypeResolver(xmlNamespaceResolver3, typeof(SelectCell).GetTypeInfo().Assembly)); xamlServiceProvider3.Add(typeof(IXmlLineInfoProvider), new XmlLineInfoProvider(new XmlLineInfo(21, 20))); bindableObject3.SetValue(fontSizeProperty3, extendedTypeConverter3.ConvertFromInvariantString(value3, xamlServiceProvider3)); label2.SetValue(Label.TextColorProperty, Color.Black); label2.SetValue(View.VerticalOptionsProperty, LayoutOptions.Center); label2.SetValue(View.HorizontalOptionsProperty, LayoutOptions.FillAndExpand); label2.SetValue(Label.HorizontalTextAlignmentProperty, new TextAlignmentConverter().ConvertFromInvariantString("Start")); label2.SetValue(Grid.ColumnProperty, 1); grid.Children.Add(label2); svgCachedImage.SetValue(CachedImage.SourceProperty, new FFImageLoading.Forms.ImageSourceConverter().ConvertFromInvariantString("rightarrow.svg")); svgCachedImage.SetValue(Grid.ColumnProperty, 1); svgCachedImage.SetValue(View.HorizontalOptionsProperty, LayoutOptions.End); svgCachedImage.SetValue(VisualElement.WidthRequestProperty, 15.0); svgCachedImage.SetValue(VisualElement.HeightRequestProperty, 15.0); svgCachedImage.SetValue(View.VerticalOptionsProperty, LayoutOptions.Center); grid.Children.Add(svgCachedImage); this.View = grid; }
/// <summary> /// Routes the bindable properties /// </summary> /// <param name="sender">The object that contains the bindable property that changed.</param> /// <param name="property">The property that changed.</param> /// <param name="oldValue">The previous value of the property.</param> /// <param name="newValue">The new value of the property.</param> private static void WhenBindablePropertyChanged(BindableObject sender, BindableProperty property, object oldValue, object newValue) { TextEditorViewModel vm = sender as TextEditorViewModel; if (vm != null) { if (property == SelectionLengthProperty) { vm.CutCommand.Refresh(); vm.CopyCommand.Refresh(); } else if (property == TextProperty) { vm.FindCommand.Refresh(); vm.ReplaceCommand.Refresh(); vm.SelectAllCommand.Refresh(); } } }
private void Init(string label) { LabelProperty = new BindableProperty<LabelledNumericTextBox, string>(this, label); LabelWidth = 100; }
void ApplyInner(Element templatedParent, BindableObject bindableObject, BindableProperty targetProperty) { if (_expression == null && templatedParent != null) _expression = new BindingExpression(this, SelfPath); _expression?.Apply(templatedParent, bindableObject, targetProperty); }
/// <summary> /// Binds a data /// 绑定数据 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="val"></param> /// <returns></returns> public JUI Bind <T>(BindableProperty <T> val) { _bind = true; val.OnChange = new Action(Message); return(this); }
public static bool IsOneOf(this PropertyChangedEventArgs args, BindableProperty p0, BindableProperty p1, BindableProperty p2, BindableProperty p3, BindableProperty p4) { return(args.PropertyName == p0.PropertyName || args.PropertyName == p1.PropertyName || args.PropertyName == p2.PropertyName || args.PropertyName == p3.PropertyName || args.PropertyName == p4.PropertyName); }
public static bool Is(this PropertyChangedEventArgs args, BindableProperty property) { return(args.PropertyName == property.PropertyName); }
public MultiCondition() { _aggregatedStateProperty = BindableProperty.CreateAttached("AggregatedState", typeof(bool), typeof(DataTrigger), false, propertyChanged: OnAggregatedStatePropertyChanged); Conditions = new TriggerBase.SealedList<Condition>(); }
public static TElement DynamicResource <TElement>(this TElement element, BindableProperty property, string key) where TElement : Element { element.SetDynamicResource(property, key); return(element); }