Beispiel #1
0
    protected void ConfigureChildWindow(RCPChildWindow window, IWindowControl windowContent, bool isModal)
    {
        // Place the content within a transitioning content control for a transition when the window is opened
        var content = new TransitioningContentControl()
        {
            FocusVisualStyle  = null,
            IsTabStop         = false,
            Transition        = Data.UI_EnableAnimations ? TransitionType.Left : TransitionType.Normal,
            UseLayoutRounding = true,
            Content           = windowContent.UIContent,
            RestartTransitionOnContentChange = true
        };

        // For some reason the transition doesn't start automatically here, so we manually reload it on load (might be because the Loaded event fires twice, probably once before it gets shown)
        void Content_Loaded(object s, RoutedEventArgs e) => content.ReloadTransition();

        void Content_Unloaded(object s, RoutedEventArgs e)
        {
            // Make sure to unsubscribe to the events
            content.Unloaded -= Content_Unloaded;
            content.Loaded   -= Content_Loaded;
        }

        content.Loaded   += Content_Loaded;
        content.Unloaded += Content_Unloaded;

        // Set window properties
        window.Content     = content;
        window.IsModal     = isModal;
        window.CanMaximize = windowContent.IsResizable;
    }
Beispiel #2
0
        private static void ReloadSelectionChanged(TabControl sender, SelectionChangedEventArgs e)
        {
            if (e.OriginalSource != sender)
            {
                return;
            }
            ContentControl      metroContentControl  = ReloadBehavior.GetMetroContentControl((TabControl)sender);
            MetroContentControl metroContentControl1 = metroContentControl as MetroContentControl;

            if (metroContentControl1 != null)
            {
                metroContentControl1.Reload();
            }
            TransitioningContentControl transitioningContentControl = metroContentControl as TransitioningContentControl;

            if (transitioningContentControl != null)
            {
                transitioningContentControl.ReloadTransition();
            }
        }