ListBox won't scroll by dragging on mobile
When I drag my finger on the list it just selects whatever item is under it. The wanted behavior is that, instead of selecting, it would scroll the list.
Code: Select all
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height=".5*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<ListBox Margin="5" ItemsSource="{Binding AvailableCharacters}"
SelectedValue="{Binding SelectedAvailableCharacter}">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid>
<TextBlock Text="{Binding Name}"
FontSize="50"/>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
....
</Grid>
-
sfernandez
Site Admin
- Posts: 2983
- Joined:
Re: ListBox won't scroll by dragging on mobile
Hi,
Are you able to reproduce the problem using our samples? could you please try the Control Gallery demo in your device and load the ListBox sample? Is scroll drag working?
In Unity we have a toggle to simulate touch inputs with mouse and I just verified that dragging a ListBox scrolls it fine.
Are you using your own style+template for the ListBox? Because you probably need to set the ScrollViewer.PanningMode to VerticalOnly (or VerticalFirst) to allow touch to drag the scroll.
Regards.
Are you able to reproduce the problem using our samples? could you please try the Control Gallery demo in your device and load the ListBox sample? Is scroll drag working?
In Unity we have a toggle to simulate touch inputs with mouse and I just verified that dragging a ListBox scrolls it fine.
Are you using your own style+template for the ListBox? Because you probably need to set the ScrollViewer.PanningMode to VerticalOnly (or VerticalFirst) to allow touch to drag the scroll.
Regards.
Re: ListBox won't scroll by dragging on mobile
Some of the samples work. The scoreboard example doesn't drag, but the control gallery does. No, the ListBox does not use any custom style.
Re: ListBox won't scroll by dragging on mobile
Are you setting the PanningMode property to VerticalOnly as explained in the Touch tutorial ?
Re: ListBox won't scroll by dragging on mobile
Is that required? I looked at some of the examples, like QuestLog, and I don't see their ListBox have any of those properties assigned. I set them and they didn't change anything.
-
sfernandez
Site Admin
- Posts: 2983
- Joined:
Re: ListBox won't scroll by dragging on mobile
The Scoreboard sample is using a ScrollViewer (line 226) around the ItemsControl, and that scroll viewer doesn't have the PanningMode set. To enable touch scrolling there you can add PanningMode="VerticalOnly" and it will work.
ListBox and ListView default templates already include its own ScrollViewer with the property PanningMode set to VerticalFirst, so you don't need to explicitly set it in those cases.
ListBox and ListView default templates already include its own ScrollViewer with the property PanningMode set to VerticalFirst, so you don't need to explicitly set it in those cases.
Re: ListBox won't scroll by dragging on mobile
Could you paste here a minimal XAML for testing in XamlPlayer reproducing your issue?
By the way, I tried contacting you in private, you should change your username to avoid exposing your email.
By the way, I tried contacting you in private, you should change your username to avoid exposing your email.
Re: ListBox won't scroll by dragging on mobile
A simple listbox in a grid has it happen. The only thing that is different is that I'm applying a scale to my root view.
Besides that, a simple ListBox like this does not allow me to touch scroll (with emulate touch enabled)
Code: Select all
public partial class RootPageView : UserControl
{
public RootPageView()
{
this.InitializeComponent();
this.SizeChanged += this.WindowSizeChangedEventHandler;
}
#if NOESIS
void InitializeComponent()
{
Noesis.GUI.LoadComponent(this, "Assets/Project/Source/Views/Pages/RootPageView.xaml");
}
#endif
private void WindowSizeChangedEventHandler(object sender, SizeChangedEventArgs e)
{
const float referenceWidth = 600,
referenceHeight = 1200;
double width = this.ActualWidth,
height = this.ActualHeight;
var scale = Math.Min(width / referenceWidth,
height / referenceHeight);
Grid control = (Grid)FindName("Root");
ScaleTransform scaleTransform = (ScaleTransform)control.LayoutTransform;
scaleTransform.ScaleX = scaleTransform.ScaleY = (float)scale;
}
}
Code: Select all
<Grid Name="Root">
<Grid.LayoutTransform>
<ScaleTransform/>
</Grid.LayoutTransform>
Code: Select all
<ListBox ItemsSource="{Binding Game.Player.Characters}" Height="200"
SelectedValue="{Binding SelectedCharacter}"
ScrollViewer.PanningMode="VerticalOnly">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}" FontSize="50"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
-
sfernandez
Site Admin
- Posts: 2983
- Joined:
Re: ListBox won't scroll by dragging on mobile
I recreated that same sample and is working for me with the 'Emulate Touch'.
I can even remove the ScrollViewer.PanningMode value set in the ListBox (because it's being set by the default template) and still works.
It's very strange... could you please create a ticket in our bugtracker and attach the whole project (you can make the ticket private if you want to)?
I can even remove the ScrollViewer.PanningMode value set in the ListBox (because it's being set by the default template) and still works.
It's very strange... could you please create a ticket in our bugtracker and attach the whole project (you can make the ticket private if you want to)?
Re: ListBox won't scroll by dragging on mobile
It randomly started working again. I'm not exactly sure why. I'll have to check my past commits.
Who is online
Users browsing this forum: Google [Bot], vinick and 66 guests