Expression Blend: Dragging controls from toolbox - expression-blend

I am following some tutorials with expression blend and many of them are tell me to drag a TextBlock from the toolbox. Sure enough I see it, if I long click on it it displays for additional controls.
So if I click it and drag it it should work but it opens up the other controls.
If I double click it then it places it in my design view but I want to drag and drop it.
Am I missing something here, the tutorials I am following are for Expression Blend 4 and I am using Expression Blend 4.
Thinking about it, its sounds correct that you should be able to drag and drop a control on the design surface, but it doesn't work here.

Well in Standard Expression Blend and I assume there is only one version of Expression Blend 4 you actually can't place controls via drag and drop from the toolbox onto the design surface. At least this is my experience.
If you want to place a control what you do is to choose a control via left mouse click in the toolbox which makes it the currently selected one. Then you can place it onto the design surface by defining its dimensions at the place you want to have it positioned.
AFAIK there is no function to drag a control out of the toolbox.

Related

How to create consistent toolbar buttons with icons

Desired look
I wish to make a toolbar for my app that will contain some simple buttons, each with a single monochromatic icon. Here is an example of some toolbar buttons similar to I'm trying to achieve, from Mail's compose window:
Notice these buttons have a consistent size, inner padding, padding, and shading. This is a pretty consistent style across macOS, present in Mail, Safari, Finder, etc. This leads me to suspect there's a standardized UI component for creating such buttons.
If I use a segmented control, each button looks correct, with each icon being correctly padded:
Now I would like to add individual buttons that match the style.
Attempt 1
My first attempt was to add a "Push Button" (NSButton) to the toolbar:
This resulted in a wide button that's a bit too short, and not lined up with the segmented control:
Attempt 2
My second attempt was to use a segmented control, with only 1 segment.
This resulted in a button that's the right shape, size, etc., but it was off center relative to its label.
Naturally, I can manually adjust the button to match the goal, but I feel like I'm missing something. What's the proper way to create these standard buttons?
This is actually quite easy to do and you were close already.
You can use NSButton for that. Note that it has different styles (defined in NSButton.BezelStyle) to choose from. The default one is the one to use inside windows and modals. But for toolbars, to match the style of segmented controls and search bars, you can choose the style .texturedRounded.
You can also set the style via Interface Builder. Note that you have to select the button itself, not the toolbar item around it.
To get the correct size, you seem to set the icon within the toolbar item, not the button itself.
Here is my result:

TriggerType Expression Blend 4

I was wondering if it is possible to assign an eventtrigger to a source outside the current artboard.
Example: I have a text box that I want to slide out of one content presenter into another when a button is selected. I have it set up so the box slides out of one and I need to bind the box to slide into the new content presenter when the previous trigger was selected.
What you described sounds an awful lot like the FluidMoveBehavior from the Blend SDK. It's a more advanced Blend concept, but it's quite snazzy and should provide a nice animation as your move your control from one container to another. Here's a quick tutorial on it.

Do 250 buttons slow the application in WP7?

I'm building a BattleShip game for WP7 that has board with 250 cells. I need to make each cell clickable, so I thought to put in each cell a button and handle each click as I need.
My question is: do 250 buttons slow the phone? If it does, so what are the alternatives?
Hell yes. 250 UI controls are complete utter madness. The alternative, and correct solution, is to use XNA instead, and developing your game as a real game, and not as a bunch of UI controls.
Yes, 250 buttons will make your application quite slow. Silverlight constructs a visual tree to represent your UI. Each button contains a template which generates various broders, rectangles etc ... for representing visual states.
A couple of alternatives are:
Use a more lightweight visual elements, for example Rectangle. These do not have a Click event, so you can handle MouseLeftButtonUp instead.
Probably the most lightweight approach is not to have an element for each cell at all. Simply handle mouse interactions on a parent element, then determine the grid cell from the click location. The MouseEventArgs contain a e.GetPosition() method that allows you to determine where the mouse click occurred.

What Qt4 widgets should I use and how to approximate a ribbon-style interface?

I am trying to create an interface for my application using Qt Designer. I want it to have a tabbed, ribbon-style set of controls at the top, and a MDI-style area with docked windows which I plan to show and hide depending on which tab of the ribbon is currently selected. I am just beginning with Qt Designer as well as Qt4 itself for that matter so I'm not quite sure how to setup the window, which widgets and layouts should I use etc.
It's quite obvious there should be a QTabWidget at the top, but I'm not sure about the bottom. Should I use a QFrame? A QMdiArea? A dock widget? What layouts can I use to make sure the tab widget has a fixed height, occupies the whole width of the window at all times and the bottom area scales as the window is resized?
I've read in the manual that splitter layouts allow for manual adjustment of the size of the widgets they contain, but I can't drag the box size of a widget after I place them inside a splitter. Thus I'm unable to setup the area below the ribbon. Anyone, help?
You should look into the QMainWindow and check the multiple utilities it can provide you (Toolbar, StatusBar, DockWidgets, CentralWidget, etc...).
The way I understood your case is that you will always have the MDI Area visible, and that the tab bar will only be used to change the dockWidgets. Here's how I would do it.
The centralWidget of the mainWindow would be a QWidget with a QVBoxLayout containing a QTabBar widget first (up) and a QMdiArea under it. The sizes should be handled automatically.
This will allow the user (or you) to dock widgets on the left, bottom, top or right areas of the mainWindow's central widget. Keep pointers to the dockWidgets to be able to move and show/hide them at will.
Hope this helps.
VTK Designer, which is built on Qt, has a Ribbon-ish interface. You might take a look at the source code for reference.

Expression Blend changing Alignment

Expression Blend 4 is changing the HorizontalAlignment and or VerticalAlignment when moving TextBlock objects with the keyboard or mouse. How can this be blocked?
I don't think it can be done. Its a visual editor, it will generate code depending on how the view looks after you're performed changes. It will create the best code that will match the layout you created based on what it understands.
It's a pain when it does that..
Go into the XAML view, and modify it by hand after you're happy everything is the right place and is the correct size, by just changing the Alignments and margins.
If you click the object, you will notice guide bars traveling vertically and horizontally from the object. At the end of these you will see little "chain link" icons. You can click these on and off at either end to toggle the alignment.

Resources