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

radRating with Lightswitch

1 Answer 54 Views
Rating
This is a migrated thread and some comments may be shown as answers.
Supreet
Top achievements
Rank 1
Supreet asked on 07 Jan 2012, 09:57 AM
Hello,
   I am trying to use radRating control with a Lightswitch application.
I am using it within a DataGrid for which the columns are generated on the fly.

One of these columns has to be a Rating Control column.

To achieve this I've done a simple POC 
Here is what I've tried.

XAML on my User Control
<UserControl> 
<UserControl.Resources>
        <!--<local:DateTimeConverter x:Key="DateConverter" />-->
        <DataTemplate x:Key="myCellTemplate">
            <rate:RadRating x:Name="myRatingControl"/>
        </DataTemplate>
    </UserControl.Resources>

    <Grid x:Name="LayoutRoot" Background="White">
        <telerik:RadGridView Name="radGridView1" AutoGenerateColumns="False"></telerik:RadGridView>
    </Grid>
</UserControl>

C# code
Binding bind = new Binding();
                        bind.Path = new System.Windows.PropertyPath("childClass");
                        bind.Converter = new FeedbackValueConverters();
                        bind.ConverterParameter = i;
                        bind.Mode = BindingMode.TwoWay;

                        dg.Columns.Add(new GridViewDataColumn
                        {
                            Header = header,
                            IsReadOnly = true,
                            CellTemplate= (DataTemplate)dgAttendance.Resources["myCellTemplate"],
                            CellEditTemplate = (DataTemplate)dgAttendance.Resources["myTextBoxCellTemplate"],
                            DataMemberBinding = bind
                        });

With this I do see the columns generated with rating control but When I make changes to the value of any of these rating controls, Convert Back () method of value converter is not being called??

Is there something that is missing because of which the UI is not firing the event where the change has to be captured back in code?

Any help is appreciated.

Thanks & Reagrds
Supreet

1 Answer, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 11 Jan 2012, 02:45 PM
Hi Supreet ,

Could you please check out this article and let us know if it helped you? Please notice that the control in the CellTemplate needs to have its Binding defined too:

<telerik:GridViewDataColumn DataMemberBinding="{Binding Salary}">
 <telerik:GridViewDataColumn.CellTemplate>
  <DataTemplate>
   <telerik:RadNumericUpDown Value="{Binding Salary}" />
  </DataTemplate>
 </telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
Actually you are specifying once the DataContext for the cell with the DataMemberBinding and then you are specifying the property to bind to.
Having this in mind, please try to re-factor your code to set the binding and converter in your XAML. You can also check out the attached project. Greetings,
Petar Mladenov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
Rating
Asked by
Supreet
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Share this question
or