如何在xamarin表单中更新DataTemplates(自定义视图)的高度和宽度?

如何在xamarin表单中更新DataTemplates(自定义视图)的高度和宽度?,xamarin,xamarin.forms,datatemplate,Xamarin,Xamarin.forms,Datatemplate,我有一个内容视图,我将使用它作为自定义网格视图的数据模板,它将支持水平滚动。对于自定义模板,我需要根据设备的宽度和高度固定宽度和高度请求。下面是自定义内容视图。如何更新宽度和高度请求值 <?xml version="1.0" encoding="UTF-8"?> <ContentView xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2

我有一个内容视图,我将使用它作为自定义网格视图的数据模板,它将支持水平滚动。对于自定义模板,我需要根据设备的宽度和高度固定宽度和高度请求。下面是自定义内容视图。如何更新宽度和高度请求值

<?xml version="1.0" encoding="UTF-8"?>
<ContentView xmlns="http://xamarin.com/schemas/2014/forms" 
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
    x:Class="GridView.BookshelfItem">
    <ContentView.Content>

        <Grid BackgroundColor="Black" WidthRequest="320">
            <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>

            <ProgressBar Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" BackgroundColor="#E4E4E4" Progress="{Binding Progress}" HeightRequest="3" VerticalOptions="EndAndExpand"/>
            <Image Source="" Aspect="AspectFill" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Grid.RowSpan="3"/>
            <Label Text="{Binding Title}" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Margin="10,0,0,0" VerticalOptions="End" TextColor="#FFFFFF" FontSize="17"/>
            <Image Source="icon.png" Aspect="AspectFill" Grid.Row="1" Grid.Column="1"/>
            <StackLayout Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" Margin="10,0,0,0">
                <Label Text="{Binding Description}" TextColor="#FFFFFF" FontSize="13"/>
                <Label Text="{Binding DescriptionDetails}" TextColor="#FFFFFF" FontSize="15"/>
            </StackLayout>

        </Grid>

    </ContentView.Content>
</ContentView>