예제 #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;
             }
         }
     }
 }
예제 #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);
        }
    }