Browse Source

Fix ContentControlMixin.

Correctly track the current ContentControl child. Fixes a bug in
MenuItem where the first child MenuItem was not a logical child after
the template got applied.
pull/494/merge
Steven Kirk 10 years ago
parent
commit
a06e3ffd73
  1. 4
      src/Perspex.Controls/Mixins/ContentControlMixin.cs

4
src/Perspex.Controls/Mixins/ContentControlMixin.cs

@ -74,7 +74,7 @@ namespace Perspex.Controls.Mixins
UpdateLogicalChild(
sender,
logicalChildren,
logicalChildren.FirstOrDefault(),
null,
presenter.GetValue(ContentPresenter.ChildProperty));
subscriptions.Value.Add(sender, subscription);
@ -143,7 +143,7 @@ namespace Perspex.Controls.Mixins
child = newValue as IControl;
if (child != null)
if (child != null && !logicalChildren.Contains(child))
{
child.SetValue(Control.TemplatedParentProperty, control.TemplatedParent);
logicalChildren.Add(child);

Loading…
Cancel
Save