Skip to main content
Home Forums Silverlight Programming Silverlight Controls and Silverlight Toolkit Not able to add Datagrid in Beta 2
21 replies. Latest Post by yifung on March 6, 2009.
(0)
Dhawal Shah
Member
14 points
9 Posts
06-10-2008 12:18 AM |
I had an existing project which I converted to Beta 2. I was using a datagrid in it but was getting a lot of erorrs. So I removed the datagrid and tried adding a new one. I got the following error:
"The operation could not be completed. Invalid FORMATETC structure"
yifung
Contributor
3257 points
537 Posts
06-10-2008 12:52 AM |
If you did any templating of the DataGrid, you'll need to redo it because the template changed a good amount. If not, I would compare your project file with one from a new SL application for Beta2 and see what's different between the two. Also compare the Pages
06-10-2008 1:17 AM |
Okay. As of now I have commented the code. But when I try to add a new Datagrid control from the toolbox I get the above mentioned FORMATTEC error. And if I try to add the datagrid manually by typing in the XAML then I get the following error on compiling:
Error 1 Derived method 'OnApplyTemplate' in type 'System.Windows.Controls.DataGrid' from assembly 'System.Windows.Controls.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' cannot reduce access. \
deslo
31 points
44 Posts
06-10-2008 8:25 AM |
I'm having the same problem.
lee_sl
2990 points
584 Posts
06-10-2008 8:55 AM |
Make the 'OnApplyTemplate' method public
cyberhuey
18 points
13 Posts
06-10-2008 9:46 AM |
lee_sl: Make the 'OnApplyTemplate' method public
Ok I'll bite. Where is this done. Also is the xmlns:my="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data" still valid?
vsi
3 Posts
06-10-2008 11:44 PM |
i've fixed this issue by removing and readding the System.* references in the project.
06-11-2008 1:29 AM |
Thanks vsi. Your fix worked.
06-11-2008 6:51 PM |
I finally got this working by opening a new project and adding a datagrid - and then copying everything over to the new project. There was probably some odd reference in there somewhere - but regardless making a new project fixed it.
K2P2
Participant
983 points
319 Posts
07-18-2008 10:37 AM |
I am having this problem with my whole solution.
In any project that I try to drop a button from the toolbox to any xaml I get this error (I tried 4 out of 10 projects).
I can hand code the button in xaml ok. But I can't drag and drop from the toolbox.
sladapter
All-Star
17181 points
3,133 Posts
07-18-2008 11:08 AM |
If you just convert your beta1 project to beta2. You need to remove System.Windows.dll, System.Windows.Controls.dll from References. Then add System.Windows.dll, System.Windows.Controls.Data.dll, System.Windows.Controls.Extended.dll to the References. Before you hit compile, exit VS (otherwise, you might get a lot of error which does not make any sense). Then re-open VS to compile your project. Now you should be able to get some meaningful compiling errors which you have to fix by hand.
You also need to check your Xaml files. Because a lot of breaking changes in beta2, some property name changed you need to fix them by hand. The compiler should indicate which line is invalid.
07-18-2008 12:03 PM |
I never used Beta 1. I started with Beta 2.
07-18-2008 12:08 PM |
Opps. Maybe my memory is bad. I have been using Beta 2 for quite a while without any problems. This just started. Although I'll try your procedure and see what happens (everything compiles fine and executes).
07-18-2008 12:14 PM |
I thought you had the same problem as the original poster. If you have been running beta2 for a while, then my post does not apply. Where do you want to drop the control? You can only drop it to the Xaml area, not the designer area.
07-18-2008 12:29 PM |
The following Button works fine. If you try to drag a button from the Toolbox above or below it you get the error. (And this happens in any xaml in any project in my solution. It happens within a Canvas or StackPanel or any general xaml anywhere in my Solution that I have tried so far -- 5 or 6 different xaml files so far.) I usually hand code my xaml so it might have been a while since I dragged and dropped something. So It might be hard to tell when this started. Thanks<UserControl x:Class="SilverLightDemo.UseThis"xmlns=http://schemas.microsoft.com/client/2007 xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml Width="700" Height="700"><Canvas x:Name="LayoutRoot" Background="White"><TextBox x:Name="TextBox1" Canvas.Left="10" Canvas.Top="10"Text="Nothing" Width="100" Height="30" /> <Button Width="100" Height="20" Margin="200,50,0,0" ></Button>
The following Button works fine. If you try to drag a button from the Toolbox above or below it you get the error. (And this happens in any xaml in any project in my solution. It happens within a Canvas or StackPanel or any general xaml anywhere in my Solution that I have tried so far -- 5 or 6 different xaml files so far.)
I usually hand code my xaml so it might have been a while since I dragged and dropped something. So It might be hard to tell when this started.
Thanks
</
07-18-2008 12:58 PM |
I tried your Xaml. It works fine. I can Drag and Drop any control in it. Have you tried to add a UserControl or even start a new Silverlight project and see if you still have the same problem?
07-18-2008 1:52 PM |
This isn't a very high priority to me because I can do everything by hand.
To test your idea I just added a new Silverlight Application project to my solution:
1) Right click "Solution \ Add \ New Project"2) Select "Silverlight Application" and press OK.3) Uncheck "Add Test page..." and press OK.4) Drag a "Button" from the toolbox into the "Grid" and get the error.
I also created a new solution:
A) Open VS 2008 standardB) Select "File \ New \ Project" and "ASP.NET Web Application"C) Follow steps 1 through 4 above and get the error.
Then I created a new solution:
A) Open VS 2008 standardB) Select "File \ New \ Project" and "Silverlight Application"C) Select "Dynamically generate an HTML test page..."D) Drag a "Button" from the toolbox into the "Grid" and get the error.
This leads me to think that something needs to be re-installed.
jreski
2 points
1 Posts
09-11-2008 3:48 AM |
Hi,
I have the same problem. I can't drag and drop from the toolbox to the XAML code.
MessageBox "The operation could be completed"
Has anyone a solution?
Best regards
Jochen
11-05-2008 8:37 AM |
I tend to do all of my GUI work in Expressions Blend and only code in Visual Studio. I cannot get the same control of looks and ease of use, not to mention the oh so long time it takes the cider to interprit the XAML.
11-05-2008 2:27 PM |
One thing you can try is right clicking the empty space inside the toolbox and select Reset toolbox
earthtec...
12 points
6 Posts
03-06-2009 4:16 PM |
Hi - i am have been spending a significant amount of time just trying to get the environment set up.. and having this exact same problem.
i have a new laptop and installed the new wpi install, have visual studio express c#, visual Web, ms sql
still banging my head against the wall - i am having this same problem and i tried everything here - deleted and added back the references, reset the toolbox, etc.
is there anyone that can help me as i am at a dead end here.
03-06-2009 9:34 PM |
For clearing the toolbox give this a try:
Btw, I recommend going to the RTM version of SL if you haven't, and there's an even newer version of the DataGrid:
http://silverlight.net/forums/t/59990.aspx