Showing posts with label Windows RT. Show all posts
Showing posts with label Windows RT. Show all posts

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.

Thursday, 23 October 2014

When Bindings Fail, and text blocks show double quote greater than

Today I was tracking down a bug where my text block was showing “> (quote greater than) when the data context was null.

I’d run into this problem once before in a WPF application, but couldn’t remember what the resolution was. 

After playing around for awhile, with various things fixing the problem, but for no apparently good reason, I had another look at the XAML.  A really close look.

Here was the XAML:

<TextBlock Style="{StaticResource StrokeSummaryBigValue}" 
                          Text="{Binding Rating, Converter={StaticResource rating}}">"></TextBlock>


It looks like while typing, intellisense had entered an extra “> into the code, so that when the binding failed, it showed the text contained in the text block.


So there you have it, if you see this behavior, search your code for “>”>

Saturday, 31 May 2014

VS2013.2 : One step forward, two steps back

We try to make it really easy to put together a new application by using the Export Template feature of VS2013 Pro.

Currently we have one template for all of our windows 8 apps, and another for our windows phone apps.

To start a new application, we use VS2013, and say File | New Project

Select our template and we’re off.  In that state we already have our view models, initialization and serialization frameworks, etc.  All of these are built from source files, and aren’t in a class library anywhere, and using templates makes it very quick to create a new independent branch.

We thought that with the advent of the new Universal Apps, we might be able to solve these problems once and for all, however, it isn’t working out like that.

The export template functionality is still there, but it doesn’t work.  You can export the shared project (but that doesn’t show up on the new project templates), and you can try to export either the WP or Windows Store projects, but they fail throwing an error about bad characters in the path.

So, from what I can see, we’ve lost this great functionality.

It appears that you could code up a template by hand by hacking through what’s in the universal app templates, but I’m not sure I can be bothered to at this stage.

With any luck, I’ll find a solution, and post it back here.

Thursday, 24 January 2013

Using a 32 GB Surface

I managed to get my hands on a Surface, and was looking into ways to expand the memory using a 64 GB SD card.  There are quite a few suggestions on the web that you can mount the card into an empty folder, and then add these folders to various libraries.

This though doesn’t deal with how to install applications to another folder.

I found several references around the web, that suggests changing a registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Appx

I did this by changing the owner to my account from trusted installer, then afterward, set the owner back by using “NT SERVICE\TrustedInstaller”

However, this doesn’t behave exactly as you might expect, as any existing apps on your machine cannot be updated after this.  More interestingly, I found that I had multiple copies of apps like “Sport” installed on the machine, because they hadn’t all been updated.

So, I’ve now paved the surface, to try again from scratch, knowing what I do now.

After the pave

I created a single user with using a local account, and tried to uninstall the Travel and Sport Apps.  Much to my surprise the apps were still present on the disk.  So I went to the store to see my apps, but it insisted that I sign in with a live account, so I did.

I then decided to try to update just one of the apps (maps) to see what happened to the existing app.  What happens is that the update app is added to the system, but in addition, the old original version stays there.

So, it looks like there’s no way to remove these old versions.  I assume this is to allow users to create a new user, and still get the default apps.

It gets worse

I uninstalled all of the default apps (apart from internet explorer), and all of the pre-installed apps were still present.  So, I decided to see what windows update had in for me.

When I first got my hands on the surface, it informed me it needed a firmware update.  I was a little surprised that I needed to install this too, as I had assumed firmware was firmware.  Obviously a pave wipes absolutely everything, so I now have 21 updates to reinstall.

Fingers crossed.