I am able to implement drag and drop from one ListView to the other ListView with the help from this blogpost
Windows 8 Drag Drop
I am also able to reoder items in the same ListView
CanReorderItems="True"
But I am not able to drop an item from one ListView control to the other ListView control in the desired location.
Is there any way to find out the position where the drop occurred so that I can insert at that location using Insert method.
http://www.codeproject.com/Articles/536519/Extending-GridView-with-Drag-and-Drop-for-Grouping
The GridViewEx control implements drag and drop for cases which are
not supported by the regular GridView control:
For items panels other than WrapGrid, StackPanel, and VirtualizingStackPanel.
When grouping is enabled.
It also allows adding new groups to the underlying data source if the
user drags some item to the left-most or right-most edges of the
control.
Thank you #Xyroid!! This is exactly what I was looking for
This should help:
XAML ListView and GridView reorder and drag and drop sample (Windows 8.1)
http://code.msdn.microsoft.com/windowsapps/XAML-ListView-and-GridView-6bd77f71
Related
I am trying to populate my windows form with new controls and data based on what is read from my database. The left side of the form is a static panel which will not need re sizing but I need to create multiple labels on the right side which requires more space. I added the vscroll control but am having trouble increasing the size of the right side of the form.
To use a scroll-bar will require a semi-low-level implementation where you need to always update the view by repositioning the elements, calculating your scroll-bar in relation to total view, what elements would be visible and so forth.
A better solution in this case will probably be to add a Panel control on the right which is docked (f.ex. Fill) and then set the AutoScroll property to True.
This way you leave all the "low level" stuff to the Panel control and you can add and position the elements you need to the Panel's Controls collection instead.
The most landing/hub pages you see are just a GroupedGridView ( for example the actual marketplace app )
But I would like to have a Grouped hub page with different controls.
For example my first control is a ListView that contains some categories.
2nd and 3th control are GridViews with several items in them.
If all 3 controls were GridViews I could easily get this working but it's not.
I can't seem to find a working combination of ScrollViewer with a Grid or Stackpanel to get the actual full Horizontal Scrolling working.
Any idea's or examples on how to create such a landing/hub page with different controls in one horizontal page?
You can use an GridView that is not grouped where each item will be a different control displayed using a different DataTemplate.
Or you can trick the FlipView to behave like a Panorama control for Windows Phone. Details at http://dotnetbyexample.blogspot.cz/2012/08/a-winrt-behavior-to-turn-flipview-into.html
EDIT:
For the first solution you create a base class and create a list with your different objects derived from the base class. Then you use the GridView's ItemTemplaceSelector to select a select an appropriate DataTemplate. See http://coding.kulman.sk/using-different-data-templates-with-gridview-in-windows-8-apps/
Can I drag an item (image, rectangle or other shapes ...) and drop it freely somewhere on the screen? I know there is a way to drag and drop items from a GridView to another, but I would like to do it without restrictions (and without Directx).
And I also found only a quickguide for drag&drop, no useful examples, that's why I'm curious.
I had the same problem. After trying to work with Manipulation etc I just gave up and implemented a quick work around.
I just placed my item ( Circle in my case ) into a ListView and allowed the ListViewItems to be dragged. (CanDragItems). I also removed all the styles so it wouldn't look like a ListView.
This way I could drag my ListViewItem (which was just a circle) and drop it somewhere. You don't have to drop it into another ListView.
If you put these property
Drop="imgCart_Drop_1" AllowDrop="True"
on an image for example then you can capture the drop event.
I hope this helps
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 have pairs of controls: immagebox + textbox = one pair.
I want these to show up in a single column grid/tabular format. Each cell contains one image/text pair.
I want this grid to scroll because the number of pairs is dynamic depending on a user selection.
I suppose I will be adding these controls in code at runtime when the user makes his/her selection.
What is the best way to accomplish that in vb.net? TableLayoutPanel or better way?
One possible approach is the following.
Use a Panel as your container. Inside this Panel you can add a TableLayoutPanel that is defined to be AutoSize=True. Add two columns to your table layout and then add controls in rows as needed. The TableLayoutPanel will then size itself automaticlly depending on the contents.
Now make your Panel be AutoScroll=True and it will automatically add the correct scrollbars so the user can move around and see the contained set of controls.