Chris Pietschmann

husband, father, hacker, entrepreneur, futurist, innovator, autodidact

NAVIGATION - SEARCH

Silverlight and JavaScript Interop Basics

I've been looking into Silverlight in my spare time a bit, to see what it has to offer, and the JavaScript "Interop" is actually pretty neat and simple to use. About three months ago I wrote a post titled "Working with HTML DOM in Silverlight using the Bridge Pattern"; so I think this time I'll go over some of the basics involved with communicating back and forth between Silverlight and JavaScript. This article is written by referencing Silverlight 2 Beta 2, but should still ... [More]

Silverlight: Load JavaScript from Embedded Resource and Execute Within Page

I've been playing around with Silverlight 2 Beta 1 alot lately, and one of the areas I've been focusing on is interoperability with JavaScript and the DOM. Here's a technique I've found that allows you to inject JavaScript into the page from within your Silverlight application. This example also starts with the idea that the JavaScript you are going to inject is stored as an Embedded Resource within your Silverlight Application. Step 1: Create your JavaScript (.js) file and... [More]

Mono: WinForms finally API complete and Moonlight v1.0 is released

It's been forever since I posted anything about Mono, but this stuff deserves some attention. Mono's Winforms 2.0 is now API Complete Yesterday, it was announced that the System.Windows.Forms support in Mono (an open source implementation of the .NET Framework targeting Linux, MacOS, Windows, etc.) has finally reached a state of being API complete. This means the public API for WinForms in Mono is exactly the same as in .NET; with a total of 12,776 methods! The first check-in of WinForms occur... [More]

PasswordTextBox for Silverlight 2 Beta 2

The standard TextBox control that is built into Silverlight 2 Beta 2 is a bit lacking and is missing alot of features that we have become accustomed to in a TextBox. One of those features is being able to mask the characters being displayed when its used to accept passwords. Here's a small PasswordTextBox control I built that does just that; it masks the characters from being displayed so you can accept passwords like you're used to. Update 6/7/2008 - I just tested this w... [More]

Working with HTML DOM in Silverlight 2 Beta 1 using the Bridge Pattern

Working with the HTML DOM in Silverlight 2 Beta 1 is rather simple and easy to do. However, to my surprise it's a similar experience to working the the HTML DOM from within JavaScript; you have to know the name of the properties to get/set and you don't have the luxury of compile time checking or intellisense. Here an example of creating a new DIV element and setting some of it's properties: [code:c#] HtmlElement myDiv = HtmlPage.Document.CreateElement("div&quo... [More]

Show a MessageBox in Silverlight 2 Beta 1

Since Silverlight is just a subset of WPF, there are alot of things missing. One missing thing I found is the System.Windows.MessageBox. I'm a little puzzled as to why they would have left this out, but I imagine MessageBox's are handled very differently in different Operating Systems. It's probably a little work to get it working on both Mac and Windows, but I hope it gets into the final release. It's not a major feature, but one that is used quite often when developing desktop ... [More]

Opening Client-Side Files using Silverlight

Silverlight does not have direct access to the local file system for security reasons. However, you can still prompt the user to select a specific file to open using the OpenFileDialog similarly to how you do in .NET. Here's some basic code that demonstrates opening a user specified file using Silverlight 2 Beta 1. This basic example opens up a user specified file, and displays its contents within a textbox. Page.xaml file <UserControl x:Class="SilverlightFileSystemInfo.Page"   ... [More]

Silverlight: Anatomy of an .XAP file

Silverlight 2 Beta 1 just came out this morning, so I started checking it out immediately. I installed the Silverlight Tools for Visual Studio and noticed that when a Silverlight Application is compiled a .xap file is created that contains the application. But, what exactly is a .xap file, and what exaclty is in there? What is an .xap file? A .xap file is basically a compiled Silverlight application. The file is actually a .zip file that contains all the files necessary for the application. ... [More]