Application.Current does not exist
-
Wednesday, February 22, 2012 3:38 AM
I am trying to use Application.Current for a jumplist (getJumpList(Application.Current)). However, despite seeing this all across my Google searches, C# does not identify the variable. This is in a windows forms application.
'System.Windows.Forms.Application' does not contain a definition for 'Current'
What is wrong, and why is it wrong?
All Replies
-
Wednesday, February 22, 2012 4:17 AM
Application.Current is Specific to WPF / Silverlight applications, as it is defined in PresentationFramework.dll Assembly. MSDN Application.Current
As you are using Winforms Application, you can use the Application Class, defined in System.Windows.Forms.dll Assembly. Winforms Application class
Most of the commonly used Application methods are defined, not sure what are you trying to achieve.
--Krishna
-
Wednesday, February 22, 2012 1:27 PM
http://msdn.microsoft.com/en-us/library/system.windows.shell.jumplist.getjumplist.aspx
I am wanting to use the line below the third comment in the example code. I have often seen Application instead of App in other examples.
-
Thursday, February 23, 2012 5:41 AMModerator
Hi AmbientX,
Welcome to the MSDN forum.
It seems that you want to use Application.Current in your winform application. If so, you can add a reference to PresentationFramework first:
1.In Solution Explorer, right-click the project node and click Add Reference.
2.In the Add Reference dialog box, select the .NET tab.
3.Select the PresentationFramework, and then click OK.Then add "using System.Windows.Shell;","using System.Windows;" to your code.
Now you can write code like :System.Windows.Application a = System.Windows.Application.Current;
Hope it can help you.
Bob Shen [MSFT]
MSDN Community Support | Feedback to us
- Marked As Answer by AmbientX Saturday, February 25, 2012 3:04 AM
-
Thursday, February 23, 2012 3:31 PM
In addition to Bob Shen's answer.. You can create a jumplist without using WPF's reference and using the Windows API.
step by step guide for Winforms Jumplist
--Krishna
-
Saturday, February 25, 2012 3:05 AMStrangely enough, neither of those work, but thanks for the reply.

