ScrollIntoView not working without BeginInvoke in a Proxy CallBack
-
Friday, March 09, 2012 9:51 AM
Hi,
I would like to understand why when I'm in a CallBack of a call to a WCF service, adding a new element to a ScrollViewer works without the need of a BeginInvoke but using ScrollIntoView from the ToolKit absolutely need to be in a BeginInvoke to works ?
All Replies
-
Friday, March 16, 2012 4:28 AM
Hi,
I am not sure I don't misundertand your meaning.Assume that you want the Datagrid to scroll to a specific row after binding it. You need to use BeginInvoke because you need to make sure that the row has value. Otherwise, there will throw an exception. Please check the links:
-
Friday, March 16, 2012 6:14 PMHi Well Maybe the UpdateLayout is the missing piece of the puzzle which I didn't try yet but the question is simply why right after adding the row to the grid in the callback i must call begininvoke on the scrollintoview otherwise it doesn't work.
-
Sunday, March 18, 2012 11:14 PM
Hi,
but the question is simply why right after adding the row to the grid in the callback i must call begininvoke on the scrollintoview otherwise it doesn't work.
Based on the description, you want to update the UI. In order to update the UI, you need to use the UI thread. However, the Dispatcher class simplifies calling the UI thread with a static method BeginInvoke. For detailes, please check the blog below:
http://www.silverlightshow.net/items/Tip-Asynchronous-Silverlight-Execute-on-the-UI-thread.aspx
-
Monday, March 19, 2012 8:12 PMI know what all that mean but it does'nt explain why I still can set datasource of a grid on the UI from the callback and yet not being able to use scrollintoview without de begininvoke. What is the different between both actions which are both performed on the UI ? Is it because one is a visual action and not the other ?

