How to set a combobox SelectedItem from ViewModel

Topics: Prism v2 - Silverlight 3
Oct 30, 2009 at 9:08 PM

Hi

I have a combox in my view and i bind to its ItemsSource a ObservableCollection and to its SelectedItem a property in my ViewModel.

The ItemsSource is bound correctly but the SelectedItem is not bound.

    public ClientDataViewModel(IUnityContainer container)
        {
            _container = container;
              LoadLocalisation();
             CurrentClient = _container.Resolve<Client>("CurrentClient");
             RegionSelect = CurrentClient.Region;


        }

        private void LoadLocalisation()
        {
            TopOffreServiceClient service = new TopOffreServiceClient();
            Guid idPays = new Guid("8899e445-9992-4930-b8f8-d7b2bc584228");
            service.loadRegionCompleted += (s, arg) =>
            {
                RegionList = arg.Result;

            };
            service.loadRegionAsync(idPays);

        }

 

  <ComboBox cmd:SingleEventCommand.RoutedEventName="SelectionChanged" 
	  cmd:SingleEventCommand.TheCommandToRun="{Binding SelectRegion}" 
           Grid.Column="1" Grid.Row="1" ItemsSource="{Binding RegionList}" 
           ItemTemplate="{StaticResource locationTemplate}" 
           SelectedItem="{Binding RegionSelect,Mode=TwoWay}"  
           Margin="5" HorizontalAlignment="Left" Width="150"/>

Any help will be appreciated.
Thanks