Evenly distributing actors in a container - clutter

I have a Box with a BindConstraint binding it to the width of the stage. I'd like to add actors and have them be evenly distributed across the width of the box. That is, I'd like the width of the actors to remain fixed, but the spacing between them to be such that the entire width of the box is filled.
At the moment I'm using a BoxLayout, but haven't found any combination of properties which achieves this effect.

It looks like setting "homogeneous" to true and packing with "x-align" as CLUTTER_BOX_ALIGNMENT_CENTER creates this effect.

Related

WPF WrapPanel, but fills empty space due to different size items?

I have a list of "Group" objects, each of which contains a list of "Option" objects, that show up as checkboxes. I want these to be displayed in a condensed fashion automatically without me having to layout the UI manually with something such as a Grid (which is what I've done in the past, and takes a lot of effort).
My groups have varying numbers of options, so the size of the container for the group is not the same across groups. I'm using a WrapPanel, but it leads to a fairly ugly design because each item in the WrapPanel appears to be slotted into the same size container:
I know I've done this in HTML/CSS/JS, where I can have it automatically condense the unused space. Is there something like this for WPF? My list of options is manually created, but I can add/remove options fairly easily in my code, so I would rather not have to manually recalculate things in a grid view.
I've looked at Is there any way to occupy blank space in WrapPanel automatically?, which sounds similar, but the answer to that question does not have an example and I could not figure out what I was actually supposed to change/use in the answer (my attempts using it did not make any difference at all to layout).
I guess you use Horizontal Orientation of WrapPanel, so every row have height as the maximum its element. Your problem isn't free space in the ends of rows, so the solution that you mentioned doesn't work for you. You can try to use Vertical orientation of WrapPanel, your wrappanel' elements look like they have similar width, possible it would look better.

Different height items in a WPF listbox

I'm wondering when modelling a real-world scenario such as a shelf stacking if it's possible to have different height items in a list box.
Assume the list box is meant to represent a shelf which is which has a height in inches or cm. I can stack boxes on this shelf up to the maximum height. I can have more smaller boxes and obviously less larger boxes. I know the dimensions of these boxes as well in inches or cm.
I'd imagine that I'll need to maintain a running total of all the items in the list box so as to know just how much shelf space I have left. I need to be able to visually show that one box is larger than the other by spanning n number of items.
Is the list box even the right control to consider using in this instance?
Yes, its the right control. Yes you can have different heights of items in a ListBox. Use DataTemplates to define the style of each container which ListBox will use to represent items. Each item will become a container with its individual height and style.
Take a look at those link:
http://www.wpf-tutorial.com/listview-control/listview-data-binding-item-template/
http://wpftutorial.net/ListBoxDataTemplate.html

Is there an alternative to a WPF WrapPanel that wraps after a certain number of items, not a height?

Normally a WPF WrapPanel (Orientation="Vertical") will stack items vertically (and grow vertically) until it runs out of space from the parent container, and then it will "wrap" to the next column.
I want this functionality, but I want to add a hard limit to the number of items in a column. For instance, if my height is 100 and I have 3 items that are 30 pixels high, normally it could fit them all without wrapping. However, say I want to force it to wrap after 2. In that case, I want it to only grow to a height of 60, and wrap the 3rd item into the second column.
Is there something I can do to make this happen?
Maybe you can do it with the UniformGrid.
Use the Rows property to definie the amount of elements in vertical direction.
here is a nice little article about the available layout panels in WPF. If one of these does not fit the bill, you might have to build your own custom panel, here is a decent demo.

Silverlight: how to use a scroll viewer to wrap a list view without specifying height?

I have a control that has a list that varies in length greatly. This control appears in various places meaning that i cannot calculate its position and desired height easily.
Moreover all I want is for the scrollviewer to simply size itself according to its parent. currently it insists on sizing itself according to the content.
currently when i have a list that exceeds the height of the screen the whole control extends off the bottom and the scrollviewer shows no bar (because it has stretched to the heigth of the contents and so thinks it is not required).
I've not included code as the object graph is fairly deep.
What i am looking for is a set of conditions that would cause the scrollviewer to resize itself according to its content rather than its parent.
I have it working in a similar situation involving grids and datagrids, the unique part of this control is that there is a list containing controls.
Any ideas? I would prefer solutions that don't require use of code behind - but im really not in a position to be choosey.
Here are common reasons that come to mind that would allow a scroll viewer to size to its contents rather than to its "parent":-
It's placed on a Canvas or a StackPanel
It's assigned to a Grid row/column with it's Horizontal or Vertical alignment not set to Stretch and its content size is less than the size of the row or column.
Its ultimately upto the containing panel how it chooses to size a child element so its not really possible to dictate this completely from code inside the child.

Get airport display type transition when data changes

A client has asked for a display to flick over like an airport display screen, ie each row flicks over when information changes.
I am not sure which is the best control to use, or the method of getting each row to transform one after the other.
any suggestions woul b gratfully accepted
John
Here's what I would do in general concept..
Make a regular panel of, say 50px high. (This is arbitrary but this panel just holds the size in place so the control doesn't shrink with its contents.)
Create a panel inside that one that will be the 'animated' panel.
When it's time for information to animate, create a storyboard that uses a transformation to "stretch" the height down to 0, change the content to the updated information, then tranform stretch the height back to 50px. This will create the illusion that the panel is flipping over.
If you make this a user control, then you could simply add however many "rows" you needed of this control to a StackPanel to make your screen.
The best way of representing this effect easily is to randomize the text during the change.
Patrick Long implemented this effect as a custom animation here

Resources