private static void selectedValuePropertyChanged(BindableObject bindable, object oldValue, object newValue) { AutoRelateRadioButton target = bindable as AutoRelateRadioButton; if (newValue == null) { return; } string newValueStr = newValue.ToString(); if (oldValue != null && oldValue.ToString() == newValueStr) { return; } if (target.GroupRelationList != null) { foreach (AutoRelateRadioButton item in target.GroupRelationList) { if (item.Text == newValueStr) { item.IsChecked = true; } else { item.IsChecked = false; } } } }
private static void labelMarginPropertyPropertyChanged(BindableObject bindable, object oldValue, object newValue) { AutoRelateRadioButton target = bindable as AutoRelateRadioButton; Thickness margin = Common.ThicknessUtils.CalcThickness(newValue); if (target.mlbl.Margin != margin) { target.mlbl.Margin = margin; } }
private static void CheckBoxColorPropertyChanged(BindableObject bindable, object oldValue, object newValue) { AutoRelateRadioButton target = bindable as AutoRelateRadioButton; if (target.mckb.Color == (Xamarin.Forms.Color)newValue) { return; } target.mckb.Color = (Xamarin.Forms.Color)newValue; }
private static void fontAttributesPropertyChanged(BindableObject bindable, object oldValue, object newValue) { AutoRelateRadioButton target = bindable as AutoRelateRadioButton; if (target.mlbl.FontAttributes.ToString() == newValue.ToString()) { return; } target.mlbl.FontAttributes = (FontAttributes) new Converters.FontAttributesConverter().Convert(newValue, null, null, null); }
private static void textPropertyChanged(BindableObject bindable, object oldValue, object newValue) { AutoRelateRadioButton target = bindable as AutoRelateRadioButton; if (target.mlbl.Text == newValue.ToString()) { return; } target.mlbl.Text = newValue.ToString(); }
private static void groupIDPropertyChanged(BindableObject bindable, object oldValue, object newValue) { AutoRelateRadioButton target = bindable as AutoRelateRadioButton; if (target.GroupRelationList != null) { throw new Exception("已经设置了GroupID, 但是又被设置成其他值了"); } string groupID = newValue.ToString(); AutoRelateRadioButton.GroupByID(groupID, target); }
public static void GroupByID(string key, AutoRelateRadioButton radioButton) { List <AutoRelateRadioButton> matchQuery = null; if (sDict.TryGetValue(key, out matchQuery) == false) { matchQuery = new List <AutoRelateRadioButton>(); sDict.TryAdd(key, matchQuery); } matchQuery.Add(radioButton); radioButton.GroupRelationList = matchQuery; }
private static void fontSizePropertyChanged(BindableObject bindable, object oldValue, object newValue) { AutoRelateRadioButton target = bindable as AutoRelateRadioButton; if (target.mlbl.FontSize.ToString() == newValue.ToString()) { return; } double tmp = 0; if (double.TryParse(newValue.ToString(), out tmp)) { target.mlbl.FontSize = tmp; } }