Silverlight?

So, if you are currently following the stories of Silverlight, Windows Runtime / Metro and .NET 4.5, you may have some confusion regarding where Silverlight sits in the land scape of Microsoft development. Well, you are not alone!  Part of the problem (as always) is the ?InterWeb?.  Do a web search on some phrase such as ?Is Silverlight Dead? and you will get numerous conflicting answers.

In a nutshell, it does seem that Microsoft is putting it?s money in HTML 5 as the champ of interactive web content. Furthermore, given that the forthcoming Windows 8 OS (and the related Metro style apps) are built using a whole new technology stack,  it does seem that the Silverlight we know today may have a limited scope (and possibly a limited lifetime).

However!  The spirit of Silverlight will live on.  As you might know, a Metro style app is constructed using the same core tools .NET programmers are already familiar with. You will build such apps using a managed language (C# or VB) or via C++. As well, XAML (or HTML 5) will be used to build out your overall UI. So the *good* news is, developers who are currently using Silverlight (or WPF for that matter) will be in a very good position to build Metro apps when Windows 8 is released.

You?ll use Visual Studio and Blend, reference assemblies and import namespaces, and build away.

As far as Silverlight proper, this will still be a useful tool for some time to come (if you ask me).  The first obvious reason is that all of IT is not going to rush into installing Windows 8 across the workplace (regardless of what we geeks might desire). Computers running Windows XP or Windows 7 will still be able to display Silverlight applications as expected. As well, if one boots up the traditional desktop from Windows 8, and launches the ?traditional? set of web browsers, Silverlight apps should run as advertised.

Even though the overall scope of Silverlight may be changing, it is worth pointing out that Silverlight 5.0 (which has recently been released) ships with numerous bells and whistles. As a quick rundown:

  • Implicit data templates
  • ClickCount support
  • Improved styles
  • Custom markup extensions
  • An improved 3D graphics API

It should not be too surprising that many of these ideas will migrate (in a slightly different manner) to Metro and .NET 4.5.

So, if you are currently building Silverlight apps, check out the new features offered by 5.0.  If you are not currently building Silverlight apps, you might wish to at least read over the key features here, to get a better idea of what life may have in store for the future.


Posted by: Andrew Troelsen
Posted on: 11/28/2011 at 10:22 AM
Categories: Silverlight | .NET
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Subscribe to this BlogRSS comment feed

Silverlight Training Video | Intro to Silverlight


Posted by: Intertech
Posted on: 8/2/2011 at 1:39 PM
Categories: Silverlight
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Subscribe to this BlogRSS comment feed

The Role of Blend Sample Data

As it turns out, it is not terribly uncommon for a developer to need to work with some temporary data during the construction of the user interface. For example, perhaps the real data will come from a relational database...which is currently being constructed by your friendly DBA. Or, perhaps the exact business objects to be used by the program are currently little more than a collection of UML class diagrams.

When you are building a WPF or Silverlight application with Blend, you can elect to insert what is known as "sample data". As the name suggests, this provides a way for you to visualize the UI even when the live data is unavailable. As well, Blend sample data can be useful during the process of learning more about data binding techniques in general.

Fire up Blend and create a new WPF Application or Silverlight Application project named FunWithSampleData. Now, open the Data panel, and elect to insert sample data to your project:

Figure 6-46

At this point, your Data panel has been populated with a number of testing items, including a custom collection (which extends ObservableCollection) and a few default properties (named Property1 and Property2). While you could rename these default names, you might find this defaults are fine (after all, it is *sample* data). If you wish to change the names, double click on the current Collection node and rename this to PersonCollection. Likewise, rename your first two properties to FirstName and LastName:

Figure 6-47

You can add additional properties to your data store using the New Property button. If you click and hold this item, you will see you have three choices:

? Add Simple Property: Use this option to add a String, Number, Boolean, or Image property. By default, a String property is added, but this can be changed after creation.

? Add Complex Property: Use this option to create a property that can contain child properties (in other words, a new class with custom properties).

? Add Collection Property: Use this option to create a new class extending ObservableCollection.

Add a new "simple property" named Picture, which will automatically default to a String data property.

Once you have added properties, you can further configure their data types. The first approach is to change properties values by clicking on the embedded property dropdown editor. In the following figure, you can see how we can change the Picture property to an Image. Do know that the Image property can be configured to select a specific image file, but don't bother; the IDE will use some sample images by default.

Figure 6-49

In addition, you can configure all property data types if you click on the Edit Sample Values button:

Figure 6-50

Use the resulting dialog box to change the LastName property to a String data type. Notice how each property is being set to a set of default string data and image files (after all, this is in fact, sample data). Also note you can change how many test records you wish to have generated:

Figure 6-51

Once you have generated the sample data, you can drag and drop elements from the Data panel onto the artboard. Make sure you double check if the Data panel is in List mode or Details mode, as inserting sample data tends to default to "details mode". Here you can see the end result of dragging the PersonCollection on to a DataGrid control (while the Data panel was in List mode).

Figure 6-52

Also note that you have the option to transform your sample data from a flat list of objects, to a hierarchal format:

Figure 6-53

Here is the same data (which is now in a hierarchal format) bound to a new TreeView control:

Figure 6-54

If the topic of sample data is of interest to you, and I'd suspect it will be during the prototyping phase of new WPF or Silverlight projects, be aware that the Blend User Guide has a whole section on the topic, which building upon the topics examined here. Look up the Create sample data for more information:

Figure 6-55 

Happy Blending!


Posted by: Andrew Troelsen
Posted on: 7/7/2011 at 4:55 PM
Tags: ,
Categories: .NET | Silverlight | WPF
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Subscribe to this BlogRSS comment feed

Defining a WPF XML Data Source via Blend

If you are a .NET developer, you are well aware that the platform supports various ways to programmatically manipulate XML data such as the original System.Xml namespace as well as the LINQ to XML API. If your WPF or Silverlight applications need to modify XML data at runtime (add new elements, delete elements, update elements) then you will most certainly need to drop down to procedural code. However, the Blend IDE also provides a way to bind user interface elements to data which is contained in an XML document using the XML Data Source option of the Data panel.

Unfortunately, the ability to bind XML data to UI elements via an XML Data Source is only available for WPF applications. Of course, it is certainly possible to manipulate XML data in a Silverlight program, however to do so you will need to rely on procedural code. Look up the topic XML Data within the Silverlight documentation for information and code examples regarding XML data and Silverlight applications.

Given this restriction, create a new WPF Application project named WpfXmlDataBinding. If you have an XML document you would like to manipulate, you are free to use that specific *.xml file, however for this example, I will assume you are using the following Inventory.xml file:

   1: <?xml version="1.0" encoding="utf-8"?>
   2: <Inventory>
   3:   <Product ProductID ="0">
   4:     <Cost>5.00</Cost>
   5:     <Description>
   6:       Eight Times the sugar and twice the caffeine
   7:     </Description>
   8:     <Name>Super Spazz Soda Pop</Name>
   9:     <HotItem>true</HotItem>    
  10:   </Product>
  11:   <Product ProductID ="1">
  12:     <Cost>10.00</Cost>
  13:     <Description>A soothing night time cookie</Description>
  14:     <Name>Sleepy Time Cookies</Name>
  15:     <HotItem>true</HotItem>        
  16:   </Product>
  17:   <Product ProductID ="2">
  18:     <Cost>15.00</Cost>
  19:     <Description>It's Tofu, what can you say?</Description>
  20:     <Name>Joe's Tofu</Name>
  21:     <HotItem>false</HotItem>        
  22:   </Product>
  23: </Inventory>

Insert this file (or your custom XML file) into your current project using the Project | Add Existing Item... menu option. Once you have done so, you should see this file within the Project panel. It is not mandatory to include an XML data file into your project in order to bind to it with the Data panel, however this does make it easy to open the file within Blend for editing.

Now, open the Data panel, and opt to add a new XML Data Source:

Figure 6-38

From the resulting dialog box, browse to whichever XML document you wish to make use of (again, here I am assuming the Inventory.xml file). Name your new XML data source InventoryXmlDataStore and store the object resource in the current document:

Figure 6-39

At this point, your Data panel should look something like what you see here:

Figure 6-40

If you examine the XAML data located in MainWindow.xaml, you will notice that a new object level resource of type XmlDataProvider has been defined:

   1: <Window.Resources>
   2:   <XmlDataProvider x:Key="InventoryDataSource" 
   3:                    Source="\Inventory.xml" 
   4:                    d:IsDataSource="True"/>
   5: </Window.Resources>

Now that we have established our XML data source, we can drag and drop the nodes from the Data panel onto the artboard, just like we did when we created an object data source. Thus, if you were to drag the entire Product node to the artboard, the IDE will generate a ListBox which displays all data for each XML element. Notice that the ItemsSource property has been bound to the <Products> node using an XPath expression:

   1: <ListBox HorizontalAlignment="Left" 
   2:   ItemTemplate="{DynamicResource ProductTemplate}" 
   3:   ItemsSource="{Binding XPath=/Inventory/Product}" 
   4:   Margin="89,65,0,77" Width="200"/>

As well, the generated template (specified by the ItemTemplate property) uses some additional XPath expressions to make to the various attributes and sub-nodes of the <Product> node:

   1: <DataTemplate x:Key="ProductTemplate">
   2:   <StackPanel>
   3:     <TextBlock Text="{Binding XPath=@ProductID}"/>
   4:     <TextBlock Text="{Binding XPath=Cost}"/>
   5:     <TextBlock Text="{Binding XPath=Description}"/>
   6:     <CheckBox IsChecked="{Binding XPath=HotItem}"/>
   7:     <TextBlock Text="{Binding XPath=Name}"/>
   8:   </StackPanel>
   9: </DataTemplate>

Again, similar to when you are working with an object data source, you can also drag individual attributes (such as ProductID) or sub-nodes (Cost, Description, etc) directly to the artboard to generate ListBox controls which only display that subset of data. Thus, if you were to drag the HotItem node to the artboard, the IDE will generate a new ListBox control using a new related data template:

   1: <!-- The ListBox -->
   2: <ListBox HorizontalAlignment="Right" 
   3:          ItemTemplate="{DynamicResource ProductTemplate1}" 
   4:          ItemsSource="{Binding XPath=/Inventory/Product}"   
   5:          Margin="0,78,54,64" Width="200"/>
   6:  
   7: <!-- The data template-->
   8: <DataTemplate x:Key="ProductTemplate1">
   9:   <StackPanel>
  10:     <CheckBox IsChecked="{Binding XPath=HotItem}"/>
  11:   </StackPanel>
  12: </DataTemplate>

So there you have it! As you can see, the Blend IDE makes it simple to bind XML data to UI elements. Of course, we could continue to alter the UI display by altering the associated data template; but that will be the topic of another post.

Happy coding!


Posted by: Andrew Troelsen
Posted on: 6/10/2011 at 5:56 PM
Tags: , ,
Categories: .NET | Silverlight | WPF
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Subscribe to this BlogRSS comment feed

We're Hiring!!!

Thanks to our loyal customers and the great work our team members are doing for those customers, we are growing. We're looking for top talent to join our award winning team. Our staff get to teach the top firms in the country on the latest technologies or use those same technologies to build great new application for clients.

If you like solving challenging problems with great technology this might be the place for you.

Here are some of the needs we have:

·         Senior Developer/Architect (.Net Silverlight WPF WCF)

·         C# ASP.NET Developer

·         Software Developer (.Net)

·         Software Developer (ASP.Net MVC)

·         Software Developer (C# ASP.NET)

·         Sr. Systems / Software Engineer ( C#.Net )

·         .Net Manufacturing Systems / Solutions Architect

·         C#.Net developer

·         .Net Developer

·         Systems / Solutions Architect (.Net Manufacturing)

·         ASP.Net MVC Developer

·         Senior .Net Silverlight WPF WCF Developer/Architect

·         Sr. C#.Net Systems / Software Engineer

·         Senior Java Developer\Architect

 

For more details on our jobs, click here.

 

You can also apply online or if you find a job that is perfect for a friend, we make it easy for you to send it to them.

 

Let us know if you find one that is perfect for you or if you know someone who may be a great fit.

 

We’re offering a free training certificate to anyone who refers someone that joins our firm.

 

Thanks!

 

 


A Few Words about Mobile development via .NET

A big thanks to all of you who attended the Intertech Mobile conference yesterday.  It was wonderful to see such a huge showing at the hotel as well as the hundreds of you who attended virtually. Thanks for a great day.

When I was speaking about Windows Phone 7 and Silverlight for Windows Phone 7, a number of you had questions about how one could use .NET on devices *other* than WP7 (ex, IPhone / Android devices).

Recall that the Mono team has created a platform named MonoTouch.  This API allows you to build .NET applications which run on Apple Idevices. The latest edition of MonoTouch has XCode / Interface Builder integration!  More information can be found here.

In addition, the Mono team is creating Mono for Android (MonoDroid). This API integrates into Visual Studio, and allows developers to target Android phones/tables using C# and the .NET platform. Right now, MonoDroid is currently in beta, but you can follow the project here.

So!  There you have it. If you love working with the .NET platform but wish to target non-MS mobile devices, no need to learn Objective-C or author reams of XML configuration documents (ala Java).

Download the bits and check it out!


Posted by: Andrew Troelsen
Posted on: 4/1/2011 at 8:43 AM
Categories: .NET | Silverlight | Windows Phone 7 | Mobile
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Subscribe to this BlogRSS comment feed

5 Reasons to Never Build another Winforms Application!

For quick and dirty apps, data entry apps, or straight forward business apps, some experts still suggest using Winforms.  Why?  Is it quicker to create a Winforms app than a WPF app?  Not at all!  Here’s why:

  1. WPF’s Canvas Layout Manager.  Do you like dragging controls on a form, setting properties, and adding some event code?  You can do all of that and more with Canvas Layout Manager.  By starting with WPF instead of Winforms, if an application, first designated as a short-term solution, ends up being a long-term application, WPF is a better application foundation.
  2. Microsoft Expression Blend.  Microsoft Expression Blend makes UI development easy (really easy).  Simply drag and drop items, set properties, and do binding.  You can create prototypes without using Visual Studio.  When Blend was first released, developers thought it was for designers.  Times have changed.  With the latest version of Blend, developers can quickly build a UI.  In addition, developers can do code behind logic without opening Visual Studio.   Finally, Blend is free with MSDN.
  3. Flexibility and Extensibility.  If an application is built with Winforms, future choices are limited.  With WPF, an app can easily move to a web app or a mobile device.  Not true with Winforms!  In WPF, a web or mobile version is just some markup away.
  4. Application Look & Feel Consistency.  With Winforms, there are custom controls.  With WPF, developers get those controls and more… Styles... Resources... Templates!  These tools simplify UI creation and management.
  5. Happy Developers.  Do you lead an application development group?  If yes, choose WPF and your developers will love you.  They’ll be more innovative and productive.  More productive developers = Happy developers.  Happy developers = Long-term employees.

Posted by: Intertech
Posted on: 12/11/2010 at 5:10 PM
Categories: .NET | Silverlight | WPF
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Subscribe to this BlogRSS comment feed

An Overview of the Moonlight Roadmap

The Microsoft Silverlight API provides a way to build very rich UIs for browser based applications, and while there is a Mac OS X runtime, the Microsoft stack does not provide a runtime for Unix/Linux based OSs.

As I've blogged before, the Mono project does provide the Moonlight API to fill that gap; however just how feature complete is Moonlight?

Well, to the surprise of many developers, Moonlight has been compatible with Silverlight 2.0 since December 2009.  This includes DeepZoom support, C# / DLR support and a support for the Silverlight control toolkit.

Moonlight 3.0 is moving along at a good clip, and once released, will provide OOB (out-of-browser) support, 3D perspective graphics and the various graphical tweaks found in Silverlight 2.0.

Not too surprisingly, Moonlight 4.0 is also in the works. As hoped, WCF RIA support, webcam support, and the other Silverlight 4.0 bits will be incorporated over time.

So, the short answer is if your company is working with Silverlight today, you might want to keep tabs on the Moonlight roadmap to see just how well your plug-in will render on a Linux based OS.


Posted by: Andrew Troelsen
Posted on: 11/15/2010 at 12:03 PM
Tags: ,
Categories: .NET | Silverlight
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Subscribe to this BlogRSS comment feed

Blend Behaviors Are Good

When you create a new WPF or Silverlight project using Expression Blend, you will gain access to a collection of libraries which represent the Blend SDK. Within these .NET assemblies, you will find a set of classes which represent various "behavior" objects.

Simply put, a behavior is an out of the box implementation of commonly required runtime (pardon the repetition) behaviors.  For example, there are behavior objects which play sounds, enable mouse movement on a given UI component, allow you to control animations and data binding operations, and so on.

The benefit of using behaviors is that they can be quickly defined and configured in XAML, and typically do not require any procedural coding. You can view all of the out-of-the-box behaviors via the Assets Library:

image

As a quick test, create a new WPF/Silverlight project, and add a custom geometry onto the artboard. Now, locate the MouseDragElementBehavior object directly onto the rendered geometry (you can also drag it to a valid node in your Objects and Timeline editor):

image

If you examine the generated XAML, you would find something like the following (note the markup for the mouse movement behavior).

   1: <ed:RegularPolygon Fill="#FF2626E0" HorizontalAlignment="Left" Height="116" InnerRadius="0.47211" 
   2:     Margin="47,68,0,0" PointCount="5" Stretch="Fill" Stroke="Black" VerticalAlignment="Top" Width="129">
   3:     <i:Interaction.Behaviors>
   4:         <ei:MouseDragElementBehavior/>
   5:     </i:Interaction.Behaviors>
   6: </ed:RegularPolygon>

Now, run your application. Sure enough you will be able to drag and drop your component around the surface!  No need to calculate bounding boxes, handle mouse events or whatnot. If you want to contain the element to its parent container, you can check the following check box in the Properties panel (just be sure you select the behavior object in Objects and Timeline first):

image

Of course, behaviors can not the perfect solution for everything. To be sure, you will need to author code for more complex situations. Nevertheless, Blend SDK behaviors can really simplify your life.

You can read up on other behaviors via the Blend SDK User Guide, which is accessible from the Blend Help menu.


Posted by: Andrew Troelsen
Posted on: 9/14/2010 at 12:31 PM
Categories: .NET | Silverlight
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Subscribe to this BlogRSS comment feed

Breaking Down the Silverlight UserControl

Any Silverlight application will have at least one class which extends the UserControl parent. For example, a new C# Silverlight project will define a class such as the following:

Code Snippet
  1. namespace TesterSLApp
  2. {
  3. ????public partial class MainPage : UserControl
  4. ????{
  5. ????????public MainPage()
  6. ????????{
  7. ????????????InitializeComponent();
  8. ????????}
  9. ????}
  10. }

Like any base class, UserControl defines a polymorphic interface to derived types. As it turns out, UserControl extends a number of additional classes, all the way to our good friend System.Object. The fill inheritance chain looks like so:

image 

The UserControl parent class allows derived types to host ?content?. The Silverlight content model demands that a UserControl specifies a single piece of content. Most often, the ?single piece of content? will be a layout manager containing all the UI elements, vector graphics, etc. Beyond this (very important) aspect, UserControl brings little to the table.

image

In addition to the Content property of UserControl, be aware that a majority of Silverlight controls extend the ContentControl parent class. This class also defines a Content property for a similar purpose. For example, the Button class extends ContentControl, and therefore can participate in the Silverlight content model.

By way of an example, a Button could maintain an inner StackPanel as ?content?. The StackPanel contains an Ellipse and TextBlock. Here is a simple example in XAML.

Code Snippet
  1. <Button Height = "150" Width = "120">
  2. ????<!-- This button has a StackPanel as content. -->
  3. ????<StackPanel>
  4. ????????<Ellipse Fill = "Orange" Height = "75" Width = "75"/>
  5. ????????<TextBlock Text = "OK!" FontSize = "20" HorizontalAlignment = "Center" />
  6. ????</StackPanel>
  7. </Button>

image

The Control parent class defines a number of members that give derived types their core look and feel. Properties exist to establish the control?s opacity, tab order logic, background color, font settings, and so forth. The Control type also provides key infrastructure to apply templates and styles to a UI widget.

image

FrameworkElement is another key parent class to many UI widgets in that it provides members to control size, tooltips, mouse cursor, and other settings. This class also provides support for animation and data binding services. Here are some common properties of FrameworkElement:

image

UIElement provides the ability to process mouse and keyboard input. This class also contains properties to control visibility, and geometric transformations. More importantly, this class defines a large number of useful events, shown here:

image

DependencyObject is the parent that provides derived types the ability to work with the ?dependency property? model. As you might know, a dependency property makes it possible for a property to receive input from multiple locations. This class also provides access to the app?s lower-level event queue via the Dispatcher property.

Beyond this parent, the last stop is System.Object, which I assume needs to introduction ;-)

Happy coding!


Posted by: Andrew Troelsen
Posted on: 8/23/2010 at 1:17 PM
Categories: .NET | Silverlight
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Subscribe to this BlogRSS comment feed
Contact Us 651-994-8558 1-800-866-9884
Home | Training | Curriculum | Course Finder | Schedule | Enroll | Twin Cities Java User Group | Consulting | Foundation | Jobs | About Us | Our Story | Press Room | Instructors | President | Map & Directions | Sitemap

Java Training | JSF / Struts / Spring / Hibernate Training | Java Power Tools Training | .NET 4.0 & Visual Studio 2010 Training | .NET 3.5 and Visual Studio 2008 Training | .NET 2.0 and Visual Studio 2003 Training | Prism / MVVM / MEF Training | Microsoft Web Development Training | Cloud Computing Training | Ajax / Web Services / XML Training | Groovy and Grails Training | SQL Server 2008 Training | SQL Server 2005 Training | Mobile Development Training | SharePoint 2010 Training | SharePoint 2007 Training | Agile, Process, Analysis & Design Training | Arch/Design Patterns Training | Microsoft Official Curriculum Training | Web Development Training | Ruby Training | Rational Application Developer (RAD) Training | WebSphere Application Server Training | WebSphere Portal Training | WebLogic Training | Boot Camp Training | Project Management Training | C++ Training | Metro / WinRT / Windows 8 Development Training | Retired

Intertech delivers training on-site and virtually serving cities including Phoenix, AZ | San Francisco, CA | Los Angeles, CA | San Diego, CA | San Jose, CA | Washington, DC | Chicago, IL | Orlando, FL | Boston, MA | Duluth, MN | Minneapolis St. Paul, MN | Rochester, MN | Raleigh-Durham, NC | New York, NY | Philadelphia, PA | Austin, TX | Dallas, TX | Houston, TX | Seattle, WA.