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

  • SEARCH
  • Home
  • 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 9134671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:42:18+00:00 2026-06-17T08:42:18+00:00

I have a listView where each item consists of a dataTemplate containing a Button.

  • 0

I have a listView where each item consists of a dataTemplate containing a Button. This is due to a requirement where clicking on the list item will act like a button click to move you into the next step of a “Wizard”.

Each Button in the DataTemplate contains a ControlTemplate.

The items inside of this controlTemplate are becoming disabled when the command’s CanExecute is false. Specifically in my example below, the Button inside of the Button’s template (the one with an image as it’s template) is becoming disabled as well.

How can I keep the items inside of the template enabled even when the command associated with that button is disabled.

Summary: Button has template that contains another button. Button inside of template is disabled when parent button’s command is disabled.

XAML:

<ListView.ItemTemplate>
    <DataTemplate>                
        <Button Name="nextButton" Height="30" Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Wiz:edited}}, Path=DataContext.ACommand}" CommandParameter="{Binding}">
              <Button.Template>
                <ControlTemplate>                     
                   <StackPanel Orientation="Horizontal">
                      <Label Content="{Binding}"/>
                      <Button>
                         <Button.Template>
                            <ControlTemplate>
                                <Image Source="{Binding source}"/>
                            </ControlTemplate>
                         </Button.Template>
                      </Button>
                   </StackPanel>
                </ControlTemplate>                    
              </Button.Template>
            </Button>
    </DataTemplate>
</ListView.ItemTemplate>
  • 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-06-17T08:42:19+00:00Added an answer on June 17, 2026 at 8:42 am

    ButtonBase hooks the CanExecute of the Command it is associated with. When the CanExecute returns false the ButtonBase caches that and returns false from its IsEnabledCore thereby disabling the ButtonBase. When an element is disabled, its descendants are disabled. If you don’t want it to be disabled then you either shouldn’t associate it with a command (e.g. hook the click) or don’t use a command whose CanExecute will be false (e.g. use a different wrapper command that returns true from CanExecute but doesn’t call the Execute of the wrapped command) or don’t put other elements inside the button (create/use some attached behavior that will execute a command when the listitem is clicked).

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

Sidebar

Related Questions

I have a ListView with multiple checkboxes (one for each list item). What would
There is a requirement to have not-so-trivial dynamic list, each record of which consists
I have a listview where each list item can contain 1 or more clickable
I have a ListView in which each List item has a Spinner . I
I have a listview with each item containing an image, a textview and a
In my application , I have a listview and each item has a button.
I have a listview with each row containing some text and a delete button.
I have a listview ,each item is a textView with property autoLink=web|email.Link will work
i have this listview each listview item has a textview that have background ,
I currently have a custom listview where each item on the list contains two

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.