Using standard Actipro Style

Ribbon for WPF Forum

Posted 10 years ago by LaurentB - Intersystems
Version: 4.5.0480
Avatar
Hello,
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
<Application.Resources>
<Style TargetType="{x:Type xcdg:NumericTextBox}">
<Setter Property="Style" Value="{StaticResource {x:Static ribbon:RibbonStyles.TextBoxKey}}" />
</Style>
</Application.Resources>

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 ?

Thanks!

PS : your WPF products are great !

Comments (2)

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hello,

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 10 years ago by LaurentB - Intersystems
Avatar
Many thanks, it's good !!!!
The latest build of this product (v2018.1 build 0675) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.