Jul 17
Creating a Silverlight game
icon1 Boyan Mihailov | icon2 Silverlight | icon4 07 17th, 2008| icon3No Comments »

Introduction

I am a great fan of Silverlight. I have never liked 1.0, but when version 2.0 was released I was very amazed. I created a few solitaire games. Now I decided to create a new game and to describe the problems I have encountered to you. First I decided to write an article about creating a Silverlight application for Facebook. But subsequently I decided to divide the article in two parts – creating a Silverlight application, which is a game in this occasion, and integrating it in Facebook.
I am going to create a game, called Cows & Bulls. You play that game for time. It supports a list of all players and their time.

Beggining

I will use a strong pattern in my application, so I need to put the common styles in the application resources. Now I can access them from everywhere in my application.

<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    x:Class="CowsAndBulls.App">
  <Application.Resources>

  </Application.Resources>
</Application>

Read the rest of this entry »

Jun 30
Drag & Drop in Silverlight 2
icon1 Boyan Mihailov | icon2 Silverlight | icon4 06 30th, 2008| icon3No Comments »

I am writing a Silverlight 2.0 Beta 2 application where I want to drag & drop items. I searched Google for information and here is the final result of my work. It’s pretty simple.

We are going to create a project, called Freedom in the Sky. We have a custrom control, called Bird, which we want to drag & drop over a canvas. Here is our custom control.

<UserControl x:Class="DragAndDropProject.Bird"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  MouseLeftButtonDown="Bird_MouseLeftButtonDown"
  MouseLeftButtonUp="Bird_MouseLeftButtonUp" MouseMove="Bird_MouseMove"
  Width="100" Height="112">

  <Grid x:Name="LayoutRoot" Background="Transparent">
    <Image Source="Images/pigeon.png" />
  </Grid>
</UserControl>

Read the rest of this entry »

Jun 3
Silverlight 2 Beta 2
icon1 Boyan Mihailov | icon2 News, Silverlight | icon4 06 3rd, 2008| icon3No Comments »

Beta 2 is coming this week! Pete Brown wrote a short overview of what will this beta contain. Here it is.

  • Cross-domain changes to Sockets
  • WCF Duplex Communications
  • TextWrapping in textbox
  • TabControl
  • Updates to Improve WPF Compatibility

Along with Silverlight 2 Beta 2, you’ll find a new preview of Expression Blend 2.5 and a new version of Deep Zoom Composer.

Mar 25

I am going to show you how you can modify the standard ListBox control used in Silverlight 2.0. Many people want to change the default view of this control but they can’t remove the line between the items. If you download the code of the Silverlight control from the official site of Microsoft you will see that after every item there is a line. In this example I will show you how you can remove this line.

Let’s create e new Silverlight 2.0 application and place a ListBox in it.

<ListBox>
    <ListBox.Items>
    <ListBoxItem Content="I am the first item in the collection" />
    <ListBoxItem Content="I am the second item in the collection" />
  </ListBox.Items>
 </ListBox>

Read the rest of this entry »

Mar 7

SilverlightIn MIX Conference 2008 Microsoft presented Silverlight 2.0 beta 1. Here is a list of new features in this release:

  • WPF UI Framework
    Silverlight 2 includes a rich WPF-based UI framework that makes building rich Web applications much easier. In includes a powerful graphics and animation engine, as well as rich support for higher-level UI capabilities like controls, layout management, data-binding, styles, and template skinning. The WPF UI Framework in Silverlight is a compatible subset of the WPF UI Framework features in the full .NET Framework, and enables developers to re-use skills, controls, code and content to build both rich cross browser web applications, as well as rich desktop Windows applications.
  • Rich Controls
    Silverlight 2 includes a rich set of built-in controls that developers and designers can use to quickly build applications. This upcoming Beta1 release includes core form controls (TextBox, CheckBox, RadioButton, etc), built-in layout management panels (StackPanel, Grid, Panel, etc), common functionality controls (Slider, ScrollViewer, Calendar, DatePicker, etc), and data manipulation controls (DataGrid, ListBox, etc). The built-in controls support a rich control templating model, which enables developers and designers to collaborate together to build highly polished solutions.
  • Rich Networking Support
    Silverlight 2 includes rich networking support. It includes out of the box support for calling REST, WS*/SOAP, POX, RSS, and standard HTTP services. It supports cross domain network access (enabling Silverlight clients to directly access resources and data from resources on the web). Beta1 also includes built-in sockets networking support.
  • Rich Base Class Library
    Silverlight 2 includes a rich .NET base class library of functionality (collections, IO, generics, threading, globalization, XML, local storage, etc). It includes rich APIs that enable HTML DOM/JavaScript integration with .NET code. It also includes LINQ and LINQ to XML library support (enabling easy transformation and querying of data), as well as local data caching and storage support. The .NET APIs in Silverlight are a compatible subset of the full .NET Framework.

The SDK for Silverlight 2.0 beta 1 is already available at its website.