Native Script ScrollView and AbsoluteLayout - scrollview

Im new to NS and I have a project. I want a Button floating inside a ScrollView.
<ScrollView>
<StackLayout orientation="vertical">
<AbsoluteLayout >
<Button top="0" left="0" right="0" text="Test" style="font-size: 10; margin:5; " />
</AbsoluteLayout>
<Label text="Trending Now: " cssClass="trending-label" />
<Repeater items="{{ categories }}">
<Repeater.itemTemplate>
.
.
.
</Repeater.itemTemplate>
</Repeater>
</StackLayout>
</ScrollView>
But its not working. The Button is also scrolling. I want the Button to be floating on ScrollView. Thank you.

The reason why the button is scrolling together with the other items is that everything is situated in a ScrollView. In order to have only the Label and the Repeater scrolling, the Button should be placed outside of it.
Another thing I have noticed is that on the Button, simultaneously are applied left and right alignment, which might cause a problem.
I made a possible implementation of the float button, which you can check here.

Related

Is it possible to detect where the swipe happens in Net MAUI?

I'm writing a .Net MAUI application and am using SwipeGestureRecognizer. This is all working great. But what I can seem to find is if you can detect where the swipe occurred.
.xaml
<Grid x:Name="myGrid" >
<Grid.GestureRecognizers>
<SwipeGestureRecognizer Direction="Right" Swiped="SwipeGestureRecognizer_Swiped" />
</Grid.GestureRecognizers>
...
.xaml.cs
private void SwipeGestureRecognizer_Swiped(object sender, SwipedEventArgs e)
{
...
}
But I specifically want to detect if you swipe in from an edge, primarily so I can show a popout menu on the edge. I can see nothing in the event args (of the Swiped event that I could use to detect where the swipe happened.
Consider the image attached. How can I tell (or detect) the difference between the wholly on-screen swipe action (green) from the off-screen swipe action (red). Some location parameters would be perfect, but they don't seem to exist.
I can't see anything in the MAUI docs to suggest this is even possible
Does anyone know if there is any way to achieve this, please?
Thanks?
It's not an elegant solution but you can place an invisible BoxView on the left:
<Grid>
<BoxView
HorizontalOptions="Start"
VerticalOptions="Center"
WidthRequest="40"
Color="Transparent">
<BoxView.GestureRecognizers>
<SwipeGestureRecognizer
Direction="Right"
Swiped="SwipeGestureRecognizer_Swiped"
Threshold="25" />
</BoxView.GestureRecognizers>
</BoxView>
<!-- your content -->
<VerticalStackLayout Margin="15,0,0,0">
<Button />
<Label Text="label" />
</VerticalStackLayout>
</Grid>
I have decreased the value of Threshold because the swipable distance is small.

How do I add padding to a Xamarin Forms CollectionView?

The CollectionView in Xamarin Forms does not support the Padding Property. Therefore the last item in the collection can be hidden behind overlaying items higher in the z-stack, like floating action buttons. Is there a workaround for this?
The best workaround I found is to use the Footer property of collectionview and add an empty, fixed height, transparent StackLayout to act as the missing padding.
<CollectionView ItemsSource="{Binding Items}" ... >
<CollectionView.Footer>
<!--A fixed height footer,to simulate bottom padding and keep the last item in view when scrolling-->
<StackLayout Padding="0,0,0,70" BackgroundColor="Transparent"/>
</CollectionView.Footer>
</CollectionView>
A simple workaround for that is to create a view that contains it, and create padding on this View. I think it is better than placing a footer.
I wanted to use a floating button in a project but used the Footer also for a button.
Then there is no problem with overlaying .
<CollectionView.Footer>
<StackLayout BackgroundColor="LightGray">
<Button Margin="10,0,0,0"
Text="Friends of Xamarin Monkey"
FontSize="Small"
FontAttributes="Bold"
Clicked="Button_Clicked"/>
</StackLayout>
</CollectionView.Footer>

change direction of nativescript slider

is there a way to make the native script slider RTL?
I want it to move from right to left like this pic
For you case, you could use Slider rotate property. For Example:
<StackLayout class="p-20">
<Slider rotate="180" loaded="slloaded" minValue="0" maxValue="100" value="" />
</StackLayout>

Search Bar inside ViewCell doesn't allow input from keyboard in Android

I'm using Xamarin.Forms and I wanted to put some controls inside a TableView. One of them is a SearchBar, which is inside a ViewCell.
I tested this one in my Android phone and it doesn't allow me to input from keyboard, I tap on it and it doesn't bring keyboard.
Perhaps is bug or I am using the wrong Cell type for a SearchBar.
<ContentPage.Content>
...
<TableView>
<TableRoot>
<TableSection Title="Cliente">
<ViewCell>
<SearchBar x:Name="txtBusquedaCliente" Placeholder="Seleccione..." />
</ViewCell>
<SwitchCell x:Name="swFormato" Text="Shor Format: " ></SwitchCell>
</TableSection>
...
</TableView>
...
</ContentPage.Content>

WindowsPhone ListPicker does not "push down" other elements

Code:
<ScrollView>
<StackLayout VerticalOptions="Start">
<local:myListPicker x:Name="LP"></local:myListPicker>
<Label Text="Push me"></Label>
<Label Text="DOWN"></Label>
</StackLayout>
</ScrollView>
I added four Items to the ListPicker, when I tap on it, it opens, but only the first one can be seen, since it does not "push away" the two labels under it.
It looks like the ListPicker is "behind" the two labels, why is that and how to fix?
Additinol Info:
ExpansionMode equals ExpansionMode.ExpansionAllowed.
With 5 or more Items in the List it gets fullscreen (which is totally OK)