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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T09:21:21+00:00 2026-05-11T09:21:21+00:00

I have a WPF ComboBox which is databound to a Collection, but depending on

  • 0

I have a WPF ComboBox which is databound to a Collection, but depending on wether a Checkbox is checked or not I’d like to vary which Collection the ComboBox is bound to.

The basic issue is I have a large collection of MyCustomer and I also have a filtered collection of MyCustomer – the filtering is quite intensive and I don’t want to do it with a CollectionView for the main reason that it is already done, the filtered collection already exists – hence the need to simply switch the databinding of the combo.

I’m hoping for a pure XAML solution, obviously writing some code behind would be a relatively simple solutions but it doesn’t feel like it should be required.

  • 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. 2026-05-11T09:21:21+00:00Added an answer on May 11, 2026 at 9:21 am

    Here’s an example using a DataTrigger to switch the collections:

    <StackPanel xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'             xmlns:sys='clr-namespace:System;assembly=mscorlib'             xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>     <StackPanel.Resources>         <x:Array x:Key='notes' Type='{x:Type sys:String}'>             <sys:String>do</sys:String>             <sys:String>re</sys:String>             <sys:String>mi</sys:String>         </x:Array>         <x:Array x:Key='letters' Type='{x:Type sys:Char}'>             <sys:Char>a</sys:Char>             <sys:Char>b</sys:Char>             <sys:Char>c</sys:Char>         </x:Array>     </StackPanel.Resources>      <CheckBox x:Name='chkLetters' Content='Use Letters'/>     <ListBox>         <ListBox.Style>             <Style TargetType='{x:Type ListBox}'>                 <Setter Property='ItemsSource' Value='{StaticResource notes}'/>                 <Style.Triggers>                     <DataTrigger Binding='{Binding IsChecked, ElementName=chkLetters}' Value='True'>                         <Setter Property='ItemsSource' Value='{StaticResource letters}'/>                     </DataTrigger>                  </Style.Triggers>             </Style>         </ListBox.Style>     </ListBox> </StackPanel> 

    For you these wouldn’t be different arrays, but probably different CollectionViewSources with filters or something, but the principle is the same.

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

Sidebar

Related Questions

I have a ComboBox in WPF which is databound, and has data template which
I have WPF ListBox which is bound to a ObservableCollection, when the collection changes,
I have a WPF ComboBox which has its IsEditable property bound to a view
I have a WPF form with a combobox and a textbox (both are databound
I have a WPF Window which has a among other controls hosts a Frame.
I have a WPF window for editing database information, which is represented using an
I have a WPF app which snaps to screen edges (I just set the
I have a WPF ListView that is bound to a BindingList<T>. The binding works
I have a WPF ComboBox named cbFileSize. I try to get is selected value
I have a WPF CombBox as follows: <ComboBox ItemsSource={Binding Source={StaticResource myList}} SelectedItem={Binding Path=mySelectedItem} />

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.