• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 60
  • Last Modified:

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

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
FaheemAhmadGul
Asked:
FaheemAhmadGul
  • 2
1 Solution
 
David Johnson, CD, MVPOwnerCommented:
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
 
FaheemAhmadGulAuthor Commented:
<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
 
FaheemAhmadGulAuthor Commented:
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

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now