문제

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!

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top