示例#1
0
        private static void OnIsGroupHolderChanged(Binding.BindableObject bindable, object oldValue, object newValue)
        {
            var view = bindable as View;

            if (view == null)
            {
                return;
            }

            if (!(bool)newValue)
            {
                view.SetValue(RadioButtonGroupProperty, null, false, true);
                return;
            }

            if (view.GetValue(RadioButtonGroupProperty) == null)
            {
                view.SetValue(RadioButtonGroupProperty, new RadioButtonGroup(), false, true);
            }
        }
示例#2
0
        private static void OnRadioButtonGroupChanged(Binding.BindableObject bindable, object oldValue, object newValue)
        {
            var view = bindable as View;

            if (view == null)
            {
                return;
            }

            if (oldValue is RadioButtonGroup oldGroup)
            {
                view.ChildAdded   -= oldGroup.OnChildChanged;
                view.ChildRemoved -= oldGroup.OnChildChanged;
                oldGroup.RemoveAll();
            }

            if (newValue is RadioButtonGroup newGroup)
            {
                view.ChildAdded   += newGroup.OnChildChanged;
                view.ChildRemoved += newGroup.OnChildChanged;
                newGroup.OnChildChanged(view, null);
            }
        }