No null check here is weird given that there is a null check here
From reference source:
/// <summary>
/// Measure adorner.
/// </summary>
protected override Size MeasureOverride(Size constraint)
{
Debug.Assert(_child != null, "_child should not be null");
if (ReferenceElement != null && AdornedElement != null &&
AdornedElement.IsMeasureValid &&
!DoubleUtil.AreClose(ReferenceElement.DesiredSize, AdornedElement.DesiredSize)
)
{
ReferenceElement.InvalidateMeasure();
}
(_child).Measure(new Size(Double.PositiveInfinity, Double.PositiveInfinity));
return (_child).DesiredSize;
}
/// <summary>
/// Default control arrangement is to only arrange
/// the first visual child. No transforms will be applied.
/// </summary>
protected override Size ArrangeOverride(Size size)
{
Size finalSize;
finalSize = base.ArrangeOverride(size);
if (_child != null)
{
_child.Arrange(new Rect(new Point(), finalSize));
}
return finalSize;
}
Did a search and did not find TemplatedAdorner in the repo.
Repro:
Resize the window with the below markup:
<DataGrid ItemsSource="{Binding People}">
<DataGrid.RowStyle>
<Style TargetType="DataGridRow">
<Setter Property="adorners:Info.Template">
<Setter.Value>
<ControlTemplate>
<Border BorderBrush="HotPink"
BorderThickness="3">
<AdornedElementPlaceholder />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</DataGrid.RowStyle>
</DataGrid>
@JohanLarsson the source code for PresentationFramework hasn't been opened yet. Once the infrastructure is ready to do so, this looks like something that could be fixed.
Ok, np, just wrote the issue as a reminder.
I would like to take this as a first issue.
Great @daniel-loudon, thanks!
I just sent you collaborator invite - that way we can assign the issue to you (assigning temporarily to myself). Ping me when you accept the invitation.
Let us know if you need any help.
Oh, wait. I just read the thread and it seems the code is not open-sourced yet - is that right @stevenbrix? In that case, we should not mark the issue as up-for-grabs as it is not ready for contributors yet.
Can you please confirm?
@karelz that's correct, i'll remove up-for-grabs. @daniel-loudon, it's yours when the source is available!
In general: I recommend to use up-for-grabs only for actionable issues (i.e. the code is open-sourced already). Or we could mark them 'blocked' if we do not want to retriage them once we open source more WPF code.
@stevenbrix @vatsan-madhavan is the code open-sourced now? If yes, we can add the up-for-grabs again ;) ... I bet there are few community members who will be interested in helping out :)
@karelz unfortunately not yet. we don't have exact dates yet, but we should be able to start getting to this soon.