BinPickerPage.xaml
2.2 KB
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
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:model="clr-namespace:IndustrialControl.Models"
x:Class="IndustrialControl.Pages.BinPickerPage"
x:Name="Root"
Title="选择库位"
BackgroundColor="White">
<Grid Padding="12" RowDefinitions="Auto,*">
<Grid ColumnDefinitions="*,Auto" Padding="0,0,0,8">
<Label Text="选择库位" FontSize="18" FontAttributes="Bold" />
<Button Text="关闭" BackgroundColor="Transparent" Clicked="OnCloseClicked"/>
</Grid>
<ScrollView Grid.Row="1">
<!-- ★ 绑定可见树 -->
<CollectionView ItemsSource="{Binding VisibleTree}" SelectionMode="None">
<CollectionView.ItemTemplate>
<DataTemplate x:DataType="model:LocationTreeNodeVM">
<Grid ColumnDefinitions="24,*" Padding="4" Margin="{Binding Indent}">
<Label Grid.Column="0" Text="{Binding ToggleIcon}"
HorizontalTextAlignment="Center" VerticalTextAlignment="Center">
<Label.GestureRecognizers>
<TapGestureRecognizer
Command="{Binding BindingContext.ToggleCommand, Source={x:Reference Root}}"
CommandParameter="{Binding .}" />
</Label.GestureRecognizers>
</Label>
<Label Grid.Column="1" Text="{Binding Name}" VerticalTextAlignment="Center">
<Label.GestureRecognizers>
<TapGestureRecognizer
Command="{Binding BindingContext.SelectNodeCommand, Source={x:Reference Root}}"
CommandParameter="{Binding .}" />
</Label.GestureRecognizers>
</Label>
</Grid>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</ScrollView>
</Grid>
</ContentPage>