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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T14:46:32+00:00 2026-06-07T14:46:32+00:00

I have listbox in my wp7 app like this <ListBox Name=lstSelectedNumber Height=50 MaxHeight=120 VerticalAlignment=Top

  • 0

I have listbox in my wp7 app like this

   <ListBox Name="lstSelectedNumber" Height="50" MaxHeight="120" VerticalAlignment="Top" Grid.Column="1" SelectionChanged="lstSelectedNumber_SelectionChanged">
                            <ListBox.ItemContainerStyle>
                                <Style TargetType="ListBoxItem">
                                    <Setter Property="Padding" Value="-15" />
                                    <Setter Property="Margin" Value="0"/>
                                </Style>
                            </ListBox.ItemContainerStyle>
                            <ListBox.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <toolkit:WrapPanel>
                                    </toolkit:WrapPanel>
                                </ItemsPanelTemplate>
                            </ListBox.ItemsPanel>
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <StackPanel>
                                    <TextBox x:Name="txtNumber" Text="{Binding Name,Mode=TwoWay}" IsEnabled="{Binding IsEnabled,Mode=TwoWay}" Background="Transparent" Foreground="{StaticResource ContactSelectorBrush}" Style="{StaticResource DialNumberStyle}" FontSize="24" KeyUp="txtNumber_KeyUp">
                                        <TextBox.CaretBrush>
                                            <SolidColorBrush Color="{StaticResource CaretBrush}" />
                                        </TextBox.CaretBrush>
                                    </TextBox>
                                    </StackPanel>
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>

And in data template of my listbox there is one Textbox Named “txtNumber”. I am calling its Textchange Event and on its textchange I’m doing some operations like this

TextBox txtbox = sender as TextBox;
                Dispatcher.BeginInvoke(() =>
                {
                    ContactModel model = lstContactModel.LastOrDefault();
                    if (string.IsNullOrEmpty(model.Name) && string.IsNullOrEmpty(model.Phone))
                    {
                        lstContactModel.Remove(model);
                        lstContactModel.Add(new ContactModel { Name = txtbox.Text, Phone = txtbox.Text + ",", IsEnabled = false });
                    }

                    lstSelectedNumber.ItemsSource = null;
                    lstSelectedNumber.ItemsSource = lstContactModel;
                    var Selecteditem = lstSelectedNumber.Items[lstSelectedNumber.Items.Count - 1];
                    lstSelectedNumber.ScrollIntoView(Selecteditem);
                    lstSelectedNumber.UpdateLayout();
                });

Im adding new item to my list and then rebinding to my listbox and I’m scrolling to end of my listbox, but it’s not working.

It shows very odd behavior. Once This Statement Runs It adds the item and focus goes to another textbox which is not in this listbox (it’s the next control in my wp7 page). Can anyone suggest what is wrong in it?

  • 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-07T14:46:34+00:00Added an answer on June 7, 2026 at 2:46 pm
    lstbox.Dispatcher.BeginInvoke(() =>
                    {
                        lstbox.ItemsSource = null;
                        lstbox.ItemsSource = lstContactModel;
                        var Selecteditem = lstbox.Items[lstbox.Items.Count - 1];
                        lstbox.ScrollIntoView(Selecteditem);
                        lstbox.UpdateLayout();
                    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have listbox like this: <ListBox Height=589 HorizontalAlignment=Left Name=AllNotesListBox VerticalAlignment=Top Width=460 SelectionChanged=AllNotesListBox_SelectionChanged> <ListBox.ItemTemplate> <DataTemplate>
I have listbox that displays information about list of objects: <ListBox Grid.Column=0 Height=152 Name=CustomersList
In a WP7.5 application, i have a listbox containing a grid. This grid contain
I have a ListBox that looks like this: <ListBox ItemsSource={StaticResource journal} DisplayMemberPath=Title /> When
This is for WP7. I have a button in a listbox itemtemplate. In the
I have a ListBox in a WP7 app page which I bind to a
I writing wp7 silverlight app. I have a listbox with items. I want each
Please help me, i am new to WP7 development.I have a class like this
I have a ListBox.ItemTemplate in ListBox inside wp7 app. What I want is to
So I have a detail page on my WP7 app that shows a 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.