XAML type converters comes to UWP

New to Creator’s Update, we can now specify a static function in charge of creation instance from string through a very well named attribute CreateFromString.

Implementing a type converter in UWP XAML

Advertisements

Ammy, a better syntax than XAML with more

EDIT: Houra, “Absolutely free for everyone!“. A very good new! And now with support of Xamarin, WPF and UWP.

In a first approach, Ammy could be just a better json based syntax for xaml. And there is more:

  • global and local variables
$fontColor = "#363636"

 can be reused:

TextBlock {
  Foreground: $fontColor
}
  • Aliases can be seen as a function returning a node:
alias Header(text) {
  TextBlock {
    FontSize: 18
    Text: $text
  }
}

can be easily used :

StackPanel {
  @Header("First chapter") {
  }
}
  • and mixins can be seen as function providing a set of properties:
mixin SeeThrough(opacity=0.5) for UIElement {
  Opacity: $opacity
}
Button {
  #SeeThrough()
}

or sub node(s):

mixin DefaultItem() for ComboBox {
  ComboBoxItem {
    "Select quantity"
  }
}
ComboBox {
    #DefaultItem()
}

or

mixin TwoRows(height1, height2) for Grid {
  RowDefinitions: [
    RowDefinition { Height: $height1 }
    RowDefinition { Height: $height2 }
  ]
}
Grid {
  #TwoRows(25, "*")
}

and are composable.

UWP is said to be coming soon but what about Xamarin forms?

This is all well and good except a big drawback: it’s not free, should be paid monthly and is extremely expensive ($299 per month for commercial project made by more than a single developer). So it’s unusable. I’m not going to invest my time to learn a new graphical language if I’m sure to be able to use it anywhere! What a pity!

Even without a VS designer, such a refresh could be extremely useful but this should be a community effort and not a commercial one to be successful.

 

Convert html/css to WPF/Xaml

Quite a bit old but target “legacy” WPF Xaml instead of new one: SocialStream/XAMLConverter at master · stimulant/SocialStream

Include html/css converters able to produce Xaml. In fact, I was searching for the new HtmlBlock which is supposed to come to Windows App Studio june upgrade and more precisely in Windows App Studio Libraries. Of course, It’s only UWP, but it can be a great source of inspiration:).

XAML compiled binding

A very interesting new kind of binding available for new Windows 10 apps. The idea is simple: rather than rely on dynamic reflexion to discover at runtime time dependency properties of INCC/INPC instances is strongly typed cases, compiler can generate plumbing code under the hood. It’s not a complete replacement of old dynamic Binding but a practical solution.

We have also a notion of phase (usable only in DataTemplate) to provide costly content in a delayed way.

This podcast is a must: Data Binding: Boost Your Apps’ Performance Through New Enhancements to XAML Data Binding | Build 2015 | Channel 9.