Page view counter
Not able to add Datagrid in Beta 2 Subscribe to this thread
Last post 03-06-2009 9:34 PM by yifung. 21 replies.
Sort Posts:
06-10-2008 12:18 AM
Not able to add Datagrid in Beta 2

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" 

Dhawal Shah

Loading...
Joined on 05-08-2008
Posts 9
06-10-2008 12:52 AM
Re: Not able to add Datagrid in Beta 2

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

Yifung Lin [MSFT]

yifung

Loading...
Joined on 03-25-2008
Redmond, WA
Posts 391
06-10-2008 1:17 AM
Re: Re: Not able to add Datagrid in Beta 2

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. \

Dhawal Shah

Loading...
Joined on 05-08-2008
Posts 9
06-10-2008 8:25 AM
Re: Re: Not able to add Datagrid in Beta 2
I'm having the same problem.
deslo

Loading...
Joined on 05-29-2008
Posts 44
06-10-2008 8:55 AM
Re: Re: Not able to add Datagrid in Beta 2

Make the 'OnApplyTemplate'  method public

----------------------------------------------
Available for consulting in Dallas, TX
http://leeontech.wordpress.com/

lee_sl

Loading...
Joined on 05-09-2008
Posts 549
06-10-2008 9:46 AM
Re: Re: Not able to add Datagrid in Beta 2

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?

 

cyberhuey

Loading...
Joined on 12-01-2007
Raleigh, NC
Posts 13
06-10-2008 11:44 PM
Marked as Answer
Re: Not able to add Datagrid in Beta 2

i've fixed this issue by removing and readding the System.* references in the project.

 

vsi

Loading...
Joined on 06-08-2008
Posts 3
06-11-2008 1:29 AM
Re: Re: Not able to add Datagrid in Beta 2

Thanks vsi. Your fix worked.

Dhawal Shah

Loading...
Joined on 05-08-2008
Posts 9
06-11-2008 6:51 PM
Re: Re: Not able to add Datagrid in Beta 2

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.

cyberhuey

Loading...
Joined on 12-01-2007
Raleigh, NC
Posts 13
07-18-2008 10:37 AM
Re: Re: Not able to add Datagrid in Beta 2

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.

 

Hard Software, Done well.
(MFC, C#, Silverlight, Embedded, Desktop, Web services)
www.subtopic.cc

K2P2

Loading...
Joined on 07-05-2008
Golden, Colorado
Posts 211
07-18-2008 11:08 AM
Re: Re: Not able to add Datagrid in Beta 2

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.

 

 

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

sladapter

Loading...
Joined on 03-05-2008
Indiana, US
Posts 2,861
07-18-2008 12:03 PM
Re: Re: Not able to add Datagrid in Beta 2

I never used Beta 1.  I started with Beta 2.

Hard Software, Done well.
(MFC, C#, Silverlight, Embedded, Desktop, Web services)
www.subtopic.cc

K2P2

Loading...
Joined on 07-05-2008
Golden, Colorado
Posts 211
07-18-2008 12:08 PM
Re: Re: Not able to add Datagrid in Beta 2

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).

Hard Software, Done well.
(MFC, C#, Silverlight, Embedded, Desktop, Web services)
www.subtopic.cc

K2P2

Loading...
Joined on 07-05-2008
Golden, Colorado
Posts 211
07-18-2008 12:14 PM
Re: Re: Not able to add Datagrid in Beta 2

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.

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

sladapter

Loading...
Joined on 03-05-2008
Indiana, US
Posts 2,861
07-18-2008 12:29 PM
Re: Re: Not able to add Datagrid in Beta 2

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>

</Canvas>

</UserControl>

Hard Software, Done well.
(MFC, C#, Silverlight, Embedded, Desktop, Web services)
www.subtopic.cc

K2P2

Loading...
Joined on 07-05-2008
Golden, Colorado
Posts 211
07-18-2008 12:58 PM
Re: Re: Not able to add Datagrid in Beta 2

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? 

 

 

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

sladapter

Loading...
Joined on 03-05-2008
Indiana, US
Posts 2,861
07-18-2008 1:52 PM
Re: Re: Not able to add Datagrid in Beta 2

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 standard
B)  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 standard
B)  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.

Hard Software, Done well.
(MFC, C#, Silverlight, Embedded, Desktop, Web services)
www.subtopic.cc

K2P2

Loading...
Joined on 07-05-2008
Golden, Colorado
Posts 211
09-11-2008 3:48 AM
Re: Re: Not able to add Datagrid in Beta 2

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

 

jreski

Loading...
Joined on 09-11-2008
Hamburg - Germany
Posts 1
11-05-2008 8:37 AM
Re: Re: Re: Not able to add Datagrid in Beta 2

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.

cyberhuey

Loading...
Joined on 12-01-2007
Raleigh, NC
Posts 13
11-05-2008 2:27 PM
Re: Re: Not able to add Datagrid in Beta 2

One thing you can try is right clicking the empty space inside the toolbox and select Reset toolbox

Yifung Lin [MSFT]

yifung

Loading...
Joined on 03-25-2008
Redmond, WA
Posts 391
03-06-2009 4:16 PM
Re: Re: Not able to add Datagrid in Beta 2

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.


www.earthtechconcepts.com
Earth Tech Concepts, Inc.

earthtechconcepts

Loading...
Joined on 02-25-2009
Posts 6
03-06-2009 9:34 PM
Re: Re: Not able to add Datagrid in Beta 2

For clearing the toolbox give this a try:

Close all instances of Microsoft Visual Studio.2.       Delete all cached toolbox items by removing all files beginning with "toolbox" from %LocalAppData%\Microsoft\VisualStudio\9.0.
  • On Microsoft Windows XP, %LocalAppData% is Documents and Settings\UserName\Local Settings\Application Data.
  • On Microsoft Windows Vista, %LocalAppData% is Users\UserName\AppData\Local.

 

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

Yifung Lin [MSFT]

yifung

Loading...
Joined on 03-25-2008
Redmond, WA
Posts 391
Microsoft Communities