Solved

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

Posted on 2016-11-19
3
12 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 78

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Wpf develop 5 32
c# code 19 58
Trouble with References... 5 22
Different Delete Messages 7 10
Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

707 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now