Ejemplo n.º 1
0
        private static void ItemsSourceChanged(BindableObject bindable, IEnumerable oldValue, IEnumerable newValue) {
            var picker = (Picker)bindable;
            if (picker == null)
                throw new Exception("only support Picker");

            var selected = picker.SelectedIndex;

            var type = newValue.GetType().GenericTypeArguments[0].GetTypeInfo();
            var dp = (string)bindable.GetValue(DisplayPathProperty);
            PropertyInfo p = null;
            if (!string.IsNullOrWhiteSpace(dp)) {
                p = type.GetDeclaredProperty(dp);
            }
            foreach (var o in newValue) {
                object value = null;
                if (p != null)
                    value = p.GetValue(o);
                else
                    value = o;

                if (value != null)
                    picker.Items.Add(value.ToString());
            }

            picker.SelectedIndex = selected;
        }
Ejemplo n.º 2
0
		internal override void SetUp(BindableObject bindable)
		{
			object newvalue = bindable.GetValue(Property);

			bool newState = (newvalue == Value) || (newvalue != null && newvalue.Equals(Value));
			bindable.SetValue(_stateProperty, newState);
			bindable.PropertyChanged += OnAttachedObjectPropertyChanged;
		}
    // I need handle it here too 'cause when I use the child `Ghost` property coming from XAML binding, it didn't hit the `set` method
    public T GetValue <T>(BindableProperty property)
    {
        var value = propagationRootObject?.GetValue(property);

        if (value != null)
        {
            INotifyPropertyChanged bindableSubObject = (value as INotifyPropertyChanged);
            if (bindableSubObject != null)
            {
                bindableSubObject.PropertyChanged -= PropagatorListener;
                bindableSubObject.PropertyChanged += PropagatorListener;
                if (!propagationProperties.Any(a => a.Key == property.PropertyName))
                {
                    propagationProperties.Add(new KeyValuePair <string, object>(property.PropertyName, value));
                }
            }
        }
        return((T)value);
    }
Ejemplo n.º 4
0
        private static void DataContextChanged(object obj, EventArgs args)
        {
            BindableObject d = obj as BindableObject;
            IList <IMvxUpdateableBinding> bindings = d?.GetValue(BindingsListProperty) as IList <IMvxUpdateableBinding>;

            if (bindings != null)
            {
                foreach (var binding in bindings)
                {
                    binding.DataContext = d.BindingContext;
                }
            }
        }
Ejemplo n.º 5
0
		void OnConditionChanged(BindableObject bindable, bool oldValue, bool newValue)
		{
			var oldState = (bool)bindable.GetValue(_aggregatedStateProperty);
			var newState = true;
			foreach (Condition condition in Conditions)
			{
				if (!condition.GetState(bindable))
				{
					newState = false;
					break;
				}
			}
			if (newState != oldState)
				bindable.SetValue(_aggregatedStateProperty, newState);
		}
Ejemplo n.º 6
0
        /// <summary>
        /// Gets the list of pinned elements for the bindable object.
        /// </summary>
        /// <param name="bindableObject">The bindable object to get the list of pinned elements.</param>
        /// <returns>The list of pinned elements of the bindable object.</returns>
        internal static List<VisualElement> GetPinned(BindableObject bindableObject)
        {
            if (bindableObject == null)
            {
                throw new ArgumentNullException(nameof(bindableObject));
            }

            var value = bindableObject.GetValue(PinnedPropertyKey.BindableProperty) as List<VisualElement>;

            if (value == null)
            {
                value = new List<VisualElement>();
                bindableObject.SetValue(PinnedPropertyKey, value);
            }

            return value;
        }
Ejemplo n.º 7
0
 internal static CellRenderer GetRenderer(BindableObject cell)
 {
     return((CellRenderer)cell.GetValue(RendererProperty));
 }
 public static string GetAwesomeEntryType(BindableObject bindable)
 {
     return((string)bindable.GetValue(AwesomeEntryTypeProperty));
 }
 public static Command GetItemTapped(BindableObject bo)
 {
     return (Command)bo.GetValue(ItemTappedProperty);
 }
        public static INotifyCollectionChanged GetVMsProperty(BindableObject obj) {
            if (null == (TabbedPage)obj)
                throw new Exception("TabbedPageVMLocatorBinder only used for TabbedPage");

            return (INotifyCollectionChanged)obj.GetValue(VMsProperty);
        }
