示例#1
0
        private static void labelMarginPropertyPropertyChanged(BindableObject bindable, object oldValue, object newValue)
        {
            BindableMultiSelect target = bindable as BindableMultiSelect;
            Thickness           margin = Common.ThicknessUtils.CalcThickness(newValue);

            if (target.mlbl.Margin != margin)
            {
                target.mlbl.Margin = margin;
            }
        }
示例#2
0
        private static void CheckBoxColorPropertyChanged(BindableObject bindable, object oldValue, object newValue)
        {
            BindableMultiSelect target = bindable as BindableMultiSelect;

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

            target.mckb.Color = (Xamarin.Forms.Color)newValue;
        }
示例#3
0
        private static void fontAttributesPropertyChanged(BindableObject bindable, object oldValue, object newValue)
        {
            BindableMultiSelect target = bindable as BindableMultiSelect;

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

            target.mlbl.FontAttributes = (FontAttributes) new Converters.FontAttributesConverter().Convert(newValue, null, null, null);
        }
示例#4
0
        private static void fontSizePropertyChanged(BindableObject bindable, object oldValue, object newValue)
        {
            BindableMultiSelect target = bindable as BindableMultiSelect;

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

            if (double.TryParse(newValue.ToString(), out double tmp))
            {
                target.mlbl.FontSize = tmp;
            }
        }
示例#5
0
        private static void ItemsSourcePropertyChanged(BindableObject bindable, IEnumerable oldValue, IEnumerable newValue)
        {
            BindableMultiSelectGroupView group = bindable as BindableMultiSelectGroupView;

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

            if (newValue != null)
            {
                int radIndex = 0;
                foreach (var item in newValue)
                {
                    var rad = new BindableMultiSelect();
                    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.SelectedTexts != null)
                {
                    List <string> temp = JsonUtils.DeserializeObject <List <string> >(group.SelectedTexts.ToString());

                    group.radioButtons
                    .Where(i => temp.Contains(i.Text))
                    .ToList()
                    .ForEach(i => i.IsChecked = true);
                }
                else if (group.SelectedNos != null)
                {
                    List <int> noList = null;
                    try
                    {
                        noList = JsonUtils.DeserializeObject <List <int> >(group.SelectedNos.ToString());
                    }
                    catch (Exception ex)
                    {
                        System.Diagnostics.Debug.WriteLine($"转换{ex.GetFullInfo()}");
                        System.Diagnostics.Debugger.Break();
                    }

                    foreach (int no in noList)
                    {
                        if (no > group.radioButtons.Count)
                        {
                            string msg = $"{0}";
                            System.Diagnostics.Debug.WriteLine(msg);

                            System.Diagnostics.Debugger.Break();
                        }
                        else
                        {
                            int index = no - 1;
                            group.radioButtons[index].IsChecked = true;
                        }
                    }
                }

                #endregion
            }
        }