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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:28:41+00:00 2026-06-12T09:28:41+00:00

I have a ComboBox that has a bound items source… I’ve stripped my example

  • 0

I have a ComboBox that has a bound items source… I’ve stripped my example down to the key pieces:

<UserControl x.Class="My.Application.ClientControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"                         
             xmlns:conv="clr-namespace:My.Utilities.Converters"
             Name="ClientControl">

    <UserControl.Resources>
        <ResourceDictionary>
            <CollectionViewSource Key="x:ClientsCollection" />
        </ResourceDictionary>

        <conv:ClientOptions x:Key="ClientOptions" />

    </UserControl.Resources>

    ...

    <ComboBox Name="Options" 
              DataContext="ClientsCollection" 
              ItemsSource="{Binding [ClientNumber], Converter={StaticResource ClientOptions}" />

</UserControl>

This works, but I now want to add a single manual item to my combobox that will trigger alternate functionality called “Other…” so I’m having to move to using the CompositeCollection… like so:

<ComboBox Name="Options"
          DataContext="ClientsCollection">
    <ComboBox.ItemsSource>
        <CompositeCollection>

            <CollectionContainer Collection="{Binding [ClientNumber], Converter={StaticResource ClientOptions} />
            <ComboBoxItem>Other...</ComboBoxItem>
        </CompositeCollection>
</ComboBox>

Try as I might, the bound items just won’t populate when using the CompositeCollection. It only shows the manual ComboBoxItem “Other…”. If I remove that item, the list is empty. If I attach a breakpoint to the converter it doesn’t catch anything, which seems to indicate that the binding isn’t even attempted.

I am obviously not understanding something about how the binding function in the CompositeCollection is happening. Can someone see an error in my XAML or explain what I’m missing?

  • 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-12T09:28:41+00:00Added an answer on June 12, 2026 at 9:28 am

    Declare the CompositeCollection in ComboBox.Resources and use it with ItemsSource=”{Binding Source={StaticResource myCompositeCollection}}” .

    <UserControl x.Class="My.Application.ClientControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"                         
             xmlns:conv="clr-namespace:My.Utilities.Converters"
             Name="ClientControl">
    
    <UserControl.Resources>
        <ResourceDictionary>
            <CollectionViewSource Key="x:ClientsCollection" />
        </ResourceDictionary>
    
        <conv:ClientOptions x:Key="ClientOptions" />
        <CompositeCollection x:Key="myCompositeCollection">
    
            <CollectionContainer Collection="{Binding Source={StaticResource ClientsCollection}, Path=[ClientNumber], Converter={StaticResource ClientOptions} />
            <ComboBoxItem>Other...</ComboBoxItem>
        </CompositeCollection>
    
    </UserControl.Resources>
    
    ...
    
    <ComboBox Name="Options" 
              DataContext="ClientsCollection" 
              ItemsSource="{Binding Source={StaticResource myCompositeCollection}}" />
    

    If you declare the CompositeCollection inside the ItemsSource property in element syntax, the Binding for the CollectionContainer.Collection doesn’t find its DataContext.

    Inside the Resources section, Freezables like CompositeCollection inherit the DataContext of their declaring element, as if they were logical children of the element. However, this is a speciality of the Resources property and properties like ContentControl.Content or similar properties which contain the logical children of a control (and maybe a few others). If you use element syntax to set the value of a property, in general you would have to expect that property value inheritance for properties like DataContext doesn’t work, and so Bindings without an explicit Source won’t work, either.

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

Sidebar

Related Questions

I have a ComboBox that has the SelectedItem bound to the ViewModel. <ComboBox SelectedItem={Binding
I have a ComboBox whose ItemsSource is bound to an ObjectDataProvider that has its
I have a ComboBox that has its ItemSource and SelectedItem properties bound to a
I have a ComboBox that has its ItemsSource bound to a static List<CustomSettings> of
I have a combobox that has the entries of a full name, eg: John
I have a combobox that has a content 'Male' and 'Female' with Tags 0
I have a combobox that is bound to an enum using the following code:
I have a ComboBox that is bound to an ObservableCollection of custom UserControls. Each
I have a ComboBox that is bound to a DataSource. I want to dynamically
i have a combobox that has 3 cases. case 0 opens a dialog saying,

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.