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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T23:27:37+00:00 2026-06-08T23:27:37+00:00

Basically, I am looking to create a custom template for my listitems. One template

  • 0

Basically, I am looking to create a custom template for my listitems. One template will use checkboxes, while the other will use radioboxes. This is meant to emulate when multiselect is allowed or not. However, I have tried many different ways, with the most promising being the DataTemplateSelector, however I need to create a Dependency Property so that I can pass in the boolean IsMultiSelect value. But, I need a DependencyObject within the Selector, and the closest I can get is the contentpresenter. I know I can get the parent control based off of that, but that seems like a hack. Is there any way to accomplish what I am looking to do?

  • 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-08T23:27:39+00:00Added an answer on June 8, 2026 at 11:27 pm

    I’m not completely sure if I understood everything correctly, but this may be helpful:

    <ListBox SelectionMode="Multiple">
    <!--<ListBox SelectionMode="Single">-->
        <ListBox.Items>
            <TextBlock Text="Test 1" />
            <TextBlock Text="Test 2" />
            <TextBlock Text="Test 3" />
            <TextBlock Text="Test 4" />
            <TextBlock Text="Test 5" />
            <TextBlock Text="Test 6" />
        </ListBox.Items>
        <ListBox.Style>
            <Style TargetType="{x:Type ListBox}">
                <Style.Resources>
                    <DataTemplate x:Key="SingleSelectionModeItemTemplate">
                        <RadioButton IsChecked="{Binding Path=IsSelected,
                                                         RelativeSource={RelativeSource AncestorType={x:Type ListBoxItem}},
                                                         Mode=TwoWay}"
                                     Content="{Binding}" />
                    </DataTemplate>
                    <DataTemplate x:Key="MultiSelectionModeItemTemplate">
                        <CheckBox IsChecked="{Binding Path=IsSelected,
                                                      RelativeSource={RelativeSource AncestorType={x:Type ListBoxItem}},
                                                      Mode=TwoWay}"
                                  Content="{Binding}" />
                    </DataTemplate>
                </Style.Resources>
                <Style.Triggers>
                    <Trigger Property="SelectionMode"
                             Value="Single">
                        <Setter Property="ItemTemplate" Value="{StaticResource SingleSelectionModeItemTemplate}" />
                    </Trigger>
                    <Trigger Property="SelectionMode"
                             Value="Multiple">
                        <Setter Property="ItemTemplate" Value="{StaticResource MultiSelectionModeItemTemplate}" />
                    </Trigger>
                </Style.Triggers>
            </Style>
        </ListBox.Style>
    </ListBox>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically I'm looking to create a silent windows installer which will install Windows drivers
I'm looking to create my own custom domain specific language that outputs HTML. Basically,
I'm looking to create an on-site API reference for my framework and application. Basically,
Basically I'd be looking to implement a method like this. IQueryAble GetQuery<T>(Entities db) or
Basically, I'm looking for something that will allow me to replicate the following Perl
I've been trying to create a custom skin/template for a TabControl in WPF. I
I'm looking to create a URL string like the one SO uses for the
Basically I looking for the ability to attach methods to an executable function while
Im looking to create a conditional within an in_array statement. Basically, I would like
Basically, I'm looking for resources/guides on how to unit test a WPF Custom Control.

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.