Click here to Skip to main content
15,867,704 members

Comments by H. S. Masud (Top 4 by date)

H. S. Masud 24-Aug-11 13:23pm View    
Hi,
I found the reason and the solution to my problem. Initialliy I thought that setting text at the status bar TextBlock should not be the reason. You agreed on that too. But that's the reason to my problem. Not the funny ParameterizedThreadStart. Please read the solution I posted to this problem.

Thanks
H. S. Masud 22-Aug-11 0:59am View    
Sending message means invoking a delegate in UI thread and to set the text property to show message at the status bar. Nothing else.

"Invocation of the delegate which only sets some text in the UI should not affect scrolling of anything." This is the only reason I posted this question. If I don't set the message the ListBox doesn't scrolls. That surprised me. I gave the link of my complete code. Here it is once again http://mediaassistant.codeplex.com/SourceControl/changeset/changes/8705#.
I understand that it's difficult to download the complete code and compile and test it. But I gave this link because I could not re-create in a different project. Something else is happening when I update my UI which makes the ListBox scroll to top. It doesn't matter how did I update the UI. I'm interested to find that.

Thanks
H. S. Masud 21-Aug-11 13:35pm View    
The ListBox scrolls even if I make the Message property to NotifyPropertyChanged instead of using dependency property and change it from a background thread. I could not explain this behavior, that's why I posted this question to codeproject. If you know anything which would solve my problem or explain why it's happening the please let me know.

Thanks
H. S. Masud 21-Aug-11 13:16pm View    
Hi,
The action sets the message property of my status bar control which is a dependency property and it's bounded to a textblock. I used ParameterizedThreadStart to send a message to the action. Why it's so funny is not clear to me. It's a very simple solution to invoke an action to UI thread from another thread. You can have many other solution to this problem. I must have miss understood your answer because I could not found any solution to my problem. Let me explain my problem once again.

When I update anything to my status bar from a thread or show any wait screen my ListBox gets scrolled to top. I tried to re-create it from a simple wpf application where I used the same BeginInvoke method with same ParameterizedThreadStart and the same action. But I could not re-create it. The problem is why does the ListBox scrolled to top automatically when I execute a code which updates a textbox or displays a wait screen. It happens with ListView too.

Thanks