Solved

How do I set the binding source of a label in WPF to this value System.Deployment.Application.ApplicationDeployment.CurrentDeployment.CurrentVersion?

Posted on 2010-08-19
1
737 Views
Last Modified: 2013-11-12
I wanted to set the value of label in WPF to the value that System.Deployment.Application.ApplicationDeployment.CurrentDeployment.CurrentVersion would give you?

How would I do that in XAML?
0
Comment
Question by:endrec
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 3

Accepted Solution

by:
with earned 500 total points
ID: 33479618
I would suggest using the MVVM pattern for a piece of data like that.  

In the following example I'm creating a new class to facilitate a DataContext; if you have an existing object you're using as DataContext already, you can add a Version property to that (instead of creating an entirely separate class just to house the Version).  But this just illustrates the concept:

public class MyViewModel
{
	public Version MyCurrentVersion 
	{ 
		get { return System.Deployment.Application.ApplicationDeployment.CurrentDeployment.CurrentVersion; }
	}
}

(then, in XAML)

<Grid>
	<Grid.DataContext>
		<local:MyViewModel/>
	</Grid.DataContext>
	<TextBlock Text={Binding MyCurrentVersion} />
</Grid>

Open in new window

0

Featured Post

The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question