IsKeyboardFocused event not getting set on editors controls

Editors for WPF Forum

Posted 10 years ago by justin stofle
Avatar
I have a style that is being set on actipro editor controls and it is supposed to make the outer edge of the control glow purple when they have keyboard focus. This works fine for standard microsoft controls like a textbox, however this property never seems to be getting set on the editors controls. below is a sample program that will illustrate what i am talking about.

<Window x:Class="ActiproBug.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:editors="http://schemas.actiprosoftware.com/winfx/xaml/editors"
    Title="Window1" Height="300" Width="300">
    <Window.Resources>
        <Style TargetType="{x:Type editors:DoubleEditBox}" BasedOn="{StaticResource {x:Type editors:DoubleEditBox}}">
            <Style.Triggers>
                <Trigger Property="IsKeyboardFocused" Value="true">
                    <Setter Property="BitmapEffect">
                        <Setter.Value>
                            <OuterGlowBitmapEffect  GlowColor="Purple" GlowSize="10" Opacity="1" />
                        </Setter.Value>
                    </Setter>
                </Trigger>
            </Style.Triggers>
        </Style>

        <Style TargetType="{x:Type editors:MaskedTextBox}" BasedOn="{StaticResource {x:Type editors:MaskedTextBox}}">
            <Style.Triggers>
                <Trigger Property="IsKeyboardFocused" Value="true">
                    <Setter Property="BitmapEffect">
                        <Setter.Value>
                            <OuterGlowBitmapEffect  GlowColor="Purple" GlowSize="10" Opacity="1" />
                        </Setter.Value>
                    </Setter>
                </Trigger>
            </Style.Triggers>
        </Style>

        <Style TargetType="{x:Type editors:DateTimeEditBox}" BasedOn="{StaticResource {x:Type editors:DateTimeEditBox}}">
            <Style.Triggers>
                <Trigger Property="IsKeyboardFocused" Value="true">
                    <Setter Property="BitmapEffect">
                        <Setter.Value>
                            <OuterGlowBitmapEffect  GlowColor="Purple" GlowSize="10" Opacity="1" />
                        </Setter.Value>
                    </Setter>
                </Trigger>
            </Style.Triggers>
        </Style>
        
        <Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource {x:Type TextBox}}">
            <Style.Triggers>
                <Trigger Property="IsKeyboardFocused" Value="true">
                    <Setter Property="BitmapEffect">
                        <Setter.Value>
                            <OuterGlowBitmapEffect  GlowColor="Purple" GlowSize="10" Opacity="1" />
                        </Setter.Value>
                    </Setter>
                </Trigger>
            </Style.Triggers>
        </Style>
    </Window.Resources>
    <Grid>
        <StackPanel Orientation="Vertical">
            <TextBlock Text="The acti pro controls below will not glow purple when they have keyboard focus"></TextBlock>
            <editors:DoubleEditBox></editors:DoubleEditBox>
            <editors:MaskedTextBox></editors:MaskedTextBox>
            <editors:DateTimeEditBox></editors:DateTimeEditBox>
            <TextBlock Text="The windows textbox control will glow purple when it has keyboard focus"></TextBlock>
            <TextBox></TextBox>
        </StackPanel>
    </Grid>
</Window>

Comments (3)

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Justin,

The DoubleEditBox control uses several inner elements, each of which can have focus. You'd probably need to base your trigger off of IsKeyboardFocusWithin instead.


Actipro Software Support

Posted 10 years ago by justin stofle
Avatar
This works for all of them except the editors:MaskedTextBox, how do you find out if that control has keyboard focus? I looked at the documentation and didnt see any properties that would tell me.
Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Justin,

Looks like MaskedTextBox (along with PasswordBox and TextBox) in our Editors for WPF product set the ClipToBounds property to true by default. I've removed this setting for the next maintenance release (so these controls work like the editboxes and native WPF editors).

In the interim, you can use a Setter that sets ClipToBounds to false.


Actipro Software Support

The latest build of this product (v2019.1 build 0682) was released 28 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.