Scroll problem
Hi
I was trying to implement a horizntal scrolling inside a listbox and I have managed to do that but the problem is that it only scrolls partially, that is, it can be scrolled only by 1 element. I think the problem is with the virtualization. This is the code
Is there any workaorund for this?
I also have this problem in a listbox when I use arrow keys to navigate betwen items.
I was trying to implement a horizntal scrolling inside a listbox and I have managed to do that but the problem is that it only scrolls partially, that is, it can be scrolled only by 1 element. I think the problem is with the virtualization. This is the code
Code: Select all
ScrollViewer sv = sender as ScrollViewer;
sv.ScrollToHorizontalOffset (args.Delta);
args.Handled = true;
I also have this problem in a listbox when I use arrow keys to navigate betwen items.
-
- ai_enabled
- Posts: 221
- Joined:
- Contact:
Re: Scroll problem
Hello!
If you need smooth scrolling (pixel-precise), you need to add this attached property to the listbox:
So your XAML will look like this:
(see a good tutorial there http://www.jonathanantoine.com/2011/10/ ... zingpanel/ )
Regards!
If you need smooth scrolling (pixel-precise), you need to add this attached property to the listbox:
Code: Select all
VirtualizingStackPanel.ScrollUnit="Pixel"
Code: Select all
<ListBox ItemsSource="{Binding ItemsCollection}"
VirtualizingStackPanel.ScrollUnit="Pixel" />
Regards!
AtomicTorch Studio Pte. Ltd. http://atomictorch.com
Re: Scroll problem
Thank you for the tip but this is not the problem, my post was a little misleading .
The problem is that for implementig a horizontall scroll I am using a stack panel and then in the code behind I set the scroll position.
The problem is that in the list should be 8 items but are dysplayed only 5, 4 are visible at the beginning and I can scroll by 1 item to the right.
I hope it is a bit more clear what the problem is.
The problem is that for implementig a horizontall scroll I am using a stack panel and then in the code behind I set the scroll position.
The problem is that in the list should be 8 items but are dysplayed only 5, 4 are visible at the beginning and I can scroll by 1 item to the right.
I hope it is a bit more clear what the problem is.
-
- ai_enabled
- Posts: 221
- Joined:
- Contact:
Re: Scroll problem
I see. Since v1.2.6 NoesisGUI using virtualization by default for ListBox control. You could disable it (for the listbox control) and see if that resolves the problem:
If it doesn't help, might you post a sample of your XAML please? Just to demonstrate the issue you have, so we (and NoesisGUI guys) could try it with Kaxaml or Visual Studio and see what could be done to resolve the issue.
Regards!
Code: Select all
VirtualizingStackPanel.IsVirtualizing="False"
Regards!
AtomicTorch Studio Pte. Ltd. http://atomictorch.com
Re: Scroll problem
Hi,
The problem is there even when virtualization is disabled.
This is the xaml code
I also have replaced the StackPanel with VirtualizingStackPanel but the problem is the same.
If I remove the ItemsPanelTemplate property I can't set the orientation of the VirtualizingStackPanel it is always vertical.
The problem is there even when virtualization is disabled.
This is the xaml code
Code: Select all
<ListBox x:Name="ArticleListBox" Padding="10,0,10,0"
ItemsSource="{Binding Articles}"
SelectedItem="{Binding SelectedArticle}"
ScrollViewer.VerticalScrollBarVisibility="Disabled"
ScrollViewer.HorizontalScrollBarVisibility="Hidden"
ScrollViewer.PanningMode="HorizontalOnly"
VirtualizingStackPanel.Orientation="Horizontal"
VirtualizingStackPanel.IsVirtualizing="True">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Width="220" Height="110">
<cv:ImagePreview ImageUrl="{Binding ThumbnailUrl}"/>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox
If I remove the ItemsPanelTemplate property I can't set the orientation of the VirtualizingStackPanel it is always vertical.
-
- ai_enabled
- Posts: 221
- Joined:
- Contact:
Re: Scroll problem
I suppose you will have only a few elements in this listbox, so virtualization is not required.
Maybe you could simply place the listbox control inside a ScrollViewer with horizontal-only scrolling? It will resolve the issue completely.
Maybe you could simply place the listbox control inside a ScrollViewer with horizontal-only scrolling? It will resolve the issue completely.
AtomicTorch Studio Pte. Ltd. http://atomictorch.com
-
- ai_enabled
- Posts: 221
- Joined:
- Contact:
-
-
sfernandez
Site Admin
- Posts: 2062
- Joined:
Re: Scroll problem
Hi Ivan,
Could you please post your xaml with the ListBox and its template, and the events and code behind you used to scroll. I want to verify that nothing is wrong in our side.
I tried with a ListBox using a horizontal StackPanel as items host and it worked as expected.
Thanks.
Could you please post your xaml with the ListBox and its template, and the events and code behind you used to scroll. I want to verify that nothing is wrong in our side.
I tried with a ListBox using a horizontal StackPanel as items host and it worked as expected.
Thanks.
Who is online
Users browsing this forum: No registered users and 2 guests