Hello,
First, i precise that i'm french, so, sorry for mistakes you could find in this thread.
I'm working with a RadGridView, and, in witch column cells i have to place a Combobox.
I writed this code :
And for the list, the definition is in a viewmodel class :
where TypeBouchon and TypeBouchonGrille are mocks class because, i'm just in the begin of development (any WCF Services implemented) :
My problem :
I select a value in the comboxBox of the first column for example. When i focus the second combo (in the second column), the first column appears empty...
I'd want to keep my selection in each columns...
I think my databing is correct, and i don't see the problem...
I send my screenshot in attach file.
Fab'
First, i precise that i'm french, so, sorry for mistakes you could find in this thread.
I'm working with a RadGridView, and, in witch column cells i have to place a Combobox.
I writed this code :
<Grid Width="900" > <Grid.RowDefinitions> <RowDefinition/> <RowDefinition/> </Grid.RowDefinitions> <telerik:RadGridView ItemsSource="{Binding ListIntervention}" IsSynchronizedWithCurrentItem="True" AutoGenerateColumns="False" ShowInsertRow="True" > <telerik:RadGridView.Columns> <telerik:GridViewComboBoxColumn Header="Objet intervention" Width="300" ItemsSource="{Binding ListObjet}" DataMemberBinding="{Binding ObjetId, Mode=TwoWay}" DisplayMemberPath="Libelle" SelectedValueMemberPath="Id" /> <telerik:GridViewComboBoxColumn Header="Sous catégorie" Width="300" ItemsSource="{Binding ListSousCategorie}" DataMemberBinding="{Binding SsCategorieId, Mode=TwoWay}" DisplayMemberPath="Libelle" SelectedValueMemberPath="Id" /> <telerik:GridViewComboBoxColumn Header="Catégorie" Width="*" ItemsSource="{Binding ListCategorie}" DataMemberBinding="{Binding CategorieId, Mode=TwoWay}" DisplayMemberPath="Libelle" SelectedValueMemberPath="Id" /> </telerik:RadGridView.Columns> </telerik:RadGridView> </Grid>And for the list, the definition is in a viewmodel class :
public class GestionAccueilViewModel : ActiveAwareViewModelBase{ #region Fields private readonly ITroncCommunService _troncCommunService; private readonly IMessageBoxService _messageBoxService; #endregion #region Ctor public GestionAccueilViewModel(ITroncCommunService troncCommunService, IMessageBoxService messageBoxService) { _troncCommunService=troncCommunService; _messageBoxService=messageBoxService; // Init. ListSousCategorie=new ObservableCollection<TypeBouchonObjet>(); ListCategorie=new ObservableCollection<TypeBouchonObjet>(); ListObjet = new ObservableCollection<TypeBouchonObjet>(); ListIntervention=new ObservableCollection<TypeBouchonIntervention>(); // Mocks ListObjet.Add(new TypeBouchonObjet() { Id=1, Libelle="Date de paiement des prestations" }); ListObjet.Add(new TypeBouchonObjet() { Id=2, Libelle="Autre objet" }); ListSousCategorie.Add(new TypeBouchonObjet() { Id=1, Libelle="Logement nature" }); ListSousCategorie.Add(new TypeBouchonObjet() { Id=2, Libelle="Autre sous-catégorie" }); ListCategorie.Add(new TypeBouchonObjet() { Id=1, Libelle="AVNAT" }); ListCategorie.Add(new TypeBouchonObjet() { Id=2, Libelle="Autre categorie" }); ListIntervention.Add(new TypeBouchonIntervention() { ObjetId=1, CategorieId=1, SsCategorieId=1 }); ListIntervention.Add(new TypeBouchonIntervention() { ObjetId=2, CategorieId=2, SsCategorieId=2 }); } #endregion #region Listes private ObservableCollection<TypeBouchonIntervention> _listIntervention; public ObservableCollection<TypeBouchonIntervention> ListIntervention { get { return _listIntervention; } set { SetValueAndRaiseEventIfPropertyChanged<ObservableCollection<TypeBouchonIntervention>>("ListIntervention", ref _listIntervention, ref value); } } // Test RadGridView public ObservableCollection<TypeBouchonObjet> ListObjet { get; set; } public ObservableCollection<TypeBouchonObjet> ListCategorie { get; set; } public ObservableCollection<TypeBouchonObjet> ListSousCategorie { get; set; } #endregion #region Commands /// <summary> /// Valide l'accueil en cours /// </summary> public ICommand ValiderAccueilCommand { get; set; } /// <summary> /// RAZ de l'accueil en cours /// </summary> public ICommand AnnulerAccueilCommand { get; set; } /// <summary> /// Crée un nouvel écran d'accueil /// </summary> public ICommand NouvelAccueilCommand { get; set; } /// <summary> /// Recherche d'une personne via l'écran d'accueil /// </summary> public ICommand RechercherPersonneAccueilCommand { get; set; } #endregionwhere TypeBouchon and TypeBouchonGrille are mocks class because, i'm just in the begin of development (any WCF Services implemented) :
public class TypeBouchon { public string Code { get; set; } public string Libelle{ get; set; } } public class TypeBouchonIntervention { public int ObjetId { get; set; } public int SsCategorieId { get; set; } public int CategorieId { get; set; } }My problem :
I select a value in the comboxBox of the first column for example. When i focus the second combo (in the second column), the first column appears empty...
I'd want to keep my selection in each columns...
I think my databing is correct, and i don't see the problem...
I send my screenshot in attach file.
Fab'