Ooooer, I like that. I'll have a look at that tomorrow.
I ended up with a work around. The combobox is not visible until the user
clicks the edit button, and the stackpanel those controls are in are made
visible, so I'm using the same method load the required value.

As for MVVM, I like the idea but changing the design at this stage would be
a lot of work and I'm still learning about it. Binding to a property was
going to be my next thing to try until I thought of putting it on the "edit"
method.

thanks for the tips, much appreciated!

cheers,
Stephen

On Thu, Mar 19, 2009 at 9:17 PM, Miguel Madero <[email protected]> wrote:

> When you set the DataContext, the first time the items are loaded the
> control will select the first item in the list. You can subscribe to the
> SelectedItemChanged event, then in the same method unsubscribe and set the
> default.
> public void SetDefaultValue(object o, EventArgs e)
> {
>    ((ComboBox)o).SelectedItemChanged-= SetDefaultValue;
>    ((ComboBox)o).SelectedItem = "SomethingElse"
> }
>
> You can also consider using MVVM and bind the SelectedItem Property of the
> ComboBox to a property of your ViewModel
>  ------------------------------
> Support procedure: https://www.codify.com/lists/support
> List address: [email protected]
> Subscribe: [email protected]
> Unsubscribe: [email protected]
> List FAQ: http://www.codify.com/lists/ozsilverlight
> Other lists you might want to join: http://www.codify.com/lists
>
--------------------------------------------------------------------------------
Support procedure: https://www.codify.com/lists/support
List address: [email protected]
Subscribe: [email protected]
Unsubscribe: [email protected]
List FAQ: http://www.codify.com/lists/ozsilverlight
Other lists you might want to join: http://www.codify.com/lists

Reply via email to