Ejemplo n.º 11
0
 public static bool GetApplyStyleImmediately(BindableObject obj)
 {
     return((bool)obj?.GetValue(ApplyStyleImmediatelyProperty));
 }
Ejemplo n.º 12
0
 public static INameScope GetNameScope(BindableObject bindable)
 {
     return((INameScope)bindable?.GetValue(NameScopeProperty));
 }
Ejemplo n.º 13
0
 public static BaseAnimation GetAnimation(BindableObject b) => (BaseAnimation)b.GetValue(AnimationProperty);
Ejemplo n.º 14
0
 public static Color GetBackgroundColor(BindableObject b) => (Color)b.GetValue(BackgroundColorProperty);
Ejemplo n.º 15
0
 public static bool GetHide(BindableObject b) => (bool)b.GetValue(HideProperty);
Ejemplo n.º 16
0
 public static bool GetIsBusy(BindableObject b) => (bool)b.GetValue(IsBusyProperty);
Ejemplo n.º 17
0
 public static bool GetIsParent(BindableObject b) => (bool)b.GetValue(IsParentProperty);
 public static RefreshPullDirection GetRefreshPullDirection(BindableObject element)
 {
     return((RefreshPullDirection)element.GetValue(RefreshPullDirectionProperty));
 }
Ejemplo n.º 19
0
 public static Qux GetQux(BindableObject bindable)
 {
     return((Qux)bindable.GetValue(QuxProperty));
 }
 public static string GetCachedSource(BindableObject bo)
 {
     return (string)bo.GetValue(ImageFactory.CachedSourceProperty);
 }
Ejemplo n.º 21
0
		internal static UITableViewCell GetRealCell(BindableObject cell)
		{
			return (UITableViewCell)cell.GetValue(RealCellProperty);
		}
Ejemplo n.º 22
0
 internal static bool GetAnimating(BindableObject b) => (bool)b.GetValue(AnimatingProperty);
Ejemplo n.º 23
0
		public static BehaviorCollection GetBehaviors(BindableObject target)
		{
			return (BehaviorCollection)target.GetValue(BehaviorsProperty);
		}
Ejemplo n.º 24
0
 internal static bool GetCancelAnimation(BindableObject b) => (bool)b.GetValue(CancelAnimationProperty);
Ejemplo n.º 25
0
 /// <summary>
 /// Gets the value of padding.
 /// </summary>
 /// <param name="bindable">The layout</param>
 /// <returns>Returns the padding.</returns>
 public static Thickness GetPadding(BindableObject bindable)
 {
     return((Thickness)bindable?.GetValue(PaddingProperty));
 }
Ejemplo n.º 26
0
 internal static Color GetOriginalBackgroundColor(BindableObject b) => (Color)b.GetValue(OriginalBackgroundColorProperty);
Ejemplo n.º 27
0
 public static void SetRenderer(BindableObject bindableObject, IVisualElementRenderer renderer)
 {
     var value = bindableObject.GetValue (RendererProperty);
     bindableObject.SetValue (RendererProperty, renderer);
 }
Ejemplo n.º 28
0
 public static TabPosition GetTabPosition(BindableObject element)
 {
     return((TabPosition)element.GetValue(TabPositionProperty));
 }
 public static bool GetAttachBehavior(BindableObject view)
 {
     return (bool)view.GetValue(AttachBehaviorProperty);
 }
Ejemplo n.º 30
0
 public static bool GetIsSelectable(BindableObject bindableObject) =>
     (bool)bindableObject.GetValue(IsSelectableProperty);
Ejemplo n.º 31
0
        public static IList <BindableObject> GetAdditionalChildren(BindableObject obj)
        {
            var value = obj?.GetValue(AdditionalChildrenProperty) as IList <BindableObject>;

            return(value);
        }
Ejemplo n.º 32
0
 public static Color GetColor(BindableObject bindable) {
     var color = (Color)bindable.GetValue(ColorProperty);
     return color;
 }
Ejemplo n.º 33
0
		public static ICommand GetItemTapped(BindableObject bindable)
		{
			return (ICommand)bindable.GetValue (CommandProperty);
		}
Ejemplo n.º 34
0
 public static double GetFontSize(BindableObject bindable) {
     return (double)bindable.GetValue(FontSizeProperty);
 }
