More maskedinput problems, where do I start...

8 posts, 0 answers
  1. danparker276
    danparker276 avatar
    389 posts
    Member since:
    Aug 2010

    Posted 04 Oct 2012 Link to this post

    I was using the RadMaskedTextbox, but when moving from silverlight to WPF, I would get a red border around the RadMaskedTextbox for my currency.  These RadMaskedTextboxs were in a tabcontrol, and the red border would go away if I went to another tab and came back.  Since RadMaskedTextbox is being replaced, I thought I'd use RadMaskedCurrencyInput, but I ran into a few problems.

    1. When I try to clear it, I'll get an error "Value '' could not be converted" - I'm guessing this is because I'm binding a decimal and not a double.  When you're dealing with currency, C# tells you to ALWAYS use decimal.  I guess I could add a converter to my binding, but I'd rather there be a better way.

    2.  Those leading placeholders.  Even if I turn off autofillnumbergroupserpartors, I won't get the comas after I lose focus.

    3. When I type focus on a RadMaskedCurrencyInput and type "123",   "321.00" shows up in the textbox

    I'm leaning towards using a  RadMaskedTextInput and only allowing 1-9 and '.''s.  I guess it would be nice if I could keep using RadMaskedTextbox, but I can't expect you to fix an issue on a control that's outdated?  Is there a way to get rid of those red borders in a tabcontrol?  It works fine in Silverlight, but not WPF.  I could probably create a sample project for you, but I don't want to waste time because that control is outdated.




  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 09 Oct 2012 Link to this post

    Hello Dan, 

       Let me first make a quick clarification - we are now in a process of resolving the MaskedInput's main issues (that usually stop our clients upgrading from MaskedTextBox to MaskedInput) and our goal is to obsolete the RadMaskedTextBox next year. 
    Now to the points:
    • You don't need to use a converter. The clear button makes the value null so you can only use decimal? instead of decimal in the ViewModel and the Validation error will not be produced. You can see this in the attached project.
    • Could you please try setting the Placeholder to " " and let us know if this is the desired behavior ?
    • In the attached project you can see the SelectionOnFocus proeperty set to "CaretToBeggining". Pressing 123 then writes 123. You can also play with the other options for SelectionOnFocus and choose the best option for you.

    Regards,
    Petar Mladenov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
  4. danparker276
    danparker276 avatar
    389 posts
    Member since:
    Aug 2010

    Posted 09 Oct 2012 Link to this post

    Many of my problems were solved with no-mask.  Mask="" and FormatString="c".  I got this from a reply to another thread.

    The only issue now is the decimal? .  The thing is with the old MaskedTextBox I didn't have to use a nullable type decimal? (and other controls I've seen, a nullable decimal isn't needed).  I'm getting a lot of values from my webservice that are type decimal.  I guess I could change all them in the webservice to decimal? .  Maybe I should anyway, I just usually don't use that.

    This is what I'm using below, works great except no max length of the number
    <Style x:Key="RadMaskedMoneyLimit" TargetType="telerik:RadMaskedCurrencyInput" >
        <Setter Property="Mask" Value="" />
        <Setter Property="FormatString" Value="c" />
        <Setter Property="TextMode" Value="PlainText" />
        <Setter Property="Width" Value="120"/>
        <Setter Property="IsClearButtonVisible" Value="False" />
        <Setter Property="IsLastPositionEditable" Value="False" />
        <Setter Property="SelectionOnFocus" Value="SelectAll" />
    </Style>
  5. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1182 posts

    Posted 12 Oct 2012 Link to this post

    Hello Dan,

    We discussed the issue with the clear button and error message and we think this is a bug in our control, so we scheduled it for the SP next Month. You can track its status here. We also updated your telerik account points.
    As for the second question, we have implemented a property that can limit the length of the input. You can read more about it in this article.

    Regards,
    Pavel R. Pavlov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  6. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 26 Oct 2012 Link to this post

    Hi Dan,

     We updated the status of the mentioned PITS item to resolved. Since the type of the Value properties in the MaskedCurrencyInput and MaskedNumericInput are nullable decimal and nullable double, we cannot consider this as a bug in our control. This is a native WPF validation error caused by the fact the ViewModels' properties are not nullable types but are bound to nullable types.
    We agree that you haven't used to nullable properties when you used the MaskedTextBox but this is mandatory in the MaskedInput control. However, MaskedInput controls are much more stable and decoupled controls than its predecessor. 
    Thank you for your understanding.

    Regards,
    Petar Mladenov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  7. danparker276
    danparker276 avatar
    389 posts
    Member since:
    Aug 2010

    Posted 26 Oct 2012 Link to this post

    Ok, I can't imagine that I'm in the minority on this one.  I could be wrong, but I don't think most people go out of their way to make their decimals nullable.  I'm just using the default.  I tried other 3rd party controls and they don't work this way.  
  8. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 30 Oct 2012 Link to this post

    Hello Dan,

     We cannot certainly say whether most of our clients use nullable types to bind to or normal types. Many clients want to see empty Mask control when their viewmodel's values are not initialized so they need to bind to nullable types. However, many clients are using custom validation, converters in their bindings or don't use clear button and so on.
     We can workaround this in our code but this won't be an elegant solution, having in mind the fact the MaskedInput controls use native WPF/SL validation mechanism and this is a native WPF/SL error.

    All the best,
    Petar Mladenov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  9. danparker276
    danparker276 avatar
    389 posts
    Member since:
    Aug 2010

    Posted 30 Oct 2012 Link to this post

    Ok, I don't use the clear button, but if you select all and do a del, it's the same thing as a clear button.  Since I do a select all on focus this happens many times.   I'm going to use a converter, it's working fine like this and it's hardly any extra coding.  I share my files between silverlight and WPF so Telerik controls work really great for me.
Back to Top
UI for WPF is Visual Studio 2017 Ready