How to scroll smoothly ScrollViewer in Windows 8 Metro App? - c#

I have such question: I have a ScrollViewer in my XAML/C# app for windows 8. Inside the ScrollViewer there is a Grid with dinamic count of Columns, I set ColumnDefenitions in code when program is loaded. But when I tryed to Scroll this grid in ScrollViewer with
scrollViewer.ScrollToHorizontalOffset(myOffset);
It scroll instantly, but I want it to scroll while some time, smoothly. Help me plz how can I do it?

It can be achieved using Storyboard, see following example (which can be also applied even to Windows Phone 8):
http://blogs.msdn.com/b/delay/archive/2009/08/04/scrolling-so-smooth-like-the-butter-on-a-muffin-how-to-animate-the-horizontal-verticaloffset-properties-of-a-scrollviewer.aspx
Edit:
New link: http://dlaa.me/blog/post/9857745 (backup)

Related

Extended StackPanel in universal app C#

I'm used to windows forms but I'm trying to get the hang of the universal apps. I need an alternative to FlowLayoutPanel from windows forms, I'm trying to make the stack panel work in similar way but it's there's one problem - if my items reach the border of the panel they wont get to the next line they will simply move out of the visible area and appear invisible. What can i do about this ?
You are looking for VariableSizedWrapGrid

UWP GridView drag drop not working

I am moving my windows 8.1 app to Windows 10 UWP. I am able to port it fine. But the drag drop functionality with GridView / ListView seems to be not working.
I have got the CanDragItems="True" set on GridView and AllowDrop="True" on the target as specified in the documentation. This was working fine on windows 8.1 but not with Windows 10 UWP. I cant find any documentation related to this for any specific setting to be added for Window 10 UWP to enable this functionality. When I drag items from the view, it shows restricted icon while I drag the item.
Can someone advice how to fix this issue?
regards

Dynamic/Adaptive Gridview to have itemtemplates stretch using RelativePanel in Win10 XAML

I would like to reproduce the News app in Win10 and have my ItemTemplate resize/stretch depending the size on my Window and also be able to move around depending on the size of the windows (so that this can work for Phone and Tablet apps).
I have tried using RelativePanel with a Listview but my items are not resizing, should I be trying to use a Gridview and work with VariableSizedGridView?
Does it look like this application is using 2 Gridview that are stack one on another with 2 different visual states depending on the size of the window?
Here are screenshot of the app and a video of the smooth effect that i would like to reproduce:
http://www.dailymotion.com/video/k47ZXBmcfBWnd0dbp9M
Edit:
It looks like they used an ItemTemplateSelector to have a different style on the first two elements. but I am having issues getting my elements to stretch.
Screenshots:

Creating a slideshow in windows phone 8 without using pivot app

I'm writing a windows 8 app wich basically does nothing when you open it (everything is done in background task and the user doesn't see it) so I need to display a kind of slideshow on the main page of the app just so it looks like something and not just a blank page.
My problem is I can't use the pivot app template, I need to start from a blank template.
So I'd like to know what is the most simple way of doing this ? By the way, I need the slideshow to switch between the images automatically (with a timer that I can set) but the user can switch himself if he wants to
Thank you :)
You say You can't use the pivot app template and want to start using a blank template.
You can however add pivot as a control once you start with a blank template.
If Not using pivot is your aim, then try panorama.
Start from a blank template and add panorama control to it. Panorama can also help you to get a nice sliding effect like in a slideshow.
you can have images in stackpanel and detect Flick Gestures whether left to right or viceversa through HorizontalVelocity of Flick events.

WebView mouse wheel scrolling issue in Windows 8

I am using a ListView and a WebView in single page. Now the problem is that I am unable to scroll using mouse wheel in WebView if I keep switching between ListView and WebView. In order to scroll WebView I have to click on it first which I don't want. I found lot of people are facing the same problem but there is no suitable answer. Following are some of them:
http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/7f1ac033-eaba-495a-92a5-699acaaa5484/
http://connect.microsoft.com/VisualStudio/feedback/details/753422/webview-in-windows-8-does-not-gain-focus-automatically-when-hovering-mouse-back-to-it
I found out Yahoo mail app in store. It has the similar interface as mine (ListView and a preview) and works flawlessly. There is no problem in scrolling if you switch between ListView and preview. I am not able to find if they are using the WebView or some other HTML control.
Different UI stacks don't usually work well together and Yahoo! Mail is an html app so it doesn't suffer from that problem. If you don't need the WebView to animate you could try switching it to a WebViewBrush when it is inactive and only show the actual WebView when it's updating content. Then you could perhaps handle mouse events on a Rectangle filled with that WebViewBrush by invoking some JavaScript in the WebView to scroll the content. Other than that I think while there might be some other hacks to get it to work perfectly - but it might take you days if not weeks of research that is still likely to fail.

Categories