RadMaskedTextInput and RadPropertyGrid control, error handling

4 posts, 0 answers
  1. Branko
    Branko avatar
    18 posts
    Member since:
    Feb 2012

    Posted 15 Feb 2012 Link to this post

    Hallo guys,

    When RadMaskedTextInput is used inside RadPropertyGrid control and when I have error state based on attributes that MaskedTextInput is using as validation parameter. How attribute Description can override Description used in RadPropertyGrid control ?

    Thank you.
    Best regards,
    Branko

  2. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 20 Feb 2012 Link to this post

    Hello Branko,

    Basically, defining Description property in your PropertyDefinition will override the one set through Description DataAnnotations attribute. Could you clarify a bit what is the exact scenario that you want to achieve ? Do you want to have them both defined and chose which one to display ? 

    Kind regards,
    Maya
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Branko
    Branko avatar
    18 posts
    Member since:
    Feb 2012

    Posted 24 Feb 2012 Link to this post

    Hello Maya,

    I would like to have both of them defined and basically for properties that you select it will show the Description for that properties.
    Example, for the property of type RadMaskedInputTextbox it will show the Descrition defined in attribute. For other property which is of type TextBox it will show from hard code type from xaml.

    <telerik:PropertyDefinition Description="Decimal value input" DisplayName="Decimal Value" GroupName="Numbers">
            <telerik:PropertyDefinition.EditorTemplate>
                <DataTemplate>
                    <TextBox Validation.ErrorTemplate="{StaticResource validationTemplate}" Style="{StaticResource textBoxInError}" Loaded="TextBox_Loaded_decimal" TextChanged="TextBox_TextChanged_Decimal">
                        <TextBox.Text>
                            <Binding Path="DecimalValue" UpdateSourceTrigger="PropertyChanged">
                                <Binding.ValidationRules>
                                    <chek:IntValidationRule/>  
                                </Binding.ValidationRules>
                            </Binding>
                        </TextBox.Text>
                    </TextBox>                
                </DataTemplate>
            </telerik:PropertyDefinition.EditorTemplate>
    </telerik:PropertyDefinition>      
    And second for RadMaskedInputTextBox, from code behind ...

    [Display(Name = "Decimal Value", Description = "This is the description for RadMaskedInputTextbox which should override Descrition from PropertyGrid")]
    [Range(typeof(decimal), "-100", "100")]
    public decimal DecimalValue
    {
        get { return decimalValue; }
        set
        {
            decimalValue = value;
            OnPropertyChanged("DecimalValue");
        }
    }
    Both text boxs are in Property Grid.

    Thank you,
    Branko
  5. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 28 Feb 2012 Link to this post

    Hello Branko,

    There should be no problem to achieve the behavior you require - to be able to define Description for one property definition, but still be able to use the description defined through data annotations for others. Please refer to our demos for a reference.
    Do you have any problems with the implementation ?  

    All the best,
    Maya
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Back to Top