Using standard Actipro Style

Ribbon for WPF Forum

Posted 15 years ago by LaurentB - Intersystems
Version: 4.5.0480
I want to use the ribbon:RibbonStyles.TextBoxKey style on all type of controls in my project (XCeed NumericTextBox, for example).

I can't do
<Style TargetType="{x:Type xcdg:NumericTextBox}">
<Setter Property="Style" Value="{StaticResource {x:Static ribbon:RibbonStyles.TextBoxKey}}" />

in app.xaml (error : Style object is not allowed to affect the Style property of the object to which it applies).
So, is there a way to use your style everywhere in an application ?


PS : your WPF products are great !

Comments (2)

Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA

As the error says, you cannot set the Style property from another Style (regardless of whether it's implicit or explicit). You would need to base your implicit style for the NumericTextBox on the Ribbon's TextBox style.

Something like this should work:

<Style TargetType="{x:Type xcdg:NumericTextBox}" BasedOn="{StaticResource {x:Static ribbon:RibbonStyles.TextBoxKey}}" />

Keep in mind that this style is designed to work with native WPF TextBox controls. If you apply it to another control, then you might not get the desired results. For example, I'm assuming the NumericTextBox has up/down buttons. Applying the Style above would remove these up/down buttons, since the Style applies a control tempate for text boxes.

We provide the Ribbon styles to customers, which can then be used to properly style third-party controls such as the NumericTextBox. If you would like the styles, please email our support address.

Actipro Software Support

Posted 15 years ago by LaurentB - Intersystems
Many thanks, it's good !!!!
The latest build of this product (v24.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.