我有一个页面,其中一个视图模型被设置为它的数据上下文。在该页面上,我有一个列表,它通过视图模型中的一个属性进行填充。列表中包含一个用户控件和一个按钮。我希望将该按钮与视图模型中的一个命令绑定起来。有没有什么方法可以做到这一点?
<Page DataContext=PageViewModel>
...
<ScrollViewer Grid.Row="3" Margin="20,0" Visibility="{Binding ByVenueSelected, Converter={StaticResource BooleanToVisibilityConverter}}">
<StackPanel>
<ItemsControl ItemsSource="{Binding EventsListByVenue}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<myControls:EventDetails /> <!--in this control i want to bind a command available in PageViewModel-->
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</ScrollViewer>
...
</Page>