Настройка отступов для окна WPF

409
02 ноября 2017, 04:27

Имеется кастомное окно, но при разворачивании его на весь экран часть содержимого не видно, а также окно разворачивается под пуск, и панель задач закрывает содержимое. Знаю, что это решается настройкой некоторых параметров, но не могу вспомнить как они называются и считаются. Подскажите, пожалуйста как это исправить?

Стиль окна:

<Style TargetType="{x:Type local:MainWindow}">
        <Setter Property="shell:WindowChrome.WindowChrome">
            <Setter.Value>
                <shell:WindowChrome GlassFrameThickness="0"                                        
                                    CornerRadius="0"
                                    ResizeBorderThickness="5"
                                    CaptionHeight="50"/>
            </Setter.Value>
        </Setter>
        <Setter Property="WindowStyle" Value="None"/>
        <Setter Property="AllowsTransparency" Value="True"/>
        <Setter Property="Title" Value="Journal Reader V3"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Window}">
                    <Border BorderThickness="2"
                            BorderBrush="{StaticResource WindowColorBrush}"
                            Background="{StaticResource WindowColorBrush}">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="50"></RowDefinition>
                                <RowDefinition Height="*"></RowDefinition>
                            </Grid.RowDefinitions>
                            <Grid Background="{StaticResource WindowColorBrush}">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="60"></ColumnDefinition>
                                    <ColumnDefinition Width="290"></ColumnDefinition>
                                    <ColumnDefinition Width="75"></ColumnDefinition>
                                    <ColumnDefinition Width="*"></ColumnDefinition>
                                    <ColumnDefinition Width="60"></ColumnDefinition>
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="20"></RowDefinition>
                                    <RowDefinition Height="*"></RowDefinition>
                                </Grid.RowDefinitions>
                                <TextBlock Grid.Column="1"
                                           Grid.Row="0"
                                           Grid.RowSpan="2"
                                           Text="Journal Reader V3"
                                           FontSize="36"
                                           VerticalAlignment="Center"
                                           HorizontalAlignment="Center"
                                           Foreground="White"
                                           FontFamily="Segoe UI Semilight"/>
                                <View:PortControlView Grid.Column="2"
                                                      Grid.Row="0"
                                                      Grid.RowSpan="2"
                                                      shell:WindowChrome.IsHitTestVisibleInChrome="True"></View:PortControlView>
                                <StackPanel Grid.Column="4"
                                            Grid.Row="0"
                                            Orientation="Horizontal"
                                            shell:WindowChrome.IsHitTestVisibleInChrome="True">
                                    <Button Command="{Binding MinimizeCommand}"
                                            Style="{StaticResource WindowButtonStyle}"
                                            ToolTip="Свернуть">
                                        <Grid Margin="2">
                                            <Path Fill="White"
                                                  Stroke="White"
                                                  StrokeThickness="3">
                                                <Path.Data>
                                                    <LineGeometry StartPoint="0,14.5"
                                                                  EndPoint="16,14.5"></LineGeometry>
                                                </Path.Data>
                                            </Path>
                                        </Grid>
                                    </Button>
                                    <Button Style="{StaticResource WindowButtonStyle}"
                                            Command="{Binding MaxNormCommand}"
                                            ToolTip="Восстановить">
                                        <Grid Margin="2">
                                            <Path Fill="White"
                                                  Stroke="White"
                                                  StrokeThickness="3">
                                                <Path.Data>
                                                    <LineGeometry StartPoint="0,1.5"
                                                                  EndPoint="16,1.5"/>
                                                </Path.Data>
                                            </Path>
                                            <Path Fill="White"
                                                  Stroke="White"
                                                  StrokeThickness="1">
                                                <Path.Data>
                                                    <LineGeometry StartPoint="0.5,0"
                                                                  EndPoint="0.5,16"></LineGeometry>
                                                </Path.Data>
                                            </Path>
                                            <Path Fill="White"
                                                  Stroke="White"
                                                  StrokeThickness="1">
                                                <Path.Data>
                                                    <LineGeometry StartPoint="15.5,0"
                                                                  EndPoint="15.5,16"></LineGeometry>
                                                </Path.Data>
                                            </Path>
                                            <Path Fill="White"
                                                  Stroke="White"
                                                  StrokeThickness="1">
                                                <Path.Data>
                                                    <LineGeometry StartPoint="0,15.5"
                                                                  EndPoint="16,15.5"></LineGeometry>
                                                </Path.Data>
                                            </Path>
                                        </Grid>
                                    </Button>
                                    <Button Style="{StaticResource WindowButtonCloseStyle}"
                                            Command="{Binding CloseCommand}"
                                            ToolTip="Закрыть">
                                        <Grid Margin="2">
                                            <Path Fill="White"
                                                  Stroke="White"
                                                  StrokeThickness="2">
                                                <Path.Data>
                                                    <LineGeometry StartPoint="0,0"
                                                                  EndPoint="16,16"></LineGeometry>
                                                </Path.Data>
                                            </Path>
                                            <Path Fill="White"
                                                  Stroke="White"
                                                  StrokeThickness="2">
                                                <Path.Data>
                                                    <LineGeometry StartPoint="0,16"
                                                                  EndPoint="16,0"></LineGeometry>
                                                </Path.Data>
                                            </Path>
                                        </Grid>
                                    </Button>
                                </StackPanel>
                            </Grid>
                            <ContentPresenter Grid.Row="1"
                                              Content="{TemplateBinding Content}"></ContentPresenter>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
READ ALSO
C# Как вытащить только цифры в int из string?

C# Как вытащить только цифры в int из string?

C# Как вытащить только цифры в int из string ?

463
Cachemode в Gmap.net

Cachemode в Gmap.net

Подобный вопрос уже был на стеке, но ответа на него так никто и не далЕсть приложение на с#, которое должно отображать карту openstreetmap с помощью...

404
Изменение BackgroundImage для элемента button

Изменение BackgroundImage для элемента button

У меня есть кнопка с именем button0Свойство BackgroundImage я задал непосредственно с помощью меню свойств в Visual Studio и теперь по нажатию кнопки хочу...

270
Replace кавычки в кавычках &ldquo; &rdquo; &ldquo; &rdquo; c#

Replace кавычки в кавычках “ ” “ ” c#

Как включить кавычки внутрь строки?

352