Share via


EditModeSwitchButton Class

A convenience button that allows the user to switch between the different PropertyContainer modes.

Namespace:  Microsoft.Windows.Design.PropertyEditing
Assembly:  Microsoft.Windows.Design (in Microsoft.Windows.Design.dll)

Syntax

'Declaration
Public Class EditModeSwitchButton _
    Inherits Button
'Usage
Dim instance As EditModeSwitchButton
public class EditModeSwitchButton : Button
public ref class EditModeSwitchButton : public Button
public class EditModeSwitchButton extends Button

Remarks

Use the EditModeSwitchButton to invoke your custom DialogPropertyValueEditor and ExtendedPropertyValueEditor implementations.

The edit mode switch button is styled to follow the appearance and behavior specific to the host application. It can operate in two modes, either it always executes a specified mode-switching command, or it adapts to the current mode of the containing PropertyContainer and "does the right thing". If set manually, the SyncModeToOwningContainer property must be set to false and the mode-switching command must be specified by using the TargetEditMode property. To set the mode automatically, the SyncModeToOwningContainer property must be set to true, in which case the TargetEditMode property is ignored.

Examples

The following code example shows how to use the EditModeSwitchButton class. For more information, see Walkthrough: Implementing a Color Editor.

<DataTemplate x:Key="BrushInlineEditorTemplate">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*"/>
            <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>
        <TextBox Grid.Column="0" Text="{Binding StringValue}"/>
        <PropertyEditing:EditModeSwitchButton Grid.Column="1"/>
    </Grid>
</DataTemplate>
<DataTemplate x:Key="BrushInlineEditorTemplate">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*"/>
            <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>
        <TextBox Grid.Column="0" Text="{Binding StringValue}"/>
        <PropertyEditing:EditModeSwitchButton Grid.Column="1"/>
    </Grid>
</DataTemplate>

Inheritance Hierarchy

System.Object
  System.Windows.Threading.DispatcherObject
    System.Windows.DependencyObject
      System.Windows.Media.Visual
        System.Windows.UIElement
          System.Windows.FrameworkElement
            System.Windows.Controls.Control
              System.Windows.Controls.ContentControl
                System.Windows.Controls.Primitives.ButtonBase
                  System.Windows.Controls.Button
                    Microsoft.Windows.Design.PropertyEditing.EditModeSwitchButton

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

EditModeSwitchButton Members

Microsoft.Windows.Design.PropertyEditing Namespace

Other Resources

Property Editing Architecture

WPF Designer Extensibility