=== Content creation ===
To directly create an object on a child of the current object, you can define a Button as follows. The method "Item.IsTypeCreationAllowed" used in the expression gets the uid of the type that should be created below a child, if a child does not allow the creation of that type underneath it, the child will be hidden in the selection dialog. To actually create the object, the "CreateChildItemCommand" needs to be passed a KeyValueList with two parameters: The Parent-key is the uid ContentViewModel of the child underneath the object should be created, the Type-key is the type of object which should be created--this should match the uid passed to the "Item.IsTypeCreationAllowed" method.
<source lang = "xml">
<x:String x:Key="PlantMap">Item.IsTypeCreationAllowed("21fc990a-d064-4bee-8d48-3293351f827a")</x:String>
<cv:ListCollectionView x:Key="PlantMapView" Expression="{StaticResource PlantMap}" ItemsSource="{Binding Children.Items}" />
<AppBarButton Grid.Column="3" Icon="PreviewLink" Style="{ThemeResource UBIKGlobalChildAppBarAppBarButton}" x:Key="createChildButton" Visibility="Visible"> <AppBarButton.Flyout> <Flyout Placement="Full"> <ListView Margin="-15" BorderThickness="0" ItemsSource="{Binding Source={StaticResource PlantMapView}}" SelectionMode="None"> <ListView.ItemTemplate> <DataTemplate> <Button Content="{Binding Header}" Command="{Binding CreateChildItemCommand}" x:Name="CreateButton" Tag="{Binding UID}"> <Button.CommandParameter> <uc:KeyValueList> <uc:KeyValueParameter Key="Parent" Value="{Binding Tag, ElementName=CreateButton}"/> <uc:KeyValueParameter Key="Type" Value="21fc990a-d064-4bee-8d48-3293351f827a"/> </uc:KeyValueList> </Button.CommandParameter> </Button> </DataTemplate> </ListView.ItemTemplate> </ListView> </Flyout> </AppBarButton.Flyout>
</AppBarButton>
</source>