New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check if _child is null in TemplatedAdorner.MeasureOverride #234

Open
JohanLarsson opened this Issue Jan 4, 2019 · 7 comments

Comments

Projects
None yet
4 participants
@JohanLarsson
Copy link

JohanLarsson commented Jan 4, 2019

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>
@stevenbrix

This comment has been minimized.

Copy link
Member

stevenbrix commented Jan 4, 2019

@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.

@JohanLarsson

This comment has been minimized.

Copy link

JohanLarsson commented Jan 4, 2019

Ok, np, just wrote the issue as a reminder.

@daniel-loudon

This comment has been minimized.

Copy link

daniel-loudon commented Jan 18, 2019

I would like to take this as a first issue.

@karelz

This comment has been minimized.

Copy link
Member

karelz commented Jan 18, 2019

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.

@karelz karelz self-assigned this Jan 18, 2019

@karelz

This comment has been minimized.

Copy link
Member

karelz commented Jan 18, 2019

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?

@stevenbrix

This comment has been minimized.

Copy link
Member

stevenbrix commented Jan 18, 2019

@karelz that's correct, i'll remove up-for-grabs. @daniel-loudon, it's yours when the source is available!

@karelz

This comment has been minimized.

Copy link
Member

karelz commented Jan 18, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment