Hi telerik team!
I meet with problem when use RadMaskCurrencyInput
XAML:
<
Grid
x:Name
=
"LayoutRoot"
Background
=
"White"
BindingValidationError
=
"LayoutRoot_BindingValidationError"
>
<
sdk:RadMaskedCurrencyInput
x:Name
=
"maskInput"
Mask
=
"c3.0"
Value
=
"{Binding Cost,Mode=TwoWay,ValidatesOnExceptions=True,NotifyOnValidationError=True}"
/>
</
Grid
>
When RadMaskedCurrencyInput binding error Debugger don't run into LayoutRoot_BindingValidationError which handle BindingValidationError event of LayoutRoot. Please give me a solution to resolve this problem.
Thanks !
8 Answers, 1 is accepted
0
Hello Umbala,
I tested this with the release version of Q1 and this worked correctly. The parent Grid panel is handling the BindingValidationError event as expected. Can you confirm that your binding is not failing and that you are correctly raising the validation exception.
Best wishes,
Alex Fidanov
the Telerik team
I tested this with the release version of Q1 and this worked correctly. The parent Grid panel is handling the BindingValidationError event as expected. Can you confirm that your binding is not failing and that you are correctly raising the validation exception.
Best wishes,
Alex Fidanov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Umbala
Top achievements
Rank 1
answered on 07 Apr 2011, 09:29 AM
Please try to run my code
XAML:
Code:
I want to when RadMaskedCurrencyInput show error message "Required", LayoutRoot_BindingValidationError event is handle
Thanks!
XAML:
<
Grid
x:Name
=
"LayoutRoot"
Background
=
"White"
BindingValidationError
=
"LayoutRoot_BindingValidationError"
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"Auto"
/>
<
RowDefinition
Height
=
"Auto"
/>
</
Grid.RowDefinitions
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
Width
=
"Auto"
/>
<
ColumnDefinition
Width
=
"Auto"
/>
<
ColumnDefinition
Width
=
"Auto"
/>
</
Grid.ColumnDefinitions
>
<
TextBlock
Text
=
"{Binding OrderName}"
Grid.Column
=
"0"
Margin
=
"8"
/>
<
sdk:RadMaskedCurrencyInput
x:Name
=
"maskInput"
Mask
=
"c3.0"
Grid.Column
=
"1"
Value
=
"{Binding Cost,Mode=TwoWay,ValidatesOnExceptions=True,NotifyOnValidationError=True}"
Margin
=
"8"
/>
</
Grid
>
Imports System.ComponentModel.DataAnnotations
Partial Public Class MainPage
Inherits UserControl
Public Sub New()
InitializeComponent()
Me.DataContext = New Order("Order1", Nothing)
End Sub
Private Sub LayoutRoot_BindingValidationError(sender As System.Object, e As System.Windows.Controls.ValidationErrorEventArgs)
MessageBox.Show(e.Error.ToString)
End Sub
End Class
Public Class Order
Public Sub New(ByVal strOrderName As String, dCost As Double)
Me.OrderName = strOrderName
Me.Cost = dCost
End Sub
Public Property OrderName As String
<
Required
(
ErrorMessage:
=
"Required"
)> _
Public Property Cost() As Double
End Class
I want to when RadMaskedCurrencyInput show error message "Required", LayoutRoot_BindingValidationError event is handle
Thanks!
0
Umbala
Top achievements
Rank 1
answered on 08 Apr 2011, 05:03 AM
Please help me!
0
Hello Umbala,
I am not sure if the data annotation attributes will raise the BindingValidationError event. What you can try is to throw a ValidationException in the setter of the bound property.
Regards,
Alex Fidanov
the Telerik team
I am not sure if the data annotation attributes will raise the BindingValidationError event. What you can try is to throw a ValidationException in the setter of the bound property.
private double cost;
public double Cost
{
get { return cost; }
set
{
if (value > 50)
{
throw new ValidationException("Cost cannot be greater than 50");
}
cost = value;
this.OnPropertyChanged("Cost");
}
}
Regards,
Alex Fidanov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Umbala
Top achievements
Rank 1
answered on 08 Apr 2011, 10:02 AM
If using RadMaskTextbox instead of using RadMaskCurrencyInput every thing work fine.
My project is using data annotation attributes to validate data and I can't change this mechanism. Please show me how to handles BindingValidationError event if using data annotation attributes to validate data because all of entity in my project inherit from System.ServiceModel.DomainServices.Client.Entity and use ValidateProperty() of System.ServiceModel.DomainServices.Client.Entity method to validate data
Public Class Order Inherits System.ServiceModel.DomainServices.Client.Entity Public Sub New(dCost As Double) Me.Cost = dCost End Sub Private m_Cost As Double <Range(1, 5, ErrorMessage:="invalid")> _ Public Property Cost() As Double Get Return m_Cost End Get Set(ByVal Value As Double) If Value <> Nothing Then Me.ValidateProperty("Cost", Value) m_Cost = Value End If End Set End Property
0
Umbala
Top achievements
Rank 1
answered on 11 Apr 2011, 03:43 AM
Please help me!
0
Umbala
Top achievements
Rank 1
answered on 13 Apr 2011, 11:06 AM
???
0
Hello Umbala,
We have acknowledged this as an issue in the masked input controls. It is logged in our PITS and you can follow its progress from here.
Greetings,
Alex Fidanov
the Telerik team
We have acknowledged this as an issue in the masked input controls. It is logged in our PITS and you can follow its progress from here.
Greetings,
Alex Fidanov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items