How can we improve the Windows dev platform?

Add Markup Extensions to (and Improve) WinRT Xaml System (System.Xaml Parity)

Much effort was made in WPF Xaml Serialization to decouple it from the presentation assemblies and moved into its own assemblies, System.Xaml, and System.Windows.Markup.

This Xaml System had it's own serialization/deserialization mechanism in XamlServices class. Furthermore, this Xaml system had a very powerful component/concept that is conspicuously absent in WinRT: Markup Extensions.

Markup Extensions are found in the following Xaml Systems:
- WPF
- Silverlight 5
- Xamarin.Forms (notably NOT a Microsoft technology, but recognizes their power nonetheless)

This feature is to ask for Xaml serialization featureset parity with WPF/System.Xaml. That means:
- Custom Markup Extensions
- XamlServices.Load and Save
- All default system markup extensions "{x:Null}, {x:Static}, etc." found in WPF/Silverlight5.
- IProvideValueTarget interface
- INameScope interface
- ... and more!

YEAH!!! XAML!!! WHOOOOOOOOOOO!!!

299 votes
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    Signed in as (Sign out)

    We’ll send you updates on this idea

    Mike-EEEMike-EEE shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    25 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      Signed in as (Sign out)
      Submitting...
      • Mike-EEEMike-EEE commented  ·   ·  Flag as inappropriate

        Well great, thanks for the reply, Clint. I guess I am a little confused on what you mean by "one request per topic." Can you please explain what you mean by this?

        Also, as far as being spec'd out, I guess I am a little confused by this as well. I was under the impression that creating a specification is what determines what goes in and what doesn't. Or rather, describes the features that will make it into this request (or topic?). I would definitely appreciate clarification around this process and what you mean by this.

        To add some more context from my perspective, in the .NET Core/ASP.NET Core/Visual Studio/MSBuild/etc. GitHub repos, the specifications are well-known, descriptive issues that are posted where the community can add their feedback to help drive the direction of those issues so that all (participating :) ) points of view are accounted for and risk is minimized for the final deliverable.

        The obvious concern here is that the first version was conducted in an opaque, closed room manner that resulted in something that developers did not like very much. Doing it again in the same way does not seem like the best course of action to ensure that it will successfully address the requested issues here.

        I am definitely open to feedback here if there is something that I am not understanding.

      • Mike-EEEMike-EEE commented  ·   ·  Flag as inappropriate

        Hi Clint, thinking about this some more after some conversations with a few people. Can you comment on the spec that is occurring with this? There is also a great conversation with the System.Xaml port for .NET Core with lots of feedback for UWP's Xaml model. Well I say feedback, but it's not really all positive and is mostly along the same lines as what birbilis shares below.

        Are the efforts here related in any way to the .NET Core request? Obviously it would be ideal to limit overlap and to leverage work done in one area to solve another (if at all possible).

        Additionally, is there any way to be a part of this process and for the community to provide their own feedback for what is taking place? It would be great to ensure we hit the right notes this time to promote the long-term success/viability of UWP going forward.

        Thank you in advance for any clarity/assistance you can provide here.

      • Mike-EEEMike-EEE commented  ·   ·  Flag as inappropriate

        AWESOME!!! Thank you Clint and team!!! Took a while -- maybe a little TOO long, haha -- but we finally got there. Or are getting there. Sorta like turning the Titanic. :P Looking forward to the progress. :)

      • DmitryDmitry commented  ·   ·  Flag as inappropriate

        Msft srsly? Without custom markup extensions UWP is not a Xaml framework. I have never written an app for UWP and will never write before this suggestion will be implemented. Silverlight is a serious downgrade comparing to WPF, but UWP is about a joke. Facepalm.jpeg here.

      • Titus RockefellerTitus Rockefeller commented  ·   ·  Flag as inappropriate

        WPF and Silverlight are still better technologies five years after the fact. They don't use these strange, magic string tokens like UWP that sort-of, kind-of masquerade like markup extensions. These markup extensions feel like a team of outsourced, junior developers made them -- basically having absolutely no clue about what .NET is and getting paid to act like it.

        Nope, WPF and Silverlight use real, live markup extensions, the way God intended!!! Also, System.Xaml can be used in all scenarios, not just the under-featured client-tier that UWP has cobbled together. It would be nice to see a separate assembly that can be used outside of clients, but somehow think the outsourced and low-quality culture there won't even consider it.

        Seriously, does anyone over there actually do any work?!?! It's been five years since Silverlight and 1.5 years since this vote was put together!!!

      • Bradley MastersonBradley Masterson commented  ·   ·  Flag as inappropriate

        So sad that Microsoft and the Windows group used to be full of smart people who cared and were passionate about the technologies they worked on. Now it is a shell of an organization that simply sits on its hands, waiting for a paycheck. Very disappointing to see that this has taken so long, or really to even identify it as a problem in the first place. Clearly an IQ exodus has taken place.

        Please get your act together and be competitive like you were back in the day. Other Microsoft groups are running circles around you, and far more transparent!

      • Josh McFaddenJosh McFadden commented  ·   ·  Flag as inappropriate

        Echoing the sentiments here. Why has this taken so long? Xaml system in UWP is a terrible joke and is not even close to older systems. String values are passed back and forth between COM and it is a mess to work with!!! Might as well code it all by hand and ditch the designer altogether. I also too agree with making this open source and cross platform so that all .NET applications can use it for the powerful serialization engine it is, not the UI cluster it has become in UWP, which was clearly written by a team of interns.

        The GitHub vote below says it all. It is overwhelmingly the most popular vote in that repo. LISTEN TO YOUR DEVELOPERS!!!

      • Juan MarcoJuan Marco commented  ·   ·  Flag as inappropriate

        Wow over 14 months to simply say you will not strive to make your product like one that was better than it created nearly a decade ago? And this is with a high-ish vote count. I do not even know where to start with that. Does anyone over there even care?

        From the looks of it, "on the backlog" looks like where ideas go to die. Some of these issues are four years and counting:
        https://wpdev.uservoice.com/forums/110705-universal-windows-platform/status/410014

        This group has a rep for sititng around and collecting a paycheck. Now I see why. Guess we'll have to go to Visual Studio or open source for this.

      • Anonymous commented  ·   ·  Flag as inappropriate

        There is old lack of native XAML
        https://wpdev.uservoice.com/forums/110705-universal-windows-platform/suggestions/7232264-add-markup-extensions-to-and-improve-winrt-xaml

        I had seen post about custom markup extensions on UWP apps but it is not work at all
        https://msdn.microsoft.com/en-us/windows/uwp/xaml-platform/customresource-markup-extension
        At first, I install latest version of Visual Studio and try to create custom extension for localization but described in your article way with derive from CustomXamlResourceLoader class doesn't work :(
        I still have compiler errors:
        Cannot assign 'Localizing' into property 'Text', type must be assignable to 'String'
        Type 'local:Localizing' is used like a markup extension but does not derive from MarkupExtension.

        Second, please, see ABindingExtension class and read the article about it
        http://makeloft.xyz/lessons/xaml/custom-binding-extensions

        public abstract class ABindingExtension : Binding, IValueConverter
        {
        protected ABindingExtension()
        {
        Source = Converter = this;
        }

        protected ABindingExtension(object source) // Source, RelativeSource, null for DataContext
        {
        var relativeSource = source as RelativeSource;
        if (relativeSource == null && source != null) Source = source;
        else RelativeSource = relativeSource;
        Converter = this;
        }

        public abstract object Convert(object value, Type targetType, object parameter, CultureInfo culture);

        public virtual object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
        throw new NotImplementedException();
        }
        }

        This class very good and memory safe alternative for classical MarkupExtension. This approach works even on old Windows Phone Silverlight where is not MarkupExtension class.

        I tried to apply this way to UWP but there are two artificial limitations of XAML-parser.

        Look at sample

        public abstract class ABindingExtension : Binding, IValueConverter
        {
        protected ABindingExtension()
        {
        Source = Converter = this;
        }

        protected ABindingExtension(object source) // Source, RelativeSource, null for DataContext
        {
        var relativeSource = source as RelativeSource;
        if (relativeSource == null && source != null) Source = source;
        else RelativeSource = relativeSource;
        Converter = this;
        }

        public abstract object Convert(object value, Type targetType, object parameter, string culture);

        public virtual object ConvertBack(object value, Type targetType, object parameter, string culture)
        {
        throw new NotImplementedException();
        }
        }

        public class Localizing : ABindingExtension
        {
        public override object Convert(object value, Type targetType, object parameter, string culture)
        {
        return "test"; // return value by key
        }
        }

        For example
        <Control>
        <Control.DataContext> // is object
        <Localizing/> // called Convert method like expected!
        <Control.DataContext>
        </Control>

        output => Works fine!
        But

        <TextBlock>
        <TextBlock.Text> // is string
        <Lokalizing/>
        <TextBlock.Text>
        </TextBlock>

        output => Cannot assign 'Localizing' into property 'Text', type must be assignable to 'String'

        Also
        <Control DataContext="{local:Localizing}"/>

        output => Type 'local:Localizing' is used like a markup extension but does not derive from MarkupExtension.

        Pease, check this artificial limitaions for Bindings becouse all works fine, but only XAML-preprocessor get errors!

        P.S. May be you will be interested by SwichConverter and some other power improvements for XAML and MVVM

        <Grid.Resources>
        <SwitchConverter x:Key="NumberSwitchConverter" Default="Hello">
        <Case Key="0" Value="Zero"/>
        <Case Key="1" Value="One"/>
        </SwitchConverter>
        </Grid.Resources>
        <TextBlock Text="{Binding Number, Converter={StaticResource NumberSwitchConverter}}"/>

        Number==0 => out: Zero
        Number==1 => out: One
        Number==2 => out: Hello

        Please, see code samples and Aero Framework library
        https://onedrive.live.com/?authkey=%21AMT2QVotfWTReos&cid=C8D6E2F8053DDCFB&id=C8D6E2F8053DDCFB%2123902&parId=C8D6E2F8053DDCFB%2123896&action=locate

        Thanks!

      • LarryLarry commented  ·   ·  Flag as inappropriate

        Without this, I cannot bind a Uid in a data template (if that is incorrect, someone please let me know!).

      ← Previous 1

      Feedback and Knowledge Base