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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:07:15+00:00 2026-05-28T06:07:15+00:00

<ListBox BorderThickness=0 x:Name=PendingChatListBox HorizontalContentAlignment=Stretch> <ListBox.ItemTemplate > <DataTemplate> <Button Height=40 Click=OpenChat_click Content={Binding BindsDirectlyToSource=True, Converter={StaticResource cPendingUnreadMessagesConverter}}

  • 0
<ListBox BorderThickness="0" x:Name="PendingChatListBox" HorizontalContentAlignment="Stretch">
    <ListBox.ItemTemplate >
        <DataTemplate>
            <Button Height="40" Click="OpenChat_click" Content="{Binding BindsDirectlyToSource=True, Converter={StaticResource cPendingUnreadMessagesConverter}}"  HorizontalContentAlignment="Center" Background="Transparent" x:Name="OpenChatButton" Foreground="Blue"/>
        </DataTemplate>
    </ListBox.ItemTemplate>
</ListBox>
ObservableCollection<SideBarUnit> OpenChats = new ObservableCollection<SideBarUnit>();
this.PendingChatListBox.ItemsSource = OpenChats;


if (PendingChatListBox.Items.Count > 0)
{
    // WHY IS THIS OBJECT NULL?
    object obj = PendingChatListBox.ItemContainerGenerator.ContainerFromItem(PendingChatListBox.Items[0]); 
}
  • 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-28T06:07:16+00:00Added an answer on May 28, 2026 at 6:07 am

    Probably because of virtualization, items out of view have no container generated for them (if the items panel is virtualizing in nature; default for ListBoxes and the like).

    Or if you assign a source and try to get the container in the same method the ListBox did not have the time to create it yet. The UI-thread must idle to do so.

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

Sidebar

Related Questions

<ListBox Margin=1,42,0,0 BorderThickness=0 BorderBrush={x:Null} telerik:StyleManager.Theme=Metro Name=lbSource ItemTemplate={StaticResource ListBoxItemTemplate} ItemContainerStyle={StaticResource DisallowDrag} telerik:DragDropManager.AllowDrag=True..... The property telerik:DragDropManager.AllowDrag
I have a templated ListBox : <ListBox Grid.Row=0 Grid.Column=1 Background=Transparent BorderThickness=0 x:Name=mainMenu ItemsSource={Binding Source={x:Static
I have a listbox where the items contain checkboxes: <ListBox Style={StaticResource CheckBoxListStyle} Name=EditListBox> <ListBox.ItemTemplate>
I have a listbox, and I have the following ItemTemplate for it: <DataTemplate x:Key=ScenarioItemTemplate>
I have this code in a xaml page: <ListBox Height=524 HorizontalAlignment=Left Margin=12,6,0,0 Name=listBox1 VerticalAlignment=Top
<Border CornerRadius=2,2,2,2 BorderThickness=1 BorderBrush=LightSkyBlue Margin=5,2,2,2 x:Name=PersonBorder Visibility=Collapsed> <StackPanel Orientation=Vertical> <ListBox Name=personListBoxTest BorderThickness=0 ScrollViewer.HorizontalScrollBarVisibility=Hidden ScrollViewer.VerticalScrollBarVisibility=Auto
I have created the fallowing ListBox : <ListBox x:Name=RecentItemsListBox Grid.Row=1 BorderThickness=0 Margin=2,0,0,0 SelectionChanged=RecentItemsListBox_SelectionChanged> <ListBox.Resources>
I have a ListBox which displays items of variable height. I want to show
I have a Contextmenu with a ListBox inside. Whenever I right click my control
I have a grid as the datatemplate for items in a listbox and it's

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.