Не перемещается окно за элемент grid в gride
Имеется такой код:
<Window x:Class="ChatClientWPF.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:ChatClientWPF"
mc:Ignorable="d"
Panel.ZIndex="0"
Title="ChatClient" Height="450" Width="800"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" WindowStartupLocation="CenterScreen" ResizeMode="NoResize" WindowStyle="None">
<Grid >
<Grid.RowDefinitions>
<RowDefinition Height="130" />
</Grid.RowDefinitions>
<Grid Grid.Row="0"
MouseLeftButtonDown="Caption_MouseLeftButtonDown">
</Grid >
</Grid>
private void Caption_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
this.DragMove();
}
Если добавить параметр MouseLeftButtonDown="Caption_MouseLeftButtonDown" в Window тогда окно будет перемещаться, а когда он находится в grid форма не перемещается. Как сделать, что бы за grid окно перемещалось
Ответы (1 шт):
Автор решения: aepot
→ Ссылка
Задайте Background для Grid, можно даже прозрачный.
<Grid Grid.Row="0" Background="Transparent" MouseLeftButtonDown="Caption_MouseLeftButtonDown">
</Grid>