Hello, when you start the program, window 1 opens, then by pressing the small right button, block 2 is added to it, then by pressing the next button, block 3 is added, circled in green. How to organize it? MainWindow, as I understand it, is the first window, dimensions should be set as the dimensions of block 1, or as dimensions of the 3rd? As long as I understand everything, blocks 2 and 3 should be a page and be connected as a frame. And then everything is deaf in Russian, but I can’t normally formulate in English. Thank. And another form of the 3rd block will not cause problems?
- Is the application window itself initially the size of the first block, and then gradually increasing to the size of the screenshot? Or is a large window at once, and blocks appear in stages inside the palate? - Sam
- The window itself at startup looks like the first block, i.e. small - Kirill_Levchenko
|
1 answer
For auto-fit window size for content, use the SizeToContent
property.
And blocks 1 and 2 simply place on top of block 3 in the grid, indicating a higher ZIndex
.
<Window ... SizeToContent="WidthAndHeight"> <Grid> <!-- Объединение блоков 1 и 2 чтобы они были поверх блока 3 --> <StackPanel ZIndex="11" HorizontalAlignment="Left" VerticalAlignment="Top" Orientation="Horizontal"> <!-- Блок 1 --> <StackPanel Background="Orange" Width="300" Height="100"> </StackPanel> <!-- Блок 2 --> <StackPanel Background="Red" Width="50" Height="100"> </StackPanel> </StackPanel> <!-- Блок 3 --> <StackPanel ZIndex="10" Background="Green" Width="600" Height="300"> </StackPanel> </Grid> </Window>
I did not add content to the panels (blocks) here - for nadladnosti I just gave them different backgrounds and a fixed size.
Next, lock in and control the Visibility
property of these three panels in accordance with the algorithm.
|