This is a migrated thread and some comments may be shown as answers.

ComboBox in AppointmentDialog

2 Answers 68 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Ramos
Top achievements
Rank 1
Ramos asked on 14 Jun 2011, 03:12 PM
I am getting issues with ComboBox selectedValue in AppoinmentDialog window.

I Have a combobox in my AppointmentDialog window like this :

<telerik:RadComboBox
ItemsSource="{Binding Path=SchedulerViewModel.ComboBoxIntervention, Source={StaticResource Locator}}"
SelectedValue="{Binding Path=Occurrence.Appointment.TypeIntervention, Mode=TwoWay}"
DisplayMemberPath="Libelle"
Grid.Column="1"
Margin="6"
Grid.Row="0"
telerik:StyleManager.Theme="{StaticResource Theme}" />

And here my TypeIntervention property :

public IItemsGenerique TypeIntervention
       {
           get
           {
               return this.Storage<Planification>().typeIntervention;
           }
           set
           {
               var storage = this.Storage<Planification>();
               storage.typeIntervention = value;
               this.OnPropertyChanged("TypeIntervention");
           }
            
       }

and my object ItemGenerique : 

using SL.CNET.Models.Interface;
using System.ComponentModel;
 
namespace SL.CNET.Models
{
    /// <summary>
    /// Classe métier qui représente les Item génrique d'une planification
    /// </summary>
    public class ItemsGenerique:IItemsGenerique,INotifyPropertyChanged
    {
        #region PRIVATE
        /// <summary>
        /// L'identifiant de l'item provenant de la BDD
        /// </summary>
        private int identifiant;
        /// <summary>
        /// Le libelle de l'item Generique
        /// </summary>
        private string libelle;
        /// <summary>
        /// Le code Item
        /// </summary>
        private string itemCode;
        /// <summary>
        /// cette propriéte va servir à rechercher les informations selon son type (motif annulation, type de l'acte médical, état de la planification)
        /// </summary>
        private string itemClassCode;
        #endregion
 
        #region IItemsGenerique Membres
 
        public int Identifiant
        {
            get
            {
                return identifiant;
            }
            set
            {
                if (identifiant != value)
                {
 
                    identifiant = value;
                    NotifyPropertyChanged("Identifiant");
                }
            }
        }
 
        public string Libelle
        {
            get
            {
                return libelle;
            }
            set
            {
                if (libelle != value)
                {
                    libelle = value;
                    NotifyPropertyChanged("Libelle");
                }
            }
        }
 
        public string ItemCode
        {
            get
            {
                return itemCode;
            }
            set
            {
                if (itemCode != value)
                {
                    itemCode = value;
                    NotifyPropertyChanged("ItemCode");
                }
            }
        }
 
        public string ItemClassCode
        {
            get
            {
                return itemClassCode;
            }
            set
            {
                if (itemClassCode != value)
                {
                    itemClassCode = value;
                    NotifyPropertyChanged("ItemClassCode");
                }
            }
        }
 
        #endregion
 
        #region INotifyPropertyChanged Membres
 
        public event PropertyChangedEventHandler PropertyChanged;
 
        private void NotifyPropertyChanged(string property)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(property));
            }
        }
 
        #endregion
 
        #region Methode Statiques
        /// <summary>
        /// Retourne un nouveau Patient ayant les mêmes valeurs que le paramètre P
        /// </summary>
        /// <param name="p">L'item à copier</param>
        /// <returns>Le nouvelle item</returns>
        public static IItemsGenerique Copy(IItemsGenerique p)
        {
            //Si p est null on renvoie une nouvelle instance mais vide
            IItemsGenerique item = new ItemsGenerique();
            //Vérification de P
            if (p != null)
            {
                item.ItemClassCode = p.ItemClassCode;
                item.ItemCode = p.ItemCode;
                item.Libelle = p.Libelle;
                item.Identifiant = p.Identifiant;
            }
            return item;
        }
        #endregion
    }
}


Problem :

ItemSource works and the comboBox is correctly populated.

SelectedValue works partially because I can see my object directly associated with my ComboBox selection,
But when I click OK in editAppointmentDialog and reopened my appointment, my combobox is not on the right selection (It displays Blank).





2 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 17 Jun 2011, 09:33 AM
Hello Ramos,

I've tried to reproduce this issue but without much success. I've attached my test project, could you please download it and give it a try?

Greetings,
Yana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Ramos
Top achievements
Rank 1
answered on 20 Jun 2011, 09:20 AM
It works now. In fact it was the copy in Planification Class, with this :
  •  this.TypeIntervention = Planification.Copy(planification.TypeIntervention) comboBox doesn't match but with this
  •  this.TypeIntervention = planification.TypeIntervention it works.

thanks for example.

Resolved
Tags
ScheduleView
Asked by
Ramos
Top achievements
Rank 1
Answers by
Yana
Telerik team
Ramos
Top achievements
Rank 1
Share this question
or