DataFormDataField derivation for RadMaskedNumericInput has problems

3 posts, 1 answers
  1. Steve
    Steve avatar
    124 posts
    Member since:
    Jun 2011

    Posted 27 Sep 2013 Link to this post

    Hello,
    I derived the DataFormDataField class to return a RadMaskedNumericInput control.  Three problems are readily apparent.

    1. The DataMemberBinding does not propagate to the control from the DataFormDataField derivative.
    2. The IsReadOnly property is not propagated to the control.
    3. The Width property of the DataFormDataField class does not effect the Width of the control.


    Here's the code...
    /// <summary>
    /// Numeric specific <c>DataFormDataField</c>.
    /// </summary>
    public class DataFormNumericField : DataFormDataField
    {
     
        /// <summary>
        /// Returns a control to display and edit the underlying data.
        /// </summary>
        /// <returns><c>Control</c></returns>
        protected override Control GetControl()
        {
            RadMaskedNumericInput ctrl = new RadMaskedNumericInput();
     
            return ctrl;
        }
    }

    You'll notice below, there is an extension to the DataFormDataField that sets the width of the label portion.  Other than that, it is a standard DataFormDataField derivation.
    <amUI:DataFormNumericField x:Name="BatchNumberField"
                               DataMemberBinding="{Binding SelectedBatch.JournalEntryBatchNumber,
                                    ValidatesOnDataErrors=True,
                                    ValidatesOnExceptions=True,
                                    NotifyOnValidationError=True,
                                    UpdateSourceTrigger=PropertyChanged}"
                               Label="{x:Static localProperties:Resources.Batch_Number}"
                               Width="163"
                               amUI:DataFormColumn.LabelColumnWidth="80"
                               IsReadOnly="True">
        <amUI:DataFormNumericField.Resources>
            <Style TargetType="telerik:RadMaskedNumericInput">
                <Setter Property="Placeholder"
                        Value=" " />
                <Setter Property="SelectionOnFocus"
                        Value="SelectAll"/>
                <Setter Property="IsClearButtonVisible"
                        Value="False" />
                <Setter Property="AllowSkipPlaceholders"
                        Value="False" />
                <Setter Property="AutoFillNumberGroupSeparators"
                        Value="False" />
                <Setter Property="AutoFillZeros"
                        Value="False" />
                <Setter Property="Mask"
                        Value="#10" />
            </Style>
        </amUI:DataFormNumericField.Resources>
    </amUI:DataFormNumericField>

    Could you provide an example where these three issues are addressed?

    Thanks in advance,
    Steve
  2. Answer
    Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1127 posts

    Posted 02 Oct 2013 Link to this post

    Hello,

    You should handle both IsReadOnly and DataMemberBinding on your side. You can have a look at this article, which illustrates a similar scenario. Can you please throw some light on the last (third) point of your list? I fear that I might have misunderstood you. What is the behavior that you expect?

    Regards,
    Ivan Ivanov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Steve
    Steve avatar
    124 posts
    Member since:
    Jun 2011

    Posted 02 Oct 2013 Link to this post

    The article pointed me in the right direction!
    Thanks,
    Steve
Back to Top