Ejemplo n.º 35
0
 /// <summary>
 /// Gets the <see cref="T:Xamarin.Forms.Color"/> thumb tint color value for the Switch control's "off" position
 /// that is currently assigned to the passed <see cref="T:Xamarin.Forms.BindableObject"/>.
 /// </summary>
 /// <returns>The currently assigned tint color or Color.Default if nothing is assigned.</returns>
 /// <param name="bindable">The <see cref="T:Xamarin.Forms.BindableObject"/> that the ThumbTintColor attached
 /// property value should be retrieved from.</param>
 public static Color GetThumbTintColor(BindableObject bindable)
 {
     return((Color)(bindable?.GetValue(ThumbTintColorProperty) ??
                    ThumbTintColorProperty.DefaultValue));
 }
Ejemplo n.º 36
0
 public static string GetFontFamily(BindableObject obj) {
     return obj.GetValue(FontFamilyProperty) as string;
 }
 public static ImagesCache GetSharedFactory(BindableObject bo)
 {
     return (ImagesCache)bo.GetValue(ImageFactory.SharedFactoryProperty);
 }
Ejemplo n.º 38
0
 /// <summary>
 /// Gets the <see cref="T:XFGloss.CellGlossAccessoryType"/> value that is currently assigned to the passed
 /// <see cref="T:Xamarin.Forms.BindableObject"/>.
 /// </summary>
 /// <returns>The assigned <see cref="T:XFGloss.CellGlossAccessoryType"/>.</returns>
 /// <param name="bindable">The <see cref="T:Xamarin.Forms.BindableObject"/> that the AccessoryType attached
 /// property value should be retrieved from.</param>
 public static CellGlossAccessoryType GetAccessoryType(BindableObject bindable)
 {
     return((CellGlossAccessoryType)(bindable?.GetValue(AccessoryTypeProperty) ??
                                     AccessoryTypeProperty.DefaultValue));
 }
Ejemplo n.º 39
0
		internal override bool GetState(BindableObject bindable)
		{
			return (bool)bindable.GetValue(_aggregatedStateProperty);
		}
Ejemplo n.º 40
0
 /// <summary>
 /// Gets the <see cref="T:Xamarin.Forms.Color"/> value that is currently assigned to the passed
 /// <see cref="T:Xamarin.Forms.BindableObject"/>.
 /// </summary>
 /// <returns>The currently assigned background color or Color.Default if nothing is assigned.</returns>
 /// <param name="bindable">The <see cref="T:Xamarin.Forms.BindableObject"/> that the BackgroundColor attached
 /// property value should be retrieved from.</param>
 public static Color GetBackgroundColor(BindableObject bindable)
 {
     return((Color)(bindable?.GetValue(BackgroundColorProperty) ??
                    BackgroundColorProperty.DefaultValue));
 }
Ejemplo n.º 41
0
 /// <summary>
 /// Gets the AutowireViewModel property value.
 /// </summary>
 /// <param name="bindable"></param>
 /// <returns></returns>
 public static bool? GetAutowireViewModel(BindableObject bindable)
 {
     return (bool?)bindable.GetValue(ViewModelLocator.AutowireViewModelProperty);
 }
 public static string GetAccessibilityLabel(BindableObject view)
 {
     return (string)view.GetValue (AccessibilityLabelProperty);
 }
Ejemplo n.º 43
0
		internal override bool GetState(BindableObject bindable)
		{
			object newValue = bindable.GetValue(_boundProperty);
			return EqualsToValue(newValue);
		}
 public static AccessibilityTrait GetAccessibilityTraits(BindableObject view)
 {
     return (AccessibilityTrait)view.GetValue(AccessibilityTraitsProperty);
 }
Ejemplo n.º 45
0
 /// <summary>
 /// Gets the value of margin.
 /// </summary>
 /// <param name="bindable">The view</param>
 /// <returns>Returns the margin</returns>
 public static Thickness GetMargin(BindableObject bindable)
 {
     return((Thickness)bindable?.GetValue(MarginProperty));
 }
 public static bool GetInAccessibleTree(BindableObject view)
 {
     return (bool)view.GetValue(InAccessibleTreeProperty);
 }
Ejemplo n.º 47
0
 /// <summary>
 /// Gets the value of corner radius.
 /// </summary>
 /// <param name="bindable">The view</param>
 /// <returns>Returns the corner radius.</returns>
 public static Thickness GetCornerRadius(BindableObject bindable)
 {
     return((Thickness)bindable?.GetValue(CornerRadiusProperty));
 }
