I have a ribbon bar containing a RadRibbonButton that is bound to a command in my VM. The numericupdown control supplies the command parameter, which my command expects to be an integer. But there doesn't seem to be any way to get the numeric updown control to provide the user's selected value as an integer. Here's a snippet of my xaml:
If I add an event handler for the button's click event, the button's CommandParameter value always has a single digit after the decimal point (i.e., 5.0 instead of the desired '5'). As a result, the following command is never activated:
Is there any way to get rid of the trailing zero? I can get my command to be activated if i change the expected parameter type from int to double, but it seems odd to have to do that.
<
telerikRibbonBar:RadRibbonSplitButton
> <
telerikRibbonBar:RadRibbonSplitButton.DropDownContent
>
<
StackPanel
>
<
telerikInput:RadNumericUpDown
x:Name
=
"updownDays"
IsInteger
=
"True"
SmallChange
=
"1"
Minimum
=
"0"
ValueFormat
=
"Numeric"
HorizontalAlignment
=
"Stretch"
/>
<
telerikRibbonBar:RadRibbonButton
Command
=
"{Binding MyCommand}"
CommandParameter
=
"{Binding ElementName=updownDays, Path=Value}"
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
Image
Source
=
"/MyImage.png"
HorizontalAlignment
=
"Stretch"
/>
<
TextBlock
Text
=
"Add"
>
</
StackPanel
>
</
telerikRibbonBar:RadRibbonButton
> </
StackPanel
>
</
telerikRibbonBar:RadRibbonSplitButton.DropDownContent
>
</
telerikRibbonBar:RadRibbonSplitButton
>
public
GalaSoft.MvvmLight.Command.RelayCommand<
int
> MyCommand{
get
;
private
set
; }
MyCommand =
new
GalaSoft.MvvmLight.Command.RelayCommand<
int
>((days) => Execute(days));