User Interface Sizing Programming Guide in C#

Sometimes when building a user interface (UI) you need to set the size of some elements to non-default values. A common pitfall is to explicitly set these sizes to values that look OK in a development environment but then fail for other users when the UI size changes.

A better approach is to set minimum and maximum values for the size of these elements. This means they can be customized while still allowing for some flexibility.

You can find an usage example in the EFL examples repository in reference/csharp/ui/src/ui_sizing.cs.

NOTE Some C# classes are currently in BETA state
They should only be used for experimenting and NOT for any product development.
These classes are marked as BETA in the reference documentation.
The source code for the tutorials is subject to change in the future.


Setting a Widget's Minimum Size

When a widget's minimum size is defined with SetHintSizeMin(), resizing the rest of the UI will not shrink the widget below the size you set. You can use it to create elements which are bigger than normal, as well as prevent the UI from becoming too small:

button = new Efl.Ui.Button(win);
button.SetText("Big button");
button.SetHintSizeMin(new Eina.Size2D(100,100));

Setting a Widget's Maximum Size

When a widget's maximum size is defined with SetHintSizeMax(), resizing the rest of the UI will not expand the widget beyond the size you set. Use it to create elements that are smaller than normal or that will not expand past a given point when the UI grows.

button = new Efl.Ui.Button(win);
button.SetHintSizeMax(new Eina.Size2D(50,50));

Further Reading

Graphical Hello world Tutorial in C#
Basic tutorial explaining how to build a simple EFL application with a Graphical User Interface.