DoubleValueCommandParameter / StringValueCommandParameter

Ribbon for WPF Forum

Posted 14 years ago by Daniel
Version: 9.2.0515
Avatar
Hi actiproteam,

I'm trying to implement an line spacing function (similar to word). It's a ComboBox with 4 Elements. Now I'd wrote an Command with your Commandparameter "DoubleValueCommandParameter". I looked at your samples (fontsizecombobox).

In the fontsizecombobox(which is a blackbox for me), there is no problem, the parameter gets filled and the value updated. But with my combobox with 4 elements, the parameter is null(but the updatevalue is inside).

CanExecutes:

       private void OnFontSizeCanExecute(object sender, CanExecuteRoutedEventArgs e)
        {
            DoubleValueCommandParameter parameter = e.Parameter as DoubleValueCommandParameter;
            if ((parameter != null) && (!this.IsPreviewModeActive))
            {
                parameter.UpdatedValue = this.SelectionFontSize;
                parameter.Handled = true;
            }
            e.CanExecute = true;
        }

private void OnLineSpacingCanExecute(object sender, CanExecuteRoutedEventArgs e)
        {
            DoubleValueCommandParameter parameter = e.Parameter as DoubleValueCommandParameter ;
            if (parameter != null)
            {
                parameter.UpdatedValue = this.SelectionLineSpacing;
                parameter.Handled = true;
            }
            e.CanExecute = true;
        }
I suppose, you'd something in your fontsize(or fontfamily) combobox, I need also.

Thank for you Support,

Ynas

Comments (3)

Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Ynas,

We do have these overrides in our font size combobox:
protected override object ExtractDataItem(object itemContainer) {
    object value = base.ExtractDataItem(itemContainer);
    if (value != null)
        return value;
    else
        return double.NaN;
}

protected override bool IsNullValue(object value) {
    return ((value is double) && (double.IsNaN((double)value)));
}
If those don't help, then please make a simple sample project that shows the issue and email it over. Please don't include any .exe files in the ZIP.


Actipro Software Support

Posted 14 years ago by Daniel
Avatar
It doesn't help, maybe the solution for this problem is in the
public FontSizeComboBox();
Constructor or in the protected override void
protected override void OnInitialized(EventArgs e);
Could you please look at this two functions?

Thank you,

Ynas
Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Ynas,

The constructor is actually empty and the OnInitialized method just creates the Items. So those shouldn't make any difference.


Actipro Software Support

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

Add Comment

Please log in to a validated account to post comments.