Skip to content

Add support for MarkupExtension #39

Closed

Description

@jeromelaban

Activity

  1. added
    kind/enhancement
    on Jun 14, 2018
  2. assassin316 commented on Jul 9, 2019

    @assassin316

    Any ETA on this ???

  3. ghuntley commented on Jul 23, 2019

    @ghuntley
    Member

    @assassin316, if you have the time and willingness to help out then it'll happen sooner. The team has reserved time in every sprint to mentor folks on how to contribute features to Uno. Let me know if you are keen.

  4. weitzhandler commented on Jul 24, 2019

    @weitzhandler
    Member

    I don't understand, looks like this has been merged in #901, wasn't it?

  5. davidjohnoliver commented on Jul 24, 2019

    @davidjohnoliver
    Contributor

    #901 just added some samples, it didn't implement the feature.

  6. Massimo37 commented on Jul 24, 2019

    @Massimo37
    Contributor

    @weitzhandler No, that sample simply shows what features are working with x:Bind and what doesn't work with MarkupExtension. When you run it, it'll show "feature not supported" for MarkupExtension when running in Android and iOS (as well as "feature not supported" for x:Bind on functions).

  7. weitzhandler commented on Jul 24, 2019

    @weitzhandler
    Member

    Oh I see.
    Well @ghuntley what does it take to implement this feature? I believe it's in the XAML parser isn't it? Can we import it from WPF now that's it's been open sourced?

  8. weitzhandler commented on Jul 24, 2019

    @weitzhandler
    Member

    Very compelling feature. Many of my converters are declared as Markup extensions (for example: IsEnabled="{Binding IsBusy, Converter={c:BooleanConverter Switch=True}}").

  9. assassin316 commented on Jul 24, 2019

    @assassin316

    I agree, MarkupExtensions can open up more possibilities for developers to customize their xaml.

  10. Massimo37 commented on Aug 26, 2019

    @Massimo37
    Contributor

    @weitzhandler Can you provide me the code for one of your converters? For example, the BooleanConverter in your sample above, I'd like to make sure that we handle that type of scenario. Thanks!

  11. michael-hawker commented on Sep 21, 2019

    @michael-hawker

    @weitzhandler agree with @Massimo37 I didn't realize you could do converters with markup extensions 🎉, I thought you would at least still have needed the bits they hadn't implemented yet from WPF for that. I totally want to convert all our Toolkit ones now... almost...

    This WPF example looked pretty simple, so I tried something similar out quick... That turned into a long fight with VS on how to escape character in XAML, which turned into a VS bug here. 😒

    Finally though, I made my new BooleanToTextConverter work! But only when using Binding; x:Bind seems to assume it should be looking for a static resource for Converter and throws an exception at run-time. 😒

    🦙 As for other samples, I have this sample one and we had added some in the toolkit as well.

    FYI @LyalinDotCom @jevansaks

  12. Massimo37 commented on Sep 22, 2019

    @Massimo37
    Contributor

    @michael-hawker I was unable to repro your x:Bind issue you mentioned, I copied your converter and tried it with an x:Bind and it worked without error. 🤨

  13. michael-hawker commented on Sep 23, 2019

    @michael-hawker

    @Massimo37 strange, I'm on 18362 and get this error at runtime:

    System.Runtime.InteropServices.COMException: Unspecified error
    
    Error: Resource Dictionary Key can only be String-typed or Type-typed values.
       at System.Runtime.InteropServices.WindowsRuntime.IMap`2.Lookup(K key)
       at System.Runtime.InteropServices.WindowsRuntime.MapToDictionaryAdapter.Lookup[K,V](IMap`2 _this, K key)
       at System.Runtime.InteropServices.WindowsRuntime.MapToDictionaryAdapter.Indexer_Get[K,V](K key)
       at MarkupExtensionTest.MainPage.MainPage_obj1_Bindings.LookupConverter(String key
    
  14. Massimo37 commented on Sep 23, 2019

    @Massimo37
    Contributor

    @michael-hawker Can you provide me with a sample project that produces this error?

  15. michael-hawker commented on Sep 23, 2019

    @michael-hawker

    Just change the 2nd binding in my gist above to this:

    <TextBlock Text="{x:Bind MyToggle.IsOn, Converter={local:BooleanToTextConverter TrueText=Hello\&#x2C; I\&#x27;m True!, FalseText='Not True!'}}"/>
    
  16. Massimo37 commented on Sep 23, 2019

    @Massimo37
    Contributor

    Thanks, I'll report back once I have something 👍

  17. added a commit that references this issue on Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions