Files
Lattice/Lattice.Example.DragDrop/MainWindow.xaml
2026-01-27 06:07:15 +03:00

141 lines
5.9 KiB
XML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<Window
x:Class="Lattice.Example.DragDrop.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:lattice="using:Lattice.UI.DragDrop.WinUI"
Title="Drag Drop Demo"
>
<Grid Background="#F0F2F5">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Инструкция -->
<TextBlock Grid.Row="0"
Text="Просто перетащите элементы справа влево!"
FontSize="14" Margin="20" HorizontalAlignment="Center"
FontWeight="SemiBold"/>
<!-- Основное содержимое -->
<Grid Grid.Row="1" Margin="20">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!-- ЦЕЛЕВАЯ ЗОНА (куда бросаем) -->
<Border Grid.Column="0"
Background="White"
CornerRadius="10"
BorderThickness="2"
BorderBrush="#4CAF50"
Padding="20"
Margin="0,0,10,0"
lattice:DragDropProperties.IsDropTarget="True">
<StackPanel>
<TextBlock Text="🟢 ЦЕЛЕВАЯ ЗОНА"
FontSize="16" FontWeight="Bold"
Foreground="#4CAF50"
Margin="0,0,0,15"/>
<TextBlock x:Name="DropInfoText"
Text="Бросьте сюда элементы"
FontSize="14"
Foreground="#666"
TextWrapping="Wrap"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</StackPanel>
</Border>
<!-- ЗОНА С ЭЛЕМЕНТАМИ (откуда тянем) -->
<StackPanel Grid.Column="1"
Background="White"
CornerRadius="10"
Padding="20"
Margin="10,0,0,0">
<TextBlock Text="📦 ЭЛЕМЕНТЫ ДЛЯ ПЕРЕТАСКИВАНИЯ"
FontSize="16" FontWeight="Bold"
Foreground="#2196F3"
Margin="0,0,0,15"/>
<!-- 1. TextBlock элемент -->
<Border Padding="15"
Background="#E3F2FD"
CornerRadius="8"
BorderThickness="1"
BorderBrush="#90CAF9"
Margin="0,0,0,10"
lattice:DragDropProperties.IsDragSource="True"
lattice:DragDropProperties.DragData="TextBlock Element">
<TextBlock Text="📝 Это TextBlock"
FontSize="14"
Foreground="#1565C0"
FontWeight="SemiBold"/>
</Border>
<!-- 2. Border элемент -->
<Border Padding="15"
Background="#E8F5E9"
CornerRadius="8"
BorderThickness="1"
BorderBrush="#A5D6A7"
Margin="0,0,0,10"
lattice:DragDropProperties.IsDragSource="True"
lattice:DragDropProperties.DragData="Border Element">
<StackPanel>
<TextBlock Text="🟩 Это Border"
FontSize="14"
Foreground="#2E7D32"
FontWeight="SemiBold"/>
<TextBlock Text="С рамкой и заливкой"
FontSize="12"
Foreground="#666"
Margin="0,5,0,0"/>
</StackPanel>
</Border>
<!-- 3. Grid элемент -->
<Border Padding="15"
Background="#FFF3E0"
CornerRadius="8"
BorderThickness="1"
BorderBrush="#FFCC80"
lattice:DragDropProperties.IsDragSource="True"
lattice:DragDropProperties.DragData="Grid Element">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!-- Иконка -->
<TextBlock Grid.Column="0"
Text="🔲"
FontSize="18"
Margin="0,0,10,0"
VerticalAlignment="Center"/>
<!-- Контент -->
<StackPanel Grid.Column="1">
<TextBlock Text="Это Grid"
FontSize="14"
Foreground="#EF6C00"
FontWeight="SemiBold"/>
<TextBlock Text="С несколькими колонками"
FontSize="12"
Foreground="#666"/>
</StackPanel>
</Grid>
</Border>
</StackPanel>
</Grid>
</Grid>
</Window>