Esempio n. 1
0
        private static void labelMarginPropertyPropertyChanged(BindableObject bindable, object oldValue, object newValue)
        {
            BindableRadioButton target = bindable as BindableRadioButton;
            Thickness           margin = Common.ThicknessUtils.CalcThickness(newValue);

            if (target.mlbl.Margin != margin)
            {
                target.mlbl.Margin = margin;
            }
        }
Esempio n. 2
0
        private static void CheckBoxColorPropertyChanged(BindableObject bindable, object oldValue, object newValue)
        {
            BindableRadioButton target = bindable as BindableRadioButton;

            if (target.mckb.Color == (Xamarin.Forms.Color)newValue)
            {
                return;
            }

            target.mckb.Color = (Xamarin.Forms.Color)newValue;
        }
Esempio n. 3
0
        private static void fontAttributesPropertyChanged(BindableObject bindable, object oldValue, object newValue)
        {
            BindableRadioButton target = bindable as BindableRadioButton;

            if (target.mlbl.FontAttributes.ToString() == newValue.ToString())
            {
                return;
            }

            target.mlbl.FontAttributes = (FontAttributes) new Converters.FontAttributesConverter().Convert(newValue, null, null, null);
        }
Esempio n. 4
0
        private static void ItemsSourcePropertyChanged(BindableObject bindable, IEnumerable oldValue, IEnumerable newValue)
        {
            BindableRadioGroupView group = bindable as BindableRadioGroupView;

            group.radioButtons.Clear();
            group.Children.Clear(); // StackLayout

            if (newValue != null)
            {
                int radIndex = 0;
                foreach (var item in newValue)
                {
                    var rad = new BindableRadioButton();
                    rad.Id             = radIndex;
                    rad.BindingContext = item;

                    rad.CheckedChanged += group.OnCheckedChanged;

                    group.radioButtons.Add(rad);
                    group.Children.Add(rad); // StackLayout

                    radIndex++;
                }

                sSetGroupViewUIProperty(group);

                #region 设置默认选中项

                if (group.SelectedText != null)
                {
                    var match = group.radioButtons.FirstOrDefault(i => i.Text == group.SelectedText.ToString());
                    if (match != null)
                    {
                        match.IsChecked = true;
                    }
                }
                else if (int.TryParse(group.SelectedNo.ToString(), out int no) && no > 0)
                {
                    if (no >= 1)
                    {
                        int index = no - 1;
                        group.radioButtons[index].IsChecked = true;
                    }
                }

                #endregion
            }
        }
Esempio n. 5
0
        private static void fontSizePropertyChanged(BindableObject bindable, object oldValue, object newValue)
        {
            BindableRadioButton target = bindable as BindableRadioButton;

            if (target.mlbl.FontSize.ToString() == newValue.ToString())
            {
                return;
            }

            double tmp = 0;

            if (double.TryParse(newValue.ToString(), out tmp))
            {
                target.mlbl.FontSize = tmp;
            }
        }