Ejemplo n.º 48
0
        /// <summary>
        /// Gets the element that the instance is pinned to.
        /// </summary>
        /// <param name="bindableObject">The bindable object to get the pin target for.</param>
        /// <returns>The element that the instance is pinned to.</returns>
        public static VisualElement GetPinTo(BindableObject bindableObject)
        {
            if (bindableObject == null)
            {
                throw new ArgumentNullException(nameof(bindableObject));
            }

            return (VisualElement) bindableObject.GetValue(PinToProperty);
        }
Ejemplo n.º 49
0
 public static IVisualElementRenderer GetRenderer(BindableObject bindableObject)
 {
     var value = bindableObject.GetValue (RendererProperty);
     return (IVisualElementRenderer)bindableObject.GetValue (RendererProperty);
 }
Ejemplo n.º 50
0
        /// <summary>
        /// Gets the position for the object.
        /// </summary>
        /// <param name="bindableObject">The bindable object to get the position for.</param>
        /// <returns>The position that has been assigned to the given object.</returns>
        public static FlyoutPosition GetPosition(BindableObject bindableObject)
        {
            if (bindableObject == null)
            {
                throw new ArgumentNullException(nameof(bindableObject));
            }

            return (FlyoutPosition) bindableObject.GetValue(PositionProperty);
        }
Ejemplo n.º 51
0
		internal static CellRenderer GetRenderer(BindableObject cell)
		{
			return (CellRenderer)cell.GetValue(RendererProperty);
		}
 public static UITableViewCell GetMyRealCell(BindableObject child)
 {
     return (UITableViewCell)child.GetValue(MyRealCellProperty);
 }
 public static IEnumerable<string> GetItems(BindableObject bo)
 {
     return (IEnumerable<string>)bo.GetValue(PickerCollection.ItemsProperty);
 }
Ejemplo n.º 54
0
 /// <include file="../../../../docs/Microsoft.Maui.Controls.PlatformConfiguration.WindowsSpecific/WebView.xml" path="//Member[@MemberName='GetExecutionMode']/Docs" />
 public static WebViewExecutionMode GetExecutionMode(BindableObject element)
 {
     return((WebViewExecutionMode)element.GetValue(ExecutionModeProperty));
 }
Ejemplo n.º 55
0
 /// <summary>
 /// Gets the <see cref="T:XFGloss.Gradient"/> instance that is currently assigned to the passed
 /// <see cref="T:Xamarin.Forms.BindableObject"/>.
 /// </summary>
 /// <returns>The currently assigned background gradient or null if nothing is assigned.</returns>
 /// <param name="bindable">The <see cref="T:Xamarin.Forms.BindableObject"/> that the BackgroundGradient attached
 /// property value should be retrieved from.</param>
 public static Gradient GetBackgroundGradient(BindableObject bindable)
 {
     return((Gradient)(bindable?.GetValue(BackgroundGradientProperty) ??
                       BackgroundGradientProperty.DefaultValue));
 }
Ejemplo n.º 56
0
 private static int GetPadding(BindableObject bo) {
     return (int)bo.GetValue(UniPadding.PaddingProperty);
 }
Ejemplo n.º 57
0
 public static IDomElement <BindableObject, BindableProperty> GetDomElement(BindableObject obj)
 {
     return(obj?.GetValue(DomElementProperty) as IDomElement <BindableObject, BindableProperty>);
 }
 /// <summary>
 /// Get ItemHeader for bindable object
 /// </summary>
 /// <param name="bindable"></param>
 /// <returns></returns>
 private static HeaderedItem GetItemModel(BindableObject bindable)
 {
     return(bindable?.GetValue(ItemModelProperty) as HeaderedItem);
 }
Ejemplo n.º 59
0
 /// <summary>
 /// Gets the <see cref="T:Xamarin.Forms.Color"/> minimum track tint color value that is currently assigned to
 /// the passed <see cref="T:Xamarin.Forms.BindableObject"/>.
 /// </summary>
 /// <returns>The currently assigned tint color or Color.Default if nothing is assigned.</returns>
 /// <param name="bindable">The <see cref="T:Xamarin.Forms.BindableObject"/> that the MinTrackTintColor attached
 /// property value should be retrieved from.</param>
 public static Color GetMinTrackTintColor(BindableObject bindable)
 {
     return((Color)(bindable?.GetValue(MinTrackTintColorProperty) ??
                    MinTrackTintColorProperty.DefaultValue));
 }
 public static ICommand GetItemTappedCommand(BindableObject bindableObject)
 {
     return((ICommand)bindableObject.GetValue(ItemTappedCommandProperty));
 }