Hacker News new | ask | show | jobs
by snuxoll 3232 days ago
> * Eliminate `<ItemsPanelTemplate>` and `<DataTemplate>` elements, they're implicit in 90% of cases and yet add another element and indent level without conveying significant information. They could be expressed as attributes of the `<ItemsControl.ItemsPanel>` and `<ItemsContorl.ItemTemplate>` property elements.

XAML ultimately compiles to an object tree, if you're putting more than a reference, string, int, etc. into a property you need to construct it as a child element - if you want you are free to define the DataTemplate elsewhere in your XAML or in a resource dictionary and use the binding syntax.

> * Allow C# expressions and the composition of child-binding to be used in property bindings, not just `String.Format` strings. In my example I have to populate `<Hyperlink.Tooltip>` with a full `<TextBlock>` and `<MultiBinding>` element - why can't I just do `<HyperLink ToolTip="{Binding Kind} {Binding Number}">`? That alone would 10 lines of my 42 line example.

Use a converter? I know they're cumbersome to write, but that's what they exist for.

> Another issue with XAML is that the creators of XAML failed to learn from HTML+CSS: while it succeeds at separating programming code from view-level concerns, it fails at separating presentation from content - it's like we're back in HTML3/4 days when <table> and <font> were all around and it was nearly impossible to tweak and standardise a UI. XAML does have <Style> and <Setter> elements but they're more used for setting Template properties - the end result is a horrid mess.

Again, resource dictionaries, bind reusable styles to your elements. Syntax again sucks, `<TextBlock Style="{StaticResource AwesomeTextBlock}"/>`, and there IS the nagging issue that the styles are decided by the UI - but it's not too much worse than CSS classes.

Don't take any of this to mean your concerns aren't valid, but it's really not AS bad as you make it out to be. There's always room for improvement though!