Coder Social home page Coder Social logo

Comments (2)

ddklo avatar ddklo commented on August 16, 2024

Any clues to what could be causing this? I would be happy to look into it and create a PR, but not sure where to start looking.

from ncontrol.controls.

ddklo avatar ddklo commented on August 16, 2024

So I looked a little more into this and it seems to be related to using bindings. If IsVisible on the ActionButton is bound to a view model the circle is not redrawn when IsVisible is changed on the view model. If the ActionButton is a child of a layout control (for instance a StackLayout) and IsVisible is bound on the layout control nothing is redrawn when IsVisible is changed in the view model.

We solved it by listening to PropertyChanged on the ActionButton and the parent of the ActionButton and calling Invalidate() on the ActionButton and the NControlView's in the ActionButton when IsVisible is changed.

private void MyActionButton_PropertyChanged(object sender,   System.ComponentModel.PropertyChangedEventArgs e)
{
    if (e.PropertyName != IsVisibleProperty.PropertyName) return;
    Invalidate();
    ButtonElement?.Invalidate();
    ButtonShadowElement?.Invalidate();
}

private Xamarin.Forms.Element parent;
protected override void OnParentSet()
{
    base.OnParentSet();            
    if (parent != null)
        parent.PropertyChanged -= Parent_PropertyChanged;
    parent = Parent;
    parent.PropertyChanged += Parent_PropertyChanged;
}
private void Parent_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
    if (e.PropertyName != IsVisibleProperty.PropertyName) return;
    Invalidate();
    ButtonElement?.Invalidate();
    ButtonShadowElement?.Invalidate();
}

from ncontrol.controls.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.