Can't find an element on iOS in my xamarin ui tests - xamarin

I wrote some tests on android and now I'm trying to make it compatible to iOS too.
I have some picker :
enter image description here
I gave the picker automation id and also to the label inside him so I can read it text,
in android I succeed but in iOS I can't even see the label.
tree repl in iOS :
Ios repl tree
tree repl in android:
android repl tree
the xaml code:
<scrControls:ScrPickerWithBorder
x:Name="SleepStartPicker"
Grid.Row="1"
Grid.Column="1"
Margin="0"
ArrowColor="{StaticResource LableTextColor}"
AutomationId="SleepStartPicker"
BackgroundColor="{StaticResource EntryBackgoundLite}"
BorderColor="#C9D0D5"
CornerRadius="5"
HeightRequest="50"
HorizontalOptions="FillAndExpand"
ItemsSource="{Binding SleepStartOptions}"
SelectedIndex="{Binding SelectedSleepStartIndex}"
TextColor="{StaticResource EntryTextColor}"
VerticalOptions="FillAndExpand"
TextAutomationId="HouseholdScrStartPickerLabel"/>
why this is happening ?
how can I read the label's text ?

Related

How to make this progress bar vertically in xamarin forms

I want to create this ui design in xamarin forms, as progress bar should look like this vertically.
To make the ProgressBar vertical, I have an easy solution for that.You can refer to the XAML below. It could help you.
Xaml:
<StackLayout Rotation="-90" VerticalOptions="CenterAndExpand" HorizontalOptions="CenterAndExpand">
<ProgressBar Progress="1" ProgressColor="Orange" >
</ProgressBar>
</StackLayout>

.Net Maui Collectionview frame with label issue

I was wondering if anyone else is experiencing this issue with the latest .Net maui preview(Version 17.2.0 Preview 1.0)
<CollectionView ItemsSource="{Binding EventList}" x:Name="Events_CollectionView" ItemsLayout="VerticalList" SelectionMode="Single">
<CollectionView.ItemTemplate>
<DataTemplate>
<Frame>
<StackLayout Margin="0,0,0,0">
<Label Text="{Binding Seconds}" FontSize="35" FontAttributes="Bold" TextColor="White" HorizontalOptions="End"/>
</StackLayout>
</Frame>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
This displays the seconds of my countdown and gets updated every second. The result:
You can see the edge of the screen and where it gets cut off.
Here is an example when the frame is removed leaving just the stack layout in the data template:
Edit:
It appears not to just apply to frames but when I have a stacklayout inside of a stacklayout in the collectionview it appears to produce a similar result.
It seems that adding a width request to the Label allowed the full text to be displayed.

Editor not supporting scrolling inside the list view for Xamarin.Forms(Android and iOS)

I have an Editor control inside ListView. If the text is larger than Editor height, I want to be able to scroll the Editor without clicking inside the Editor. But ListView scroll only working, Editor scroll not working.
<ListView
x:Name="listProjects"
HasUnevenRows="true"
SeparatorVisibility="None"
ItemsSource="{Binding Feedbacks}"
HorizontalOptions="FillAndExpand"
ItemTapped="Handle_ItemTapped">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout Padding="15,15,15,15" BackgroundColor="Transparent">
<Editor HeightRequest="50" FontSize="Small"/>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
You can use a ScrollView to wrap the Editorlike following code.
<ScrollView HeightRequest="50">
<Editor Text="22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222" ></Editor>
</ScrollView>
Here is running GIF.
And please update Xamarin forms nuget packages to 4.7.0.1179 or later.

How to make icon size same in landscape mode and potrait mode in xamarin forms

I am a beginner in xamarin.forms. I am using Xamarin.forms Absolute layout for identifying the message count. When in potrait mode, it works fine. In landscape mode, it is giving an enlarged icon. Is there a way we can change this ? Please suggest .
Here is my Xaml file:
<effect:BudocodeButton x:Name="chatMsgCnt" AbsoluteLayout.LayoutBounds=".9,0,.4,.9" BorderRadius="12"
AbsoluteLayout.LayoutFlags="PositionProportional,SizeProportional" BackgroundColor="Red" TextColor="White" FontSize="Medium" Text="{Binding ChatMsgCount}" FontAttributes="Bold" >
landscapeimg
potraitimage
Make your hight and the width static for the view and set AbsoluteLayout.LayoutFlags to X&Y Proportional.
Code:
<effect:BudocodeButton
x:Name="chatMsgCnt"
AbsoluteLayout.LayoutBounds=".9,0,60,60"
BorderRadius="12"
AbsoluteLayout.LayoutFlags="XProportional,YProportional"
BackgroundColor="Red"
TextColor="White"
FontSize="Medium"
Text="{Binding ChatMsgCount}"
FontAttributes="Bold">

WP7 - Problem with DataTemplate on emulator but not On Blend

This is the code:
<ItemsControl x:Name="ContactsControl" ItemsSource="{Binding Contacts}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid>
<TextBlock Text="{Binding ElementName=ContactsControl, Path=DataContext.PageName}" />
</Grid>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
On the TextBlock I want to get date from the ItemsControl data context, so I use ElementName and in the 'Path' I use Path=DataContext.PageName.
So, On Blend I can see the data on the TextBlock as it should be, but when I run the emulator I cant see the data...
Why is it?
I'm working with VS2010 and Blend 4.
Thanks.
You are binding an items control to a list of Contacts. Traditionally you will then bind the textblock to a property of the class contained in the list. Why are you binding to another control and then bringing datacontext into the equation? Doesn't seem like something you normally do with a list.

Resources