Tuesday 21 April 2015

What Broke My App This Time? The XAML Editor

In one of my base classes, I implement a handler for a particular event.

The idea was that I have have a certain set of things I always want to do in my framework when the bottom appbar opens.

So I took one of the classes, typed Opened=”BottomAppBarOpened” into the xaml editor on the BottomAppBar, and then right clicked and chose Goto Definition.

That opens the code behind and implements the method.

I then cut the method from there, and pasted into the base class, changed it to a protected virtual, and thought “Bob’s my uncle” (he is, actually)

So, that was weeks ago.  Today, I was looking for that code, and clicked Goto Definition.

This time, I got a new private implementation (just like the first time, naturally), that hid the virtual function.

As a result, I’ve now changed my code so each class that has this, implements the method and calls the base class implementation.  It’s a shame the editor can’t see the inherited signatures, and jump to that instead.

It’s the Templates Stupid! (The joys of XAML)

I’ve been trying to solve some usability problems with text being too small to read on a 7 inch tablet for people who are ageing, and tried to increase the font size in my app.

Much to my dismay, that caused RadioButtons and CheckBoxes to align badly.

Eventually I tracked down the alignment problem to the alignment of the button or checkbox always being top in the template, while the content inherited it from the control.

 

I’ve published my updated templates as a Gist.

In addition, on 8.1 you may also want to set the content to be a TextBlock with TextLineBounds=Tight to get the best results.