Sergio Loscialo's Blog

  • Windows 8 GridView and Variable-Sized Items

    The GridView control is one of the most used layout controls within Windows 8 Store applications.  By using the Grid App project template with Visual Studio 2012, your first page will look similar to the following: While this looks great, what if you’d like to create a items that vary in size?  Something like the following: This type of layout is possible using the GridView with very little extra work.   There are multiple methods for accomplishing this task; some easier …

    Read More...
  • Programmatically uninstalling Silverlight Out-Of-Browser Application

    Every once in a while there comes a need to provide a mechanism to uninstall your application programmatically.   For Silverlight Out-Of-Browser applications , there seemed to be no way to accomplish it.  Fortunately, there’s a work-around that trusted OOB applications running in Windows can use. Silverlight OOB applications are launched via the “sllauncher.exe” command.  And if you open the properties on an OOB shortcut, you will see a target textbox with something like: …

    Read More...
  • Working with PivotViewer and the CxmlCollectionSource

    Microsoft’s PivotViewer control is an amazing tool for visualizing data and creating a unique UI for your application.  The one issue everyone seems to have with it, however, is its lack of styling capability.  In fact, working with PivotViewer in Expression Blend yields little in the way of styling or templating.  There are only a few color settings one can make, and some generic overall changes.   Replacing the filter panel or info panel is not currently supported. …

    Read More...
  • The Cascade Game: From Silverlight to HTML5 (part 2)

    Game Loops and Timer-Based Animations Previous Entries in Series Part 1 – Introduction and Game Layout My next short term goal was to get some of spheres to show and animate. And that was going to entail using HTML5’s new <canvas> tag. I saw two ways of going about animating the spheres. The first way would be to manually draw the spheres on a single canvas and animate them by clearing the canvas and redrawing at every game cycle. The second way would be to create a …

    Read More...
  • The Cascade Game: From Silverlight to HTML5 (part 1)

    A few years ago I played a game on Facebook that had a simple premise, but became quite addictive for a while.  It consisted of progressing levels of spheres in which the player was tasked with exploding by initiating a chain-reaction.  You had one shot.  Placement, timing, and luck determined how well you scored.  At the time, I was learning Silverlight and thought it would be a good sample project to duplicate the fundamentals of this game in Silverlight, and thus Cascade …

    Read More...
  • Where’s my DataContext?

    Every now and then a question comes up concerning a missing DataContext.  The questions usually center around a ViewModel being set to a View properly, but then developer can not bind some command or property to a FrameworkElement.  And typically the FrameworkElement in question is nested within an ItemsControl’s ItemTemplate or other similar structure. First things first, once a DataContext is set, it is available for every child and all nested children until another DataContext is …

    Read More...
  • Yet another way to attach ViewModels to Views

    Throughout the short history of the MVVM design pattern, several methods have originated for populating Views with their ViewModels.  One of the most common methods is to use one of the frameworks (PRISM, MVVM Light, Jounce, among others).  Typically, the ViewModel is registered with an IOC container and retrieved when needed.   One of the more outstanding issues is when to take the ViewModel and assign it to a View’s DataContext.  In many cases, the connection occurs …

    Read More...
  • Silverlight Memory Leaks and AutomationPeers

    Using a memory profiling tool such as ANTS Memory Profiler from Red-Gate or MemProfiler from SciTech Software (I’m sure there others, but those were the only two I found that can profile a Silverlight Out-Of-Browser application) is a good idea.  By using such a tool, developers can discover a myriad of memory leaks and fix them before releasing their code.  These leaks usually stem from classes that attach event handlers to other classes.  In fact, in my opinion, I’ve seen more …

    Read More...
  • Resumable downloads in Silverlight Out-Of-Browser applications

    The task facing us is simple.  In fact, it has been done before.  Many download management tools already have the ability to resume downloading a file if, for some reason, the process was interrupted.  There is no built-in facility for resuming an interrupted download within a Silverlight applications.  Silverlight does provide some tools for working around this limitation, but only while running under elevated privileges in an out-of-browser application. A little …

    Read More...
  • WPF – Animating multiple elements simultaneously

    A question appeared on StackOverflow asking how to animate a property on multiple elements from one or more trigger mechanisms (i.e. a button click or list box selection).  The traditional approach (for brevity’s sake, I omitted the Xaml comprising the actual UI elements) is rather straight-forward: <Window.Resources> <Storyboard x:Key="OnClick1"> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" …

    Read More...