Beispiel #1
0
 private void OnScrollViewerLoaded(object sender, RoutedEventArgs args)
 {
     if (sender is FrameworkElement scrollViewer)
     {
         var scrollContentPresenterFE = SharedHelpers.FindInVisualTreeByName(scrollViewer, "ScrollContentPresenter");
         if (scrollContentPresenterFE != null)
         {
             if (scrollContentPresenterFE is ScrollContentPresenter scrollContentPresenter)
             {
                 scrollContentPresenter.SizesContentToTemplatedParent = true;
             }
         }
     }
 }
Beispiel #2
0
    /* static */
    internal static UIElement WindowElement()
    {
        var instance = LifetimeHandler.GetDisplayRegionHelperInstance();

        if (instance.m_simulateDisplayRegions)
        {
            // Instead of returning the actual window, find the SimulatedWindow element
            UIElement window = null;

            if (Window.Current.Content is FrameworkElement fe)
            {
                window = SharedHelpers.FindInVisualTreeByName(fe, "SimulatedWindow");
            }

            return(window);
        }
        else
        {
            return(Window.Current.Content);
        }
    }