Skip to main content

Posts

Showing posts with the label Silverlight

C# Silverlight - Using Sliders [Beginner]

Being the month of Silverlight, I decided to get off my PHP and JS butt, and learn something new. I am incredibly new to the whole silvery-light thing, but luckily with Visual Studio on your side, it is pretty easy to get things going. I am also using VS2010, which makes the whole experience a grand opening of new stuff for me. So to begin my foray into Silverlight, I did something easy, but slightly useful at the same time. What I have made is a set of three sliders that represent a RGB value, which in turn changes the color of some text. It is some pretty short code, but it does showcase how to change the color of TextBlock text, which took me a few minutes to find. [silverlight width="400" height="300" src="SilverlightApplication.xap" border="true"] To begin with, lets get the XAML out of the way: <UserControl x:Class = "SilverLightColorSliders.Page" xmlns = "http://schemas.microsoft.com/winfx/2006/xaml...

C# Silverlight - Using a DataGridTemplateColumn [Beginner]

Whenever you pit designers against developers, it always seems to be the developer that loses. It's very rare that controls like the Silverlight DataGrid are left alone - designers want little tweaks and polish to increase the user experience. This tutorial is going to illustrate how to use one of the most flexible solutions to theming a DataGrid - the DataGridTemplateColumn. We'll be touching very little on the basics of how to use the Silverlight DataGrid. If you're new to the control. The first thing we're going to do is build a default DataGrid without any styling. I created a class to hold some information about the SOTC authors and bound a collection of those to my DataGrid. [silverlight width="400" height="300" src="BasicDataGrid.xap"] using System.Collections.Generic; using System.Windows.Controls; namespace DataGridStyling { public partial class Page : UserControl { public Page() { InitializeComp...

C# Silverlight - Loading a Client Side Image [Beginner]

Since the RTW (release to web) of Silverlight 2 was just the other day, I decided to take a look and see if this problem still existed. And what do you know! Not only is it possible, it is downright easy. You can load images from any stream, which means it could be a file stream from isolated storage, a file that the user just chose in an Open File Dialog, or even over the web using stuff like OpenReadAsync (on the WebClient class. Below, you can see the small example app that shows this off - you can pick any image file on your computer, and Silverlight can display it right there for you. [silverlight width="400" height="300" border="true" src="Silverlight2ImageLoading.xap"] This is going to be a short tutorial, because really there isn't much code behind it. So let's jump straight into the XAML: <UserControl x:Class="Silverlight2ImageLoading.Page" xmlns="http://schemas.microsoft.com/winfx/2006/xa...