Problem with inheriting from ValueCOmmandParameter

Ribbon for WPF Forum

Posted 13 years ago by Robert Croshere
Version: 11.1.0543

I would like to add some additional properties to a gallery command parameter and decided to create an implementation of DoubleValueCommandParameter which inherites from the actipro commandparameter class.

My ribbon is configured like this:

Type="{x:Type sys:Double}">

ItemsSource="{Binding Source={StaticResource borderWidths}}">
<self:DoubleValueCommandParameter />

public class DoubleValueCommandParameter : actipro.DoubleValueCommandParameter { }

Without this implementation, I receive the ValueCommandParameter<double>, so in theory the DoubleValueCommandParameter should be fine, as this approach works for me when used with a Brush instead of a double in other parts of the ribbon.

However when I run the code I receive a NullReferenceException with only the following line as stacktrace:

at ActiproSoftware.Windows.Controls.Ribbon.Input.ValueCommandParameter`1.ActiproSoftware.Windows.Controls.Ribbon.Input.IValueCommandParameter.set_Value(Object value)

When I change the DoubleValueCommandParameter to ObjectValueCommandParameter (again own implementation with additional properties), the code runs just fine.
However, I need the CommandParameter to be “typed” correctly, and a double should be passed as value.

Any ideas of how to get this working?

Robert Croshere

Comments (3)

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

It's hard to say without having a sample to debug. Please make a new simple sample project that shows the issue and email it to our support. Rename the .zip file extension so it doesn't get spam blocked and reference this forum post in your message with steps to dupe it. Thanks!

Actipro Software Support

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

Thanks for the sample.

A null value was trying to be assigned. If you change your DobuleValueCommandParameter to inherit actipro.ValueCommandParameter<Double?> instead (note the nullable double), it works fine.

Actipro Software Support

Posted 13 years ago by Robert Croshere
Boy, I should of thought of that myself...

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

Add Comment

Please log in to a validated account to post comments.