WPF Как увеличить окно программы, по нажатии кнопки?
Пробовал через c# не помогло. Можно ли как то увеличить в разметке ?
<Button Height="22" Width="23"
VerticalAlignment="Top"
HorizontalAlignment="Right"
Margin="0 9 40 0"
ToolTip="Развернуть"
Background="#CEE3FF"
BorderThickness="0"
Name="btnExpand"
Click="btnExpand_Click">
<Image Style="{StaticResource Expand}">
</Image>
</Button>
Полный код разметки вот
<Window x:Class="Librarian.Windows.StartWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Librarian.Windows"
mc:Ignorable="d"
Height="450" Width="800"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
MouseLeftButtonDown="Window_MouseLeftButtonDown"
AllowsTransparency="True" Background="Transparent" ResizeMode="CanResizeWithGrip" x:Name="windowMain">
<Border BorderBrush="#FF42C4EB" BorderThickness="2"
CornerRadius="20,20,20,20" x:Name="borderMain">
<Border.Background>
<LinearGradientBrush>
<GradientBrush.GradientStops>
<GradientStopCollection>
<GradientStop Color="#E7EBF7" Offset="0.0"></GradientStop>
<GradientStop Color="#CEE3FF" Offset="0.5"></GradientStop>
</GradientStopCollection>
</GradientBrush.GradientStops>
</LinearGradientBrush>
</Border.Background>
<Grid x:Name="gridMain">
<Grid.RowDefinitions>
<RowDefinition Height="98"/>
<RowDefinition/>
<RowDefinition Height="39"></RowDefinition>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Image Source="/Resources/logo/logo.png"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Height="30" Width="28"
Margin="10,10,0,0">
</Image>
<Image MouseLeftButtonDown="Exit_MouseLeftButtonDown" Name="Exit"
VerticalAlignment="Top"
HorizontalAlignment="Right"
Margin="0 10 10 0"
Style="{StaticResource Cross}"
ToolTip="Закрыть">
</Image>
<Button Height="22" Width="23"
VerticalAlignment="Top"
HorizontalAlignment="Right"
Margin="0 9 40 0"
ToolTip="Развернуть"
Background="#CEE3FF"
BorderThickness="0"
Name="btnExpand"
Click="btnExpand_Click">
<Image Style="{StaticResource Expand}">
</Image>
</Button>
<Image Style="{StaticResource RollUp}"
VerticalAlignment="Top"
HorizontalAlignment="Right"
Margin="0 9 70 0"
Name="rollUp"
MouseLeftButtonDown="rollUp_MouseLeftButtonDown">
</Image>
</Grid>
<Grid Background="#B5CBEF" Grid.Row="1">
</Grid>
<Grid Grid.Row="2">
<TextBlock Margin="12" Grid.Row="2">My Footer</TextBlock>
</Grid>
</Grid>
</Border>
И последний вопросик. Как свернуть программу в нормальные размеры, и как свернуть вообще ?
Ответы (1 шт):
Автор решения: Qwerty Q
→ Ссылка
Если обращаться к View.xaml из View.cs ничего страшного нет, тем более для подобных задач и тут никакого смешивания с бизнес логикой приложения ведь для этого существует ViewModel.cs