Beispiel #1
0
        private static void OnSetRegionNameCallback(DependencyObject element, DependencyPropertyChangedEventArgs args)
        {
            if (element != null)
            {
                IRegionManager regionManager = element.GetValue(RegionManagerProperty) as IRegionManager;
                if (regionManager != null)
                {
                    string oldRegionName = args.OldValue as string;
                    if (oldRegionName != null)
                    {
                        regionManager.Regions.Remove(oldRegionName);
                    }

                    string newRegionName = args.NewValue as string;
                    if (newRegionName != null)
                    {
                        regionManager.AttachNewRegion(element, newRegionName);
                    }
                }
            }
        }