private static object OnCoerceFocusable(DependencyObject d, object baseValue) { RibbonRadioButton button = (RibbonRadioButton)d; if (button.CoerceFocusable) { return(false); } return(baseValue); }
private static Control MapQatDataToControl(VM.QatItem qatItem) { string typeName = qatItem.Instance.GetType().Name; Control control = null; switch (typeName) { case "ButtonData": { control = new RibbonButton(); control.DataContext = qatItem.Instance; break; } case "ToggleButtonData": { control = new RibbonToggleButton(); control.DataContext = qatItem.Instance; break; } case "RadioButtonData": { control = new RibbonRadioButton(); control.DataContext = qatItem.Instance; break; } case "CheckBoxData": { control = new RibbonCheckBox(); control.DataContext = qatItem.Instance; break; } case "TextBoxData": { control = new RibbonTextBox(); control.DataContext = qatItem.Instance; break; } case "MenuButtonData": { control = new RibbonMenuButton(); control.DataContext = qatItem.Instance; break; } case "SplitButtonData": { if (!qatItem.IsSplitHeader) { control = new RibbonSplitButton(); } else { VM.SplitButtonData splitButtonData = (VM.SplitButtonData)qatItem.Instance; if (splitButtonData.IsCheckable) { control = new RibbonToggleButton(); } else { control = new RibbonButton(); } } control.DataContext = qatItem.Instance; break; } case "ComboBoxData": { control = new RibbonComboBox(); control.DataContext = qatItem.Instance; break; } case "MenuItemData": { VM.MenuItemData menuItemData = (VM.MenuItemData)qatItem.Instance; if (menuItemData.ControlDataCollection.Count > 0) { control = new RibbonMenuButton(); } else { control = new RibbonButton(); } control.DataContext = qatItem.Instance; break; } case "SplitMenuItemData": { VM.SplitMenuItemData splitMenuItemData = (VM.SplitMenuItemData)qatItem.Instance; if (!qatItem.IsSplitHeader) { if (splitMenuItemData.ControlDataCollection.Count > 0) { control = new RibbonSplitButton(); } else if (splitMenuItemData.IsCheckable) { control = new RibbonToggleButton(); } else { control = new RibbonButton(); } } else { control = new RibbonToggleButton(); } control.DataContext = qatItem.Instance; break; } case "GalleryData": { RibbonGallery gallery = new RibbonGallery(); RibbonMenuButton menuButton = new RibbonMenuButton(); menuButton.ItemsSource = new object[] { gallery }; control = menuButton; control.DataContext = qatItem.Instance; break; } case "GroupData": { control = new RibbonGroup(); control.DataContext = qatItem.Instance; break; } } return control; }
/// <summary> /// Initialize Automation Peer for RibbonRadioButton /// </summary> public RibbonRadioButtonAutomationPeer(RibbonRadioButton owner) : base(owner) { }