This is a migrated thread and some comments may be shown as answers.

RadMaskedTextInput and RadPropertyGrid control, error handling

3 Answers 84 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
Branko
Top achievements
Rank 1
Branko asked on 15 Feb 2012, 03:04 PM
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

3 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 20 Feb 2012, 12:43 PM
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 >>
0
Branko
Top achievements
Rank 1
answered on 24 Feb 2012, 04:14 PM
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
0
Maya
Telerik team
answered on 28 Feb 2012, 09:45 AM
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 >>
Tags
PropertyGrid
Asked by
Branko
Top achievements
Rank 1
Answers by
Maya
Telerik team
Branko
Top achievements
Rank 1
Share this question
or