开发者

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>


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

CommandParameter="{Binding IDForumTopic}" 

..or have I misunderstood your question?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