I have derived a custom appointment that implements IAppointment called AppointmentViewModel. I have created a customized EditAppointmentView Dialog, by taking the provided RadSchedulView template XAML and adding a few RadComboBoxes (that are not resources), and assigning the template to the RadScheduleView's EditAppointmentDialogStyle. After a bit of work, all is working as planned except for one problem. In our LOB app, the schedule represents appointments in a auto repair shop. We need to provide the user with a list of predefined repair symptoms that they can choose from when creating or editing the appointment. I have successfully added a RadComboBox to allow them to choose from the list of symptoms. After making a selection in the RadComboBox, I call code on the SelectedItem's setter, that calls an internal method on my derived Appointment to concatenate the selected symptom text to the Body property of the Appointment. All works, the RadComboBox, the concatenation code, everything, except the Body TextBox will not show the value stored for the Body until the Appointment is closed and reopened. I am calling OnPropertyChanged(() => Body) both in the method that appends the symptom to the Body and on the Body setter itself. All seem to be ignored. I know about having to BeginEdit and CommitEdit the RadScheduleView when updating appointments with code and need the ScheduleView to update, but shouldn't the IAppointment behind the EditAppointmentView Dialog be able to edit one of it's own properties and have it be reflected in the open Edit Dialog if it is a TwoWay binding? Originally I didn't have the Body overridden in my derived Appointment, but did so later just to confirm the firing of the OnPropertyChanged.
Once again, the desired work is taking place and upon close and reopen the Body shows the appended symptom as desired, but not live when you make the change. Am I missing something?
XAML snippet from customized EditAppointmentTemplate for Body TexyBox;
<TextBox
Grid.Row="1"
HorizontalAlignment="Stretch
Margin="8,11,12,8"
VerticalAlignment="Stretch"
TextWrapping="WrapWithOverflow"
VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Auto"
SpellCheck.IsEnabled="True"
Text="{Binding Occurrence.Appointment.Body, Mode=TwoWay}"
AcceptsReturn="True"
AcceptsTab="True"
IsReadOnly="{Binding IsReadOnly}"
/>
Property in my derived IAppointment that the Body TextBox is bound too;
public override string Body
{
get
{
return base.Body;
}
set
{
base.Body = value;
OnPropertyChanged(() => Body);
}
}
For what it's worth, here's the little method that is called to concatenate a string to the Body property. Note that I have tried calling OnPropertyChanged(() => Body) in this method as well, but currently have to commented out. The OnPropertyChanged(() => Body) of the Body itself is being fired.
internal void AppendSymptomToAppointmentNote()
{
if (SelectedSymptom == null)
return;
if (Body == null)
{
Body = "* " + SelectedSymptom + "\r\n";
// OnPropertyChanged(() => Body);
}
else
{
if (!Body.Contains(SelectedSymptom))
{
Body = Body + "* " + SelectedSymptom + "\r\n";
// OnPropertyChanged(() => Body);
}
}
}
Once again, the desired work is taking place and upon close and reopen the Body shows the appended symptom as desired, but not live when you make the change. Am I missing something?
XAML snippet from customized EditAppointmentTemplate for Body TexyBox;
<TextBox
Grid.Row="1"
HorizontalAlignment="Stretch
Margin="8,11,12,8"
VerticalAlignment="Stretch"
TextWrapping="WrapWithOverflow"
VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Auto"
SpellCheck.IsEnabled="True"
Text="{Binding Occurrence.Appointment.Body, Mode=TwoWay}"
AcceptsReturn="True"
AcceptsTab="True"
IsReadOnly="{Binding IsReadOnly}"
/>
Property in my derived IAppointment that the Body TextBox is bound too;
public override string Body
{
get
{
return base.Body;
}
set
{
base.Body = value;
OnPropertyChanged(() => Body);
}
}
For what it's worth, here's the little method that is called to concatenate a string to the Body property. Note that I have tried calling OnPropertyChanged(() => Body) in this method as well, but currently have to commented out. The OnPropertyChanged(() => Body) of the Body itself is being fired.
internal void AppendSymptomToAppointmentNote()
{
if (SelectedSymptom == null)
return;
if (Body == null)
{
Body = "* " + SelectedSymptom + "\r\n";
// OnPropertyChanged(() => Body);
}
else
{
if (!Body.Contains(SelectedSymptom))
{
Body = Body + "* " + SelectedSymptom + "\r\n";
// OnPropertyChanged(() => Body);
}
}
}