Solved

Setting a Buttons CommandParameter to its own Tag or Content Property in a WPF application

Posted on 2016-11-19
3
30 Views
Last Modified: 2016-11-26
In a very simple WPF application I am binding a Button to a Command. I would like to set this button's CommandParameter to this buttons' own tag or content property. I would appreciate help with syntax for this.
Thank you for your help.
0
Comment
Question by:FaheemAhmadGul
  • 2
3 Comments
 
LVL 80

Expert Comment

by:David Johnson, CD, MVP
ID: 41894297
Windows is event driven so when you mouseover or click the button it fires an event so in your code behind you set the actions based on the event
0
 

Accepted Solution

by:
FaheemAhmadGul earned 0 total points
ID: 41896884
<Button Grid.Row="7" Background="Green" Command="{Binding SaveCommand}"  CommandParameter="{Binding RelativeSource={RelativeSource Self},  Path=.}" >Good</Button>

Open in new window


Perhaps my question was not very clear. I was asking about using Command using MVVM pattern in a WPF application. I did manage to find the solution in the end and that is as I have posted in the code Section.
0
 

Author Closing Comment

by:FaheemAhmadGul
ID: 41902218
No body posted the correct solution. In the end I managed to find a solution on StackOverflow and have posted here and accepted it.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

840 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