Quantcast
Channel: Caliburn.Micro: Xaml Made Easy
Viewing all articles
Browse latest Browse all 1760

New Post: Calling Parent VM in ItemsControl

$
0
0

There's this example from the Nuts'n'Bolts series, however it deals with the item being a DataTemplate. I'd like to keep things separate with a viewmodel, which works fine, but apparently not with Actions. How would I do "Remove($dataContext)" if the ItemTemplate were to be a separate View?

<UserControlx:Class="Caliburn.Micro.BubblingAction.ShellView"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:cal="http://www.caliburnproject.org"><StackPanel><ItemsControlx:Name="Items"><ItemsControl.ItemTemplate><DataTemplate><StackPanelOrientation="Horizontal"><ButtonContent="Remove"cal:Message.Attach="Remove($dataContext)"/><TextBlockText="{Binding Id}"/></StackPanel></DataTemplate></ItemsControl.ItemTemplate></ItemsControl><ButtonContent="Add"cal:Message.Attach="Add"/></StackPanel></UserControl>


Viewing all articles
Browse latest Browse all 1760

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>