-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMainWindow.xaml
62 lines (62 loc) · 3.51 KB
/
MainWindow.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<Window x:Class="WpfApp1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controlEx="clr-namespace:WpfApp1.ControlExtend"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:local="clr-namespace:WpfApp1"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Name="window"
Title="DataGrid Drag Row"
Width="400"
Height="400"
Background="{StaticResource RegionBrush}"
mc:Ignorable="d">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition />
</Grid.RowDefinitions>
<Menu Height="30" VerticalAlignment="Top">
<MenuItem VerticalAlignment="Center" Header="TestDemo">
<MenuItem.Icon>
<Path VerticalAlignment="Center" Data="{StaticResource FatalGeometry}" Stretch="Uniform" Stroke="Gray" />
</MenuItem.Icon>
<MenuItem Header="1.1">1.1.1</MenuItem>
<MenuItem Header="1.2" />
</MenuItem>
</Menu>
<Grid Grid.Row="1" Margin="5">
<Popup x:Name="popup1" AllowsTransparency="True" IsHitTestVisible="False" Placement="RelativePoint" PlacementTarget="{Binding ElementName=dataGrid1}" />
<DataGrid x:Name="dataGrid1" controlEx:DragDropRowBehavior.Enabled="True" controlEx:DragDropRowBehavior.PopupControl="{Binding ElementName=popup1}" AutoGenerateColumns="False" ItemsSource="{Binding ListItem}" RowHeaderWidth="60">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Column1}" Header="column1" />
<DataGridTemplateColumn Header="column2" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Width="100" Text="{Binding Column2, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="column3" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Border Margin="-10,0">
<ToggleButton IsChecked="{Binding Column3, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}">
<ToggleButton.Resources>
<Style BasedOn="{StaticResource ToggleButtonSwitch}" TargetType="{x:Type ToggleButton}">
<Style.Resources>
<SolidColorBrush x:Key="PrimaryBrush" Color="{StaticResource InfoColor}" />
</Style.Resources>
</Style>
</ToggleButton.Resources>
</ToggleButton>
</Border>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</Grid>
</Grid>
</Window>