anonymous-delegates

Event handling with an anonymous delegate

旧时模样 提交于 2019-12-18 09:45:24
问题 For the record: I found a similar question here but I have to elaborate a bit more on on the subject. My concrete scenario is this: In Silverlight 4, The myFrameworkElement.FindName("otherElementName") method seems to work fine now, but I encountered a problem. It still returns null when the element is not yet added to the visual tree obviously. But now I need this functionality in a DependencyProperty 's PropertyChangedCallback of a custom UserControl handler. In this scope, it is uncertain

Dispatcher.Invoke with anonymous delegate works in Silverlight but not WPF

老子叫甜甜 提交于 2019-12-08 15:47:01
问题 In Silverlight 4 I have a custom service class which has an asynchronous Completed event. Inside the Completed event I take the returned data and invoke a populate method via something like this: private void service_Completed(object sender, CompletedEventArgs args) { Dispatcher.BeginInvoke(() => populateInbox(args.Jobs)); } private void populateInbox(List<JobViewModel> jobs) { inbox.DataContext = jobs; } The BeginInvoke works in SL4, however when I ported it to WPF I get the following error:

Event handling with an anonymous delegate

送分小仙女□ 提交于 2019-11-29 18:02:49
For the record: I found a similar question here but I have to elaborate a bit more on on the subject. My concrete scenario is this: In Silverlight 4, The myFrameworkElement.FindName("otherElementName") method seems to work fine now, but I encountered a problem. It still returns null when the element is not yet added to the visual tree obviously. But now I need this functionality in a DependencyProperty 's PropertyChangedCallback of a custom UserControl handler. In this scope, it is uncertain if the UserControl is added to the visual tree yet. But I must execute a certain action on another