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?
精彩评论