Thoughts about application packaging, Resources, MVVM and others

Sunday, October 24, 2010

I thought a lot before decided to write this post… First - I’d like to thanks Ariel Ben Horesh for “inspiring” me to write this post and for dedicating so much time to write his post! After reading his post I thought a lot and my thoughts about the post are the follows: 1. First, I thought about the applications and the way to provide user with best experience while loading those applications… The users shouldn’t wait minutes for application to download… While authoring large Silverlight applications (MVVM or not) the author should consider to split...

Silverlight for Symbian goes RTM

Wednesday, July 7, 2010

Microsoft just announced the general availability of Silverlight for Symbian. This brings the Silverlight experience to the 20+ million users of Nokia S60 5th edition Nokia 5800 XPressMusic and Nokia N97 devices. Highlighted features in this product are: Media: Hardware assisted Media playback of H.264 content. This gives a great media viewing experience using full hardware decode and hardware post processing. IIS Smooth Streaming: Enables users to access live and on demand media content streamed using IIS Smooth...

Silverlight Quick Tip: How to Perform a Hit Test

Tuesday, August 11, 2009

In some cases, especially when developing rich UI application developer need to identify which control were clicked or under mouse pointer at some point of time or just under some coordinate at the UI. For those purposes Silverlight provides “FindElementsInHostCoordinates” function in VisualTreeHelper class. The function gets the Point (coordinate on the screen) or Rect (rectangular area) and UIElement which will be checked recursively to have any visual child's in desired coordinate/area. The function returns IEnumerable<UIElement>. In most cases, especially when using custom controls the returned list will have many UIElements. They need to be filtered out....

Silverlight Quick Tip: How to force re-binding

Tuesday, July 14, 2009

Today I’ll show how to do “dirty trick” to force re-binding and as a result UI value updating. First of all – the reasonable question – “Why force rebinding? Why not use INotifyPropertyChanged mechanism?” This was my questions also, but the person who asked the question had his reasons: he is using resources (Resx) to localize the application and bind the UI to those resources. Also UI gives user an ability to change the language (and code behind  does it by changing CurrentThread.CurrentUICulture). In this case what should be the notification? The request was to keep binding definition...

Quick Tip: LINQ & Data Binding notifications

Tuesday, June 23, 2009

In Silverlight & WPF we could databind to the LINQ query results: private ObservableCollection<string> someData = new ObservableCollection<string>(); //Somewhere in code someData.Add("Alex"); someData.Add("Alen"); someData.Add("Josh"); someData.Add("Brad"); var res = from data in someData            where data.StartsWith("A")            select data; listbox.ItemsSource = res; ”listbox” is the name of the Listbox on my XAML page. When application will load we will get expected results: But what happens when out collection (reminder: ObservableCollection, which implements INotifyCollectionChanged) changed? someData.Add("Antony"); Nothing! Because we bounded to the LINQ query (predicate), and the query was executed...

Silverlight 2 applications: a day after Silverlight 3 release

Tuesday, June 16, 2009

Silverlight 3 release date is approaching, and I’m getting questions what will happen to existing Silverlight 2 applications after it will be released. Also I’m getting questions about the runtime version upgrade. Let’s see what will happen after Silverlight 3 will be released… Those who already using Silverlight 2 and getting automatic updates will receive the new runtime automatically. Everyone else need to download and install it manually. The updated clients will be able to run Silverlight 2 applications as it was before the runtime update. It is possible because of “quirk mode change” –...

Silverlight & Visual Studio 2010 Beta

Wednesday, May 20, 2009

As you probably know, Visual Studio 2010 Beta 1 was released to MSDN subscribers and soon will be released to general public here. What is new in this release for Silverlight developers? First of all – Silverlight is a first class citizen in this release, like WPF for example. More good news - now we will be able to create/manage both version of Silverlight projects (2 and 3)! When you choosing to create a new Silverlight projects, you will be prompted with dialog which allows to select the version of the technology:...

Silverlight Quick Tip: How to change Tab Items order

Monday, May 18, 2009

I’ve got a question from my colleague about how he could change the order of Tab Items according to some business logic. When adding the TabItem to the Tab control dynamically (from code behind for example) the TabItems will be added in the order they added. Here is the simple solution of hot change the order of already added tabs. In my case I have simple XAML with Tab Control: <controls:TabControl Width="400" Height="200" x:Name="tabs" Margin="5"> <controls:TabItem Header="Tab #1"> <controls:TabItem.Content> ... </controls:TabItem.Content> </controls:TabItem> ...

Silverlight Tip: Object Creation via Silverlight.js – IE8 & FireFox tweak

Friday, May 1, 2009

Yesterday, when I arrive to the office my colleague (same one from this post) waited for me at the entry with new question/problem. That’s what I heard: - Hi Alex. I have a problem with my Silverlight application under FireFox – it is not being displayed on page! In IE(7) everything works fine, and in the FF is event not shown… :( - Well – I said – let’s see… I’ve got the sources from the company source server, launched the application on my machine IE(8) and got very “wired” sized application and on...

Silverlight Quick Tip: How to resize window from Silverlight

Sunday, April 26, 2009

One of my colleagues asked me if it is possible to resize the Browser Window from within Silverlight application. Well, my answer was: “everything what is possible to do from JavaScript is possible to do from Silverlight”. Here is sample code how to do it in case someone else is also looking for the solution: if (HtmlPage.BrowserInformation.UserAgent.ToLower().IndexOf("chrome") < 0) { HtmlPage.Window.Invoke("moveTo", new object { 100, 100 }); HtmlPage.Window.Invoke("resizeTo", new object { 250, 250 }); } //else // MessageBox.Show("Why bother? Chrome will not accept this anyway ;)"); * this will not work on Google Chrome probably because of some...