private static void OnIsCheckedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { SplitButton button = d as SplitButton; if (button.IsCheckable) { if ((bool)e.NewValue) { button.RaiseEvent(new RoutedEventArgs(CheckedEvent, button)); } else { button.RaiseEvent(new RoutedEventArgs(UncheckedEvent, button)); } ToggleButtonHelper.OnIsCheckedChanged(d, e); } }
/// <summary> /// Gets control which represents shortcut item. /// This item MUST be synchronized with the original /// and send command to original one control. /// </summary> /// <returns>Control which represents shortcut item</returns> public FrameworkElement CreateQuickAccessItem() { if (HasItems) { if (IsSplited) { SplitButton button = new SplitButton(); RibbonControl.BindQuickAccessItem(this, button); RibbonControl.Bind(this, button, "ResizeMode", ResizeModeProperty, BindingMode.Default); RibbonControl.Bind(this, button, "MaxDropDownHeight", MaxDropDownHeightProperty, BindingMode.Default); RibbonControl.Bind(this, button, "DisplayMemberPath", DisplayMemberPathProperty, BindingMode.OneWay); RibbonControl.Bind(this, button, "GroupStyleSelector", GroupStyleSelectorProperty, BindingMode.OneWay); RibbonControl.Bind(this, button, "ItemContainerStyle", ItemContainerStyleProperty, BindingMode.OneWay); RibbonControl.Bind(this, button, "ItemsPanel", ItemsPanelProperty, BindingMode.OneWay); RibbonControl.Bind(this, button, "ItemStringFormat", ItemStringFormatProperty, BindingMode.OneWay); RibbonControl.Bind(this, button, "ItemTemplate", ItemTemplateProperty, BindingMode.OneWay); button.DropDownOpened += OnQuickAccessOpened; return(button); } else { DropDownButton button = new DropDownButton(); RibbonControl.BindQuickAccessItem(this, button); RibbonControl.Bind(this, button, "ResizeMode", ResizeModeProperty, BindingMode.Default); RibbonControl.Bind(this, button, "MaxDropDownHeight", MaxDropDownHeightProperty, BindingMode.Default); RibbonControl.Bind(this, button, "DisplayMemberPath", DisplayMemberPathProperty, BindingMode.OneWay); RibbonControl.Bind(this, button, "GroupStyleSelector", GroupStyleSelectorProperty, BindingMode.OneWay); RibbonControl.Bind(this, button, "ItemContainerStyle", ItemContainerStyleProperty, BindingMode.OneWay); RibbonControl.Bind(this, button, "ItemsPanel", ItemsPanelProperty, BindingMode.OneWay); RibbonControl.Bind(this, button, "ItemStringFormat", ItemStringFormatProperty, BindingMode.OneWay); RibbonControl.Bind(this, button, "ItemTemplate", ItemTemplateProperty, BindingMode.OneWay); button.DropDownOpened += OnQuickAccessOpened; return(button); } } else { Button button = new Button(); RibbonControl.BindQuickAccessItem(this, button); return(button); } }