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

Problem in upgrading radgridview

10 Answers 215 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Kaustubh Wadi
Top achievements
Rank 1
Kaustubh Wadi asked on 19 Jul 2010, 11:11 AM
Hello Telerik Team,
    I am using Telerik's Silverlight RadGridView in my application. Recently i downloaded the RadControls for Silverlight Q1 2010 SP2 and replaced the old assemblies with new one. But after building my project i got the following errors;

  1. 'Telerik.Windows.Controls.RadGridView' does not contain a definition for 'ItemsControl' and no extension method 'ItemsControl' accepting a first argument of type 'Telerik.Windows.Controls.RadGridView' could be found (are you missing a using directive or an assembly reference?)
  2. 'Telerik.Windows.Controls.GridView.GridViewRow' does not contain a definition for 'Items' and no extension method 'Items' accepting a first argument of type 'Telerik.Windows.Controls.GridView.GridViewRow' could be found (are you missing a using directive or an assembly reference?) 
    for (int i = 0; i < gridview.Items.Count; i++)
                {
                    var row = (GridViewRow)this.gridview.ItemsControl.ItemsGenerator.GenerateItemAtIndex(i);
                    GridViewCell secondCell = (GridViewCell)row.Items[1];
                    RadComboBox cmb = secondCell.ChildrenOfType<RadComboBox>()[0];
                    cmb.ItemsSource = query;
                    cmb.SelectedIndex = 0;
                }

Here is the code snippet, where i got these errors. I think ItemsControl and Items property is removed from latest version of Silverlight controls.
Is there any other properties in new version having same functionality of ItemsControl and Items?

Best Regards,
Kaustubh.

10 Answers, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 19 Jul 2010, 12:54 PM
Hello Kaustubh Wadi,

In the context of improving performance and optimizing memory consumption, we have made a major refactoring to the scrolling and virtualization logic of RadGridView.
This is the reason to lose the properties/methods you have mentioned.
Looking at your code I assume you are trying to set an ItemsSource for a ComboBox in a GridView cell . 
I  believe  we can find a good replacement for your code with the current version of RadGridView.
Can you please share some more details on the entire scenario. What is the final goal you are trying to achieve and I am sure we can think of some good solution.

For example - we may expose the ItemsSource for the combo boxes as a static resource and bind the combo to it directly in XAML .
Once I have  your requirements I will gladly gather a small sample for you .

Regards,
Pavel Pavlov
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
Kaustubh Wadi
Top achievements
Rank 1
answered on 19 Jul 2010, 01:39 PM

Hello Pavel.
Thanks for your reply.
    Yes, you are right. In my application i am trying to set an ItemsSource for a ComboBox in a GridView cell which is data template. I am retriving data from SharePoint list and binding to the Combo box. I am following this approach because the number of rows in grid view is not fixed. The number of rows depends upon the value selected by user. Below is the approach I am using to create specified number of rows.

var data = from i in Enumerable.Range(0, count)
                       select new MyObject()
                       {
                           ID = "G-" + (i + 1),
                       };
            grid.ItemsSource = data;

 Here the value of count may be from 2 to 8, as per selected by user. After then I am creating the cells for each row having the combo box in cell.

