Coder Social home page Coder Social logo

Comments (3)

opcodewriter avatar opcodewriter commented on September 18, 2024

Weird thing that this doesn't work (SVG is not displayed):
SvgAssemblyType="{x:Type vm:MyViewModel}"

Doing the same thing by code works.

from ncontrol.controls.

opcodewriter avatar opcodewriter commented on September 18, 2024

I spent an incredibly amount of time on this...
Maybe this is helpful for someone else too.

The issue with not updating when using in XAML is because in the propertyChanged callback, it calls ctrl.SvgAssemblyType = (Type)newValue; but in the getter the getter value is already the same with property, therefore UpdateSvg and Invalidate are not called.
An easy fix is to explicitly call UpdateSvg and Invalidate on each propertyChanged.

But the real issue I think is that by default the SvgImage should use the current assembly, such that there shouldn't be necessary to set it explicitly.

        public static BindableProperty SvgAssemblyTypeProperty =
            BindableProperty.Create(nameof(SvgAssemblyType), typeof(Type), typeof(SvgImage), Application.Current.GetType(),
                propertyChanged: (bindable, oldValue, newValue) => {
                    var ctrl = (SvgImage)bindable;
                    ctrl.SvgAssemblyType = (Type)newValue;
                });

Another thing: I don't understand why all the 3 bindable properties are two-way, it doesn't make sense
to me, the control doesn't change any of them.

from ncontrol.controls.

chrfalch avatar chrfalch commented on September 18, 2024

You are welcome to fork the project and try to if you can fix this and submit a pull request if possible.

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.