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

Wrong Namespace for GridView

8 Answers 265 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ben Hayat
Top achievements
Rank 2
Ben Hayat asked on 19 Nov 2008, 12:06 AM
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

8 Answers, 1 is accepted

Sort by
0
Serrin
Top achievements
Rank 1
answered on 19 Nov 2008, 01:39 PM
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? :)
0
Hristo Deshev
Telerik team
answered on 19 Nov 2008, 05:28 PM
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.
0
Serrin
Top achievements
Rank 1
answered on 19 Nov 2008, 06:09 PM
Hey Hristo,

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

Thanks again!!
0
Ben Hayat
Top achievements
Rank 2
answered on 19 Nov 2008, 07:06 PM
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!


0
Hristo Deshev
Telerik team
answered on 20 Nov 2008, 03:42 PM
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.
0
Ben Hayat
Top achievements
Rank 2
answered on 20 Nov 2008, 03:50 PM
>>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!
0
Accepted
Hristo Deshev
Telerik team
answered on 20 Nov 2008, 05:05 PM
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.
0
Ben Hayat
Top achievements
Rank 2
answered on 20 Nov 2008, 05:25 PM
>>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!
Tags
General Discussions
Asked by
Ben Hayat
Top achievements
Rank 2
Answers by
Serrin
Top achievements
Rank 1
Hristo Deshev
Telerik team
Ben Hayat
Top achievements
Rank 2
Share this question
or