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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T07:51:41+00:00 2026-05-20T07:51:41+00:00

<StackPanel Grid.Column=0 > <Button Name=buttonEditListBoxItem Content=Edit Click=buttonEditListBoxItem_Click></Button> <ListBox Name=ListBoxTriggers SelectedValuePath=TriggerId IsSynchronizedWithCurrentItem=True SelectionChanged=Triggers_SelectionChanged ScrollViewer.HorizontalScrollBarVisibility=Auto HorizontalContentAlignment=Stretch>

  • 0
  <StackPanel Grid.Column="0" >
            <Button Name="buttonEditListBoxItem" Content="Edit" Click="buttonEditListBoxItem_Click"></Button>
            <ListBox  Name="ListBoxTriggers" 
                 SelectedValuePath="TriggerId" 
                 IsSynchronizedWithCurrentItem="True"
                 SelectionChanged="Triggers_SelectionChanged"
                 ScrollViewer.HorizontalScrollBarVisibility="Auto" 
                 HorizontalContentAlignment="Stretch">
            <ListBox.ItemTemplate>
                <DataTemplate><Grid >
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="AUTO"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <CheckBox Grid.Column="0" VerticalAlignment="Center" x:Name="checkBoxTriggers" ></CheckBox>
                            <Button Grid.Column="1" Style="{StaticResource GlassButton}" 
                            Uid="{Binding Path=TriggerId}" 
                            Margin="5"
                           x:Name="ButtonTrigger"
                           GotFocus="ButtonTrigger_GotFocus"
                          >
                                <Button.Content>
                                    <TextBlock Foreground="White" TextAlignment="Justify"
                                       TextWrapping="Wrap" Margin="6"   Text="{Binding Path=Name}"/>
                                </Button.Content>
                            </Button>
                        </Grid>
                    </DataTemplate>
                </ListBox.ItemTemplate></ListBox>

            </StackPanel>

I want to create a listbox with a data Template which includes a button and a checkbox . What i want to do is when i click on the Edit button these checkboxes should get visible and when i click it again i want to make those checkboxes invisible/collapsed

Answer:I have changed the code now to this: `

</Window.Resources>  <StackPanel Grid.Column="0" >
            <ToggleButton Name="buttonEditListBoxItem" 
                          Content="Edit" 
                          IsChecked="False"
                          Click="buttonEditListBoxItem_Click"></ToggleButton>
            <ListBox  Name="ListBoxTriggers" 
                 SelectedValuePath="TriggerId" 
                 IsSynchronizedWithCurrentItem="True"
                 SelectionChanged="Triggers_SelectionChanged"
                 ScrollViewer.HorizontalScrollBarVisibility="Auto" 
                 HorizontalContentAlignment="Stretch">
            <ListBox.ItemTemplate>
                <DataTemplate>  <Grid >
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="AUTO"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <CheckBox Visibility="{Binding ElementName=buttonEditListBoxItem, Path=IsChecked, Converter={StaticResource visibilityConverter}}" Grid.Column="0" VerticalAlignment="Center" x:Name="checkBoxTriggers" ></CheckBox>
                            <Button Grid.Column="1" Style="{StaticResource GlassButton}" 
                            Uid="{Binding Path=TriggerId}" 
                            Margin="5"
                           x:Name="ButtonTrigger"
                           GotFocus="ButtonTrigger_GotFocus"
                          >
                                <Button.Content>
                                    <TextBlock Foreground="White" TextAlignment="Justify"
                                       TextWrapping="Wrap" Margin="6"   Text="{Binding Path=Name}"/>
                                </Button.Content>
                            </Button>
                        </Grid>
                    </DataTemplate> </ListBox.ItemTemplate>
        </ListBox>` `public class VisibilityConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        return ((Boolean)value) ? Visibility.Visible : Visibility.Collapsed;
    }

    public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        return (((Visibility)value) == Visibility.Visible);
    }
}`
  • 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-20T07:51:42+00:00Added an answer on May 20, 2026 at 7:51 am

    the easiest way to achieve that is to use a togglebutton

    example:

    <ToggleButton  Name="Toggler">
    </ToggleButton>
    <StackPanel Visibility="{Binding ElementName=Toggler, Path=Checked, Converter={StaticResource booleanToVisibilityConverter}}">
    <!-- in here you can place the checkboxes-->
    </StackPanel>
    

    you just have to create a valueconverter which converts from boolean to the enumeration Visibility

    another possibility is to use a “Popup” Element in combination with a ToggleButton (which gives the feeling of a small helper which pops up to edit the item and if StaysOpen=”False” is set closes immediately on losing focus)
    If you use this approach you do not have to repress the edit button to hide the checkboxes

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

Sidebar

Related Questions

I have this: <ListBox x:Name=PART_lstAttributes Grid.Row=1 Style={StaticResource GlossyBlackListBox}> <ListBox.ItemTemplate> <DataTemplate> <StackPanel> <TextBlock x:Name=txtAttributeName Text={Binding
I have listbox that displays information about list of objects: <ListBox Grid.Column=0 Height=152 Name=CustomersList
This is my current XAML. <StackPanel Orientation=Horizontal Grid.Column=3 Grid.Row=1> <Label Content=Allocated: FontSize=14/> <Label Content={Binding
This is my current XAML. <StackPanel Orientation=Horizontal Grid.Column=3 Grid.Row=1> <Label Content=Allocated: FontSize=14/> <Label Content={Binding
I've got some RadioButtons in my XAML... <StackPanel> <RadioButton Name=RadioButton1 GroupName=Buttons Click=ButtonsChecked IsChecked=True>One</RadioButton> <RadioButton
I have a databound and itemtemplated ListBox: <ListBox x:Name=lbLista ScrollViewer.VerticalScrollBarVisibility=Visible> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation=Horizontal>
I have created a Silverlight User Control. The markup is: <StackPanel Grid.Row=4 Grid.Column=0 Orientation=Horizontal
I have a ListBox with a StackPanel that contains an image and label. <ListBox.ItemsPanel>
People use frequently something like: <ListBox ItemsSource={Binding ElementName=thisControl, Path=ListIndexes}> <ListBox.ItemTemplate> <DataTemplate> <StackPanel> <Label Content={Binding
I'm using a DataGrid inside a StackPanel inside a Grid which causes the GridView

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.