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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:51:08+00:00 2026-05-16T06:51:08+00:00

I have ToggleButtons that are dynamically created based on my datasource. I would like

  • 0

I have ToggleButtons that are dynamically created based on my datasource. I would like to have only one togglebutton checked at a time when a user clicks one. How can I accomplish this?

<UserControl.Resources>

    <ItemsPanelTemplate x:Key="HorizontalMiniDrawerList">
        <StackPanel Orientation="Horizontal"/>
    </ItemsPanelTemplate>

    <DataTemplate x:Key="MiniDrawerRowTemplate">
        <ToggleButton x:Name="_MiniDrawerButton" Width="60" Height="85" Style="{DynamicResource MiniDrawerButtonWhite}" Checked="_MiniDrawerButton_Checked" >
        </ToggleButton>
        <DataTemplate.Triggers>
            <DataTrigger Binding="{Binding Width}" Value="3">
                <Setter TargetName="_MiniDrawerButton" Property="Width" Value="185"/>
            </DataTrigger>                                

        </DataTemplate.Triggers> 
    </DataTemplate>

    <DataTemplate x:Key="MiniDrawerListItemTemplate">
        <ListBox SelectionMode="Multiple" Background="#00000000" BorderThickness="0" Width="500"
            ItemsPanel="{StaticResource HorizontalMiniDrawerList}"
            ItemTemplate="{StaticResource MiniDrawerRowTemplate}" 
            ItemsSource="{Binding Row}" >

        </ListBox>
    </DataTemplate>        

</UserControl.Resources>

<Grid Background="{DynamicResource ListBackgroundColor}" >

    <ListBox x:Name="_MiniDrawerRows" BorderThickness="0" Background="Transparent"  Margin="107,84,225,217" ScrollViewer.HorizontalScrollBarVisibility="Disabled"
             ItemsSource="{Binding Path=MiniDrawerRows, diagnostics:PresentationTraceSources.TraceLevel=High}" 
             ItemTemplate="{StaticResource MiniDrawerListItemTemplate}"  >                  
    </ListBox>      

</Grid>

Update: Instead of using a togglebutton I used a radiobutton and changed the style of the radio button to look like a togglebutton.

<Style x:Key="MiniDrawerButtonWhiteRadioToToggleButton" BasedOn="{StaticResource {x:Type ToggleButton}}" TargetType="{x:Type RadioButton}">
  • 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-16T06:51:09+00:00Added an answer on May 16, 2026 at 6:51 am

    I assume you mean “only one” instead of “only when”. In that case you can use RadioButton (which is derived from ToggleButton) instead and set a GroupName on _MiniDrawerButton in your ItemTemplate. It looks like you are probably already using a custom ControlTemplate so you can use the same one for RadioButton by just changing the Style and ControlTemplate TargetTypes.

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

Sidebar

Related Questions

We have a simple animation that runs when a ToggleButton is checked and unchecked
I want a widget that behaves like a togglebutton and can have its background
I have several StackPanels that change visibility based on ToggleButtons. The code below works
I want my WPF application to have a ToggleButton that contains an image of
I have a group of buttons that should act like toggle buttons, but also
I need to have a command handler for a ToggleButton that can take multiple
Within a Desktop app I have a toggle button: <ToggleButton x:Name=CFStglBtn Checked=cfsCBox_Checked Unchecked=cfsCBox_Unchecked IsChecked=True
i have a row of buttins created like this i want to change the
I have a ToggleButton that is malfunctioning. As I understand it, a ToggleButton should
I have a four ToggleButton buttons that I want to behave as a group,

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.