Forum Xamarin.Forms

How to find out selected date in calendar

LukasBLukasB Member ✭✭

I am trying to assert that current date is selected in calendar. I can see in Repl(); that what makes it selected is that it belongs to some "class": "MonthViewItem > CellTextView"

However I am not able to query for that class. I tried lots of things but none of them works.
For example I was expecting this to work but it doesn't it gives empty array:
app.Query(x => x.Class("MonthViewItem").Class("CellTextView").Marked("Thursday 09/July/2020"));

This doesn't work as well:
app.Query(x => x.Class("MonthViewItem > CellTextView"));

Is there an easy way how to get date which selected in calendar?

Thank you.


  • YelinzhYelinzh Member, Xamarin Team Xamurai

    What control did you use as the picture shown? To get the date, try to use the code like below:

    var results = app.Query (c => c.Class ("numberPicker").Invoke ());
  • LukasBLukasB Member ✭✭

    thanks for the answer.
    I did not use any control yet. Picture is only showing tree of current screen (and it is cut), I just wanted to show that date which is selected on screen, is the one which is in "MonthViewItem > CellTextView".

    Can you explain your query a bit? Should I pass something in .Ivoke()? Because it is required to have argument there. What is the "numberPicker"?

    Thank you

Sign In or Register to comment.