how to get DayCell focused
Hi there,
i want to show a Popup window when some Day Cell is highlighted, like Mouse Over Effect. But there isn't any mouse over event. Could you help me. Thanks a lot!
Best regards
Wenkai
SIGN IN To post a reply.
3 Replies
KR
Kannan R
Syncfusion Team
November 18, 2018 06:15 AM UTC
Hi Wenkai,
Thank you for contacting Syncfusion Support.
We have prepared simple example for your reference. In this example, we have configured DateCell MouseEnter event of today’s date alone.
For example:
If today’s date is 18th November, 2018 and then event will be raised for that.
Code Snippet : [C#]
|
public ViewModel()
{
LoadedCommand = new DelegateCommand<object>((calendar) =>
{
date.Year = DateTime.Now.Year;
date.Month = DateTime.Now.Month;
date.Day = DateTime.Now.Day;
DayGrid grid = VisualUtils.FindDescendant((calendar as CalendarEdit), typeof(DayGrid)) as DayGrid;
IEnumerable<Visual> cells = VisualUtils.EnumChildrenOfType(grid, typeof(DayCell));
foreach (DayCell cell in cells)
{
// This event will be called only for current Date Cell
if(cell.Date == date)
cell.MouseEnter += Item_MouseEnter;
}
});
}
private void Item_MouseEnter(object sender, System.Windows.Input.MouseEventArgs e)
{
DayCell cell = sender as DayCell;
CalendarEdit calender = VisualUtils.FindAncestor(cell,typeof(CalendarEdit)) as CalendarEdit;
DateTime datetime = cell.Date.ToDateTime(calender.Calendar);
MessageBox.Show("Mouse hovered on "+ datetime.DayOfWeek + ", " + datetime.ToString("MMMM") + " " + datetime.Day + ", " + datetime.Year);
}
|
Sample: http://www.syncfusion.com/downloads/support/directtrac/general/ze/CalenderEdit_sample1811329402.zip
Note: Similarly you can make use this approach to configure based on your requirement.
Please let us know if it helps.
Regards,
Kannan
WW
Wenkai Wang
November 22, 2018 01:18 PM UTC
Hi Kannan,
thanks for your sample! It's really helpful. May I ask you one more question? If I switch the month view, for example click the arrow to December and go back to November again, then the MouseEnter event can not be fired any more. Could you please try the workflow which I mentioned, and modify the code?
Best regards
Wenkai
KR
Kannan R
Syncfusion Team
November 23, 2018 09:47 AM UTC
Hi Wenkai,
Thank you for your update.
We have checked and confirmed the reported case “DayCell MouseEnter event not invoked after changed the Month” in CalendarEdit is a defect. A support incident to track the status of this defect has been created under your account. Please log on to our support website to check for further updates
Regards,
Kannan
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
WW Wenkai Wang
- Nov 15, 2018 03:33 PM UTC
- Nov 23, 2018 09:47 AM UTC