I am coding a custom control and I want to make an animation to set the width of the control to the {DynamicResource
{x:Static SystemParameters.VerticalScrollBarWidthKey}}
However, WPF threw an exception that 'Cannot freeze this Storyboard timeline tree for use across threads'.
I found a solution in https://social.msdn.microsoft.com/Forums/vstudio/en-US/9336022f-badb-4b40-a86c-a50ab1a64ba5/quotcannot-freeze-this-storyboard-timeline-tree-for-use-across-threadsquot?forum=wpf by using a StaticResource.
And then I wrote these codes soon:
<ResourceDictionaryxmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:system="clr-namespace:System;assembly=mscorlib"><system:Doublex:Key="VerticalScrollBarWidthKey"></system:Double></ResourceDictionary>
But I found that I can't set the StaticResource VerticalScrollBarWidthKey
to
the value of {DynamicResource
{x:Static SystemParameters.VerticalScrollBarWidthKey}}
How can I solve this? Would you please help me? Thank you.