I feel like C++ is getting ridiculously cumbersome to code on par with Java, and I also feel like this "XAML" crap by Microsoft would drive away all but the more patient programmers.
for example from the same page: to print "Hello's" you actually have to type "Hello"s", (I assumed you cant use \' anymore)
You can also create your own triggers so that you can be "responsive" to any arbitrary event.
> bmp Windows::WinForms::XAML::Imaging::Bitmap = ^new Windows::WinForms::XAML::Imaging::Bitmap(filestream)
That must be an outdated example. That namespace doesn't even exist. You can add images like this:
<Image Source="hello.jpg"/>
Basically this XAML does 3 things:
- declare 2 states: narrowState for windows smaller than 640px widestate for windows wider >= 641px
- set the layout stacking strategy of a container to Vertical when in narrowState
- set a top margin of a button to 4px when in narrowState (not sure this is relevant for this sample)
Sure, it could be improved by having
1) the "auto" keyword and
b) one project include which exactly defines which namespaces/aliases to use.
>its now in 4 spots (header, function definition, and two spots on the same line in case the compiler cant find those?)
also they added a ^ operator so thats cool.
but I guess my gripe is every time I want a different taxonomy function I have to page up to the top of my CPP and type 42 keystrokes. (also I think I might have been missing an extra taxonomy there and its really 5 namespaces deep.)
Declarative UIs in XML are more verbose and less flexible than just putting the appropriate expressions in a simple resize-recalc table, which is what the Win32 equivalent would be.
All I wanted was SetWindowMinMaxSize(hwnd, min_size, max_size) and an event to tell me the window has resized. That's it.
This complexity allows apps to misbehave in various ways, either unintentionally, on purpose or maliciously. Windows programming is so darn complicated that it doesn't make any sense.
So you're suggesting I should handroll my own layout manager? That sounds several orders of magnitude more complicated.
Not that you couldn't go the hard way and write the responsive UI with code only. A XAML file is essentially just a recipe for creating the hierarchy of objects in your UI, that the framework then goes on to draw. Everything that is done in XAML can just as well be done with code.
To make your window resizable (!) and responsive, use the following XAML
i lolled.theres also this gem:
Which can be avoided by putting `namespace Windows::WinForms::XAML::Imaging` in every CPP file.