Issue with Xamarin.Forms 2.0.0.6482, IsVisible Binding when in AbsoluteLayout

NathanWilliamsNathanWilliams USUniversity ✭✭
edited November 2015 in Xamarin.Forms

In XAML:

<AbsoluteLayout> <ContentView IsVisible="{Binding IsContentVisible}" AbsoluteLayout.LayoutBounds="0,0,1,1" AbsoluteLayout.LayoutFlags="All"> <Image Source="SomeImage" /> </ContentView> </AbsoluteLayout>

When the IsContentVisible property changes, the ContentView becomes visible, however, the contained Image does not. Note that the problem only occurs if the ContentView is contained within an AbsoluteLayout. If there is no containing AbsoluteLayout, then the Image becomes visible as expected. The IsVisible value does appear to be propagating to the Image so I suspect it is a layout or measuring issue. This used to work pre 2.0+.

Posts

  • Same thing as RelativeLayout.

    I have two popup views wrapped in AbsoluteLayout and RelativeLayout, now they both not showing.

  • TheRealJasonSmithTheRealJasonSmith USXamarin Team Xamurai

    Yeah this very well might be a glitch in the new layout optimization work. I am looking into it

  • TheRealJasonSmithTheRealJasonSmith USXamarin Team Xamurai

    btw you might try calling ForceLayout on the ContentView

  • After update from xamarin forms from 1.5.0.6447 to 2.0.0.64822.0 everythings stop working in winphone like picker doesn't appear Entry object same thing ... what's happen with this version in winphone 8?

  • This also happens to me when using a custom renderer which inherits from "ContentView".

    @TheRealJasonSmith thanks for the ForceLayout() hint, that resolved my issue.

  • FrancoisMFrancoisM FRUniversity ✭✭

    Same here with absolutelayout.
    As suggested I had to to do the following:

    protected override void OnPropertyChanged(string propertyName = null)
            {
                base.OnPropertyChanged(propertyName);
                if (propertyName == ContentView.IsVisibleProperty.PropertyName)
                    ForceLayout();
            }
    
  • KimSvedmarkKimSvedmark SEBeta, University ✭✭

    Same issue here - also with popup overlays using AbsoluteLayout. A simple ForceLayout call after the visibility change solved it for me too!

  • threadythready CAMember ✭✭✭

    I have a ContentView-derived class who's IsVisible property is set to false and still shows up. ForceLayout doesn't do it for me unfortunately.

  • NMackayNMackay GBInsider, University mod

    This bug still exists, wasted a few days writing a custom control which uses ContentView and have fallen into this pit too :neutral:

  • ChristophEngelsChristophEngels USMember ✭✭
    edited December 2016

    Regarding MyClassInheritedFromContentView.IsVisible="{Binding MyProperty}" does not work:

    I just ran into it, so this bug is confirmed to remain existant in Xamarin.Forms v2.3.2.127.
    I have not yet tried 2.3.3, but since there is no "this is fixed now" posting here, I suppose it still persists in 2.3.3 as well.

  • SuatKorkmazSuatKorkmaz USMember ✭✭✭
    edited January 2017
            override protected void OnPropertyChanged(string propertyName)
            {
                var changed = PropertyChanged;
                if (changed != null)
                {
                    PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
                }
    
                if (propertyName == "IsVisible")
                {
                    Debug.WriteLine("IsVisible Changed= " + IsVisible);
    
                    ForceLayout();
                }
            }
    

    Didn't work for me. XF version is 2.3.3.175

  • SuatKorkmazSuatKorkmaz USMember ✭✭✭

    Same result on 2.3.3.184-pre1

Sign In or Register to comment.