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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:52:16+00:00 2026-05-26T12:52:16+00:00

I have a problem with the selection of items in a Listbox, when the

  • 0

I have a problem with the selection of items in a Listbox, when the Listbox is in a Tabcontrol.
I can’t select any item in the Listbox.
I am filling the Listbox dynamically via code-behind, also I am using drag and drop on it, though, Drag and drop is working with the tabcontrol.

Here is my XAML code:

<Window x:Class="SPInstallApp.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:toolkit="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit.Extended"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="SharePoint 2010 - wspSync" Height="450" Width="700" AllowDrop="True" Icon="/SPInstallApp;component/Images/favicon.ico">

<Window.Resources>
    <DataTemplate x:Key="CustomListBoxTemplate">
        <StackPanel>
            <Grid Margin="4">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="48 "/>
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                </Grid.RowDefinitions>
                <Image Source="{Binding Path=ImageSource}" Grid.Column="0" Grid.RowSpan="3" Margin="0,0,5,0" />
                <TextBlock 
              Padding="0,5,0,0"
              Text="{Binding Path=Title}" 
              Grid.Column="1" 
              Grid.Row="0" 
              FontWeight="Bold"/>
                <TextBlock
              Padding="0,0,0,5"
              Text="{Binding Path=Description}" 
              Grid.Column="1" 
              Grid.Row="1"
              FontStyle="Italic" />
                <TextBlock
              Padding="0,0,0,5"
              Text="{Binding Path=Status}"                  
              Grid.Column="1" 
              Grid.Row="2"
              FontStyle="Italic" Foreground="#FFDE2B2B" />
            </Grid>                
        </StackPanel>
    </DataTemplate>
</Window.Resources>
<toolkit:BusyIndicator IsBusy="True" BusyContent="Bitte warten..." Name="busyIndicator">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="50"/>
        </Grid.RowDefinitions>
        <Label Content="Websitecollection wählen:" Grid.Row="0" Grid.Column="0" Margin="5,0,0,0"  />
        <ComboBox Grid.Row="1" Grid.Column="0" Height="20" Margin="10,0,10,10" Name="cbWebsitecollection" SelectionChanged="CbWebsitecollectionSelectionChanged" />
        <TabControl Grid.Row="2" Grid.Column="0" Name="tc" SelectionChanged="TcSelectionChanged" Margin="10,0,10,0">
            <TabItem Header="Installieren">
                <ListBox AllowDrop="True" Background="#CCC" Drop="ListBoxDrop" Name="lbDropbox" IsSynchronizedWithCurrentItem="True" ItemTemplate="{StaticResource CustomListBoxTemplate}" KeyUp="LbDropboxKeyUp" />
            </TabItem>
            <TabItem Header="Websitecollection">
                <CheckBox Content="test" />
            </TabItem>
        </TabControl>
        <Label Grid.Row="2" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Center" FontWeight="Bold" Content="drag 'n' drop" Margin="10" Drop="ListBoxDrop" Name="lbDescription" />
        <Button Grid.Row="3" Grid.Column="0" Name="cmdSync" Content="Synchronisieren" Margin="10" Width="100" HorizontalAlignment="Right" Click="CmdSyncClick" />
        <Image Grid.Row="3" HorizontalAlignment="Left" Name="Logo" Source="/SPInstallApp;component/Images/logo.gif" Margin="10" MouseUp="LogoMouseUp" MouseEnter="LogoMouseEnter" MouseLeave="LogoMouseLeave" />
    </Grid>
</toolkit:BusyIndicator></Window>

If i remove the Tabcontrol, everything is working.
I hope someone can help me or know what the problem is.

greets

  • 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-26T12:52:16+00:00Added an answer on May 26, 2026 at 12:52 pm

    I have found the problem.
    The problem is how Microsoft designed the MessageHandles.
    If a child of an item throws a message (for example selectionChanged) and the message is not handles, the message goes to the parent Item.
    So, in my case, if I click on an item in the ListBox, the (unhandled) message “selectionChanged” was sent to the TabControl, this was the problem. Because i have custom code in the TabControl.selectionChanged it always ran my code, instead of selecting the item in the ListBox.

    The workaround is, to put this code in the selectionChanged eventhandler of the ListBox:

    private void ListBox_selectionChanged(object sender, DragEventArgs e)
    {
        e.handled = true;
    }
    

    This avoids the transfer of the message from the child messagehandler to the parent messagehandler.

    I hope u can undersand my explanation.

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

Sidebar

Related Questions

With a listbox, I have the following code to extract the item selected: private
I have a list box control: <asp:ListBox runat=server id=lbox autoPostBack=true /> The code behind
I have a listbox that can potentially have a large number of items with
I have a listbox with a datatemplate for the items. The problem is that
I have a selection list that is generated dynamically, it lists a number of
I have a Masterpage that has Treeview. You can select some nodes there. Based
I have a JTextArea and am deteching if any text is selection, if none
I have the following code to copy paths of multiple selected items in Finder:
I have a ListBox with custom styles applied. It seems sometimes, when I select
Here's my problem. ListBox A show all the items in an Observable Collection. ListBox

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.