What is the difference between using "Binding to StaticResource" and using "StaticResource directly" in WPF

I created mycustomItemsPanelinApp.Resources

<Application.Resources>
    <ItemsPanelTemplate x:Key="mycustomItemsPanel">
        .... Some code here
    </ItemsPanelTemplate>
</Application.Resources>

and thus providing this UIControl

<.... ItemsPanel="{StaticResource mycustomItemsPanel}" />

But I found out that it can be provided as

<.... ItemsPanel="Binding Source={StaticResource mycustomItemsPanel}}" />

What is the difference between the two?

+5
source share
1 answer

On the one hand, the binding will only be in dependency properties , on the other hand, some objects will behave differently when assigned Binding.Source, namely DataSourceProviders.

DataSourceProvider, , , - .

, DataSourceProvider, DataSourceProvider.

, , .

+2

All Articles