dotnet / dotnet/wpf

Framework Measure() method is not calculated the size properly While using the Relative source.

Open
#9,076 1 comment 0 reactions 0 assignees View on GitHub
Investigate
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

### Description

I added a Label into the Grid in WPF and set its content using **RelativeSource** Binding. However, during calculation, the size was improperly determined in the **Measure()**, resulting in the content not being visible in the view. Interestingly, when I switched to using a static resource instead, the issue resolved, and the content displayed properly.

[RelativeSource.zip](https://github.com/dotnet/wpf/files/15200719/RelativeSource.zip)

### Reproduction Steps

Run the sample. The content of the label located in the middle is not being updated.

![image](https://github.com/dotnet/wpf/assets/113903149/678d5024-a8bc-4ebd-8746-f75f9c38c6c7)

### Expected behavior

The content should be updated properly when binding with relative source.

### Actual behavior

The content is not updated in the view because of improperly calculated the size.

### Regression?

_No response_

### Known Workarounds

_No response_

### Impact

_No response_

### Configuration

_No response_

### Other information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.