I am having a lot of Items(Say 100), I want the user to swipe right and left to see the detailed description of Items.
I thought of using a Pivot Control, but that is causing performance problem because of too many items.
Now, In order to make it lightweight, I want to implement the scenario in a Single page and change the DataContext when the user swipes. I know that swipe gestures can be detected from the toolkit project. Now, I want to animate my grid, when swipe gestures happening exactly like Pivot Page or a Normal Scroll behaviour. I searched a bit, and found that it can be done by creating StoryBoard animation but I am less experienced in that. Any code sample will be helpful. Thanks.
i think you can make archive page and when the user select the item jump to the pivot with selected index
Small possible code sample.
In your page code behand, initialize a Dictionary ( where int is the position and pivotitem the pivot )
Load it up with 3 pivots at start
Than if your Pivot control is called AllPivots, do AllPivots.Items.Add(pivotItem) for each pivot inside the dictionary.
Next thing to do is detect how the user is changing the pivots, so if the selectedindex changes of AllPivots, see if the user advances, if so, add the next pivot into the dictionary and also to the AllPivots.Items and remove the first pivot with AllPivots.Items.Remove.
Each time the user goes back or forward look up the next or previous pivot in the dictionay and perform the correct actions or create new pivots on the fly.
Like I said a dirty hack, but maybe worth a try
Related
I am working on a listview of items and I need to allow user to scroll up/down but I need the bring into view handling to bring the item into view as well as a small part of the next item (in scrollviewer extent). This will indicate to user that there is an item above or below in the list.
I have made a simplified sandbox app to work on this and here are screenshots of what I am trying to do. Arrow indicates scroll direction and the red parens indicate the part I cannot get to show up, meaning the partial amount of the next item.
Please ask if you need anything clarified, I understand this is a complex explanation.
What I have tried:
margin (+/-) on ItemsPresenter/ScrollViewer/ListView
handling ListView.SelectionChanged and using math and various logic to determine direction of scroll and then use ScrollViewer.ChangeView call with calculated vertical offset value.
handling ListView.BringIntoViewRequested and set args.Handled = true and issue new request with various BringIntoViewOptions values, including VerticalOffset, VerticalAlignmentRatio, and new TargetRect with adjusted Y value.
I have read several helpful existing questions here on SO that led me to the BringIntoViewOptions attempt. But nothing so far has worked.
None of these have worked. If I could describe what I want it would be to utilize the existing BringIntoView functionality but bring the item far enough into view that the next item shows a little.
I am using Panaroma control to display list of items. The problem i am facing is that after last item it will again continue to display the items from first . I just want it will go from first to last item in one swipe direction and viceversa in another direction. How to achieve this?
That's the natural behavior of the Panorama control, and I suggest you not to manipulate it. Even if you do it'll be a concern from the user's perspectives as it's the usual behavior in a Windows Phone app.
Disable Panorama looping
If you really wanted to, then have a look at this & How to stop pivot looping.
You cannot stop looping items in a Panorama Control. But you can stop looping Pivot Items by simply setting YourPivot.IsLock=true when you are in the last Pivot Item.
And you can unlock the Pivot, by detecting the swipe direction.
I'm trying to implement a sort of drag functionality into my app. As a simplistic example imagine I have a 2x2 square of buttons, so four buttons total. Clicking a button will perform some other functionality however I want when they hold and drag one of these buttons for it to do something else (ideally if you drag one button and drop it while in the space of another button the two buttons will swap places, as long as I can get dragging and dropping working the swap should be easy).
I've done some research and followed a few tutorials but seemed to get errors at one step or another with all of those. It seems ListViews and GridViews have some drag and drop functionality in them already , but I had trouble properly arranging my buttons (there are many more than four and they are in very specific positions, like a diagram) inside these views, let alone getting drag and drop working with them.
How would I go about doing this? Ideally I could just tag these buttons as draggable, and then on a drag-drop event check for a drop position, then if the position is valid perform a swap method. I just can't seem to figure out how to make them draggable or how to have an event that checks a drop position.
Thanks.
Easy peasy, create a custom control that looks the way you want it to, set ManipulationMode to TranslateX|TranslateY, handle manipulation delta events to update positioning with something like a Canvas or TranslateTransform and when manipulation completes - either make it click or animate to the new position. From my experience - getting any other manipulations to work with a regular Button class just isn't working and since a button is a really simple control - it is easier to create your own than try to extend the existing one in such cases.
I'm making a navigation based application. When the user selects a row on the table view, it goes to the next table. However, depending on how many entries are on the table view, this can be instantaneous, or it can take a while.
Something needs to be shown to the user that the program is working and is not frozen. I was thinking of bringing up a different view with a progress bar on it, but that won't be useful for situations when the next table will load immediately.
I was also thinking of overlaying some kind of progress meter on top of the first table, but instead of a bar it's a circle. Is that possible?
What's the best way to handle this?
Take a look at this example http://github.com/matej/MBProgressHUD. Hope it helps.
Is it posible to use table view to show just one row of a big amount of elements? What I'm looking for is for some kind of horizontal list, like we have in XCode preferences or Aperture image list.
It would behave just like a one columnt table view, but instead of showing the elements vertically, it should be horizontally.
Can you point me to where should I start from?
If you're okay with Leopard-only, The new NSCollectionView supports horizontal display. Just set the collection view's number of rows to 1 in Interface Builder; it'll even handle the horizontal scroll bar for you. The IconCollection sample code provides a simple demonstration of how it works. It's bindings work similarly to a table view's, except instead of rows and columns, each object represented gets an 'item' (an object of type NSCollectionViewItem) that displays it, and those items will be laid out in a grid. The sample code above demonstrates how to set up these 'items' in Interface Builder, which is definitely the easiest way.
With a table view? No. If I'm understanding correctly what you want, in the past I've created my own NSView subclass for this type of control. Define a data source protocol similar to NSTableView, and in your NSView drawRect method, draw the elements in order one by one from left to right. You can either keep track of paging in your control, or put it in a scroll view and resize yourself whenever the number of items changes.
Usually this type of thing starts off pretty simple, and gets a bit complex once you start handling caching, paging, selection, mouse and keyboard input and so on. My advice, start as simple as possible and add new features one by one, only after you've finished the previous task.