File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -84,11 +84,40 @@ protected override void OnApplyTemplate()
8484 EnsureGridLines ( ) ;
8585 }
8686
87+ /// <inheritdoc/>
88+ protected override void OnContentChanged ( object oldContent , object newContent )
89+ {
90+ base . OnContentChanged ( oldContent , newContent ) ;
91+
92+ if ( newContent is ContentControl contentControl )
93+ {
94+ contentControl . Loaded += OnContentLoaded ;
95+ }
96+
97+ void OnContentLoaded ( object sender , RoutedEventArgs e )
98+ {
99+ ( ( ContentControl ) sender ) . Loaded -= OnContentLoaded ;
100+ Measure ( new Size ( double . PositiveInfinity , double . PositiveInfinity ) ) ;
101+ }
102+ }
103+
87104 /// <inheritdoc/>
88105 protected override Size MeasureOverride ( Size availableSize )
89106 {
90107 if ( Column is not null && Row is not null && _contentPresenter is not null && Content is FrameworkElement element )
91108 {
109+ if ( Column is TableViewTemplateColumn )
110+ {
111+ #if WINDOWS
112+ if ( element is ContentControl { ContentTemplateRoot : FrameworkElement root } )
113+ #else
114+ if ( element . FindDescendant < ContentPresenter > ( ) is { ContentTemplateRoot : FrameworkElement root } )
115+ #endif
116+ element = root ;
117+ else
118+ return base . MeasureOverride ( availableSize ) ;
119+ }
120+
92121 #region TEMP_FIX_FOR_ISSUE https://github.com/microsoft/microsoft-ui-xaml/issues/9860
93122 element . MaxWidth = double . PositiveInfinity ;
94123 element . MaxHeight = double . PositiveInfinity ;
You can’t perform that action at this time.
0 commit comments