Components that are hidden on the form still occupy space while default behaviour should rather be to revalidate container and do not include hidden components, at least in BoxLayout and FlowLayout.
Does cn1 supports layout similar to BoxLayout that does not take into account hidden components?
No. You can easily remove/add the component dynamically.
Related
I have ContantPage for adding new object to database. And one part of this page can be two sets of controls depending on state of ToggleButton.
How to implement such thing with Xamarin.Forms keeping in mind that I need to access values of this optional part from ContantPage?
Have two Layout views (e.g. StackLayout) one with the toggle off controls and the other with the toggle on controls.
Then bind the IsVisible property of the StackLayouts to the toggled property of the switch (one bound to be visible when toggled on, the other when toggled off).
I just noticed that if I put a GridView or ListView in UWP app inside a HubSection, the UI Virtualization breaks. Is my understanding correct?
Thanks
Virtualization only happens for items outside the viewport. So it's important to place your GridView into a control that limits its size (e.g. Grid without auto-sized rows/columns) or set the size of the control. Wouldn't surprise me if your HubSection doesn't have a fixed size.
The concept of a viewport is critical to UI virtualization because the
framework must create the elements that are likely to be shown. In
general, the viewport of an ItemsControl is the extent of the logical
control. For example, the viewport of a ListView is the width and
height of the ListView element. Some panels allow child elements
unlimited space, examples being ScrollViewer and a Grid, with
auto-sized rows or columns. When a virtualized ItemsControl is placed
in a panel like that, it takes enough room to display all of its
items, which defeats virtualization. Restore virtualization by setting
a width and height on the ItemsControl.
Also custom templates often break virtualization:
If you provide a custom items panel template (see ItemsPanel) then
make sure you use a virtualizing panel such as ItemsWrapGrid or
ItemsStackPanel. If you use VariableSizedWrapGrid, WrapGrid, or
StackPanel, then you will not get virtualization.
More info on MSDN: UWP and Win8, which also has some good points that still count.
I have a QHBoxLayout, and it has 2 QVBoxLayouts on it one near the other.
Each layout has widgets, and I wonder how to make this layout resizable (the user can change the width) ?
Use a QSplitter. Create a couple of top-level container widgets for your vbox layouts, and then use the splitter's addWidget method to add the widgets to the splitter. The splitter's orientation is horizontal by default, so the vboxes will appear side by side.
While exploring the basic concepts of JavaFX, the following question arose:
Is there a way to customize the layout of composite controls (such as TreeView or Accordion)?
For example, to achieve a horizontal arrangement of child elements or to introduce animations.
Some controls include API for controlling their layout. For example, you can set the orientation of a ListView to Horizontal or Vertical or switch animation on or off in a TitledPane.
You can write your own skins to apply to existing controls and modify their layout.
Public API for control skinning is provided in Java 8.
Use the -fx-skin attribute to change a skin via css.
More details are in the JavaFX wiki control skinning section.
Using custom skins you can completely change the layout and animations for a control. See for instance this carousel skin of a TreeView.
I'm new to Macs and iOS, I got my app running on webOS, Android, and WPF/Windows. In all cases the size of, say, a 'widget' to display a bunch of text, can change depending on the dimension of the text to be displayed, as well as the position can be up against another widget. As the text size changes, the position will change so that all the widgets are crammed together nicely.
I've been searching for this capability in IOS4 in books and on-line, and it's starting to look like in iOS, you have to actually calculate the size of the text to be displayed in ViewText and then change the dimensions of ViewText, which of course then bumps other Views around to accommodate this size change. It sounds like a nightmare. Isn't there some other way to do this (like all the other GUIs can do) to size based on content, and to position relative to other Views like stacking them all together whatever size they are?
Same with ScrollView, it looks like the size of the window you actually see has to be manually specified as well, instead of, say, taking up the entire viewable window and then you can populate the ScrollView with a bunch of sub-views, some of which are below the initially viewable area? I tried this in Xcode4, but so far, haven't gotten it to work.
Similarly with creating an object with a NIB and instantiating that NIB onto an existing View, how does it determine where to position this NIB onto the existing screen?
Thanks!
Paul,
For the scrollview you need to set the bounds so it fills the screen or the area you wish it to occupy, it will then automatically generate scrollbars based on the layout within it. In the land of iOS you do have to do extensive layout work such as positioning and sizing your controls but you can also use the UIAutoResize (if I remember correctly) masks such as if they are anchored to a size, fill the area, etc. It's a little complicated to learn initially but you'll get the hang of it.
As for text you just need to use the right control, I believe what you want is a UITextView and set the options on it as needed.
When you view a XIB it's going to layout initially as you have it, again, you need to position your controls AND set their anchors (autoresize masks) so they adjust based on the screen size (phone vs. pad) and orientation: landscape vs. portrait.
HTH