Hi,
As the title says, when the XamDayView loads I need to guarantee that a specific Time slot is visible.
For example: if someone opens the XamDayView and the first appointment occurs at 10 AM, I want to display that particular timeslot at 10AM so that the appointment is visible (the display needs to be scrolled to make that particular time slot visible)
I'm searching for a functionality equal to EnsureTimeSlotVisible that exists for UltraDayView.
Is there something similar for XamDayView? If not, how can this be done?
Best Regards.
Currently this functionality is not directly supported. In order to possibly get this feature into a future release, please submit a feature request at the following webpage:
http://devcenter.infragistics.com/Protected/RequestFeature.aspx
Ok, but is there a workaround or any way to achieve this?
Maybe this will be useful to you:
private void XamDayView1_Loaded(object sender, RoutedEventArgs e)
{
ScrollBar scrollBar = (ScrollBar)Infragistics.Windows.Utilities.GetDescendantFromName(XamDayView1, "TimeslotScrollBar");
double nowOffset = (DateTime.Now.Hour + 1) / 24.0;
scrollBar.Value = nowOffset * scrollBar.Maximum;
}
This code scrolls the current hour into view if you have viewable 24 hours in the day view. Hope this helps.
Thanks,
Diyan Dimitrov
Hi
Is the above scrollbar calculation dependent on TimeSlot interval setting?
If yes, how can we take that into account?
thanks
Steven
Hello Steven,
The calculations Vlad made, are not related to the TimeSlot's Interval.
Hope this helps you.
Is this still not done? I also need this and opened a feature request now: http://ideas.infragistics.com/forums/192363-wpf/suggestions/6363676-scroll-the-xamdayview-control-to-a-certain-time-of
Hello Will,
Thank you for your feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well.
Thanks again.
after some research, i have another workaround, which is to use dispatcher to invoke auto-scrolling, the code is like the following:
private void dayView_OnLoaded(object sender, RoutedEventArgs e){ Dispatcher.BeginInvoke(new Action(ScrollToDesiredPosition), DispatcherPriority.ContextIdle, null);}private void ScrollToDesiredPosition(){ var scrollBar = (ScrollBar)Infragistics.Windows.Utilities.GetDescendantFromName(dayView, "TimeslotScrollBar"): scrollBar.Value = [whatever your algorithm is];}
thank you for your reply Stefan, however my question is whether this is a valid workaround, has anybody tried it?
when i overload the loaded event as it suggested, i could set the value of scrollbar, however later in code the value is reset again.
from the stack trace this is shows:
InfragisticsWPF4.Controls.Schedules.v12.2.dll!Infragistics.Controls.Schedules.ScheduleTimeControlBase.BringTimeslotIntoView(System.DateTime datetime, double? timeslotOffsetPercent, bool useNearestTime) + 0x7d3 bytesInfragisticsWPF4.Controls.Schedules.v12.2.dll!Infragistics.Controls.Schedules.ScheduleTimeControlBase.PerformInitialScrollIntoViewImpl() + 0x2cc bytes InfragisticsWPF4.Controls.Schedules.v12.2.dll!Infragistics.Controls.Schedules.ScheduleTimeControlBase.PerformInitialScrollIntoView() + 0x7e bytesInfragisticsWPF4.Controls.Schedules.v12.2.dll!Infragistics.Controls.Schedules.ScheduleTimeControlBase.OnPostVerifyState() + 0x27 bytesInfragisticsWPF4.Controls.Schedules.v12.2.dll!Infragistics.Controls.Schedules.ScheduleControlBase.VerifyState() + 0x4f5 bytes
how do i setup to make it not recalculate scrollbar min & max and reset value? or is there any other event that happens after Loaded that i can catch to set it back?
I beliove that the solution Vlad gave is the best for the moment, but if I think of a better one I will let you know.