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

XAML condition decision

$
0
0

Hi all,

Is it possible to add in XAML some condition checking ?

Like in the following pseudo code:

<ListView
    ItemsSource="{Binding Staffs}"
    HasUnevenRows="True">
    <ListView.ItemTemplate>
        <DataTemplate>
      <!-- How to add condition check for example -->
            <ViewCell>
                <!-- Check condition from context of model the Type of view and if choose the following view -->
                <views:OneView
                    BindingContext="{Binding .}"
                    HorizontalOptions="FillAndExpand"
                    VerticalOptions="FillAndExpand"/>
                <!-- else choose the following view -->
                <views:AnotherView
                    BindingContext="{Binding .}"
                    HorizontalOptions="FillAndExpand"
                    VerticalOptions="FillAndExpand"/>
                <!-- endif -->
            </ViewCell>
        </DataTemplate>
    </ListView.ItemTemplate>
</ListView>

Viewing all articles
Browse latest Browse all 89864

Trending Articles



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