Saturday, February 04, 2012    
Blog  

OpenLight Blog
Author: Created: 12/14/2009 2:45 PM RssIcon
Richard Waddell on Silverlight
By Richard Waddell on 4/9/2011 11:14 PM
image

I’m using LightSwitch as a prototyping tool to get a jump start on a project at work that I took over from a long-exited programmer. The design I inherited has a lot of gaps that need to be filled in. I think the quickest way I can display those to my boss is to create the tables and basic maintenance screens so I can easily point out what’s there and what’s missing. LightSwitch inherently expresses database relationships in the screens it creates, so even if you aren’t going to use LightSwitch in the final application, you can quickly throw together and easily modify the table layout as you...
By Richard Waddell on 12/3/2010 9:16 PM
Michael Washington said I should blog about this, so if it’s too mundane, blame him. I added some animation stuff to hopefully make it a little more interesting.

Consider a simulation where the ViewModel controls the onscreen action. On the following screen, clicking the Start Button will cause the space ship to fly around the the screen. But the Start Button should only be enabled if the ViewModel actually has access to the space ship and the Speed is valid.

image

Try It Out: http://richardwaddell.adefwebserver.com/CanExecuteChangedSite/CanExecuteChangedExampleTestPage.html

...
By Richard Waddell on 11/21/2010 1:52 PM
Michael Washington made such a good case for tabbed pages that I decided to adapt a project I was already blogging about. I’d reached the point where I’d created  a simple example and now wanted to build on it. Usually, rather than go to the trouble of creating some paging mechanism, I’d just keep on coding and the source underlying the example would be gone forever. With tabbed pages it’s easy to keep each example within its own tabbed page. I’m glad I made the decision, because his example made it easy to make the change:

image...
By Richard Waddell on 10/30/2010 7:36 PM
This is a follow up to my previous article PollResultsBar – Binding to Multiple Values Through Inheritance and Custom Dependency Properties

image

In it I describe how to bind a single ProgressBar property to multiple ViewModel properties through use of an inherited class so I can bind the Maximum property to the sum of the Agree and Disagree counts. I found it’s possible to accomplish the same thing through...
By Richard Waddell on 10/30/2010 12:22 PM
I recently had the requirement to create an interface similar to the following:

image

The item of interest is the colored bar that shows the ratio between agreements and disagreements. We can use a ProgressBar and set the Maximum property  to the total of the Agree and Disagree counts, and set the Value property to the Agree count. Nothing very tricky except how to bind the Maximum property in the ProgressBar to two separate properties in the ViewModel.

This may not be the best solution, but it’s a good example of how you can use inheritance and custom Dependency Properties...
By Richard Waddell on 10/27/2010 12:07 PM
This tutorial will take you through the steps necessary to add a Menu to a Silverlight UserControl and attach a HisowaModPopUpBehavior and make them work together.

image

The advantages of Marcelo Ricardo de Oliveira’s Silverlight Menu:

1. It’s easy to implement.

...
By Richard Waddell on 10/27/2010 12:00 PM
If you’re reading another blog where I place all C# beyond the mandatory in a Silverlight class library rather than the Silverlight application, and it’s not obvious how the solution is put together this tutorial will take you through the steps:

(1) Creating the Silverlight Application with hosting Web Site

(2) Adding a Silverlight Class Library to the solution

(3) Referencing the class library from the application

(4) Setting Project Dependencies.

(5) Web Site project settings to consume the xap file / add a new Silverlight application to an existing web site

(6) Setting MainPage DataContext to a class in the class library

Code-Free Zones and Silverlight Class Libraries

From working recently on an OpenLightGroup team project, I’ve become taken with the idea of keeping all C# code out of the Silverlight application project except for the almost vestigial  UserControl code-behinds. No more inadvertent simultaneous edits to the same ViewModel code in...
By Richard Waddell on 10/24/2010 1:23 PM
In my opinion, Canvas is better suited than Grid to serve as LayoutRoot (the default name of the main UI Element within UserControl). Using a Grid locks the entire UI into a matrix of rows and columns; you can set properties to allow elements to cross row and column boundaries, but why should you have to. If you use a Canvas, you can position elements wherever you want them, including Grids.

Sometimes, though, I don’t think about that when I start coding and I end up in a situation where I want to change LayoutRoot to a Canvas when the page is well along. Fortunately it’s not that tough. But first…

Using the Pinned Tools Icon and Waking it Up. To begin with, I’m going to add a Canvas to the existing LayoutRoot. First I find it under Assets and then double-click it to add it to the pinned Controls icon on the Tools Panel. Probably I won’t need to add a Canvas again,...
By Richard Waddell on 10/23/2010 8:58 AM
I have a habit of starting to explore some aspect of Blend and wandering off topic when I’m blogging. Usually it’s some detail that’s new to me and only comes up because I am blogging and feel the need to explain each step. So, rather than clutter things up, I’m going to put them in blogs of their own. Nothing earth-shattering and probably not of much use to experienced Blend users. But if I’ve overlooked details in the past, maybe what I learn as I explore them now will be helpful to newbies.

MainPage and the Default Hosting Web Site Quite likely, when you create a new Silverlight application you create a web site to host it at the same time, this is the dialog you see in Visual Studio:

image...
By Richard Waddell on 10/3/2010 1:36 PM
Just to set the record straight, I’m usually not all that enthusiastic about visual programming tools. I rarely use the UI in Visual Studio to add controls, Silverlight or ASP.NET – in fact about the only time I do use it is to set properties. But Blend is different. Just having a view-centric tool that you can use to reach out to the ViewModel without ever touching a line of code helps in visualizing the relationships and in appreciating just what binding is about.

But, much as I love Blend, sometimes it confuses me. To this day the dimensions assumed by some auto-sized controls bewilders me. So when I say simple layout techniques, I mean simple. It’s sort of a path hacked out by an earlier explorer that may not be the best, but avoids falling into the swamp.

So to start with I’ll show you the feature-complete but aesthetically challenged first pass at the UI for one of the pages of a project I just started. The Application is called Test Me, and the first iteration will show two TextBlocks, one...
  
Copyright 2009 by OpenLightGroup.net   |  Privacy Statement  |  Terms Of Use