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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T01:36:39+00:00 2026-06-04T01:36:39+00:00

I am using a ListBox and a ListBox style from here: http://viblend.com/products/net/wpf/controls/free-wpf-controls.aspx That looks

  • 0

I am using a ListBox and a ListBox style from here: http://viblend.com/products/net/wpf/controls/free-wpf-controls.aspx

That looks like this:

    <ListBox x:Name="listBox" ItemsSource="{Binding}" Style="{StaticResource Office2010SilverListBoxStyle}">
    <ListBox.ItemTemplate>
        <DataTemplate>
            <ListBoxItem Style="{StaticResource Office2010SilverListBoxItemStyle}" Content="{Binding}"/>
        </DataTemplate>
    </ListBox.ItemTemplate>
</ListBox>

But if I am clicking on an item it gets not marked as selected item.
If i am using no datatemplate all works fine. So does anyone has any idea why?
Here the working example:

<ListBox x:Name="listBox" Style="{StaticResource Office2010SilverListBoxStyle}">
    <ListBoxItem Style="{StaticResource Office2010SilverListBoxItemStyle}">1. Frame</ListBoxItem>
    <ListBoxItem Style="{StaticResource Office2010SilverListBoxItemStyle}">2. Frame</ListBoxItem>
    <ListBoxItem Style="{StaticResource Office2010SilverListBoxItemStyle}">3. Frame</ListBoxItem>
    <ListBoxItem Style="{StaticResource Office2010SilverListBoxItemStyle}">4. Frame</ListBoxItem>
    <ListBoxItem Style="{StaticResource Office2010SilverListBoxItemStyle}">5. Frame</ListBoxItem>
    <ListBoxItem Style="{StaticResource Office2010SilverListBoxItemStyle}">6. Frame</ListBoxItem>
</ListBox>-->
  • 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-04T01:36:41+00:00Added an answer on June 4, 2026 at 1:36 am

    Your DataTemplate should not contain a ListBoxItem, that will be created by the ListBox control already, in your example there will be a ListBoxItem in a ListBoxItem, confuses selection.

    Also you should apply the style to the items via ItemContainerStyle. (As far as i know this only works for auto-generated ListBoxItems which are created if you add data either directly or via ItemsSource, if you add ListBoxItems directly both DataTemplate and the ItemContainerStyle will be ignored)

    See also: Data Templating Overview

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

Sidebar

Related Questions

In my application I am using a style to a listbox. In that style
In a ASP.NET MVC (Razor) project, I'm using a ListBox with Multi Select option
I have a listbox that I am populating using a foreach. (Long explanation of
i'm using a listbox style twice in my project so i want to use
I am using Listbox with ItemTemplate, and when I select an item from the
Using MVVM style I have successfully bound an ObservableCollection<string> to a ListBox , showing
I have an app that is built from Flash CS5.5, exported using AIR3.1 and
I have a WPF window with this xaml: <Window x:Class=WpfApplication2.MainWindow xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml Title=MainWindow Height=350
I have a listbox that users can add/remove from. To add, there's a text
I'm currently implementing a listbox in WPF that will have 2 alternative layouts for

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.