This issue is similar to this issue.
We're using the RadScheduleView only with MonthViewDefinition.
There's room on the screen for 4 weeks only (and Oct. 2011, for example, takes 6 weeks: 25/09/2011 is the first week, 30/10/11 is the last).
When the view is scrolled to its top (Showing first 4 weeks), and an appointment is being selected (from an external list, updated via binding of SelectedAppointment) that starts on the 5'th week, ScrollIntoView method does not scroll to the proper week, and the appointment, although being selected, stays off the view.
We're using this attached behavior:
What am I missing?
Thanks in advance,
Idan Felix.
We're using the RadScheduleView only with MonthViewDefinition.
There's room on the screen for 4 weeks only (and Oct. 2011, for example, takes 6 weeks: 25/09/2011 is the first week, 30/10/11 is the last).
When the view is scrolled to its top (Showing first 4 weeks), and an appointment is being selected (from an external list, updated via binding of SelectedAppointment) that starts on the 5'th week, ScrollIntoView method does not scroll to the proper week, and the appointment, although being selected, stays off the view.
We're using this attached behavior:
public
static
class
RadSchedule
{
public
static
bool
GetEnsureVisibilityOfSelectedAppointments(DependencyObject obj)
{
return
(
bool
)obj.GetValue(EnsureVisibilityOfSelectedAppointmentsProperty);
}
public
static
void
SetEnsureVisibilityOfSelectedAppointments(DependencyObject obj,
bool
value)
{
obj.SetValue(EnsureVisibilityOfSelectedAppointmentsProperty, value);
}
public
static
readonly
DependencyProperty EnsureVisibilityOfSelectedAppointmentsProperty =
DependencyProperty.RegisterAttached(
"EnsureVisibilityOfSelectedAppointments"
,
typeof
(
bool
),
typeof
(RadSchedule),
new
UIPropertyMetadata(
false
, EnsureVisibilityChanged));
private
static
void
EnsureVisibilityChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if
(d ==
null
)
{
throw
new
ArgumentNullException(
"d"
);
}
var view = d
as
RadScheduleView;
if
(view ==
null
)
{
throw
new
NotSupportedException(
"This attached behavior can only be set on a Telerik RadScheduleView."
);
}
var shouldEnsureVisibility = (
bool
)e.NewValue;
if
(shouldEnsureVisibility)
{
view.AppointmentSelectionChanged += view_AppointmentSelectionChanged;
}
else
{
view.AppointmentSelectionChanged -= view_AppointmentSelectionChanged;
}
}
static
void
view_AppointmentSelectionChanged(
object
sender, System.Windows.Controls.SelectionChangedEventArgs e)
{
if
(sender ==
null
)
{
throw
new
ArgumentNullException(
"sender"
);
}
var view = sender
as
RadScheduleView;
if
(view ==
null
)
{
throw
new
NotSupportedException(
"This attached behavior can only be set on a Telerik RadScheduleView."
);
}
if
(view.SelectedAppointment ==
null
)
{
return
;
}
view.ScrollIntoView(view.SelectedAppointment,
true
);
// According to http://www.telerik.com/community/forums/wpf/scheduleview/scrollntoview-not-working.aspx,
// this should have solved this issue:
view.CurrentDate = view.SelectedAppointment.Start.Date;
}
}
What am I missing?
Thanks in advance,
Idan Felix.