Version

SetPreferredWidth Method

Sets the preferred width of the element. This width will be used by the panel to determine how much space to allocate to the element.
Syntax
'Declaration
 
Public Shared Sub SetPreferredWidth( _
   ByVal d As DependencyObject, _
   ByVal value As Double _
) 
public static void SetPreferredWidth( 
   DependencyObject d,
   double value
)

Parameters

d
Element to set the preferred width on.
value
Preferred width to set.
Remarks

PreferredWidth property is different from setting the Width property of the element directly. When you set Width property of the element, that will be its final width. It may be desirable instead to specify a preferred width and then let the layout panel adjust the size (make it bigger or smaller) based on the availability of space.

Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also