Exemplo n.º 1
0
        protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)
        {
            if (!string.IsNullOrEmpty(GroupName))
            {
                _groupManager?.Remove(this, _groupName);

                _groupManager = RadioButtonGroupManager.GetOrCreateForRoot(e.Root);

                _groupManager.Add(this);
            }
            base.OnAttachedToVisualTree(e);
        }
Exemplo n.º 2
0
        private void SetGroupName(string newGroupName)
        {
            string oldGroupName = GroupName;

            if (newGroupName != oldGroupName)
            {
                if (!string.IsNullOrEmpty(oldGroupName) && _groupManager != null)
                {
                    _groupManager.Remove(this, oldGroupName);
                }
                _groupName = newGroupName;
                if (!string.IsNullOrEmpty(newGroupName))
                {
                    if (_groupManager == null)
                    {
                        _groupManager = RadioButtonGroupManager.GetOrCreateForRoot(this.GetVisualRoot());
                    }
                    _groupManager.Add(this);
                }
            }
        }