Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 805705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T00:07:24+00:00 2026-05-15T00:07:24+00:00

I want Image button with two state(normal , mouse over). that button must change

  • 0

I want Image button with two state(normal , mouse over). that button must change image with Mouse Over event trigger automatically.
this image button must be a user control. Also i want to set image for each state form code in which form i use that user control.

Solution is using a template with “Value Converter” but i don’t know how?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T00:07:25+00:00Added an answer on May 15, 2026 at 12:07 am

    I found This on Code-project-Article(Cool example)

    http://www.codeproject.com/KB/WPF/WPF_xaml_taskbar_window.aspx

    First He create Wpf-Custom-control(you can create class inherit from Button like this)

     public class ImageButton : Button
    {
        private string cornerRadius;
        public string CornerRadius
        {
            get { return cornerRadius; }
            set { cornerRadius = value; }
        }
    
        private string highlightBackground;
        public string HighlightBackground
        {
            get { return highlightBackground; }
            set { highlightBackground = value; }
        }
    
        private string pressedBackground;
        public string PressedBackground
        {
            get { return pressedBackground; }
            set { pressedBackground = value; }
        }
    }
    

    As second step you must Create template in resource-dictionary(here is code)

    <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:Phone.Controls">
    
    <ControlTemplate x:Key="ButtonTemplate" TargetType="{x:Type local:ImageButton}">
        <ControlTemplate.Resources>
            <Storyboard x:Key="MouseOverButton">
                <ThicknessAnimation Storyboard.TargetName="ButtonBackgroundBorder" 
                                    Storyboard.TargetProperty="(Control.Margin)"
                                    Duration="0:0:0.05" 
                                    FillBehavior="Stop"
                                    From="0,0,0,0" To="2,2,2,2" 
                                    AutoReverse="True" />
            </Storyboard>
        </ControlTemplate.Resources>
        <Grid x:Name="ButtonOuterGrid">
            <Border x:Name="ButtonBackgroundBorder" 
                    CornerRadius="{Binding Path=CornerRadius, RelativeSource={RelativeSource TemplatedParent}}" 
                    Background="{Binding Path=HighlightBackground, RelativeSource={RelativeSource TemplatedParent}}" 
                    BorderBrush="Black"
                    BorderThickness="0.8"
                    Opacity="0">
                <Border.BitmapEffect>
                    <OuterGlowBitmapEffect GlowColor="#FFFFFFFF" GlowSize="2.75" Noise="0.20"/>
                </Border.BitmapEffect>
            </Border>
            <Border x:Name="ButtonEdgesBorder" CornerRadius="{Binding Path=CornerRadius, RelativeSource={RelativeSource TemplatedParent}}"
                    Opacity="1" 
                    BorderBrush="Transparent"
                    BorderThickness="0" />
            <Border x:Name="ButtonContentBorder" 
                    CornerRadius="{Binding Path=CornerRadius, RelativeSource={RelativeSource TemplatedParent}}" 
                    Opacity="1" 
                    BorderThickness="1">
                <ContentPresenter x:Name="ContentText"
                                  Width="Auto" Height="Auto"
    
                                  HorizontalAlignment="Center" 
                                  VerticalAlignment="Center"/>
            </Border>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Trigger.Setters>
                    <Setter Property="Opacity" TargetName="ButtonBackgroundBorder" Value="1"/>
                    <Setter Property="TextElement.Foreground" TargetName="ContentText" Value="Black"/>
                </Trigger.Setters>
            </Trigger>
            <EventTrigger RoutedEvent="Grid.MouseEnter" 
                          SourceName="ButtonOuterGrid">
                <BeginStoryboard Storyboard="{StaticResource MouseOverButton}"/>
            </EventTrigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>
    <Style x:Key="ImageButton" TargetType="{x:Type Button}">
        <Setter Property="Template" Value="{StaticResource ButtonTemplate}" />
    </Style>
    

    And this is last Step, in xaml file you must insert this custom-control

    <ImageButton x:Name="btnConfigs"
                          Style="{StaticResource ImageButton}"
                          Width="25" Height="25"
                          VerticalAlignment="Top"
                          HorizontalAlignment="Right"
                          Margin="0,31.125,16.418,0">
                <Image x:Name="ImgConfigs"
                       Stretch="Fill"/>
            </ImageButton >
    

    and in cs file do this

     this.ImgConfigs.Source="any imag-source" 
    

    also we can change this image-source on btnconfig-click event

    With special thanks from Murray-Foxcroft for create that article

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 514k
  • Answers 514k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Well, first of all, your method returns byte[] and you're… May 16, 2026 at 6:15 pm
  • Editorial Team
    Editorial Team added an answer For Apache configuration: this can (for certain settings) be done… May 16, 2026 at 6:15 pm
  • Editorial Team
    Editorial Team added an answer Read the file by FTP or file_Get_contents()` explode each line… May 16, 2026 at 6:15 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have two forms, one with a radio button that users must select to
I used two image button for Next and Back and i used onclick event
I wanna customize the toggle state of the toggle button in wpf. I want
I have a MasterPage that has two image buttons , and two content pages,
I have a looping animation I want to present for an image button before
I know this is a real newbie question, but that's what I am! I've
I've got an app that has two parts. Basically, the first part shows a
I'm using a ListView and have two buttons that allows users to delete or
Does anyone have any pointers for creating a tristate image button? I have the
What I Want: A border indicating if a UIButton is selected or not. Background:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.