'Binding column definition width property in Xamarin.forms grid layout

I am trying to set the width property of column definition in grid layout to a bindable property it gives me this statement System.NotSupportedException: Don't know about Xamarin.Forms.GridLength all i want to do is bind column definition width to be related to device dimensions by binding with property named "ww" in my page popuppage1 instead binding it with the property named "w" in my popupentity class so idk what I am doing wrong in here ,thx in advance my code is as follows:

popuppage1.xaml.cs

namespace DOTFORMS3.Views{   
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class popuppage1 : Rg.Plugins.Popup.Pages.PopupPage
{
    public int width = (int)DeviceDisplay.MainDisplayInfo.Width;
    public int height = (int)DeviceDisplay.MainDisplayInfo.Height;
    public GridLength ww { get; set; }
    public GridLength hh { get; set; }       
    public popuppage1()
    {
        InitializeComponent();
        var dbconn = new SQLiteConnection(Model.HelperMethods.dbPath);
        dbconn.CreateTable<popupentity>();
        mytb = dbconn.Table<popupentity>().ToList();
        MCET = new ObservableCollection<popupentity>(mytb);
        InitializeComponent();
        this.BindingContext = this;
        dbconn.Close();
       
        ww = (width-20) / 2;
        hh = (width - 20) / 2;
        Padding = 20;
    }
    public static List<popupentity> mytb { get; set; } = new List<popupentity>();
    public ObservableCollection<popupentity> MCET { get; set; }

    private void MTZ_ItemTapped(object sender, ItemTappedEventArgs e)
    {            
        var product = e.Item as popupentity;
        var xx = BindingContext as popuppage1;
    }  
}

and here is my xaml code popuppage1.xaml

<pages:PopupPage     
xmlns:pages="clr-namespace:Rg.Plugins.Popup.Pages;assembly=Rg.Plugins.Popup"
xmlns:animations="clr-namespace:Rg.Plugins.Popup.Animations;assembly=Rg.Plugins.Popup"
x:Class="DOTFORMS3.Views.popuppage1">      
    <ScrollView >
    <ListView HasUnevenRows="True" ItemsSource="{Binding MCET }" SelectionMode="None"  >
        <ListView.ItemTemplate>
            <DataTemplate>
                <ViewCell >
                    <Frame>
                        <StackLayout>
                            <Label Text="{Binding DIS1}" IsVisible="{Binding isDIS1}"></Label>
                              <Grid>
                                    <Grid.ColumnDefinitions >
                                        <ColumnDefinition  Width="{Binding w}">/ColumnDefinition>
                                        <ColumnDefinition  Width="{Binding w}" ></ColumnDefinition>
                                    </Grid.ColumnDefinitions>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="{Binding w}" ></RowDefinition>
                                        <RowDefinition Height="{Binding w}"></RowDefinition>
                                    </Grid.RowDefinitions>
                                <Image Grid.Column="0" Grid.Row="0" Source="{Binding image1}"></Image>
                                <Image Grid.Column="0" Grid.Row="1" Source="{Binding image2}"></Image>
                                <Image Grid.Column="1" Grid.Row="1" Source="{Binding image3}"></Image>
                                <Image Grid.Column="1" Grid.Row="0" Source="{Binding image4}"></Image>
                             </Grid>                                                                
                        </StackLayout>
                    </Frame>
                </ViewCell>
            </DataTemplate>
        </ListView.ItemTemplate>
    </ListView>
</ScrollView></pages:PopupPage>

and here is my popupentity class

public class popupentity : TableEntity
{
    public int width = (int)DeviceDisplay.MainDisplayInfo.Width;
    public int height = (int)DeviceDisplay.MainDisplayInfo.Height;
   public popupentity()
    {
        w = (width - 20) / 2;
        h = (width - 20) / 2;
    }

    [PrimaryKey, AutoIncrement, Column("_id44")]
    public GridLength w { get; set; }
    public GridLength h { get; set; }
   
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source