This question is locked. New answers and comments are not allowed.
On the Appointment Detail form, I'm trying to bind visibility of a control to a custom appointment property. It works fine for the base properties, like IsAllDayEvent, but not for custom appointment properties.
I modified a Telerik sample project I found to demo the issue.
In my example, I have 2 checkboxes:
- Is done?
- IsAllDayEvent
When checked, a label should be displayed to the right of each checkbox.
http://www.youtube.com/watch?v=funpvUMb6_Y&feature=youtu.be
You can see in the video that when the IsAllDayEvent value is toggled, the label's Visibility value changes immediately.
However, when the custom "IsDone" value is toggled the label's Visibility is not changed until the appointment is closing/saving.
I would like controls bound to the values of custom properties to work like they do for the base IsAllDayEvent property. What am I missing?
Thanks
Here is the XAML I modified in the sample project. I'd be happy to zip the project and send it if that would help?
<StackPanel Orientation="Horizontal">
<CheckBox Content="Is done?"
IsChecked="{Binding Occurrence.Appointment.IsDone, Mode=TwoWay}"/>
<TextBlock Text="Appt Is DONE"
Visibility="{Binding Occurrence.Appointment.IsDone, Converter={StaticResource BooleanToVisibilityConverter}}" />
</StackPanel>
<StackPanel Orientation="Horizontal" >
<CheckBox Content="IsAllDayEvent"
IsChecked="{Binding IsAllDayEvent, Mode=TwoWay}"/>
<TextBlock Text="Appt Is All Day"
Visibility="{Binding IsAllDayEvent, Converter={StaticResource BooleanToVisibilityConverter}}"/>
</StackPanel>
This is the class w/ the custom IsDone property:
public class Task : Appointment
{
private bool isDone;
public bool IsDone
{
get
{
return this.Storage<Task>().isDone;
}
set
{
var storage = this.Storage<Task>();
if (storage.isDone != value)
{
storage.isDone = value;
this.OnPropertyChanged(() => this.IsDone);
}
}
}
public override IAppointment Copy()
{
var newAppointment = new Task();
newAppointment.CopyFrom(this);
return newAppointment;
}
public override void CopyFrom(IAppointment other)
{
var task = other as Task;
if (task != null)
{
this.IsDone = task.IsDone;
}
base.CopyFrom(other);
}
}
I modified a Telerik sample project I found to demo the issue.
In my example, I have 2 checkboxes:
- Is done?
- IsAllDayEvent
When checked, a label should be displayed to the right of each checkbox.
http://www.youtube.com/watch?v=funpvUMb6_Y&feature=youtu.be
You can see in the video that when the IsAllDayEvent value is toggled, the label's Visibility value changes immediately.
However, when the custom "IsDone" value is toggled the label's Visibility is not changed until the appointment is closing/saving.
I would like controls bound to the values of custom properties to work like they do for the base IsAllDayEvent property. What am I missing?
Thanks
Here is the XAML I modified in the sample project. I'd be happy to zip the project and send it if that would help?
<StackPanel Orientation="Horizontal">
<CheckBox Content="Is done?"
IsChecked="{Binding Occurrence.Appointment.IsDone, Mode=TwoWay}"/>
<TextBlock Text="Appt Is DONE"
Visibility="{Binding Occurrence.Appointment.IsDone, Converter={StaticResource BooleanToVisibilityConverter}}" />
</StackPanel>
<StackPanel Orientation="Horizontal" >
<CheckBox Content="IsAllDayEvent"
IsChecked="{Binding IsAllDayEvent, Mode=TwoWay}"/>
<TextBlock Text="Appt Is All Day"
Visibility="{Binding IsAllDayEvent, Converter={StaticResource BooleanToVisibilityConverter}}"/>
</StackPanel>
This is the class w/ the custom IsDone property:
{
private bool isDone;
public bool IsDone
{
get
{
return this.Storage<Task>().isDone;
}
set
{
var storage = this.Storage<Task>();
if (storage.isDone != value)
{
storage.isDone = value;
this.OnPropertyChanged(() => this.IsDone);
}
}
}
public override IAppointment Copy()
{
var newAppointment = new Task();
newAppointment.CopyFrom(this);
return newAppointment;
}
public override void CopyFrom(IAppointment other)
{
var task = other as Task;
if (task != null)
{
this.IsDone = task.IsDone;
}
base.CopyFrom(other);
}
}