In This Article

ResizableContentControl Class

Represents a ContentControl that contains a gripper, allowing it to be resized.

[TemplatePart(Name = "PART_Gripper", Type = typeof(Thumb))]
[TemplatePart(Name = "PART_Presenter", Type = typeof(ContentPresenter))]
public class ResizableContentControl : ContentControl
Inheritance:
object Visual UIElement FrameworkElement Control ContentControl object

Remarks

For detailed documentation on this control's features and how to use them, please see the ResizableContentControl documentation topic.

Constructors

ResizableContentControl()

Initializes an instance of the ResizableContentControl class.

public ResizableContentControl()

ResizableContentControl(object)

Initializes an instance of the ResizableContentControl class.

public ResizableContentControl(object content)
Parameter Type Description
content object

The object to use as the content.

Properties

CanAutoSize

Gets or sets whether the gripper auto-sizes to its content when it is double-clicked.

public bool CanAutoSize { get; set; }

Property Value

bool:

true if the gripper auto-sizes to its content when it is double-clicked; otherwise, false. The default value is true.

GripperBackground

Gets or sets the Brush to use for the gripper background.

public Brush GripperBackground { get; set; }

Property Value

Brush:

The Brush to use for the gripper background.

GripperForeground

Gets or sets the Brush to use for the gripper foreground.

public Brush GripperForeground { get; set; }

Property Value

Brush:

The Brush to use for the gripper foreground.

ResizeMode

Gets or sets a ControlResizeMode indicating the resizing capabilities of the gripper.

public ControlResizeMode ResizeMode { get; set; }

Property Value

ControlResizeMode:

A ControlResizeMode indicating the resizing capabilities of the gripper. The default value is ControlResizeMode.Both.

Remarks

Use the ControlResizeMode.None value to hide the gripper.

Methods

AutoSize()

Auto-sizes the content control to the desired size of its content.

public void AutoSize()

GetUseAlternateScrollViewerStyle(DependencyObject)

Gets the value of the UseAlternateScrollViewerStyleProperty attached property for a specified object.

public static bool GetUseAlternateScrollViewerStyle(DependencyObject obj)
Parameter Type Description
obj DependencyObject

The object to which the attached property is retrieved.

Returns

bool:

true if the alternate Style should be used for ScrollViewer elements; otherwise, false.

MeasureOverride(Size)

Measures all children given an available size and returns the element's desired size based on the size of its children.

protected override Size MeasureOverride(Size constraint)
Parameter Type Description
constraint Size

The size the element is suggested to fit inside.

Returns

Size:

The desired size of the element.

OnApplyTemplate()

Invoked whenever application code or internal processes call ApplyTemplate().

public override void OnApplyTemplate()

SetUseAlternateScrollViewerStyle(DependencyObject, bool)

Sets the value of the UseAlternateScrollViewerStyleProperty attached property to a specified object.

public static void SetUseAlternateScrollViewerStyle(DependencyObject obj, bool value)
Parameter Type Description
obj DependencyObject

The object to which the attached property is written.

value bool

true if the alternate Style should be used for ScrollViewer elements; otherwise, false.

Fields

CanAutoSizeProperty

Identifies the CanAutoSize dependency property. This field is read-only.

public static readonly DependencyProperty CanAutoSizeProperty

GripperBackgroundProperty

Identifies the GripperBackground dependency property. This field is read-only.

public static readonly DependencyProperty GripperBackgroundProperty

GripperForegroundProperty

Identifies the GripperForeground dependency property. This field is read-only.

public static readonly DependencyProperty GripperForegroundProperty

ResizeModeProperty

Identifies the ResizeMode dependency property. This field is read-only.

public static readonly DependencyProperty ResizeModeProperty

UseAlternateScrollViewerStyleProperty

Identifies the UseAlternateScrollViewerStyle dependency property. This field is read-only.

public static readonly DependencyProperty UseAlternateScrollViewerStyleProperty