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 4072720
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T16:55:15+00:00 2026-05-20T16:55:15+00:00

I have a toolbar that binds it’s ItemsSource to my VM, it’s a list

  • 0

I have a toolbar that binds it’s ItemsSource to my VM, it’s a list of ToolBarItem

public class ToolbarItem : ObservableObject
{
    public string ToolTip { get; set; }
    public ICommand Command { get; set; }
    public BitmapImage Icon { get; set; }
    private bool _isPressed;

    public bool IsPressed
    {
        get { return _isPressed; }
        set { _isPressed = value; RaisePropertyChanged("IsPressed"); }
    }


    public ToolbarItem(string tooltip, ICommand command, BitmapImage icon)
    {
        this.Icon = icon;
        this.Command = command;
        this.ToolTip = tooltip;            
    }
}

}

this is my Toolbar item template:

<DataTemplate x:Key="toolBarItemTemplate">
    <Button x:Name="toolBarButton"
            ToolTip="{Binding Path=ToolTip}"                
            Command="{Binding Path=Command}"
            Cursor="Hand"
            Style="{StaticResource toolBarButtonItemStyle}">
        <ContentControl Content="{Binding}" ContentTemplate="{StaticResource toolBarButtonItemTemplate}" />
    </Button>
</DataTemplate>

<DataTemplate x:Key="toolBarButtonItemTemplate">
    <Image Width="16"
           Height="16"                 
           Source="{Binding Path=Icon}"
           Style="{StaticResource toolBarButtonImageStyle}" />
</DataTemplate>

What I want to do is, when the user clicks on specific toolbar button to change that button behavior, for example, have a border around it.

  • 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-20T16:55:15+00:00Added an answer on May 20, 2026 at 4:55 pm

    the way to do it, is using ItemTemplateSelector and based on the item’s type, use a different DataTemplate.

    this is done in code

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

Sidebar

Related Questions

I want to have a button on my toolbar that has a little down
I have a ControlTemplate that is made up of a ToolBarTray and a ToolBar.
I have written a toolbar that runs on the taskbar. Unfortunately, after it is
I have a 'toolbar' div that I made resizable via jQuery UI. The weird
I have a toolbar that manipulates a Google map. Some of the functions affect
I have a page that have toolbar at top and an iframe below the
I have written an Application Desktop Toolbar (a.k.a AppBar), it works great except for
Do anyone have good ideas of how to modify the toolbar for the WinForms
I have a UINavigationController. In its toolbar is a segmented control with two buttons.
I am writing a toolbar for IE(6+). I have used the various sample bars

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.