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;
        }
Example #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);
    }
Example #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;
                }
            }
        }
Example #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);
		}
Example #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;
        }
Example #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);
        }
Example #11
0
 public static bool GetApplyStyleImmediately(BindableObject obj)
 {
     return((bool)obj?.GetValue(ApplyStyleImmediatelyProperty));
 }
Example #12
0
 public static INameScope GetNameScope(BindableObject bindable)
 {
     return((INameScope)bindable?.GetValue(NameScopeProperty));
 }
 public static BaseAnimation GetAnimation(BindableObject b) => (BaseAnimation)b.GetValue(AnimationProperty);
 public static Color GetBackgroundColor(BindableObject b) => (Color)b.GetValue(BackgroundColorProperty);
 public static bool GetHide(BindableObject b) => (bool)b.GetValue(HideProperty);
 public static bool GetIsBusy(BindableObject b) => (bool)b.GetValue(IsBusyProperty);
 public static bool GetIsParent(BindableObject b) => (bool)b.GetValue(IsParentProperty);
 public static RefreshPullDirection GetRefreshPullDirection(BindableObject element)
 {
     return((RefreshPullDirection)element.GetValue(RefreshPullDirectionProperty));
 }
 public static Qux GetQux(BindableObject bindable)
 {
     return((Qux)bindable.GetValue(QuxProperty));
 }
 public static string GetCachedSource(BindableObject bo)
 {
     return (string)bo.GetValue(ImageFactory.CachedSourceProperty);
 }
Example #21
0
		internal static UITableViewCell GetRealCell(BindableObject cell)
		{
			return (UITableViewCell)cell.GetValue(RealCellProperty);
		}
 internal static bool GetAnimating(BindableObject b) => (bool)b.GetValue(AnimatingProperty);
Example #23
0
		public static BehaviorCollection GetBehaviors(BindableObject target)
		{
			return (BehaviorCollection)target.GetValue(BehaviorsProperty);
		}
 internal static bool GetCancelAnimation(BindableObject b) => (bool)b.GetValue(CancelAnimationProperty);
Example #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));
 }
 internal static Color GetOriginalBackgroundColor(BindableObject b) => (Color)b.GetValue(OriginalBackgroundColorProperty);
 public static void SetRenderer(BindableObject bindableObject, IVisualElementRenderer renderer)
 {
     var value = bindableObject.GetValue (RendererProperty);
     bindableObject.SetValue (RendererProperty, renderer);
 }
Example #28
0
 public static TabPosition GetTabPosition(BindableObject element)
 {
     return((TabPosition)element.GetValue(TabPositionProperty));
 }
 public static bool GetAttachBehavior(BindableObject view)
 {
     return (bool)view.GetValue(AttachBehaviorProperty);
 }
 public static bool GetIsSelectable(BindableObject bindableObject) =>
     (bool)bindableObject.GetValue(IsSelectableProperty);
Example #31
0
        public static IList <BindableObject> GetAdditionalChildren(BindableObject obj)
        {
            var value = obj?.GetValue(AdditionalChildrenProperty) as IList <BindableObject>;

            return(value);
        }
 public static Color GetColor(BindableObject bindable) {
     var color = (Color)bindable.GetValue(ColorProperty);
     return color;
 }
Example #33
0
		public static ICommand GetItemTapped(BindableObject bindable)
		{
			return (ICommand)bindable.GetValue (CommandProperty);
		}
 public static double GetFontSize(BindableObject bindable) {
     return (double)bindable.GetValue(FontSizeProperty);
 }
Example #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));
 }
 public static string GetFontFamily(BindableObject obj) {
     return obj.GetValue(FontFamilyProperty) as string;
 }
 public static ImagesCache GetSharedFactory(BindableObject bo)
 {
     return (ImagesCache)bo.GetValue(ImageFactory.SharedFactoryProperty);
 }
Example #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));
 }
Example #39
0
		internal override bool GetState(BindableObject bindable)
		{
			return (bool)bindable.GetValue(_aggregatedStateProperty);
		}
Example #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));
 }
Example #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);
 }
Example #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);
 }
Example #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);
 }
Example #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));
 }
Example #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);
        }
 public static IVisualElementRenderer GetRenderer(BindableObject bindableObject)
 {
     var value = bindableObject.GetValue (RendererProperty);
     return (IVisualElementRenderer)bindableObject.GetValue (RendererProperty);
 }
Example #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);
        }
Example #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);
 }
Example #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));
 }
Example #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));
 }
Example #56
0
 private static int GetPadding(BindableObject bo) {
     return (int)bo.GetValue(UniPadding.PaddingProperty);
 }
Example #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);
 }
Example #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));
 }