Hi,
Steps:
1. Create new WPF application;
2. Add TextBox control to the MainWindow;
3. Add a Path (horizontal line) with Stretch=Fill, Width="Auto" to the same window;
4. Set the window property SizeOnContent="Width";
From that point, the MainWindow will extend to the width of the screen. The line won't show in window.
What I was expecting is the window shrink to fit the width of the TextBox. Am I missing something here?
Code sample:
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525" ResizeMode="NoResize" SizeToContent="Width">
<Grid>
<Path Data="M40,102 L411,107" Fill="Black" Margin="0,37,0,281" Stretch="Fill" Stroke="Black" StrokeThickness="2"/>
<TextBlock HorizontalAlignment="Left" Height="21" Margin="0" TextWrapping="Wrap" VerticalAlignment="Top" Width="62" Text="TextBlock"/>
</Grid>
</Window>
Thanks,
Gabriel