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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T21:44:39+00:00 2026-06-10T21:44:39+00:00

I have a basic ListView, whose XAML can be found below. Basically, after I

  • 0

I have a basic ListView, whose XAML can be found below. Basically, after I populate things to it, I’d like to be able to remove them, hence the “X” button:

<ListView Name="selectedPeople" ItemsSource="{Binding Path=map, RelativeSource={RelativeSource AncestorType=Window},
                Mode=OneWay}" Width="480" Height="200" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,225,10,0"
                SelectionChanged="selectedPeople_SelectionChanged">
         <ListView.View>
            <GridView AllowsColumnReorder="True" ColumnHeaderToolTip="Broadcast call targets">
               <GridViewColumn DisplayMemberBinding="{Binding Path=Key}"   Header="ID"      Width="120" />
               <GridViewColumn DisplayMemberBinding="{Binding Path=Value}" Header="Description" Width="320" />
               <GridViewColumn Header="" Width="30">
                  <GridViewColumn.CellTemplate>
                     <DataTemplate>
                        <Button Content=" X " Visibility="Hidden" />
                     </DataTemplate>
                  </GridViewColumn.CellTemplate>
               </GridViewColumn>
            </GridView>            
         </ListView.View>      
      </ListView>

I’ve left the X button invisible by default because the desired behavior is for it to only appear for rows when they are selected. How can this be done, that is changing visibility of the button on selected change? Also, once clicked, how can I relate which row/item the button was associated with?

  • 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-10T21:44:41+00:00Added an answer on June 10, 2026 at 9:44 pm

    you can change the button column template as like below with its IsEnabled Property.

    <GridViewColumn Width="30" Header="">
                            <GridViewColumn.CellTemplate>
                                <DataTemplate>
                                    <Button Content=" X " IsEnabled="{Binding RelativeSource={RelativeSource AncestorType={x:Type ListViewItem}}, Path=IsSelected}" />
                                </DataTemplate>
                            </GridViewColumn.CellTemplate>
                        </GridViewColumn>
    

    or you can use the converter or trigger for visiblity.

     <Window.Resources>
            <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter1" />
        </Window.Resources>
      <GridViewColumn Width="30" Header="">
                            <GridViewColumn.CellTemplate>
                                <DataTemplate>
                                    <StackPanel>
    
                                        <Button Content=" X " Visibility="{Binding RelativeSource={RelativeSource AncestorType={x:Type ListViewItem}}, Path=IsSelected, Converter={StaticResource BooleanToVisibilityConverter1}}" />
                                    </StackPanel>
    
                                </DataTemplate>
                            </GridViewColumn.CellTemplate>
                        </GridViewColumn>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a nested listview, i can bind the selected item of the basic
I have basic Spring MVC 3 setup for i18n where I can show labels
So I've got a pretty basic ListView, that has two columns. Sample code below:
I have a very basic ListView in android and had set a very basic
I have a very basic ListView in android and had set a very basic
I have a ListView in WPF that is databound to a basic table that
I have the following very basic layout for each row of a ListView .
I have created a basic ListView and added a TextView and ImageView in it.
I'm attempting to create a ListView where I can draw some basic shapes into
I have a basic iPhone/iPad app which has a ; a. List view &

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.