Greg
Greg

Reputation: 2690

XAML binding to another elements command parameter

I have a ListBox with Items - Each item consists of a Hyperlink and a Button. I am using MVVM and Commanding. The hyperlink's commandparameter is bound to "IDForumTopic". I want to pass the same parameter from the button as the hyperlink is passing:

  <HyperlinkButton x:Name='hlTopicText'
    Content='{Binding ForumTopicText}'
    FontWeight='Bold'
    Margin='5,0,0,0'
    Width='175'
    Command='{Binding LoadThreadHeadersCommand,Source={StaticResource ViewModel}}'
    CommandParameter='{Binding IDForumTopic}'>
  </HyperlinkButton>
  <Button Content='New Post'
    Background='Orange'
    Command='{Binding NewForumPostWindowCommand,Source={StaticResource ViewModel}}'
    CommandParameter='{???}'>
  </Button>

Upvotes: 0

Views: 652

Answers (1)

Myles J
Myles J

Reputation: 2880

Why can't you simply use the same binding on the buttons CommandParameter e.g:

CommandParameter="{Binding IDForumTopic}" 

..or have I misunderstood your question?

Upvotes: 1

Related Questions