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

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

Visual Studio can't resolve static resource in WPF window, even though it works at run time - why?

Posted By:      Posted Date: April 14, 2011    Points: 0   Category :JQuery

I have a WPF window and am using the MVVM pattern. I set the view model as a resource for the window as follows...

  ...other stuff removed for clarity...
  <mvvm:DhrTemplatesViewModel x:Key="viewmodel" />

I want to set the window's data context to use the resource, and found that the following XAML works...

<StaticResource ResourceKey="viewmodel"/>

The problem is that I can only do this by typing the XAML manually, Visual Studio doesn't show the resource anywhere. I can go to the window's properties and click the little icon next to the DataContext property, click the "Apply resource" option, but it doesn't show "viewmodel" as a resource, static or dynamic. If I enter the XAML manually and then open the "Apply resource" pop-up window, it has the "viewmodel" underlined as an error, and hovering over it shows a tooltip "cannot resolve resource reference"

However, when I run the application, it works fine, so the resource is being resolved at run time.

Anyone ab

View Complete Post

More Related Resource Links

How to implement Design-Time drag & drop from Custom Visual Studio Tool Window to WPF Designer

Hi, Could someone tell me if it is possible to intercept a design time drop event coming from a custom Visual Studio tool window onto the cider design surface? I am hoping to use the same API's as those used by the Visual Studio 2010 'Data Sources' tool window, which provides drag & drop data-binding between classes and WPF/Silverlight controls. My requirement is to pass a DataObject (used with the WPF DragDrop API) from my custom Visual Studio WPF tool window treeview to my custom WPF control at design time, read the data and do some binding/XAML manipulation of my own. The drag aspect is simple enough but I can't work out how to accept a drop event from anything other than the toolbox. At the moment, when I drag my treenode over the design surface it shows the 'cannot drop here' cursor. If someone could give me some insight into how the 'Data Sources' tool window allows dragging of treenodes to controls I would really appreciate it. It is obviously possible but which API's are used and are they public? Thanks in advance, Paul  

HttpHandler works with Visual Studio Development Server debugging, but not otherwise


Hi all,

I'm new to HttpHandlers.  I am writing an HttpHandler that reads uploaded files directly from the request stream to provide progress that can be queried using an AJAX request.  For large files, this seems to be faster than having ASP.NET load the file contents into Request.Files and then streaming the file from there to wherever it goes (Linq to SQL into a VARBINARY column in an SQL Server database.)

My HttpHandler works perfectly when I'm debugging using the Visual Studio Development Server, but doesn't work otherwise.  The application pool for this application in IIS 7 is set to run in Classic Mode, and the Handler Mappings screen in IIS says that I must manage managed handlers in system.web/httpHandlers. 

I set up in my applications Web.config file.

<add verb="GET,POST" path="*.upload" type="Namespace.For.UploadHandler, AssemblyForUploadHandler"/>

It works great, so long as I don't debug with the "Use Local IIS Web server" option.

What else do I need to do to get this to work?


Thread Performance: Resource Contention Concurrency Profiling in Visual Studio 2010


Visual Studio 2010 includes new resource contention profiling features that help detect concurrency contention among threads. We walk through a profiling investigation to demonstrate how you can pinpoint and fix resource contention problems in your code.

Maxim Goldin

MSDN Magazine June 2010

XML Comments: Document Your Code in No Time At All with Macros in Visual Studio


Starting in Visual Studio 2005, XML documentation support will become available in Visual Basic and C++ as it has been for C#. However, making full use of the many comment tags will take a little extra work In this article, the author shows how Visual Studio macros can be used to automate the creation of XML documentation and creates macros that write large sections of comments with just a keystroke.

Tony Chow

MSDN Magazine July 2005

Visual Studio .NET: Building Windows Forms Controls and Components with Rich Design-Time Features, P


This is the second of two articles discussing the extremely rich design-time features of the .NET Framework. Part 1 discussed the basics, showing you where to start and how to extend your control implementation through attributes and interfaces, as well as their effects on the property browser, code serialization, and other controls. Part 2 continues the journey by concentrating on design-time functionality that you can implement beyond your components and controls, including TypeConverters, UITypeEditors, and Designers. It would be impossible to cover everything you can do in two short articles, which is a testament to just how all-encompassing and flexible the design-time capability of the .NET Framework is.

Michael Weinhardt and Chris Sells

MSDN Magazine May 2003

Visual Studio .NET: Building Windows Forms Controls and Components with Rich Design-Time Features


Visual Studio .NET provides support for designing rich features into your controls and components, allowing you to set properties, set form placement, inherit from base classes, and much more. So how does Visual Studio .NET do all this? What does the Windows Forms designer do? What's the difference between a control and a component? How does Visual Studio integrate your controls so that they can access features of the .NET Framework?In this article, the authors answer these common questions by building a clock control and taking the reader along for the ride. In building the control, hosts and containers are illustrated, the property browser is explained, debugging is discussed, and a general overview of the design-time infrastructure is presented.

Michael Weinhardt and Chris Sells

MSDN Magazine April 2003

Visual Studio 2010 crashes all the time

Does anyone know why VS 2010 crashes so often, and how to fix it?Greg H.

Visual studio 2005 - Port Number is difference during run time.

