Question

Not sure if this can be done - I've got a WPF Application with a bunch of XAML screens and what I'd like to be able to do on one of them is bind the Text value of a TextBlock to the Content Value of a selected button. I've got say 5 buttons in my XAML and when I click any of them I want the text block to reflect the button content. I know I can do this through Commands ala MVVM but I'd love to do this in pure XAML - no code at all.

Can it be done?

Thanks heaps!

Was it helpful?

Solution

Answers below!

Chris W response:

Add a trigger on your buttons individually or as a template shared by all of them to do a ChangePropertyAction with your TextBlock as the TargetObject to its Text property with the Buttons content and voila, you're done.

XAMIMAX response:

Set the Trigger for your button, in the

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top