Getting an ArgumentException when using editors (trying DoubleEditBox and Int32EditBox)

Editors for WPF Forum

Posted 6 years ago by Jun Pacomios
Version: 18.1.0672
Avatar

I am getting an ArgumentException. The version I am using is 17.2.661.0

An unhandled exception of type 'System.ArgumentException' occurred in PresentationFramework.dll

Additional information: 'Button' ControlTemplate TargetType does not match templated type 'RepeatButton'.

... there are no stacktrace other than the error above. 

The project is a little large now and it is extremely hard to reproduce. What I did was in my big project file, I added 

        xmlns:editors="http://schemas.actiprosoftware.com/winfx/xaml/editors"

 also tried this approach. 

        xmlns:editors="clr-namespace:ActiproSoftware.Windows.Controls.Editors;assembly=ActiproSoftware.Editors.Wpf"

 then added the controls as such under the following parent controls

<ribbon:RibbonWindow
    <Grid>
        <TabControl Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Width="Auto" Margin="0,10">
            <TabItem Header="ControlsXX" >
                <ScrollViewer VerticalScrollBarVisibility="Visible">
                    <Grid>
                        <StackPanel Orientation="Horizontal">
                            <StackPanel Margin="10,30,10,81" Grid.ColumnSpan="2">
                                <editors:DoubleEditBox Name="testdoublespin" HorizontalAlignment="Left" Minimum="-10" Maximum="10" Value="0" Format="0.##' in'" />
                                <!--<editors:Int32EditBox HorizontalAlignment="Left" Minimum="1" Maximum="10" Width="100" />-->

...

I tried it on a new clean solution/project and it seems to work just fine using the same approach as above.

I already added and readded Actipro assemblies, did a clean and rebuild but no luck. 

This is the first time I am trying to use the editors control. In perspective, I have a lot of control templates (styles) that I changed from the supplied Actipro styles. But, none of them are related to editors (spinner controls) such as DoubleEditBox and Int32EditBox. 

What am I missing here? 

Please advise. 


UPDATE

I managed to fix it. I created a ticking time bomb and it exploded when I used above editors. 

    <Style x:Key="{x:Static namespace:class.resourcekey}" TargetType="{x:Type ButtonBase}">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">

I just changed the Button TargetType to ButtonBase. 

 

This should be closed. 

[Modified 6 years ago]

Comments (1)

Answer - Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

Yes, in WPF your TargetType for the Style and ControlTemplate should always match exactly or you could run into issues like the exception you received.  And as you saw, using ButtonBase allows you to target normal Button and RepeatButton with the same Style.  I'm glad you got it working.


Actipro Software Support

The latest build of this product (v24.1.2) was released 5 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.