Problem in upgrading radgridview

11 posts, 0 answers
  1. Kaustubh Wadi
    Kaustubh Wadi avatar
    26 posts
    Member since:
    Apr 2010

    Posted 19 Jul 2010 Link to this post

    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.
  2. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 19 Jul 2010 Link to this post

    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
  3. DevCraft banner
  4. Kaustubh Wadi
    Kaustubh Wadi avatar
    26 posts
    Member since:
    Apr 2010

    Posted 19 Jul 2010 Link to this post

    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. 
  5. Chetan
    Chetan avatar
    5 posts
    Member since:
    Jul 2010

    Posted 21 Jul 2010 Link to this post

    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
  6. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 22 Jul 2010 Link to this post

    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
  7. Anita
    Anita avatar
    15 posts
    Member since:
    Aug 2010

    Posted 05 May 2011 Link to this post

    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
  8. Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 05 May 2011 Link to this post

    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
  9. Anita
    Anita avatar
    15 posts
    Member since:
    Aug 2010

    Posted 05 May 2011 Link to this post

    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

  10. Jawahar
    Jawahar avatar
    2 posts
    Member since:
    Nov 2013

    Posted 18 Nov 2013 Link to this post

    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

  11. Randy
    Randy avatar
    12 posts
    Member since:
    Oct 2012

    Posted 03 Feb 2014 in reply to Jawahar Link to this post

    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
  12. Yoan
    Admin
    Yoan avatar
    1070 posts

    Posted 05 Feb 2014 Link to this post

    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 >>
Back to Top
DevCraft banner