Friday 19 June 2015

There are no Behaviours in Blend 2015 RC. No prob, you can add them. They don't seem to work, but actually they do.

One (, possibly the only,) major disappointment dequehead found in the new Blend was the lack of behaviours. For him they are pretty much the whole point about using Blend.

Well, one of the whole points, as least. It turns out that you can reference the Blend 2013 Interactivity DLLs from Blend 2015 - I just copied the managed Behaviours SDK folder over from a machine with VS 2013 installed an placed it here:

C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\

so I could add a reference in a UWP project to this DLL:

C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\BehaviorsXamlSDKManaged\12.0\References\CommonConfiguration\Neutral\Microsoft.Xaml.Interactivity.dll

The behaviours show up (albeit with ugly names) and you can drag them on to controls as you would expect.

But, you can not drop an Action onto a Trigger, and if you type it in the XAML manually the IDE squiggles it with "Cannot add content to object of type EventTriggerBehavior" (or whatever behaviour you are trying to use). This is accompanied by Designer Death and is entirely inconvenient, but the important thing is that if you run it it works. I repeat, Behaviors (how every you spell it) do work.

Presumably the issues are just bugs in RC which will be fixed for RTM. but dequehead found the issues too annoying to deal with while learning the new Adaptive UI techniques (which really tie in well with Behaviours), so for now he hacked up some custom Triggers and Actions (using IBehavior and IAction from the Interactivity DLL), which don't exhibit the problem (in particular he used a single IAction, instead of an ActionCollection, and a corresponding [ContentProperty(Name = "Action")], this seemed to stop the designer issues for some reason). He will of course attach the code here in due course.

No comments:

Post a Comment