I stumbled across this Silverlight “feature” today. Silverlight’s binding works in a linear order.

1
<ComboBox SelectedValue="{Binding SelectedHour, Mode=TwoWay}" ItemsSource="{Binding Hours}" />

In the above code, selected value isn’t being set on page load. When I change the ComboBox my SelectedHour ViewModel property was being updated with a new value. This let me know that my binding is working. In further debugging I noticed SelectedHour property was being accessed before the Hours property. The binding was trying to set the selected value but the ComboBox was ignoring it because it didn’t have any values. For fun I tired moving ItemSource binding in front of the SelectedValue binding.

1
<ComboBox ItemsSource="{Binding Hours}" SelectedValue="{Binding SelectedHour, Mode=TwoWay}" />

Everything started working perfectly. Now I know to watch the order of my XAML properties in Silverlight.

Tagged with:
 

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">

Set your Twitter account name in your settings to use the TwitterBar Section.
film izle film izle film izle film izle film izle film izle film izle film izle dizi izle dizi izle film izle film izle film izle