Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2016-11-19
3
Medium Priority
?
54 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 84

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
 
LVL 1

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
 
LVL 1

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Integration Management Part 2
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

916 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