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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:21:00+00:00 2026-05-24T11:21:00+00:00

I am trying to create a custom control, which behaves a bit like one

  • 0

I am trying to create a custom control, which behaves a bit like one of the “rows” in the toolbox in Expression Blend.

When closed, it displays the first of its items, and when the user holds the mouse down over it for a second or so, it “expands” to reveal the other items in a popup excluding the item which is currently selected (the item which was clicked on still remains visible, but is not grouped with the others).

I have managed to make a control which inherits from ContentControl displays one item and then reveals the others when expanded, but the item which is displayed first does not change when one is clicked.

The template is as follows:

<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<Grid>
    <ContentPresenter Content="{TemplateBinding MainItem}" /> // The item that is seen even when not expanded
    <Popup Name="Popup" Placement="Right" IsOpen="{TemplateBinding IsExpanded}" AllowsTransparency="True" Focusable="False" PopupAnimation="Fade">
        <Border Name="SubmenuBorder" SnapsToDevicePixels="True" BorderThickness="0" >
            <StackPanel Orientation="Horizontal" IsItemsHost="True" /> // The items only seen when expanded
        </Border>
    </Popup>
</Grid>

At the moment, I have to manually set the MainItem in XAML and it is not a member of the Items property of the ContentControl.

Is there a way to achieve this functionality where all items are part of the Items collection and are automatically not shown when an IsSelected property or something is set, and are then shown where the current MainItem is shown when this is the case?

I tried changing it to a Selector and using a filter on the Items to achieve this and binding the first ContentPresenter to the SelectedItem but it didn’t seem to work.

If possible, the order of the items only visible when the control is expanded should be the same as the order in which they are laid out in XAML, with the currently selected item missing.

Thanks

  • 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-24T11:21:01+00:00Added an answer on May 24, 2026 at 11:21 am

    try using the ItemContainerStyle to set the visibility of the selected item to ‘Hidden’. You’d need a BoolToVisibilityConverter (you can write one easily or get one from the WPFToolkit) to get the correct value

    <ContentPresenter Content="{Binding ElementName=selector, Path=SelectedItem}" />
    <ComboBox x:Name="selector">
        <ComboBox.ItemContainerStyle>
            <Style TargetType="ComboBoxItem">
                <Setter Property="Visibility" Value="{Binding Path=IsSelected, Converter={StaticResource boolToVisibilityConverter}}" />
            </Style>
        </ComboBox.ItemContainerStyle>
        <ComboBox.ItemTemplate>
            <DataTemplate>
                <TextBlock Text="{Binding SomeProperty}" />
            </DataTemplate>
        </ComboBox.ItemTemplate>
    </ComboBox>ComboBoxItem
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a custom control - a button - which will have
I've been trying to create a custom control that works exactly like the Panel
I am trying to create a custom control which does nothing except decorate the
I am trying to create a Custom control specifically for my application which would
I'm trying to create a custom control in WPF to display the game tree
I am trying to create a custom datasource control. I have been following this
I'm trying to create a custom file upload control in WPF 4.0 and I'm
I'm trying to create a custom JSP tag that would take an array object
I am trying to create a custom accordion for my page to that display
I'm trying to create a custom transition, to serve as a replacement for a

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.