Wrong Namespace for GridView

9 posts, 1 answers
  1. Ben Hayat
    Ben Hayat avatar
    892 posts
    Member since:
    May 2008

    Posted 18 Nov 2008 Link to this post

    When I drop a GridView from VS Toolbox, VS creates:
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
    but when I try to run the app, it complains Unknown NameSpace. Isn't this from your WPF Namespace.

    Although I replaced it with the following, I still get error:

    xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView" 

    xmlns:telerikGridView="clr-namespace:Telerik.Windows.Controls.GridView;assembly=Telerik.Windows.Controls.GridView"

    ..Ben
  2. Serrin
    Serrin avatar
    286 posts
    Member since:
    Sep 2008

    Posted 19 Nov 2008 Link to this post

    Unfortunately I have to second that...  I've tried to model my XAML after what is shown in the demos, but nothing I'm trying is making the CTP grid usable.  I've already tried re-installing, loading into a fresh project instead of existing, and resetting the VS toolbar and re-adding everything from references to tools manually, but to not avail.  Any ideas, or are we missing something very simple here? :)
  3. DevCraft banner
  4. Hristo Deshev
    Admin
    Hristo Deshev avatar
    559 posts

    Posted 19 Nov 2008 Link to this post

    Hi Ben, Serrin,

    Ben, you are right. The Silverlight designer somehow picks up the WPF-related URI namespace, and that won't work in Silverlight. We'll work around that by not including the URI namespace attributes.

    You can change the namespace to use clr-namespace, but you should also add a reference to the Telerik.Windows.Controls, Telerik.Windows.Input and possibly the Telerik.Windows.Data assemblies. I am attaching a bare bones project with a single RadGridView instance that seems to work.

    Greetings,
    Hristo Deshev
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  5. Serrin
    Serrin avatar
    286 posts
    Member since:
    Sep 2008

    Posted 19 Nov 2008 Link to this post

    Hey Hristo,

    Well that worked like a charm! :)  Now on to the Grid forum with my new questions.

    Thanks again!!
  6. Ben Hayat
    Ben Hayat avatar
    892 posts
    Member since:
    May 2008

    Posted 19 Nov 2008 Link to this post

    Hi Hristo;

    In your attached sample, go ahead and comment out the following code:
                RadGridView1.ItemsSource = new Person[] {
                    new Person { Name = "John", Age = 3},
                    new Person { Name = "Mike", Age = 4}
                };

    And then in XAML remove the grid name and run.

    Last night after I fixed the Namespace and reference issues, I then faced this problem as you can see by running. Since when you drop a grid, it does not create a name for it, it will then fail. So, you may want to solve this problem too, that a grid without name should be able to run!


  7. Hristo Deshev
    Admin
    Hristo Deshev avatar
    559 posts

    Posted 20 Nov 2008 Link to this post

    Hi ..Ben,

    I don't think this is related to the Name attribute. Yesterday we found out that RadGridView crashes when being displayed before being bound (ugh!). The workaround is to bind it to an empty collection:

    RadGridView1.ItemsSource = new Person[] {
    };


    Sincerely yours,
    Hristo Deshev
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  8. Ben Hayat
    Ben Hayat avatar
    892 posts
    Member since:
    May 2008

    Posted 20 Nov 2008 Link to this post

    >>I don't think this is related to the Name attribute.<<

    Right, right! I should have made a separate thread to report this problem. I was just trying to say, if a grid does not have a name associated in XAML, then it crashes too!
  9. Answer
    Hristo Deshev
    Admin
    Hristo Deshev avatar
    559 posts

    Posted 20 Nov 2008 Link to this post

    Hello ..Ben,

    >> I was just trying to say, if a grid does not have a name associated in XAML, then it crashes too!

    It crashes because by removing the Name, you make it very difficult to bind it to objects. And the current bug causes a crash in unbound grids. I removed the name, located the grid instance by asking its parent panel, bound it, and the problem crash disappeared:

    var grid = (RadGridView) LayoutRoot.Children[0];
    grid.ItemsSource = new Person[] { };


    My point is that the grid works just fine without a Name being set, and the problem is in the aforementioned bug.

    Kind regards,
    Hristo Deshev
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  10. Ben Hayat
    Ben Hayat avatar
    892 posts
    Member since:
    May 2008

    Posted 20 Nov 2008 Link to this post

    >>My point is that the grid works just fine without a Name being set, and the problem is in the aforementioned bug.<<

    Thanks for the clarification. I missed the connection point in previous reply. Thanks!
Back to Top
DevCraft banner