How to apply UI virtualization to ScrollViewer in WinRT - windows-8

Is it possible to apply UI virtualization to ScrollViewer in WinRT. In my application I am creating a line chart with the help of Polyline(Polyline embedded inside a scrollviewver). But in the current case, If it come more than 500 points. It blocks the UI during the time of interacting with the Map. So what I am trying to achieve is to apply kind of UI virtualization to scroll view. If anyone had any idea to solve this please help me.

The way I would handle a Polyline is I would break its data into sections, perhaps screen-wide ones (assuming horizontal-only scrolling), put a Canvas inside of the ScrollViewer, make the size (Width) of the Canvas the total size of the chart and put a few (say 5) Polyline controls in it and then on the ViewChanged event update the Polyline controls' Canvas.Left and Points properties to correspond to the area around the current view port of the ScrollViewer. That should give you smooth scrolling. Just don't add/remove or update the controls on each ViewChanged and only update Canvas.Left and Points when you need to - that is when you don't have a Polyline ready to display next to the current view port.

Related

Drag using Toolkit Gestures goes crazy on Landscape Orientation

In a WP8 app, I have a ListBox bound to an ItemsSource with a Grid as it's ItemsPanelTemplate. The layout of the Grid might be different each time (different number of rows/columns) based on user selection and I'm using a helper class in order to bind the ItemsPanelTemplate Grid's Row and Column Definitions to values read from a database.
The user can add item's to the app and assign each item to a Grid cell in the ListBox. Each item can "sit" in multiple Grids (a many-to-many relationship), which led me to use another binding helper class in order to set the bindings of Grid.Row and Grid.Column attached properties in the ListBox.ItemContainerStyle, bound to a property of the ItemsSource class.
Another requirement is to have the app in Portrait orientation when Rows.Count >= Columns.Count and in Landscape when the columns are more.
I'm also using the Toolkit Gestures for drag and drop operations.
The issue in question, is a drag issue on Landscape orientation. While everything works great on Portrait, while on Landscape orientation the ListBox goes crazy. The dragging happens to different cell's that those actually being dragged and some of them don't even raise the gesture events (DragStarted, DragDelta, DragCompleted).
I'm lost here, don't know what the issue might be, or how to solve this.
Need your lights please.
Here is a sample that illustrates the problem.
EDIT
Phew, it's a bug of the GestureListener on the toolkit. It does not respect the Landscape orientation and treats the UIElements as if they were rendered in Portrait.
Using the Manipulation Events instead, which work properly. Can I have my 50 bounty points back? :P
If it is not gesture listener but Manipulation Event you are looking at there is couple of good questions out there:
Drag and drop from list to canvas on windows phone with MVVM
Moving Object in ScrollViewer

Adding Stationary New Items/Shapes To UI - Windows Store App

I'm sure this issue must have a very straightforward answer but I can't seem to find it. Any help is much appreciated.
Whenever a new item is added to the UI, either at runtime or dynamically once the program is running, it slides into view to reach its position (with inertia). Only when it reaches that point are certain properties applied: like transform properties or opacity values. For example, if a rectangle set to 50% opacity is added when a button is tapped, it will slide onto the screen about 30 points from its actual position at 100% opacity, reach the correct position and then change to the correct 50% opacity.
I would like to be able to turn off this default behavior so the rectangle appears immediately at the correct position with all the properties set.
I've found that I'm asking two separate questions and that both have been answered on this site (links below).
Individual objects can be targeted using the Transitions property under Miscellaneous in Visual Studio 2012.
How to remove EntranceThemeTransition from object or container in Windows 8 Store Apps?
RenderTransform occurs after EntranceThemeTransition on a TextBlock

how can i implement dynamic navigation/group header positioning in a winrt app?

I know the title is a little confusing, but the best way to describe what I'm after is by running the Weather metro app on the Consumer Preview; as you scroll horizontally, you'll note that the section headings kind of move around and stay on top of the relevant content, and then fade out as you cross over into a new section. (The main background for the first section also kind of does this)
My question is, how would I go about replicating this behavior in a WinRT app of my own? Are there any existing controls I can leverage or would I have to essentially rewrite it all?
This looks just like a ScrollViewer - you would handle the ViewChanged event and depending on the scroll offset - change the opacity of overlaid static TextBlocks and completely hide the ones that scroll once you cross specific tresholds. I don't think there is anything like that that does it, but I can build it.

Resizing a component added to the canvas by dragging along the edge

I am developing an application where I need to place rectangular slabs of different shapes to create the shape of a Bench Top. I am placing the rectangular slabs of different shapes(I am using a the Canvas container as the slab) in a repeater and dragging them on the main canvas. One functionality that needs to be implemented is the ability to resize these slabs once the are dragged from the repeater into the drawing canvas by dragging along their edges like we resize the windows that we normally see. Is there any way this can be done.
I just found an component developed for the purpose
http://www.rogue-development.com/objectHandles.html
I am going to check it out.
Please inform if anyone has any other solutions.

Scale a canvas inside a templated usercontrol

I created a templated usercontrol from a button in order to use common states etc. What I dont get is how to scale a canvas inside the template. I created a little drawing with lines but they do not scale/transform with the control when I use it.
Most interesting would be if that is possible using xaml element binding (I am playing with SL3).
Regards Mario
I would use a Grid and set it's Height and Width to Auto. If yo addi items to the rows and columns and they are all set to stretch the stuff nside the grid will automatically resize. Not sure if that is what you are asking but that is what comes off the top of my head.