4 Answers, 1 is accepted
0
Hello sivakanth,
Binding the value of RadRating could be achieved by using a ViewModel like so:
Please let us know if this fits in your scenario.
Greetings,
Petar Mladenov
the Telerik team
Binding the value of RadRating could be achieved by using a ViewModel like so:
<
telerik:RadRating
Width
=
"120"
Height
=
"40"
Value
=
"{Binding RatingValue}"
x:Name
=
"ratingControl"
/>
class
RatingViewModel
{
public
double
RatingValue
{
get
;
set
;
}
}
public
MainWindow()
{
InitializeComponent();
this
.ratingControl.DataContext =
new
RatingViewModel() { RatingValue = 4.5 };
}
Greetings,
Petar Mladenov
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Dan
Top achievements
Rank 1
answered on 03 Apr 2012, 05:02 PM
This example is not working. the value is read from the binding, however the value is not set back to the binding.
This is my workaround
Version: 2012.1.215.40
This is my workaround
Private Sub RadRating1_ValueChanged(sender As Object, e As System.Windows.RoutedPropertyChangedEventArgs(Of Double?)) Handles RadRating1.ValueChanged
CType(DataContext, MyObject).Rating = RadRating1.Value
End Sub
Version: 2012.1.215.40
0
Hello Dan,
You don't have to handle the ValueChanged event. Instead you can set the binding mode of the Value property to TwoWay:
I attached a sample project demonstrating this approach. Please give it a try and let us know if it helps.
Kind regards,
Tina Stancheva
the Telerik team
You don't have to handle the ValueChanged event. Instead you can set the binding mode of the Value property to TwoWay:
<
telerik:RadRating
Value
=
"{Binding Rating, Mode=TwoWay}"
/>
I attached a sample project demonstrating this approach. Please give it a try and let us know if it helps.
Kind regards,
Tina Stancheva
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
Dan
Top achievements
Rank 1
answered on 04 Apr 2012, 04:45 PM
Thank you Tina for your response. Your suggestion works, however, Telerik should change this to the default behavior. It's more reasonable to assume 2 way binding on every control until otherwise set that way.
Thanks again for your help.
Thanks again for your help.