As we saw in the previous recipe, Using logical resources, binding to a resource is achieved in XAML by using the
StaticResource markup extension. But what happens if we replace a specific resource? Would that be reflected in all objects using the resource? And if not, can we bind to the resource dynamically?
Make a copy of the previous recipe project
CH02.SimpleResources, or create a new project named
CH02.DynamicVsStatic and copy the Window XAML contents from the previous project to the new one.
DynamicResource and see the effect:
MainWindow.xaml. Add a button to the end of the
StackPanellabeled Replace brush and connect it to an event ...