WIA308 The Biggest Little-Known Features in Silverlight – Jeff Prosise
Name an extremely good, speedy and focused presenter that comes well prepared! Yes, you might say Jeff Prosise. This was one of the best sessions at TechEd. And definitely the most valuable code demos with zip download. Stuff I already know I’ll use in my Silverlight projects in the future.
Things that Jeff went through:
- WebClient, HttpWebRequest and web services proxies all use the browser stack for communication as default. Can’t get soap exceptions, will be 404 instead.
- Silverlight 3 has true client stack, not owned by browser.
- Note that the browser stack will cache data, and the client stack will not.
- Turn on by HttpWebRequest.RegisterPrefix(“http://”
- Use event CompositionTarget.Rendering.
- Intended for pictures in sample to load one by one, but they don’t. Because of threading model. Switching to this event fixes that. [But what about my own threads? Same thing?]
- Enhanced frame-rate counter for diagnostics.
- Vectors are gone when handing over to GPU. Canvas.CacheMode. Could lead to zooming pixelation.
- BitmapCache.RenderAtScale = 4, assumes scaled up to 4 times when zooming.
- Analytics class. About cpu load and GPU collection.
- AssemblyPart class. Only download required assemblies. Better to deploy small .xap file. You do not have to give up strong typing either with a trick.
- Some controls are in separate dll, Calendar is in System.Windows.Controls.
- “The Calendar control might be one of the most useless controls in Silverlight” [but will serve our purpose as an example]
- LayoutRoot.
- Set Copy local = false. Uses OpenReadCompleted, OpenReadAsync, AssemblyPart, Load(e.Result).
- Can’t register handler to Assembly.Resolver in Silverlight.
- Put call in separate method – might work (if not inlined by compiler optimization).
- [MethodImpl(MethodImplOptions.NoInlining)]
- Application Extension Services – can plug in into app with same lifetime.
- IApplicationService, Start/StopService, ApplicationLifetimeObjects.
- Build your own services.
- Visual.TreeHelper – Get to generated xaml by system, like templates.
- No ItemCreated event exists for listbox (like in an ASP.NET Repeater).
- “Visual.TreeHelper is the key to unlock modification of generated xaml”
- Child windows = Modal dialogs
- VirtualizingStackPanel – default for alist box. Not for combobox, need retemplating.
- {RelativeSource} equivalent of two-way template binding.
- [What is "SuperSlider" ?]
- AutomationPeer – can simulate button clicks.
- NetworkInterface.GetIsNetworkAvailable, NetworkChange.NetworkAddressChanged.
Final verdict: this session was great!
WIA301 Architecting Microsoft Silverlight Applications with MVVM – Shawn Wildermuth
Shawn knows a lot about the Model-View-ViewModel pattern but unfortunately he isn’t able to communicate that much of his knowledge. There is way too much code writing going on during his presentation. Also, even though there are a few pointers to take with you, I didn’t really feel that I got the whole gist of what is so great with the MVVM pattern.
Not that many notes:
- “The real problem is tight coupling.”
- Prism + MVVM is a good match [watch other session about Prism]
- The ViewModel’s goal is to take data from the model and format it suitable for the view to consume.
- You should understand the pattern before using a framework to implement it.
- ViewModel need to include INotifyPropertyChanged.
- Error message handling belongs in the ViewModel.
- Formatting is typically done in the View.
- View: 100% xaml if possible, Silverlight 3 behaviors and element binding help.
Final verdict: this session was ok.
DEV05-IS Building Extensible Systems in Microsoft .NET Framework 4.0 and Microsoft Silverlight – Magnus MÃ¥rtensson
This session was first scheduled, then removed, and now reintroduced as the last session on friday. I don’t know the reasons behind this, but since it was the only session on MEF (Managed Extensibility Framework) I was pleased that it wasn’t killed after all. This should have meant less than perfect preparations for Magnus, which might have shown through – or he was just going with the fact that it was an interactive session. Anyway, it was a relaxed presentation where he took requests about what to demo and a lot of questions from the audience. As it turned out, it isn’t that much to the core of MEF, which I guess is only a good thing.
Last notes:
- ExtensibleApplication
- Drop dll:s in folder – need [Import] and [Export] attributes.
- Finding extensions: AssemblyCatalog + DirectoryCatalog = AggregateCatalog = CompositionContainer
- SatisfyImportOnce(myObj);
- [Export] class Foo
- [Export(typeof(IFoo))] class Foo: IFoo
- [Import] ILogger
- Performance hit not that bad.
- Visual Studio is moving into MEF for extensibility [not 2010?]
- Can’t answer question about Prism, but Glen Block moved from Prism to MEF team.
- Silverlight Grid Extensions.
- Silverlight implementation of MEF is a one-liner PartInitializer.SatisfyImports(this) – catalogs not needed.
- MEF basic parts: Export, Import, Compose.
- [ImportMany] for multiple plugins at a single extension point.
- Lazy<T, TView>, parts can have metadata.
- Question about versioning of plugins – no clear answer.
- “The pain-point of extensibility is gone.”
- An extension can be marked as a singleton.
Final verdict: this session was ok.
And the end has come.
Leave a Reply