freezable

How to debug this error when none of my code shows up in the stack?

让人想犯罪 __ 提交于 2020-01-14 09:35:14
问题 I'm sometimes getting the following error in my application: Cannot use a DependencyObject that belongs to a different thread than its parent Freezable I know how to solve this kind of error, but in that case I have no idea where it is happening, so I don't know what to fix... The exception's stack trace only contains .NET framework code, not my code (except the Main method): at System.Windows.Freezable.EnsureConsistentDispatchers(DependencyObject owner, DependencyObject child) at System

How can WPF objects deriving from Freezable be frozen in XAML?

允我心安 提交于 2019-12-28 09:40:20
问题 Many types in WPF derive from Freezable . It provides immutability to mutable POCO objects and allows for improved performance in certain situations. So my question is, how can I freeze objects in XAML markup? (Note that I have posted a similar but different question too). 回答1: To freeze a Freezable object declared in markup, you use the Freeze attribute defined in XML namespace http://schemas.microsoft.com/winfx/2006/xaml/presentation/options . In the following example, a SolidColorBrush is

In what scenarios does freezing WPF objects benefit performance greatly?

狂风中的少年 提交于 2019-12-17 07:09:14
问题 Many types in WPF derive from Freezable . It provides immutability to mutable POCO objects and, apparently, allows for improved performance in certain situations. Has anyone found that freezing objects within their WPF application has greatly improved performance? If so, then which items gave the biggest performance difference when being frozen? (Note that I have posted a similar but different question too) 回答1: You might be interested in my experiences with Freezable: I once wrote a PDF

What I want to do is FreezableCollection.AddRange(collectionToAdd)

一世执手 提交于 2019-12-12 21:51:04
问题 What I want to do is FreezableCollection.AddRange(collectionToAdd) Each time I add to the FreezableCollection an event is raised and something happens. Now I have a new collection I would want to add but this time I want the CollectionChanged event of the FreezableCollection to fire only once. Looping through and adding them will raise the event for each new item. Is there a way I can add to FreezableCollection all at a goal, similar to List.AddRange? 回答1: Derive from a collection and

What is a parent freezable? What does this error mean?

我的未来我决定 提交于 2019-12-06 19:14:12
问题 I'm getting this error: Cannot use a DependencyObject that belongs to a different thread than its parent Freezable What does that even mean? Is it in English? Is the parent frozen, or is it just freezable? Any way to make a parent not freezable, if it makes the error go away? What's happening: I have two opengl winforms controls in a WPF app, and so far, everything's been working smoothly (I think). Now, I've added an update so that when one winform control updates the image, the other should

What is a parent freezable? What does this error mean?

你离开我真会死。 提交于 2019-12-05 01:15:26
I'm getting this error: Cannot use a DependencyObject that belongs to a different thread than its parent Freezable What does that even mean? Is it in English? Is the parent frozen, or is it just freezable? Any way to make a parent not freezable, if it makes the error go away? What's happening: I have two opengl winforms controls in a WPF app, and so far, everything's been working smoothly (I think). Now, I've added an update so that when one winform control updates the image, the other should as well. That actually used to work, and now I'm getting that error. Stepping through the code has the

How can WPF objects deriving from Freezable be frozen in XAML?

廉价感情. 提交于 2019-11-28 04:57:08
Many types in WPF derive from Freezable . It provides immutability to mutable POCO objects and allows for improved performance in certain situations. So my question is, how can I freeze objects in XAML markup? (Note that I have posted a similar but different question too). CSharper To freeze a Freezable object declared in markup, you use the Freeze attribute defined in XML namespace http://schemas.microsoft.com/winfx/2006/xaml/presentation/options . In the following example, a SolidColorBrush is declared as a page resource and frozen. It is then used to set the background of a button. <Page

Why is CompositeCollection not Freezable?

心已入冬 提交于 2019-11-27 14:37:05
I am writing an application using the MVVM pattern. I am providing data to my view by setting my view's DataContext property to an instance of my ViewModel. Generally I just use Binding from there and go about my way. Recently, I tried to implement a ComboBox with an "extra" element beyond the collection my ViewModel provides that says "Select Item". <ComboBox> <ComboBox.ItemsSource> <CompositeCollection> <ComboBoxItem IsEnabled="False">Select Item</ComboBoxItem> <CollectionContainer Collection="{Binding MyItemsCollection}" /> </CompositeCollection> </ComboBox.ItemsSource> </ComboBox> The

Why is CompositeCollection not Freezable?

允我心安 提交于 2019-11-26 16:49:22
问题 I am writing an application using the MVVM pattern. I am providing data to my view by setting my view's DataContext property to an instance of my ViewModel. Generally I just use Binding from there and go about my way. Recently, I tried to implement a ComboBox with an "extra" element beyond the collection my ViewModel provides that says "Select Item". <ComboBox> <ComboBox.ItemsSource> <CompositeCollection> <ComboBoxItem IsEnabled="False">Select Item</ComboBoxItem> <CollectionContainer