Advertisement
Guest User

Untitled

a guest
Jan 15th, 2024
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 5.15 KB | None | 0 0
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <ContentView
  3.     x:Class="DemyAI.Controls.UserDetailsExpander"
  4.     xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
  5.     xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
  6.     xmlns:chechbox="clr-namespace:Syncfusion.Maui.Buttons;assembly=Syncfusion.Maui.Buttons"
  7.     xmlns:expander="clr-namespace:Syncfusion.Maui.Expander;assembly=Syncfusion.Maui.Expander"
  8.     xmlns:helpers="clr-namespace:DemyAI.Helpers"
  9.     xmlns:inputLayout="clr-namespace:Syncfusion.Maui.Core;assembly=Syncfusion.Maui.Core"
  10.     x:Name="UserExpander">
  11.  
  12.  
  13.     <StackLayout>
  14.         <inputLayout:SfTextInputLayout
  15.             Hint="{Binding Hint, Source={x:Reference UserExpander}}"
  16.             HorizontalOptions="StartAndExpand"
  17.             OutlineCornerRadius="8">
  18.             <Entry Text="{Binding RomeName, Source={x:Reference UserExpander}}" />
  19.         </inputLayout:SfTextInputLayout>
  20.  
  21.         <expander:SfExpander>
  22.             <expander:SfExpander.Header>
  23.                 <Grid
  24.                     ColumnDefinitions="50,60"
  25.                     ColumnSpacing="10">
  26.                     <Label
  27.                         FontFamily="Mat"
  28.                         FontSize="Header"
  29.                         HorizontalTextAlignment="Center"
  30.                         Text="{Static helpers:IconFont.Group}"
  31.                         VerticalTextAlignment="Center" />
  32.                     <Label
  33.                         Grid.Column="1"
  34.                         Text="Students" />
  35.                 </Grid>
  36.             </expander:SfExpander.Header>
  37.             <expander:SfExpander.Content>
  38.                 <CollectionView
  39.                     ItemsSource="{Binding Users, Source={x:Reference UserExpander}}"
  40.                     SelectionMode="None">
  41.                     <CollectionView.ItemTemplate>
  42.                         <DataTemplate>
  43.                             <Border Margin="2">
  44.                                 <Border.StrokeShape>
  45.                                     <RoundRectangle CornerRadius="8" />
  46.                                 </Border.StrokeShape>
  47.                                 <Grid
  48.                                     Margin="5,5,5,0"
  49.                                     ColumnDefinitions="40,*"
  50.                                     RowDefinitions="*,*">
  51.                                     <Label
  52.                                         Grid.Column="1"
  53.                                         Text="{Binding Name}" />
  54.                                     <Label
  55.                                         Grid.Row="3"
  56.                                         Grid.Column="1"
  57.                                         Text="{Binding Email}" />
  58.                                     <chechbox:SfCheckBox
  59.                                         Grid.RowSpan="3"
  60.                                         HorizontalOptions="End"
  61.                                         IsChecked="{Binding IsParticipant}"
  62.                                         VerticalOptions="End">
  63.                                         <chechbox:SfCheckBox.GestureRecognizers>
  64.                                             <TapGestureRecognizer
  65.                                                 Command="{Binding Source={x:Reference UserExpander}, Path=HandleCheckBox}"
  66.                                                 CommandParameter="{Binding .}" />
  67.                                         </chechbox:SfCheckBox.GestureRecognizers>
  68.                                     </chechbox:SfCheckBox>
  69.                                 </Grid>
  70.                             </Border>
  71.                         </DataTemplate>
  72.                     </CollectionView.ItemTemplate>
  73.                 </CollectionView>
  74.             </expander:SfExpander.Content>
  75.         </expander:SfExpander>
  76.     </StackLayout>
  77. </>
  78.  
  79. public partial class UserDetailsExpander : ContentView {
  80.     public UserDetailsExpander() {
  81.         InitializeComponent();
  82.     }
  83.  
  84.  
  85.     public static readonly BindableProperty HintProperty = BindableProperty.Create(
  86.         nameof(Hint), typeof(string), typeof(UserDetailsExpander);
  87.  
  88.     public string Hint {
  89.         get => (string)GetValue(HintProperty);
  90.         set => SetValue(HintProperty, value);
  91.     }
  92.  
  93.     public static readonly BindableProperty RomeNameProperty = BindableProperty.Create(
  94.         nameof(RomeName), typeof(string), typeof(UserDetailsExpander));
  95.  
  96.     public string RomeName {
  97.         get => (string)GetValue(RomeNameProperty);
  98.         set => SetValue(RomeNameProperty, value);
  99.     }
  100.  
  101.  
  102.     public static readonly BindableProperty UsersProperty = BindableProperty.Create(
  103.         nameof(Users), typeof(IEnumerable), typeof(UserDetailsExpander));
  104.  
  105.     public IEnumerable Users {
  106.         get => (IEnumerable)GetValue(UsersProperty);
  107.         set => SetValue(UsersProperty, value);
  108.     }
  109.  
  110.     public static readonly BindableProperty HandleCheckBoxCommandProperty = BindableProperty.Create(
  111.         nameof(HandleCheckBoxCommand), typeof(RelayCommand), typeof(UserDetailsExpander));
  112.  
  113.     public RelayCommand HandleCheckBoxCommand {
  114.         get => (RelayCommand)GetValue(HandleCheckBoxCommandProperty);
  115.         set => SetValue(HandleCheckBoxCommandProperty, value);
  116.     }
  117. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement