Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

How to find out selected date in calendar

LukasBLukasB Member ✭✭

Hi,
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.

Answers

  • JarvanJarvan 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 ✭✭

    @Jarvan
    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.