Hi, When I debug(F5), the port number display in the URL is difference from the ASP.net development server. Eg: URL address port number is  - 1084, while for the Server is 1088 I have tried difference ways such as trying to set the dynamic port to false, so that I can configure my own port, but it is not able to work. I have also turned off the ESet Firewall however the port number is still difference.  Need your help in this area.. Thank you! 

Ldap authenication code is not working with IIS but works with Visual Studio developement webserver

Hi,I have weird issue here, I have a method that  takes a login Id and authenticates with LDAP active directory and returns the employee Id.It works great when I run the application in Visual studio 2008 ( it uses the default visual studio developement webserver). The code authenitcates the login id and returns emp Id perfectly. But the problem comes when I publish the code to the Local IIS in my developement PC.public string GetEastWestTeamMembersEmployeeID(string loginID)        {            string domain = string.Empty;            string login = string.Empty;            int position = loginID.IndexOf(@"\");            string empid = "";                  System.DirectoryServices.DirectoryEntry directoryEntry = null;            if (position >= 0)            {                domain = loginID.Substring(0, position);    &n

how to send emails to multiple persons at the same time from sharepoint workflow using visual studio


Hi Every one !!

   I am trying to send copy of a document for multiple directors at my client for their approval.

   The director can approve the document at the same time.

   Hence, I would like to know how to create a task to send emails for multiple people at the same time from a sharepoint workflow using visual studio 2008.

   I see there is a parallel activity. But it gives me only 2 paths ( means would be able to send only for 2 users )

   If creating a separate task to send emails for each user is an inefficient way, please let me know if there is another good way of sending emails to multiple users.


Thank you

Visual Studio 2003 in Window 7 (IIS 7.5)



I install visual studio 2003 in window 7 which window 7 build in is IIS7.5. I can't debug it. Any ideas?





Visual Studio wont resolve URL, help


Im having issues in my development environment. I have just been using a standard installation of Visual Studio 2010 ult.

Any object's link to an image, page, or anything else will not resolve on my local system. Once Ive uploaded to the server it work fine, but on my local machine it doesn't work.

Does anyone have any insight on how to correct this? or if I just dont know what Im doing, Im pretty new.

For example:

Does Not Work:   <img src="../App_Themes/Unity/images/logo.png' />

Works : <img src="App_Themes/Unity/images/logo.png" />

How to resolve WPF Visual Studio 2008 message "this member is defined more than once"


In a code behind file for a custom user control in a C# WPF project the variables representing controls defined in XAML (e.g. closeButton) display red squiggly lines underneath with a tooltip message indicating "this member is defined more than once".

When I 'find all references' on these control variables I see there are 2 references, one in a .g.cs file and another in a g.i.cs file. Hence VS thinks items are defined twice.

A rebuild solves problem for a bit, but then the red squiggly lines return!

I don't think I've seen references to a .g.i.cs file before, but I've read they are generated in memory to help with intellisense.

I'm not sure what I may have accidentally done to provoke this issue but any help to resolve this will be much appreciated.

Event Receiver works through Visual Studio, but not when manually installing solution



I have developed a custom library list definition and also added a event receiver for the ItemUpdating event of the list.

When deploying through Visual Studio 2010 by going to "Build - Deploy", the event fires perfectly when I add a file to the library.

But when manually installing the .wsp (like the client will), the event does not fire at all when I add a document!  Here is what I do to install the .wsp:

  1. Package the solution by going to "Build - Package"
  2. Install the package by running the following command in the "SharePoint 2010 Management Shell": Add-SPSolution -LiteralPath "PATHTOWSP"
  3. In Central Administration, under "System Settings", then "Manage Farm Solutions" - I deploy the WSP

Is there something wrong here?  Could it be a permissions issue, and how do I check?


Visual Studio 2010 Crashes every time I close it.


I have Visual Stutio 2010 RTM Premiem install on my machine, but it crashed when ever i close the it.

Following is the error detail.

Problem signature:
  Problem Event Name: APPCRASH
  Application Name: devenv.exe
  Application Version: 10.0.30319.1
  Application Timestamp: 4ba1fab3
  Fault Module Name: KERNELBASE.dll
  Fault Module Version: 6.1.7600.16385
  Fault Module Timestamp: 4a5bdaae
  Exception Code: c0020001
  Exception Offset: 00009617
  OS Version: 6.1.7600.
  Locale ID: 1033
  Additional Information 1: 0a9e
  Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
  Additional Information 3: 0a9e
  Additional Information 4: 0a9e372d3b4ad19135b953a78882e789

View Call Hierarchy window in Visual Studio 2010


Visual studio 2010 Ultimate is great IDE(Integrated Development Environment) and I am loving more and more whenever I found some thing new. While doing some Code and Review and other stuff with Visual Studio 2010 I have found one of most interesting feature in Visual Studio 2010 called "Called Hierarchy".You can navigate your code better with the Call Hierarchy feature in Visual Studio 2010.

To check out let's Create a sample asp.net MVC application like following .CallHirerchay

After creating a ASP.NET MVC 2 application it will create a basic simple application and we can run it and We have two views like home and about. We will check few code with Call Hirarchy. We can enable Call hierarchy window with two way one from the View->View Call Hierarchy like following or you can also use the shortcut Ctrl+Alt+K.

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