TAG | Silverlight
15
Thoughts on Visual Studio LightSwitch
4 Comments · Posted by Ferry Meidianto in Visual Studio
Earlier this month (August 2010) Microsoft has introduced a new Visual Studio family member, it’s Visual Studio LightSwitch.
Visual Studio LightSwitch is RAD (Rapid Application Development) tool that can be used to build WPF and Silverlight applications in an easy way.
Don’t expect me to explain the features in this post, it will be too long ๐ instead please watch the following videos:
- http://channel9.msdn.com/posts/Dan/Jay-Schmelzer-Introducing-Visual-Studio-LightSwitch/
- http://channel9.msdn.com/posts/funkyonex/Visual-Studio-LightSwitch-Beyond-the-Basics/
Okay, done watching? ๐
This kind of tool is not new. Many 3rd party software companies has built similar tool and my favorite was Iron Speed Designer but the output is ASP.NET website rather than WPF or Silverlight.
Iron Speed Designer was great. I used that tool in 2007 to 2009 because it was the main dev tool at the company I used to work. But the downside is the cost. It’s too expensive to get the full features. For a single seat of Enterprise Edition it cost $3,975.
This Visual Studio LightSwitch is absolutely a great tool and it absolutely has good market prospect. It’s a very good decision from Microsoft to develop this tool.
I hope Microsoft can release this tool in an affordable price. If that will happen, I canย say “Visual Studio LightSwitch is Iron Speed Designer KILLER”.
PS: The free public beta will be available on 23 August 2010.
Iron Speed Designer · LightSwitch · Silverlight · Visual Studio · WPF
13
Working with Image.Source on Silverlight 3
3 Comments · Posted by Ferry Meidianto in Silverlight
Below are some options to work with Image.Source
1. Embedded in the .xap file as Content
Note that the Build Action is “Content”
XAML
<Image x:Name="imgContent" Source="/Assets/Images/2.jpg" />
Code (C#)
imgContent.Source = new BitmapImage(new Uri("/Assets/Images/2.jpg", UriKind.Relative));
2. Embedded in the .xap file as Resource
Note that the Build Action is “Resource”
XAML
<Image x:Name="imgResource" Source="/SilverlightApplication1;component/Assets/Images/1.jpg" />
Code (C#)
imgResource.Source = new BitmapImage(new Uri("/SilverlightApplication1;component/Assets/Images/1.jpg", UriKind.Relative));
3. Absolute URL
The file is stored anywhere in the internet
XAML
<Image x:Name="imgAbsolute" Source="http://i3.silverlight.net/avatar/meidianto.jpg?cdn_id=10092009" />
Code (C#)
imgAbsolute.Source = new BitmapImage(new Uri("http://i3.silverlight.net/avatar/meidianto.jpg?cdn_id=10092009", UriKind.Absolute));
4. Stored inside the web application/website
Note: in this example the image is stored in the same folder as the .xap file
XAML
<Image x:Name="imgServer" Source="/3.jpg" />
Code (C#)
imgServer.Source = new BitmapImage(new Uri("/3.jpg", UriKind.Relative));
5. Async Network Call
Note: in this example the image is stored in the same folder as the .xap file as above
Code (C#)
private void LoadImage() { WebClient client = new WebClient(); client.OpenReadCompleted += new OpenReadCompletedEventHandler(client_OpenReadCompleted); client.OpenReadAsync(new Uri("3.jpg", UriKind.Relative)); } void client_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e) { if (e.Error == null && e.Result != null) { BitmapImage img = new BitmapImage(); img.SetSource(e.Result); imgServer.Source = img; } }