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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:46:55+00:00 2026-06-17T07:46:55+00:00

I am making a custom control in WPF. I am still learning the ins-and-outs

  • 0

I am making a custom control in WPF. I am still learning the ins-and-outs of what a TemplateBinding is (used a lot in custom controls).

One think I am noticing is that I can’t seem to use a TemplateBinding inside of a MulitBinding.

When I try this:

<ComboBox.ItemsSource>
    <MultiBinding Converter="{StaticResource MyMultiConverter}">
        <Binding ElementName="PART_AComboBox" Path="SelectedItem"/>
        <TemplateBinding Property="MyListOne"/>
        <TemplateBinding Property="MyListTwo"/>
    </MultiBinding>
</ComboBox.ItemsSource>

I get this error:

The value “System.Windows.TemplateBindingExpression” is not of type “System.Windows.Data.BindingBase” and cannot be used in this generic collection.
Parameter name: value

Am I missing something? Is there a way to make this work?

This is the workaround I have going, but it is kind of a hack:

<ListBox x:Name="ListOne" 
         ItemsSource="{TemplateBinding MyListOne}" 
         Visibility="Collapsed" />
<ListBox x:Name="ListTwo" 
         ItemsSource="{TemplateBinding MyListTwo}"
         Visibility="Collapsed" />

<ComboBox.ItemsSource>
    <MultiBinding Converter="{StaticResource DictionaryFilteredToKeysConverter}">
        <Binding ElementName="PART_TextTemplateAreasHost" Path="SelectedItem"/>
        <Binding ElementName="ListOne" Path="ItemsSource"/>
        <Binding ElementName="ListTwo" Path="ItemsSource"/>
    </MultiBinding>
</ComboBox.ItemsSource>

I bind the ListBoxes to the dependency property and then in my mulitbinding I do an element bind to the ItemsSource of the list boxes.

As I said above, this feels like a hack and I would like to know if there is a correct way to do a MultiBinding with a TemplateBinding as one of the components.

  • 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-17T07:46:56+00:00Added an answer on June 17, 2026 at 7:46 am

    You could use:

    <Binding Path="MyListOne" RelativeSource="{RelativeSource TemplatedParent}"/>
    

    TemplateBinding is really just a short-hand, optimized version of the above. It is very strict in where and how it can be used (directly inside template without hierarchical path et cetera).

    The XAML compiler is still pretty rubbish at giving decent feedback about these kind of issues (at least in 4.0, not tested 4.5 specifically for this). I just now had this XAML:

    <ControlTemplate TargetType="...">
        <Path ...>
            <Path.RenderTransform>
                <RotateTransform Angle="{TemplateBinding Tag}"/>
            </Path.RenderTransform>
        </Path>
    </ControlTemplate>
    

    It compiled and executed fine but was not binding the value in Tag to the rotation angle. I snooped and saw that the property was bound, but zero. Intuitively (after years of dealing with this annoyance) I changed it to this:

    <ControlTemplate TargetType="...">
        <Path ...>
            <Path.RenderTransform>
                <RotateTransform Angle="{Binding Tag, RelativeSource={RelativeSource TemplatedParent}}"/>
            </Path.RenderTransform>
        </Path>
    </ControlTemplate>
    

    And it worked fine.

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

Sidebar

Related Questions

I have a custom control which is used on many pages. I am making
I'm making some custom control. One of the subviews of the control is transparent
I'm making a custom control that can be dragged around and it is semi
I am making a custom control I need to add some default keybindings, microsoft
I'm making a custom webcam user control. I use Microsoft Expression Encoder, and set
I'm making a custom button (Winforms Control Library) and have the code below so
I'm making a custom ImageView . One of the methods is to load an
I am making a custom textbox control and am thinking about adding keybindings in
Silverligh 4, VS 2010. Making a Custom Control. (Non just UserControl, but public class
So i am making a custom edit control. In order to keep track of

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.