I have a listview with an extensible title, this works correctly, however, when I add a button, it does not start the linked command.
<ControlTemplate>
<Expander IsExpanded="True">
<Expander.Header>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Name}" Name="txtX" FontWeight="Bold" Foreground="Gray" FontSize="22" VerticalAlignment="Bottom" />
<Button Content="Add Task List" Width="150" HorizontalAlignment="Right" Command="{Binding XCommand}"/>
</StackPanel>
</Expander.Header>
<ItemsPresenter />
</Expander>
</ControlTemplate>
All other buttons on the page correctly control the commands of my view mode, so I will be afraid to guess that this is due to xaml or how the buttons are created dynamically with each grouping.
* CHANGE
Just add the appropriate view model code for the context. If I add an identical button outside the list, it launches the command. Link to the image of all xaml.
Public Property XCommand As ICommand
Public Sub New(ByVal regionManager As IRegionManager, _
ByVal container As IUnityContainer)
XCommand = New RelayCommand(AddressOf DoSomething)
_regionManager = regionManager
_container = container
End Sub
Private Sub DoSomething()
MessageBox.show("Test")
End Sub
Any help on how to make this work correctly?
Thankyou!
source
share