Reputation: 1265
I have a UserControl that defines a Grid Like this :
<Grid ClipToBounds="True"
x:Name="GHeader"
Grid.Row="0"
Grid.Column="0"
Background="{DynamicResource BrushRoomHeaderBackground}"
>
The following styles are defined in ResourceDictionary which are loaded at the start:
<SolidColorBrush x:Key="BrushRoomHeaderBackground"
Color="{DynamicResource ColorPassive}"
/>
<Color x:Key="ColorPassive">#FF9499C0</Color>
Should DynamicResource binding be used or StaticResource ? Could there be any memory leak here ?
Upvotes: 0
Views: 173
Reputation: 3043
As explained Manish you should have a look on his link to have a better understanding of the difference between Static and Dynamic ressource.
The short story is:
So for you the question is: did you plan to update your dictionnary at runtime, or at least is your ressource defined after the grid declaration? If not, prefer StaticResource for clarity and performance.
Upvotes: 1