ContentPresenter.RecognizesAccessKey Property

Gets or sets a value that indicates whether the ContentPresenter should use AccessText in its style.

Namespace: System.Windows.Controls
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

public bool RecognizesAccessKey { get; set; }
/** @property */
public boolean get_RecognizesAccessKey ()

/** @property */
public void set_RecognizesAccessKey (boolean value)

public function get RecognizesAccessKey () : boolean

public function set RecognizesAccessKey (value : boolean)

<object RecognizesAccessKey="bool" .../>

Property Value

true if the ContentPresenter should use AccessText in its style; otherwise false. The default value is false.

Identifier field

RecognizesAccessKeyProperty

Metadata properties set to true

None

The following example shows a style for the CheckBox control:

<Style x:Key="{x:Type CheckBox}" TargetType="CheckBox">
  <Setter Property="SnapsToDevicePixels" Value="true"/>
  <Setter Property="OverridesDefaultStyle" Value="true"/>
  <Setter Property="FocusVisualStyle"    Value="{StaticResource CheckBoxFocusVisual}"/>
  <Setter Property="Template">
    <Setter.Value>
      <ControlTemplate TargetType="CheckBox">
        <BulletDecorator Background="Transparent">
          <BulletDecorator.Bullet>
            <Border x:Name="Border"  
              Width="13" 
              Height="13" 
              CornerRadius="0" 
              Background="{StaticResource NormalBrush}"
              BorderThickness="1"
              BorderBrush="{StaticResource NormalBorderBrush}">
              <Path 
                Width="7" Height="7" 
                x:Name="CheckMark"
                SnapsToDevicePixels="False" 
                Stroke="{StaticResource GlyphBrush}"
                StrokeThickness="2"
                Data="M 0 0 L 7 7 M 0 7 L 7 0" />
            </Border>
          </BulletDecorator.Bullet>
          <ContentPresenter Margin="4,0,0,0"
            VerticalAlignment="Center"
            HorizontalAlignment="Left"
            RecognizesAccessKey="True"/>
        </BulletDecorator>
        <ControlTemplate.Triggers>
          <Trigger Property="IsChecked" Value="false">
            <Setter TargetName="CheckMark" Property="Visibility" Value="Collapsed"/>
          </Trigger>
          <Trigger Property="IsChecked" Value="{x:Null}">
            <Setter TargetName="CheckMark" Property="Data" Value="M 0 7 L 7 0" />
          </Trigger>
          <Trigger Property="IsMouseOver" Value="true">
            <Setter TargetName="Border" Property="Background" Value="{StaticResource DarkBrush}" />
          </Trigger>
          <Trigger Property="IsPressed" Value="true">
            <Setter TargetName="Border" Property="Background" Value="{StaticResource PressedBrush}" />
            <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource PressedBorderBrush}" />
          </Trigger>
          <Trigger Property="IsEnabled" Value="false">
            <Setter TargetName="Border" Property="Background" Value="{StaticResource DisabledBackgroundBrush}" />
            <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource DisabledBorderBrush}" />
            <Setter Property="Foreground" Value="{StaticResource DisabledForegroundBrush}"/>
          </Trigger>
        </ControlTemplate.Triggers>
      </ControlTemplate>
    </Setter.Value>
  </Setter>
</Style>

For more information about this example, see CheckBox Control Template.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

ADD
Show: