DateTimeEditBox disable MouseOver effect

Editors for WPF Forum

Posted 10 years ago by Ahmil Onas
Version: 13.2.0592
Avatar

Is there a way to disable the MouseOver effect in the DateTimeEditbox?

 

I noticed that when you hover over the DateTimeEditbox, its background color changes to white (or transparent).

 

Is there a way to disable this behavior?

Comments (8)

Posted 10 years ago by Ahmil Onas
Avatar

I tried doing the following:

First:

<Window x:Class="WpfApplication00005.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525"
        xmlns:editors="http://schemas.actiprosoftware.com/winfx/xaml/editors">
    <Window.Resources>
        <Style x:Key="myStyle" TargetType="editors:DateTimeEditBox">
            <Setter Property="SnapsToDevicePixels" Value="True"/>
            <Setter Property="OverridesDefaultStyle" Value="True"/>
            <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type editors:DateTimeEditBox}">
                        <Border Name="Border" 
                                CornerRadius="2" 
                                Padding="2"
                                Background="#FFFFFF"
                                BorderBrush="#888888"
                                BorderThickness="2" >
                            <ContentPresenter Margin="2" 
                                 HorizontalAlignment="Center"
                                 VerticalAlignment="Center" 
                                 RecognizesAccessKey="True"/>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Style.Triggers>
                <Trigger Property='IsMouseOver' Value='True'>
                    <Setter Property='Background' Value='Beige' />
                </Trigger>
            </Style.Triggers>
        </Style>
    </Window.Resources>
    <Grid>
        <editors:DateTimeEditBox Style="{StaticResource myStyle}" Name="DT" Margin="154,158,229,103">
            
        </editors:DateTimeEditBox>
</Grid>
</Window>

 But it didn't work. The entire DateTimeEditBox became just a box.

I also tried the following:

<Window x:Class="WpfApplication00005.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525"
        xmlns:editors="http://schemas.actiprosoftware.com/winfx/xaml/editors"
        xmlns:system="clr-namespace:System;assembly=mscorlib"
        xmlns:themes="http://schemas.actiprosoftware.com/winfx/xaml/themes">
    <Window.Resources>
        <system:Boolean x:Key="{x:Static themes:AssetResourceKeys.EditIsAnimationEnabledBooleanKey}">False</system:Boolean>
    </Window.Resources>
    <Grid>
        <editors:DateTimeEditBox Background="Red"  Name="DT" Margin="154,158,229,103">
        </editors:DateTimeEditBox>
</Grid>
</Window>

 ..but it still didn't work. When I hover over the DateTimeEditBox, it still has an animation. That is the background becomes transparent/white.

 

I also tried moving the 

        <system:Boolean x:Key="{x:Static themes:AssetResourceKeys.EditIsAnimationEnabledBooleanKey}">False</syste

 in the App.xaml's <Application.Resources> but it still didn't work.

I was wondering if I am missing something?

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

Hello,

You could either use another Actipro theme that might not have hover state changes, or if you like the one you are using in general, you could redefine the related theme asset brushes in your app's Resources.  For instance like this:

<SolidColorBrush PresentationOptions:Freeze="True" x:Key="{x:Static themes:AssetResourceKeys.EditBackgroundFocusedBrushKey}" themes:TintGroup.Name="Edit" 
		Color="#FFFFFFFF" /> 

There are asset brushes for each state (normal, hover, focused, etc.) and for things like backgrounds, borders, etc.  The AssetResourceKeys class defines them all. Check the documentation's class library topic for AssetResourceKeys to see all the Edit* brush assets that are available to you to customize.

I believe the IsAnimationEnabled key you tried using just defines if the transitions between the various states is animated or if it happens instantly.  It won't stop the state changes from happening.


Actipro Software Support

Posted 10 years ago by Ahmil Onas
Avatar

Thanks. Will this work if I don't use a theme for my DateTimeEditBox control? Or if I dont use a theme for my DateTimeEditBox, is there a default theme assigned to it? Thanks again.

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

All our controls are themed and will make use of our theme system.  Our theme system will use a theme that matches the current operating system theme by default.  If you want to always ensure that your app gets a specific theme, you can set ThemeManager.CurrentTheme.  You can read more about the above in the Themes documentation.


Actipro Software Support

Posted 10 years ago by Ahmil Onas
Avatar

When I try to debug it, when I put ThemeManager.CurrentTheme in the watch window, it says that its value is Null.

 

So I was thinking, am I suppose to set a theme for it first before the above can work?

Something like this (as I've read on the documentation):

 

ThemeManager.CurrentTheme = Themes.LunaLight.ToString()

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

A null value there means it effectively will use the system theme.  It should be the same as if you set it to "Generic".


Actipro Software Support

Posted 10 years ago by Ahmil Onas
Avatar

And even if it is using the system theme, disabling the mouseover effects using the assetresourcekeys is still possible right?

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

Well our controls are always using our themes.  By default if you don't set ThemeManager.CurrentTheme, then an Actipro theme the mimics the look of the current system theme is used.  Thus yes, modifying the resource brushes will always work for Actipro controls.


Actipro Software Support

The latest build of this product (v24.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.