.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

InvalidOperationException in VS2010 WPF Designer on Visual State Manager

Posted By:      Posted Date: October 11, 2010    Points: 0   Category :WPF


When adding WPF styles through control templates and resourcedictionarys VS2010 throws an InvalidOperationException error in the designer on controls when certain properties are set, that link back to the Visual States. I thought this must be the way i was creating the Visual States (i am using Blend 4.0) but I am also getting the same error, even using the ControlTemplateExamples downloaded from the msdn site.  http://code.msdn.microsoft.com/Project/Download/FileDownload.aspx?ProjectName=wpfsamples&DownloadId=7741

I opened up the solution in VS2010, then opened MainWindow.xaml (split screen - designer and markup)


'System.Windows.Media.Animation.ColorAnimation' animation object cannot be used to animate property 'Foreground' because it is of incompatible type 'System.Windows.Media.Brush'.

... there are 11 errors but the solution builds successfully and runs fine.

If you look at the markup in MainWindow.xaml and the first set of buttons, the first error is linked to the "IsEnabled" property

View Complete Post

More Related Resource Links

Problem setting Foreground with Visual State Manager (WPF - .Net v4.0

0 down vote favorite I have a WPF application, and I am attempting to style a TextBox using the .Net v4 Visual State Manager. Specifically, I am attempting to set the colors of the Foreground and Background for the MouseOver state. What is happening is that, while the background and border are changing perfectly, the foreground is not. If the brushes that I am using get their color via a StaticResource, then the foreground does not change at all. If the brushes that I am using get their color via a DynamicResource, then when I mouse over a TextBox, the foreground of all TextBoxes change. Clearly, either I'm doing something wrong, or what I want to do is simply not possible with VSM (which would be rather disappointing). Here are the resources that I am using:   <Color x:Key="ControlBackgroundColor" R="178" G="178" B="178" A="255" />  <Color x:Key="ControlForegroundColor" R="0" G="0" B="0" A="255" />  <Color x:Key="BorderColor" R="127" G="127" B="127" A="255" />  <Color x:Key="MouseOverControlBackgroundColor" R="0" G="0" B="0" A="255" />  <Color x:Key="MouseOverControlForegroundColor" R="255" G="2

Visual State Manager conflicts with WPFtoolkit.

how can i get the wpftoolit to work together with framework 4.0? when i add a VisualStateManager item to my xaml-file in vs 2010 i get the following error: The type 'System.Windows.VisualStateGroup' exists in both 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client\PresentationFramework.dll' and 'c:\Program Files (x86)\WPF Toolkit\v3.5.50211.1\WPFToolkit.dll' thanks for your help regards

Visual Studio closes itself by opening aspx-Page designer after Windows Update


Hey Guys,

I've a problem with my Visual Studio.

On the 13th of August 2010 i installed a Windows update on my vista sp2 pc. For this date my Visual Studio 2008 sp 1 always has closed itself by opening an aspx-page in designer view. There is no error message just closing the window. I restored a backup of my windows from the time before updating it and it helped, i could open aspx pages in the design view till the update has been installed again automatically after rebooting the pc. I can't disable windows updates, cause it's my pc at work and safety is very important. I hope you could help me out of this disaster.



browser gives jibberish when State manager (sql) is turned on


Hi all, we're testing our web app with a state manager so that we can do distributed rollouts. We're not getting any errors, but we are getting jibberish returned for every page request. 

(it won't even let me paste it in here)

HOw do I get it to serve the pages normally?


Smart Tags: Simplify UI Development with Custom Designer Actions in Visual Studio


Windows Forms 2.0 components expose smart tags by utilizing Designer Actions. By taking advantage of this feature, you can add smart tags to your own custom components to make setting their properties and other actions much easier and developer-friendly.

Michael Weinhardt

MSDN Magazine July 2005

Visual Studio designer event problem


Hi there

I have a small issue that I'm sure others have experienced - but haven't yet found a solution / workaround for this.

When adding controls to Visual Studio in designer you normally get a event button (the yellow flash light) in the properties window.

But when you nest a button inside a placeholder (for example) you cannot mark the button from the designer - only the placeholder! When trying to go into "split-view" on the designer you'll be able to mark the button in the bottom of the designer - but only properties and not the event button appers in the properties window!

I know that you can go into codebehind and manually add the event but I thiink it is really tiresome to do so if I don't have to...

I had a small hope that VS2010 the issue would be gone but sadly it isn't...

Anyone ever found a solution for this one?

Kind regards Thomas

WPF Designer (in VS 2008 and VS 2010) crashes with Visual Studio

Good day all. I have the following question: WPF designer in both VS 2008 and VS 2010 crashes with Visual Studio when I try to edit UI form. Moreover, it crashes even when I try to save .xaml.cs file. Meanwhile, Winforms and Dataset UI editors work as usual. Are there other people met this issue? And how could I fix up this problem? Deleting the .suo file, uninstalling silverlight, repairing visual studio, and further googling did not help me. Thanks in advance.

VS 2010 Designer InvalidOperationException after using Blend 4 VSM

Working on an WPF 4 app today and noticed the VS 2010 Designer won't load after using Blend 4 Visual State Manager. Basic info that I did. 1. Had a Button.  Would display in both VS10 Designer and Blend 4. 2. In Blend 4, I right clicked Button -> Edit Template -> Create Empty. 3. Added ContentPresenter to Grid. 4. Back in Window.xaml, added Image to Button's ContentPresenter.  Still works in both VS10 and Blend 4. 5. In Blend 4, went back to Edit Template and modified some of the States.     - Disabled: Grid Opacity 50%     - MouseOver: Grid Scale X/Y to 1.1     - Pressed: Grid Angle 15. 6. Save and go back to VS10, the designer won't load.  Get the Yellow bar at top stating something like... InvalidOperationException was thrown on "button": Property does not point to a DependencyObject in path...... The button now has an X with red circle in it. Is this a know issue?  Is there a fix? It still works in Blend 4 and I can run the WPF app in both VS10 and Blend 4. Thanks in advance.

WPF Binding Not Showing in Visual Designer

I wrote a demo app (download src here) that doesn't properly display sample data in the Visual Studio Designer and I need help. After 6+ years developing in C# and WinForms, I've decided to use WPF in my current project. I've written a small demo application to teach myself and experiment with WPF. The app simply downloads and displays recent news stories from the Google News RSS feed (see Figure below):   My first attempt at this resulted in the class called "GoogleNewsWidget." After reading about the MVVM model, however, I tried again and built "GoogleNewsWidget2" that attempts to utilize a more MVVM-oriented architecture. I'm not sure which implementation is best as they both seem to be working fine on the whole (and though I'd appreciate comments on which implementation is better, this is not my primary question). My main problem is that neither GoogleNewsWidget or GoogleNewsWidget2 play very well with the Visual Studio Designer. The GoogleNewsWidget2 loads and displays data fine when its xaml is opened directly but does not display correctly when embedded into another xaml file. The GoogleNewsWidget does not display data in the Designer in either case (see Visual Designer screenshots here). What's worse, I can't figure out a way to debug stuff in Visual Designer--are there tools for this? Any help would be appreciated

VS2010: Switching tabs in wpf designer

Hi, I have a problem with the WPF designer in VS 2010. I have a WPF UserControl which contains a TabControl with several Tabs (TabItems).  It was always possible to switch the tabs in the designer to see the content of the individual tabs. However, suddenly this stops working. I can not switch the tabs anymore. [EDIT] Seems to be a known issues? https://connect.microsoft.com/VisualStudio/feedback/details/531868/wpf-editor-tabcontrol-issues Workaround does not work for me (or I do not understand it correctly)... [/EDIT] Any ideas? Thanks in advance. Jus  

VS2010 designer problems with custom markup extensions returning FontFamily

App.xaml: <Application x:Class="CustomMarkup.App"              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"              xmlns:int="clr-namespace:CustomMarkup"              xmlns:ext="clr-namespace:ExternalMarkupExt;assembly=ExternalMarkupExt"              StartupUri="MainWindow.xaml">     <Application.Resources>         <Style x:Key="MyStyle">             <Setter                  Property="Control.FontFamily"                  Value="{ext:ExtMarkupExt {x:Static int:Resources.FONTFAMILY_NAME}}"/>         </Style>     </Application.Resources> </Application> MainWindow: <Window x:Class="CustomMarkup.MainWindow"         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"         xmlns:x=&quo

How to display breakpoint and debug visual cues with custom activity designer based on WorkflowViewE

Hi,   I am developing custom activity designers based on "WorkflowViewElement" instead of "ActivityDesigner" in my xaml. It allows me to have greater control of the look and feel of the designer. However I noticed that with this approach, the breakpoint visual cue (Dark red solid circle that appears on the left side of the designer when you set breakpoint on the designer) is not visible. It works fine when you write your designed based on "ActivityDesigner". The same behavior happens to the debug visual cue when you debugging the WF. It appears as bright yellow rectangle surrounding the activity designer if you are based on "ActivityDesigner", but it is not available when your designer is based on"WorkflowViewElement". Any help is highly appreciated. Li

Visual Studio 2008 Failing to Add New Controls into *.designer.cs

I've encountered a situation with my current project where, when I add a new control, VS2008 is not adding it into the associated Designer file.  This is occurring with both a Web Page (ASPX) and a User Control (ASCX).At first I thought it was because I was going into the layout page and manually adding a control that way.  But then when I went back to dragging the controls right from the ToolBox the problem persisted.Why is this happening and how can I fix it?Robert

MS Visual STudio 2010 Beta and SSIS Designer - BI Development Studio

Hello, I am trying to use SSIS Designer with BI Development Studio.  I downloaded MS Visual Studio 2010 Beta and do not find an option to get into either the SSIS Designer or BI Development Studio. Can someone please help?   Thanks, Chela 

can't debug anymore a state machine workFlow in Visual Studio

Hi, I have an issue with debuging a workFlow with visual studio when it should start the workFlow when I create an item nothing happen and sharepoint stay stuck : I can't refresh any lists, visual studio rich 40% of the CPU, no exception on log. At the same time if i deploy without debugging it works. Please help me. Thanks, Patrice  

Visual Studio 2010 designer UnresolvedAssemblyException

I'm having a problem with Visual Studio 2010 that is proving to be extremely difficult to find a solution for. Any help is appreciated. I have a custom library that handles regular expression validation for me. This library sits plainly on our server for everyone to access. In my most recent WPF application I've been learning about ValidationRules. I created my own custom rule that would simply test the input against a supplied regex pattern. Here's an example of the XAML. <TextBox Grid.Column="2" VerticalAlignment="Center" Style="{StaticResource sTextBox}" Validation.ErrorTemplate="{StaticResource TextBox}" SourceUpdated="ProductQuantity_TargetUpdated"> <TextBox.Text> <Binding Path="Quantity" Mode="TwoWay" NotifyOnValidationError="True" NotifyOnSourceUpdated="True" NotifyOnTargetUpdated="True" ValidatesOnDataErrors="True" UpdateSourceTrigger="PropertyChanged" ValidatesOnExceptions="True"> <Binding.ValidationRules> <vr:RequiredField Label="Quantity" /> <vr:RegularExpression Label="Quantity" ValidationPattern="NumberAbsoluteNoDecimals" /> </Binding.ValidationRules> </Binding> </TextBox.Text> </

Resync designer view with model/view state

Hi, In most cases, changes made to the model or view state pretty much immediately reflect in the designer UI, assuming there is a corresponding UI representation for the model item or view state.  What I'm doing is using the view state to establish links (in a Flowchart designer) between activity designers.  Normally this works fine.  But occasionally, an exception is thrown saying that a connection cannot be made between two points.   In the event of this exception, I can wrap the statement that throws the exception (in my case, EditingScope.Complete) and retry the logic, this time not specifying the connection points and letting the designer's routing algorithm comes up with its own path.   The problem I'm experience is when I wrap the call (EditingScope.Complete) in a try/catch block that throws the exception and re-do the connection logic, this time not specifying the view state (but still specifying the Next property of a FlowStep, or True/False property of a FlowDecision, etc using the ModelItem.SetValue method), visually a connection is not made between the activities.  But if I manually close the designer and reload it or use the bread crumb navigation to move away from the current designer and then return, the connections visually appear. I want to be able to programmatically refresh the UI based on the updated model / view st
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend