How To Create Draggable and Drappable List Of Controls? - c#

I have a ItemControl and i set ItemPanel Property to Horizontal StackPanel and I Bound it to ObservableCollection of Icons.Now I Wanna user be able to remove icons with drag drop them to out of ItemControl and also can change items positions with each other by drag and Drop.
(Look likes MacOSX DocBar).Can i do this with above controls ,if yes,please tell me how.if not,i appreciate to tell me i should use which controls and how
Thanks In Advance.

You should be able to with your own inherited version of the controls. Microsoft writes their controls in a way to allow for easy inheriting and overriding of behavior.
It should be similar to what's done here:
http://www.codeproject.com/Articles/7841/Drag-and-Drop-Treeview-control
You want to watch events like DragStart, and DragLeave, and when it's not over your control and drop is performed do your operation.
More information:
http://msdn.microsoft.com/en-us/library/za0zx9y0.aspx
Good luck.

Related

How to implement panel with features of ListBox And FlipView in WPF

I'm am not good enough in WPF, so I'd like to ask for any advice how to implement panel layout something link displayed on image below:
So, the main purpose is to display a collection of items with possibility to select a single item, which should be moved to the first position (probably with animation) and then another item template should be applied to that container (it is bigger than other items in the collection). The list doesn't have to be infinitive, so just like a simple ListBox.
For me it looks like a FlipView but with a few items, which are neighboring siblings of the selected one and are also visible in the panel's viewport.
Please, advice me how to implement such a panel, or if you have seen something suitable, please, provide a link to the source.
You need to create your custom panel using User control.
Here is one example which is similar to your requirement.

C#: custom control vs native control

ALL,
I am trying to develop a C# Windows Forms application.
For that I needed to make a custom control that is derived from the GroupBox.
Now for the problem.
I have a form and on the form I put a grid box. On 1 cell I put a GroupBox and on another cell I put my custom control.
For both controls properties I put "ColumnSpan" to be 3 as grid has 3 columns.
The native control display itself properly, meaning it is stretched.
The custom control display itself incorrectly, meaning it is not stretched.
I checked and all properties in the properties inspector are the same.
What am I missing?
Thank you.
For some reason custom controls do not resize themselves. So all I had to do in the GUI designer is to resize the control.
Thank you for reading and hopefully it will help someone else.

TreeView with columns

I need a multi columned Treeview for an app I am writing, I was wondering if anyone knew of a free working (in Vs-2010) multi columned Treeview.
There are a number of sample controls to be found around the web:
TreeViewAdv for .Net
TreeView with Columns
ContainerListView and TreeListView
But the all-time favorite is probably the ObjectListView, which provides an expandable, multi-column ListView, along with many other incredibly handy features:
You can use this example here or download this control
Try this Microsof TreeListView WPF control
http://msdn.microsoft.com/en-us/library/vstudio/ms771523%28v=vs.90%29.aspx
You can do an illusion to the user in the user interface.
Drag a listview and drop this over the treeview which was already placed in the form.
Create columns in the listview as you need.
Set the 'HeaderStyle' property to 'Nonclickable' and 'Scrollabe' property to 'False' of the listview.
Set width and location of the listview as it fits to the treeview.

Rearrange items in ListBox

I have a ListBox with a number of ListBoxItem objects. What is the best way to allow users to rearrange the items by dragging and dropping? Do I have to use StackPanels instead?
Thanks for any suggestions
You are going to use a different listbox control or build your own. Here is an example of building your own. Here is another one where he extends the silverlight toolkit listbox control.
For prosperity, the Silverlight Toolkit offers a set of DragDropTarget's which can be used to reorder items within a ListBox, TreeView, or a simple ItemsControl. You can also drag items between ItemsControls. Run the Silverligh 4 samples project and look at 'Drag and Drop' under the Toolkit section.
http://silverlight.codeplex.com/
http://www.silverlight.net/content/samples/sl4/toolkitcontrolsamples/run/default.html
The controls you want are:
ListBoxDragDropTarget
TreeViewDragDropTarget
DataPointSeriesDragDropTarget

Adding a textblock to a custom wpf control (piepiece control from codeplex)

I'm currently building a Surface application where the main navigation is a circular menu. For each menu item I'm using a custom control that I found on codeproject.com:
http://www.codeproject.com/KB/WPF/PieChartDataBinding.aspx (PiePiece control)
The number of submenu items (which is also piepiece controls) comes from a database and thus dynamically loaded. What I can't figure out is how I add a textblock to this custom control to display the submenu item text. It needs to follow the PiePiece's RotationAngle property to line up correctly.
Anyone got a hot-fix for this? I was thinking about adding another dependencyproperty to the piepiece custom control, but that way I can't set the font-family, size etc (can I?)
Any input on this is greatly appreciated! Thanks!
Have you tried using an Adorners, without taking a really close look the PiePiece Control you're using this might solve your problem.
Hope that helps!

Categories