try
           {
               XNamespace ns = "#RowsetSchema";
               var query = from x in e.Result.Descendants()
                           where x.Name == ns + "row"
                           select x.Attribute("ows_Title").Value.Split(',')[0];
                 
               for (int i = 0; i < count; i++)
               {
                   var row = (GridViewRow)this.grid.ItemsControl.ItemsGenerator.GenerateItemAtIndex(i);
                   GridViewCell secondCell = (GridViewCell)row.Items[1];
                   RadComboBox cmb = secondCell.ChildrenOfType<RadComboBox>()[0];
                     
                   cmb.ItemsSource = query;
                   cmb.SelectedIndex = 0;
               }

Here is the XAML of my RadGridview;

<grid:RadGridView x:Name="grid"   Margin="190,150,0,0" RowIndicatorVisibility="Collapsed" IsReadOnly="True" AutoGenerateColumns="False" CanUserFreezeColumns="False"  CanUserResizeColumns="False" Width="520" Height="270" >
                <grid:RadGridView.Columns>
                    <grid:GridViewDataColumn x:Name="gaugeColumn"  Header="Gauges" HeaderTextAlignment="Center"  Width="150" DataMemberBinding="{Binding ID}" TextAlignment="Center"/> 
                      
                    <grid:GridViewDataColumn x:Name="measureColumn" HeaderText="Measures" HeaderTextAlignment="Center" Width="200">
                        <grid:GridViewDataColumn.CellTemplate>
                            <DataTemplate>
                                <telerikInput:RadComboBox x:Name="cbMeasures" SelectedIndex="0" ItemsSource="{Binding Measures}">
                                    </telerikInput:RadComboBox>
                            </DataTemplate>
                        </grid:GridViewDataColumn.CellTemplate>
                    </grid:GridViewDataColumn>
</grid:RadGridView.Columns>
            </grid:RadGridView>

Waiting for your response.

Many Thanks,
Kaustubh. 
0
Chetan
Top achievements
Rank 1
answered on 21 Jul 2010, 11:05 AM
I am facing same problem. Is there any way by which i can iterate through griview rows and find the child control of cell

Thank you
Chetan
0
Pavel Pavlov
Telerik team
answered on 22 Jul 2010, 12:08 PM
Hello Kaustubh,

Instead of using the itemcontainer generator to obtain a row,
you can subscribe to the RowLoaded event and set the ItemsSource there . Each time a row is loaded , within the event handler you may set its items source .

This is the recommended way.

Kind regards,
Pavel Pavlov
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
Anita
Top achievements
Rank 1
answered on 05 May 2011, 08:39 AM
Hi,

I have same problem. i did not find the "ItemsControl" property for RadGridview. So how can i get the perticular GridviewCell for the Radgridview in code behind after the control loading?
My requirement is setting the tooltip for a perticular cell according to business rule.

Thanks & Best Regards,
Anita Sahu
0
Vanya Pavlova
Telerik team
answered on 05 May 2011, 09:48 AM
Hello Anita,

 

The better approach in your case is to use ToolTipTemplateSelectors, you may check this demo.


Best wishes,
Vanya Pavlova
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
Anita
Top achievements
Rank 1
answered on 05 May 2011, 10:41 AM
Hi Vanya,

Thanks for your quick response.

But my requirement is like below code in the current version of the telerik which is not supporting "ItemsControl" property.  I dont need the tooltip binding per  each cell column wise , i want the tooltip for a pericular cell through the row and column index.

 

 

public void SetCellTooltip(int rowindex, int columnindex,string tooltip)

 

 

{

 

 

 

 

 

var row = (GridViewRow)this.gridview.ItemsControl.ItemsGenerator.GenerateItemAtIndex(rowindex);

 

 

 

 

GridViewCell Cell = (GridViewCell)row.Items[columnindex];

 

 

 

 

ToolTipService.SetToolTip(Cell, tooltip);

 

 

}

Best Reagards,
Anita Sahu

0
Jawahar
Top achievements
Rank 1
answered on 18 Nov 2013, 02:07 PM
Hi,
  I tried out RadGridView scroll sample in two different versions (2009.2.701.1020 and 2012.2.912.1050). What my requirement is to scroll two grid synchronously in horizontal direction, the sample work fine in 2009.2.701.1020 but some event and methods missing in 2012.2.912.1050, which make it difficult to achieve it. I enclosed sample project which i obtained from telerik. Help me to achieve the same functionality in 2012.2.912.1050.

Functionality not available in 2012:
1. this.RadGridView1.ItemsControl.Loaded // ItemsControl not available in 2012

2. void verticalScrollBar1_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
        {
            this.RadGridView2.ItemsControl.VirtualizingPanel.SetVerticalOffset(e.NewValue);
        }

I Enclosed sample image with it. Thanks

0
Randy
Top achievements
Rank 1
answered on 04 Feb 2014, 12:21 AM
I have the same problem.  I am trying to synchronize scrolling between two radGridView tables, using 2013 Q3 version.  Did you ever find a solution for this, using the later libraries?

Thanks,
Randy
0
Yoan
Telerik team
answered on 05 Feb 2014, 03:22 PM
Hello Randy,

I would suggest you to check this github demo for an example on how to scroll two GridViews simultaneously.

I hope this helps.



Regards,
Yoan
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
GridView
Asked by
Kaustubh Wadi
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
Kaustubh Wadi
Top achievements
Rank 1
Chetan
Top achievements
Rank 1
Anita
Top achievements
Rank 1
Vanya Pavlova
Telerik team
Jawahar
Top achievements
Rank 1
Randy
Top achievements
Rank 1
Yoan
Telerik team
Share this question
or