Method Fill
Fill()
Creates a Dim object that fills the dimension, leaving no margin.
public static Dim Fill()
Returns
- Dim
The Fill dimension.
Examples
var view = new View { X = 5, Y = 0, Width = Dim.Fill(), Height = 1 };
// If SuperView width is 80, view width will be 75 (80 - 5)
Remarks
The view will fill from its position to the end of the SuperView's content area.
If the SuperView uses Auto(DimAutoStyle, Dim?, Dim?), a DimFill SubView does not
contribute to the auto-sizing calculation and will receive a size of 0. Use
Fill(Dim, Dim?) with a minimumContentDim to ensure the SubView contributes
a minimum size. See the Dim.Auto Deep Dive for details.
Fill(Dim)
Creates a Dim object that fills the dimension, leaving the specified margin.
public static Dim Fill(Dim margin)
Parameters
marginDimMargin to use.
Returns
- Dim
The Fill dimension.
Examples
var view = new View { X = 0, Y = 0, Width = Dim.Fill(2), Height = 1 };
// If SuperView width is 80, view width will be 78 (80 - 2)
Remarks
If the SuperView uses Auto(DimAutoStyle, Dim?, Dim?), a DimFill SubView does not
contribute to the auto-sizing calculation and will receive a size of 0. Use
Fill(Dim, Dim?) with a minimumContentDim to ensure the SubView contributes
a minimum size. See the Dim.Auto Deep Dive for details.
Fill(Dim, Dim?)
Creates a Dim object that fills the dimension, leaving the specified margin and respecting the specified minimum dimension.
public static Dim Fill(Dim margin, Dim? minimumContentDim)
Parameters
marginDimMargin to use.
minimumContentDimDimThe minimum dimension. If null, no minimum is enforced.
Returns
- Dim
The Fill dimension.
Examples
// Fill with minimum width of 40
var view = new View { X = 0, Y = 0, Width = Dim.Fill(margin: 0, minimumContentDim: 40), Height = 1 };
// If SuperView has Dim.Auto() width, it will be at least 40 wide
// If SuperView is 80 wide, view will be 80 wide
// If SuperView is 30 wide, view will still be 40 wide (minimum)
Remarks
When the SuperView uses Auto(DimAutoStyle, Dim?, Dim?), a DimFill SubView does not
contribute to the auto-sizing calculation by default. The minimumContentDim parameter
resolves this: it contributes a floor to the auto-sizing calculation, ensuring the SuperView is at least
large enough to accommodate the minimum. Without it, the SubView will receive a size of 0.
See the Dim.Auto Deep Dive for details.