Hi,
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:
<UserControl.Resources>
<ResourceDictionary>
<x:Array
x:Key="borderWidths"
Type="{x:Type sys:Double}">
<sys:Double>1</sys:Double>
<sys:Double>1.5</sys:Double>
<sys:Double>2</sys:Double>
<sys:Double>2.5</sys:Double>
</x:Array>
</ResourceDictionary>
</UserControl.Resources>
<ribbon:PopupGallery
ItemsSource="{Binding Source={StaticResource borderWidths}}">
<ribbon:PopupGallery.CommandParameter>
<self:DoubleValueCommandParameter />
</ribbon:PopupGallery.CommandParameter>
</ribbon:PopupGallery>
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
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:
<UserControl.Resources>
<ResourceDictionary>
<x:Array
x:Key="borderWidths"
Type="{x:Type sys:Double}">
<sys:Double>1</sys:Double>
<sys:Double>1.5</sys:Double>
<sys:Double>2</sys:Double>
<sys:Double>2.5</sys:Double>
</x:Array>
</ResourceDictionary>
</UserControl.Resources>
<ribbon:PopupGallery
ItemsSource="{Binding Source={StaticResource borderWidths}}">
<ribbon:PopupGallery.CommandParameter>
<self:DoubleValueCommandParameter />
</ribbon:PopupGallery.CommandParameter>
</ribbon:PopupGallery>
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