Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

How can I set the value of the StaticResource to a DynamicResource?

$
0
0

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.


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>