Ive been playing with Microsoft Silverlight and would like to share how to use it. First what is Microsoft Silverlight
Currently in Version 3. Version 2 brought with it the use of the Dynamic Language Runtime environment or DLR this allows for languages using .net to implement Silverlight Applications Such as C# VB.net Iron Python and Iron Ruby. To explain it better you can now use Python in your browser!Microsoft Silverlight is a programmable web browser plugin that enables features such as animation, vector graphics and audio-video playback that characterizes rich Internet applications
Silverlight uses XAML an XML based language developed by microsoft for use with silverlight
Alright now that we know what Silverlight is we can start to use it. The examples I will be developing will be for IronPython 2.01Extensible Application Markup Language, or XAML (pronounced "zammel"), is an XML-based markup language developed by Microsoft
Our Import Statements.
Code: Select all
from System.Windows import *
from System.Windows.Controls import *
We than create our box basically a StackPanel allows us to stack elements of the GUI this initial StackPanel creates a Vertical Box
Code: Select all
main = StackPanel()
Code: Select all
layer1 = StackPanel()
layer1.Orientation = Orientation.Horizontal
textb = TextBox()
textb.Width = 100
button = Button()
button.Content = “Generate String“
Code: Select all
def stringCheese(s, e):
textb.Text = ""
textb.Text = "Hello from IronPython!"
Code: Select all
button.Click += stringCheese
Code: Select all
layer1.Children.Add(textb)
layer1.Children.Add(button)
main.Children.Add(layer1)
Code: Select all
Application.Current.RootVisual = main
Code: Select all
<Path to IronPython>\Silverlight\bin\Chiron.exe /d:C:\app_folder\ /z:C:\app.xap
In order to view the page in a browser simple add the html tags as describe here
Code: Select all
http://msdn.microsoft.com/en-us/library/cc189089(VS.95).aspx
Any way have fun
*cheers
Maboroshi