I am getting issues with ComboBox selectedValue in AppoinmentDialog window.
I Have a combobox in my AppointmentDialog window like this :
And here my TypeIntervention property :
and my object ItemGenerique :
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).
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).