Browse Source

don't reset data template on attached to visual tree, but on attached to logical tree

Andrey Kunchev 7 years ago
parent
commit
f1622f4802
1 changed files with 1 additions and 7 deletions
  1. 1 7
      src/Avalonia.Controls/Presenters/ContentPresenter.cs

+ 1 - 7
src/Avalonia.Controls/Presenters/ContentPresenter.cs

@@ -197,13 +197,6 @@ namespace Avalonia.Controls.Presenters
             }
         }
 
-        /// <inheritdoc/>
-        protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)
-        {
-            base.OnAttachedToVisualTree(e);
-            _dataTemplate = null;
-        }
-
         /// <summary>
         /// Updates the <see cref="Child"/> control based on the control's <see cref="Content"/>.
         /// </summary>
@@ -268,6 +261,7 @@ namespace Avalonia.Controls.Presenters
         protected override void OnAttachedToLogicalTree(LogicalTreeAttachmentEventArgs e)
         {
             base.OnAttachedToLogicalTree(e);
+            _dataTemplate = null;
             _createdChild = false;
             InvalidateMeasure();
         }