C# WPF accordion collapsing Images - c#

I've decided to took up a evening time project. I decided to write a simple GUI application displaying info about units form some game.
I've poked around and decided to do it in a C# WPF application. I have a background in java and C, so programming isn't that different.
I want to add some eye candy to it by having a series of images cropped to half one under another. And when one gets a mouse click I want to show it whole. (ie accordion behaviour), if some picture is already fullsize I want to collapse it.
I was thinking about couple of solutions, but since its my first C# project I thought it best to ask for the best/easiest solution.

Check out this Customizing WPF Expander with ControlTemplate article over on codeproject.com...

I think the WPF Expander control is what you are looking for. You can use a StackPanel to create a series of them.

Related

Creating a dynamic grid of controls in C#

I'm working on a personal project, and I want to create a simple GUI to accomplish this project.(Using C#) My main goal for this project is the creation of a custom grid of squares. What I would like is for the user to be able to click any of the generated squares on the GUI, and be able to change the color of that square. Now, I've looked for the past few nights but I haven't had any luck with finding anything to fit that sort of request.
Would it be easier for me to create square button controls ahead of time and just hide the ones I don't use? Or is it at all possible to dynamically create buttons in a grid shape? Or is there something more efficient than using buttons that can change color?
Thank you for any help!
EDIT: I'm planning on using Winforms, and I was going to build this GUI using a desktop application.

Creating custom ListView from scratch in Blend

I already looked through the internet but could not find a tutorial that showed the creation of a ListView in Expression Blend. I do not want to modify existing ListViews that are part of Blend, as I have done that already.
I need a tutorial that shows the first steps of creating a custom ListView and, in my case, specifically states all the parts the ListView consists of.
A button for example, can be created in Blend by drawing a Rectangle, adding a ContentPresenter and converting that into a Button user control. I would like to do the same thing for a ListView.
I went through that post already but since it is about WinForms I could not draw any helpful conclusions.
I am thankful for links to similar posts, tutorials and even code snippets.
After a long night of further research I came across this answer. I installed the Windows SDK and there are files that contain the ControlTemplates for WPF Controls. Using them as a blueprint gives me the possibility of creating my own desired version of the ListView.

Generic approach to create flow charts in WPF

I have to create an animated flow chart GUI which displays different states. Further on demand the flow chart elements are re-positioned and re-sized if the focus shifts to certain elements.
All of this is no problem, with drawing shapes, animations, etc. provided by WPF this is an easy, though by hand and alot of manually is done.
The problem I am facing is, that there will be > 40 of these flow charts.
Is there a template mechanism or generic approach to generalize this task?
Creating a set of user controls is the right way to deal with this problem.
The advantage is, animation and design can be encapsulated into the user control files. This way they don't polute the main application code.
There is a project called Graph# http://graphsharp.codeplex.com/ an there must be similar projects on codeplex.

Free Windows Forms Components Similar to jQuery UI Draggables

EDIT:
So, I ended up making my own basic solution to this problem, and it can be found in my own answer to the question below. Or, here's a link.
Original Post
I'm doing some UI programming for a small .NET application. The application has some collections of items that need to be displayed in a grid sort of format (X columns by Y rows) and the grid elements need to be able to get dragged around to different grid locations, and possibly out of the grid all together.
The most comparable sort of UI design elements I can think of are the jQueryUI Draggables.
Do I have to roll my own or are there components people have already written to act like this? Even better, are there any free components? Or is there an easy way to do this that I just don't know about (don't do a lot of .NET UI programming..)
Also these "grid items" need to be able to include windows form components. The DataRepeater control is close to what I need, except it only supports horizontal or vertical alignments, not grids of items.
Here's a visual example of what I'm looking for:
I tried to stick with a halloween theme here.
Well I rolled my own solution and hosted it on GoogleCode:
draggableitemorderedpanel- A .NET Winforms Component... Kinda like jQuery UI Draggables (not really, maybe someday)
here's a screenshot:
(source: googlecode.com)
and another just resized:
(source: googlecode.com)
Hope this helps someone else out. Also it's super basic and pretty sucks right now but gets the job done.
Anyone that wants project access can have it.
The System.Windows.Forms.TableLayoutPanel control supports dragging and dropping, you just have to handle the right events. You could make your own "GridItem" user control, with the icon, caption, background color, etc displayed on a Panel, and then plop a bunch of them in the tablelayoutpanel, and wire up some event handlers. Here's something similar:
http://social.msdn.microsoft.com/Forums/en-US/Vsexpressvcs/thread/1cade626-b76d-40c5-9e5a-101cf2a5e412

How can I create a button with an embedded close button

I am trying to create a panel which will have a set of "buttons" on it.
These buttons should have the following behaviour:
Appear similar to a tag (with
rounded edges)
Contain a red
cross to remove the filter/tag from
the panel, similar to the way internet
explorer tabs have an embedded cross to close the individual tab.
allow the user to click
on the tag and respond like a normal
button (as long as the click is not
in the red cross)
Number 1 is no problem, this is just appearance, however, regarding numbers 2 and 3, I am not sure if there is already code out there do to something similar...and I dont really want to reinvent the wheel if I can avoid it!
My question is: Does anyone know if there is something out there in infragistics which will do this simply, or will I need to write this myself by subclassing winform buttons?
Thanks in advance!
Is this new development or maintenance of an existing project?
If it is maintenance, you have a somewhat tougher time ahead. You'll implement a UserControl, probably segmented into two buttons. Use docking to get the behavior as correct as possible. The far right button would contain your cross image; the left (which would need to auto-expand as you resize the control) would contain your primary button behavior. Play with the visual styles until you get them right (EG, removing borders, etc).
If this is new development, and you haven't gotten too far into it, you might consider using Windows Presentation Framework (WPF) instead of WinForms. It will be easier to build the control and get it to look exactly how you want it. WPF includes an extremely powerful control compositing system which allows you to layer multiple controls on top of each other and have them work exactly as you'd expect, and it carries the added advantage of allowing full visual control out-of-the-box.
Either way, this is more work than dropping in an external component ... I've used Infragistics for years, and I can't think of anything they have which is comparable. The closest, but only if you're building an MDI application and these controls are for window navigation, is the Tabbed MDI window management tools -- and there, only the tabs (which replace window title bars) have this behavior.
I don't think that infragistics can do something like this. The UltraButton control can't.
Implementing a own control wouldn't be that hard.
your probably going to have to make a costume control for this type of work.

Categories