WPF C#

  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  x:Class="WpfApplication1.DPClearValue">
    
      
        
        
        
      
      
        
        
        
      
      
        
        
        
      
      
        
        
      
      
        
      
    

  
    
    
    
  
    Make everything red
    
  Clear local values
  

//File:Window.xaml.cs
using System.Windows;
using System.Collections;
using System.Windows.Media;
using System.Windows.Controls;
using System.Windows.Shapes;
namespace WpfApplication1 {
    public partial class DPClearValue {
        void RestoreDefaultProperties(object sender, RoutedEventArgs e)
        {
            UIElementCollection uic = myDockPanel.Children;
            foreach (Shape uie in uic)
            {
                LocalValueEnumerator locallySetProperties = uie.GetLocalValueEnumerator();
                while (locallySetProperties.MoveNext())
                {
                    DependencyProperty propertyToClear = (DependencyProperty)locallySetProperties.Current.Property;
                    if (!propertyToClear.ReadOnly) { uie.ClearValue(propertyToClear); }
                }
            }
        }
        void MakeEverythingRed(object sender, RoutedEventArgs e)
        {
            UIElementCollection uic = myDockPanel.Children;
            foreach (Shape uie in uic) {uie.Fill = new SolidColorBrush(Colors.Red);}
        }
    }
}