Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

Additional Content in a custom Xamarin.Forms Control (XAML)

$
0
0

If a custom control is created with content, is there any way to specify additional content:
(Example here StatusView is a ContentView with a Grid for its Content)
I would like to take whatever additional controls are added via XAML and add them into the grid from the custom control

<?xml version="1.0" encoding="UTF-8"?>
<ContentPage 
    xmlns="http://xamarin.com/schemas/2014/forms" 
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:vm="clr-namespace:MobileClient.ViewModels;assembly=MobileClient" 
    xmlns:controls="clr-namespace:MobileClient.Controls;assembly=MobileClient" 
    x:Class="MobileClient.Views.StatusView"
    Title="{Binding Title}"
    Icon="{Binding Icon}">
    <ContentPage.BindingContext>
        <vm:StatusViewModel />
    </ContentPage.BindingContext>
    <ContentPage.Content>
        <!-- Style row just defines RowHeight = 100 -->
        <ListView Style="{StaticResource row}" ItemsSource="{Binding Statuses}"> 
        <ListView.ItemTemplate>
            <DataTemplate>
                <ViewCell>
                    <ViewCell.View>
                        <controls:StatusView Status="{Binding Name}" StatusColor="{Binding Color, Converter={StaticResource colorizer},         Mode=OneWay}" Title="{Binding Code}" Description="{Binding StatusType}">
                            **<!-- Additional XAML Here with Binding -->**
                        </controls:StatusView>
                    </ViewCell.View>
                </ViewCell>
            </DataTemplate>
        </ListView.ItemTemplate>
    </ListView>
    </ContentPage.Content>
</ContentPage>

Viewing all articles
Browse latest Browse all 91519

Trending Articles



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