Exemplo n.º 1
0
        private static void OnContentPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var cc = d as ContentControl;

            if (cc == null)
            {
                return;
            }

            var region = GetRegion(cc);

            if (region == null)
            {
                return;
            }

            var oldVal = e.OldValue as string;
            var newVal = e.NewValue as string;

            var navigation = BootstrapperBase.ResolveStatic <NavigationService>();

            if (navigation == null)
            {
                return;
            }

            var service = navigation[region];

            service?.ChangeHostContentProperty(cc, oldVal, newVal);
        }
Exemplo n.º 2
0
        private static void OnRegionChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var cc = d as ContentControl;

            if (cc == null)
            {
                return;
            }

            var oldRegion = e.OldValue as Region;
            var newRegion = e.NewValue as Region;

            var navigation = BootstrapperBase.ResolveStatic <NavigationService>();

            if (navigation == null)
            {
                return;
            }

            if (oldRegion != null)
            {
                var service = navigation[oldRegion];
                service?.RemoveHost(cc);
            }

            if (newRegion != null)
            {
                var service = navigation[newRegion];
                service?.AddHost(cc);
            }
        }