-
Notifications
You must be signed in to change notification settings - Fork 15
/
MainPage.xaml
139 lines (129 loc) · 10 KB
/
MainPage.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<ContentPage x:Class="GridExport.MainPage"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:dx="http://schemas.devexpress.com/maui"
xmlns:local="clr-namespace:GridExport"
xmlns:vm="clr-namespace:GridExport.ViewModels"
xmlns:controls="clr-namespace:GridExport.Controls"
BindingContext="{vm:ExportViewModel}" >
<ContentPage.ToolbarItems>
<ToolbarItem IconImageSource="{AppThemeBinding Light=export_button_light, Dark=export_button_light}" Clicked="ExportButton_Clicked"/>
</ContentPage.ToolbarItems>
<dx:DXStackLayout>
<dx:BottomSheet x:Name="bottomSheet" State="{Binding BottomSheetState}" AllowedState="HalfExpanded">
<dx:BottomSheet.HalfExpandedRatio>
<OnPlatform x:TypeArguments="x:Double">
<On Platform="iOS" Value="{dx:OnScreenHeight ExtraLarge=0.37, Large=0.44, Medium=0.51, Small=0.58, ExtraSmall=0.65}"/>
<On Platform="Android" Value="{dx:OnScreenHeight ExtraLarge=0.43, Large=0.5, Medium=0.57, Small=0.64, ExtraSmall=0.71}"/>
</OnPlatform>
</dx:BottomSheet.HalfExpandedRatio>
<Grid>
<controls:DockLayout Margin="30,20" IsVisible="{Binding IsInExport, Converter={local:InverseBoolConverter}}">
<controls:DockLayout.Resources>
<Style TargetType="Border">
<Setter Property="BackgroundColor" Value="{AppThemeBinding Light=White, Dark=Black}"/>
<Setter Property="Padding" Value="5"/>
<Setter Property="StrokeThickness" Value="{OnPlatform iOS=3, Android=2}"/>
<Setter Property="StrokeShape" Value="RoundRectangle 5,5,5,5"/>
<Setter Property="WidthRequest" Value="{OnPlatform iOS=42, Android=50}"/>
<Setter Property="HeightRequest" Value="{OnPlatform iOS=42, Android=50}"/>
<Style.Triggers>
<DataTrigger TargetType="Border" Binding="{Binding IsChecked}" Value="False">
<Setter Property="Stroke" Value="{AppThemeBinding Light={StaticResource UnselectedBorderColor_Light}, Dark={StaticResource UnselectedBorderColor_Dark}}"/>
</DataTrigger>
<DataTrigger TargetType="Border" Binding="{Binding IsChecked}" Value="True">
<Setter Property="Stroke" Value="{AppThemeBinding Light={StaticResource AccentColor_Light}, Dark={StaticResource AccentColor_Dark}}"/>
</DataTrigger>
</Style.Triggers>
</Style>
<Style TargetType="Label">
<Setter Property="FontSize" Value="12"/>
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource FormatTextColor_Light}, Dark={StaticResource FormatTextColor_Dark}}"/>
<Setter Property="FontFamily" Value="Roboto"/>
<Setter Property="HorizontalOptions" Value="Center"/>
<Setter Property="Margin" Value="5"/>
</Style>
<Style TargetType="dx:CheckEdit">
<Setter Property="CheckedCheckBoxImage" Value="radiobuttonchecked"/>
<Setter Property="UncheckedCheckBoxImage" Value="radiobuttonunchecked"/>
<Setter Property="LabelFontSize" Value="14"/>
<Setter Property="LabelFontFamily" Value="Roboto"/>
<Setter Property="CheckBoxIndent" Value="15"/>
</Style>
</controls:DockLayout.Resources>
<dx:DXStackLayout Orientation="Horizontal" RadioButtonGroup.GroupName="format" RadioButtonGroup.SelectedValue="{Binding SelectedFormat, Mode=TwoWay}" ItemSpacing="38" controls:DockLayout.Dock="Top">
<RadioButton Value="{x:Static vm:ExportFormat.Pdf}">
<RadioButton.ControlTemplate>
<ControlTemplate>
<dx:DXStackLayout Orientation="Vertical" BindingContext="{Binding Source={RelativeSource TemplatedParent}}">
<Border>
<dx:DXImage Source="pdf"/>
</Border>
<Label Text="PDF" />
</dx:DXStackLayout>
</ControlTemplate>
</RadioButton.ControlTemplate>
</RadioButton>
<RadioButton Value="{x:Static vm:ExportFormat.Xlsx}">
<RadioButton.ControlTemplate>
<ControlTemplate>
<dx:DXStackLayout Orientation="Vertical" BindingContext="{Binding Source={RelativeSource TemplatedParent}}">
<Border>
<dx:DXImage Source="xlsx"/>
</Border>
<Label Text="XLSX"/>
</dx:DXStackLayout>
</ControlTemplate>
</RadioButton.ControlTemplate>
</RadioButton>
<RadioButton Value="{x:Static vm:ExportFormat.Docx}">
<RadioButton.ControlTemplate>
<ControlTemplate>
<dx:DXStackLayout Orientation="Vertical" BindingContext="{Binding Source={RelativeSource TemplatedParent}}">
<Border>
<dx:DXImage Source="docx"/>
</Border>
<Label Text="DOCX"/>
</dx:DXStackLayout>
</ControlTemplate>
</RadioButton.ControlTemplate>
</RadioButton>
</dx:DXStackLayout>
<dx:DXStackLayout Orientation="Vertical" ItemSpacing="25" Margin="5,10,0,0" controls:DockLayout.Dock="Top">
<dx:CheckEdit Label="Landscape" IsChecked="{Binding LandscapeSelected}"/>
<dx:CheckEdit Label="Portrait" IsChecked="{Binding PortraitSelected}"/>
</dx:DXStackLayout>
<dx:ChoiceChipGroup controls:DockLayout.Dock="Top" Padding="0,25" ChipSelectedBackgroundColor="{AppThemeBinding Light={StaticResource SelectedPaperSizeColor_Light}, Dark={StaticResource SelectedPaperSizeColor_Dark}}" ItemsSource="{local:EnumToItemsSource EnumType={x:Type vm:PaperSize}}" SelectedItem="{Binding SelectedPaperSize}"/>
<dx:SimpleButton HorizontalOptions="Fill" controls:DockLayout.Dock="Bottom" VerticalOptions="End" Margin="50,0,50,0" Text="Export" Icon="export_button" Command="{Binding ExportCommand}" CommandParameter="{x:Reference grid}"/>
</controls:DockLayout>
<controls:DockLayout Margin="30,20" IsVisible="{Binding IsInExport}">
<ActivityIndicator IsRunning="True" Color="{AppThemeBinding Light={StaticResource AccentColor_Light}, Dark={StaticResource AccentColor_Dark}}" controls:DockLayout.Dock="Top" Margin="30,80" WidthRequest="50"/>
<dx:SimpleButton HorizontalOptions="Fill" controls:DockLayout.Dock="Bottom" VerticalOptions="End" Margin="50,0,50,0" Text="Cancel Exporting" Command="{Binding CancelExportCommand}"/>
</controls:DockLayout>
</Grid>
</dx:BottomSheet>
<dx:DataGridView x:Name="grid" ItemsSource="{Binding Path=Employees}">
<dx:DataGridView.Columns>
<dx:ImageColumn FieldName="Image" AllowExport="true" IsVisible="false"/>
<dx:TemplateColumn Width="{OnIdiom Phone='180', Tablet='240'}" FixedStyle="Start" IsReadOnly="true" Caption="Employee" FieldName="FullName">
<dx:TemplateColumn.DisplayTemplate>
<DataTemplate>
<Grid ColumnDefinitions="Auto,*" Padding="16,8" ColumnSpacing="16" IgnoreSafeArea="True">
<dx:DXImage Source="{Binding Item.Image}" VerticalOptions="Center" HorizontalOptions="Center" WidthRequest="40" HeightRequest="40">
<dx:DXImage.Clip>
<EllipseGeometry RadiusX="20" RadiusY="20" Center="20, 20" />
</dx:DXImage.Clip>
</dx:DXImage>
<Label Text="{Binding Item.FullName}" TextColor="{Binding Source={RelativeSource AncestorType={x:Type dx:DataGridView}}, Path=ActualAppearance.GroupRowFontColor}" VerticalOptions="Center" Grid.Column="1" FontFamily="{Binding Source={RelativeSource AncestorType={x:Type dx:DataGridView}}, Path=ActualAppearance.GroupRowFontFamily}" FontSize="16"/>
</Grid>
</DataTemplate>
</dx:TemplateColumn.DisplayTemplate>
</dx:TemplateColumn>
<dx:TextColumn FieldName="GroupName" GroupCaptionDisplayFormat="{}{1}" IsGrouped="true"/>
<dx:TextColumn FieldName="JobTitle" MinWidth="150" Width="1.5*" />
<dx:TextColumn FieldName="Phone" MinWidth="150" Width="*" />
<dx:DateColumn FieldName="HireDate" MinWidth="120" Width="*" />
</dx:DataGridView.Columns>
</dx:DataGridView>
</dx:DXStackLayout>
</ContentPage>