Jump to: navigation, search

Changes


XAML Tips

1,043 bytes added, 14:48, 1 September 2020
/* Content creation */
=== Content creation ===
{{Version/WinXSince|3.5.5}}
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 or the 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(&quot;21fc990a-d064-4bee-8d48-3293351f827a&quot;)</x:String><cv:ListCollectionView x:Key="PlantMapView" Expression="{StaticResource PlantMap}" ItemsSource="{Binding Children.Items}" /> <AppBarButton><AppBarButton.Flyout> <Flyout Placement="Full"> <ListView ItemsSource="{Binding Source={StaticResource PlantMapView}}"> <ListView.ItemTemplate> <DataTemplate> <Button Content="{Binding Header}" Command="{Binding CreateChildItemCommand}" x:Name="CreateButton" Tag="{Binding}"> <Button.CommandParameter> <uc:KeyValueList> <uc:KeyValueParameter Key="Parent" Value="6D733909-1742-4110-8619-237849BFE453"/> <uc:KeyValueParameter Key="Type" Value="21fc990a-d064-4bee-8d48-3293351f827a"/> </uc:KeyValueList> </Button.CommandParameter> </Button> </DataTemplate> </ListView.ItemTemplate> </ListView> </Flyout></AppBarButton.Flyout></AppBarButton></source> 
<source lang = "xml">
<x:String x:Key="PlantMap">Item.IsTypeCreationAllowed(&quot;21fc990a-d064-4bee-8d48-3293351f827a&quot;)</x:String>
* AutoCommit (optional, defaults to false): When set to true, the change(s) will be saved to the local cache and the database, and then committed to the server.
[[Category:Client|XAML Tips]][[Category:WinX|XAML Tips]]
=== Disable FilloutCriteria ===
1,578
edits