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

Bindable Property Error

$
0
0

I want to create a custom SplitView for Xamarinforms for crossplatform use, but the problem is.. my bindable property does not work!

` #region IsPaneOpen

    private static bool IsOpen = false;
    /// <summary>
    /// Gets or sets a value that specifies whether the <see cref="SplitView"/> pane is expanded to its full width.
    /// </summary>
    /// <returns>true if the pane is expanded to its full width; otherwise, false. The default is true.</returns>
    public bool IsPaneOpen
    {
        get { return (bool)GetValue(IsPaneOpenProperty); }
        set { SetValue(IsPaneOpenProperty, value); }
    }
    public static readonly BindableProperty IsPaneOpenProperty = BindableProperty.Create(
        nameof(IsPaneOpen),
        returnType: typeof(bool),
        declaringType: typeof(SplitView),
        defaultValue: false,
        propertyChanged: IsOpenChanged);

    private static void IsOpenChanged(BindableObject bindable, object oldValue, object newValue)
    {
        var control = (SplitView)bindable;
        IsOpen = (bool)newValue;
        if (IsOpen)
            control.ItemFrame.WidthRequest = CompactLength + OpenLength;
        else
            control.ItemFrame.WidthRequest = CompactLength;

    }
    #endregion`

Here is the screenshot

Please help me to fix this problem..
or give a working sample code.


Viewing all articles
Browse latest Browse all 91519

Trending Articles



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