I have generated XAML file from Windows Forms, and with the process calculated right and bottom margins because they do not exist in Forms. I have this output:
<Grid>
<TextBox Width="129" Height="18" Margin="36,46,278,686" />
...
<TextBox Width="54" Height="18" Margin="345,705,83,31" />
<TextBox Width="54" Height="18" Margin="345,728,83,8" />
<TextBox Width="54" Height="18" Margin="345,770,83,-34" />
...
</Grid>
The problem is that Content of Grid is too large, even for the designer, so scroll bar is generated in win forms. However, this is not case in WPF, so I try adding ScrollViewer around it. But it only scrolls down to content with positive bottom margin. Controls with negative margins are not shown anywhere.
Any idea how to solve this is appreciated.
The
Gridis the wrong thing for this task. If you’re going to do the positioning yourself, you should use aCanvasand then useCanvas.LeftandCanvas.Topto position it. You don’t need theBottomorRightvalues since you seem to know theWidthandHeight.I believe you should be able to use the
ScrollVieweraround theCanvasobject too.