There is no direct way to do this that I know of, since WPF automatically passes the available space to the Measure () function of the child elements to match the free space.
Please note that by default it runs endlessly for the vertical direction, as the content can scroll forever vertically. You can change the visibility of the scroll bars in both the vertical and horizontal directions to influence whether the infinity passes vertically, horizontally, or both.
, , XAML, - , - ActualWidth:
<ScrollViewer>
<StackPanel>
<Grid x:Name="MeasureGrid"/>
<TextBox Text="{Binding ElementName=MeasureGrid, Path=ActualWidth}"/>
</StackPanel>
</ScrollViewer>
, , XAML, , , . , ?