i have a problem with my borderless design when maximizing it the button will not follow the form and also how do i make it go fullscreen no matter the resoultuion and prevent it from go over the task bar
c#
Code:
private void Minimize_Click(object sender, RoutedEventArgs e)
{
this.WindowState = WindowState.Minimized;
}
private void maximize_Click(object sender, RoutedEventArgs e)
{
if (this.WindowState == System.Windows.WindowState.Normal)
{
this.WindowState = System.Windows.WindowState.Maximized;
}
else
{
this.WindowState = System.Windows.WindowState.Normal;
}
}
Xaml buttons
Code:
<Button x:Name="Maximize" RenderTransformOrigin="0.477,0.375" Click="maximize_Click" Background="Transparent" BorderBrush="Transparent" Foreground="Transparent" IsTabStop="False" HorizontalAlignment="Center" VerticalAlignment="Center" Height="29" Width="50" Margin="1036,6,67,848">
<Image>
<Image.Style>
<Style TargetType="{x:Type Image}">
<Style.Triggers>
<DataTrigger Binding="{Binding WindowState, RelativeSource={RelativeSource AncestorType={x:Type Window}, Mode=FindAncestor}}" Value="Normal">
<Setter Property="Source" Value="img\maximize_window-.png"/>
</DataTrigger>
<DataTrigger Binding="{Binding WindowState, RelativeSource={RelativeSource AncestorType={x:Type Window}, Mode=FindAncestor}}" Value="Maximized">
<Setter Property="Source" Value="img\restore-window-icon-61212.png"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Image.Style>
</Image>
</Button>
<Button x:Name="Minimize" RenderTransformOrigin="0.5,0.5" Click="Minimize_Click" Content="" FontSize="18.667" ToolTip="Minimer" IsTabStop="False" VerticalAlignment="Center" HorizontalAlignment="Center" Width="50" Height="29" Margin="962,6,141,848">
<Button.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="-1"/>
<SkewTransform/>
<RotateTransform/>
<TranslateTransform/>
</TransformGroup>
</Button.RenderTransform>
<Button.Background>
<ImageBrush ImageSource="img/Programming-Minimize-Window-icon.png"/>
</Button.Background>
<Button.Foreground>
<ImageBrush ImageSource="img/maximize_window-.png"/>
</Button.Foreground>
<Button.BorderBrush>
<ImageBrush ImageSource="img/Programming-Minimize-Window-icon.png"/>
</Button.BorderBrush>
</Button>
<Button x:Name="Luk" RenderTransformOrigin="0.5,0.5" Content="" FontSize="18.667" Click="Luk_Click" ToolTip="Luk" IsTabStop="False" VerticalAlignment="Center" HorizontalAlignment="Center" Width="50" Height="30" Margin="1107,9,-4,844">
<Button.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="-1"/>
<SkewTransform/>
<RotateTransform/>
<TranslateTransform X="-1.7"/>
</TransformGroup>
</Button.RenderTransform>
<Button.Foreground>
<ImageBrush ImageSource="img/close-icon.png"/>
</Button.Foreground>
<Button.BorderBrush>
<ImageBrush ImageSource="img/close-icon.png"/>
</Button.BorderBrush>
<Button.Background>
<ImageBrush ImageSource="img/close-icon.png"/>
</Button.Background>
</Button>
XAML window
Code:
<Window x:Class="Omini_Tires_And_rims.MainWindow"
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:Omini_Tires_And_rims"
mc:Ignorable="d"
Title="Omini Dæk & Fælge" Height="903.43" Width="1175.414" WindowStartupLocation="CenterScreen" AllowsTransparency="True" WindowStyle="None" Background="{x:Null}" MouseDown="Window_MouseDown" HorizontalAlignment="Left" VerticalAlignment="Top">
<WindowChrome.WindowChrome>
<WindowChrome/>
</WindowChrome.WindowChrome>
<Window.Foreground>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="Black" Offset="0"/>
<GradientStop Color="White" Offset="1"/>
</LinearGradientBrush>
</Window.Foreground>
<DockPanel LastChildFill="False" Margin="10,10,0,10">
<Grid Width="1153" Margin="0,-4,0,4">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.Background>
<LinearGradientBrush EndPoint="0.5,1" MappingMode="RelativeToBoundingBox" StartPoint="0.5,0">
<GradientStop Color="Black"/>
<GradientStop Color="White" Offset="0.189"/>
</LinearGradientBrush>
</Grid.Background>