ComboBoxItem subclass - Style not applied

Ribbon for WPF Forum

Posted 13 years ago by Owen Christensen - Software Engineer, Minitab Inc.
Version: 10.2.0532
Platform: .NET 4.0
Environment: Windows 7 (64-bit)
Avatar
I have two subclasses: one of Ribbon.Controls.ComboBox and one of ComboBoxItem.

Overriding GetContainerForItemOverride to return my ComboBoxItem subclass, causes all the styling to be lost on the item. I'm not overriding the metadata for DefaultStyleKeyProperty and even explicitly setting it to typeof(ComboBoxItem) doesn't seem to fix this issue...and ideas?

I've tested this subclassing as described with the only code being the override of GetContainerForItemOverride and it does the same so there is no possibility this is (directly) due to my code.

public sealed class BackstageComboBox : ActiproSoftware.Windows.Controls.Ribbon.Controls.ComboBox
    {
        protected override System.Windows.DependencyObject GetContainerForItemOverride()
        {
            return new BackstageComboBoxItem();
        }
    }

public sealed class BackstageComboBoxItem : ComboBoxItem { }
[Modified at 11/15/2010 03:42 PM]

[Modified at 11/15/2010 03:42 PM]

Comments (2)

Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Owen,

We've made a tweak to our style for ribbon:ComboBox that will fix this in the next build.

But in the meantime you could probably do this in your item subclass:
this.SetResourceReference(StyleProperty, typeof(ComboBoxItem));
[Modified at 11/16/2010 09:32 AM]


Actipro Software Support

Posted 13 years ago by Owen Christensen - Software Engineer, Minitab Inc.
Avatar
Great! Appreciate the quick turnaround (as usual :))
The latest build of this product (v24.1.2) was released 2 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.