Adding final project to dev branch
This commit is contained in:
29
WguApp/Controls/CustomButton.xaml
Normal file
29
WguApp/Controls/CustomButton.xaml
Normal file
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="WguApp.Controls.CustomButton"
|
||||
x:Name="ThisControl">
|
||||
<Border>
|
||||
<Grid BackgroundColor="#002f51"
|
||||
Padding="10"
|
||||
ColumnDefinitions="*, Auto">
|
||||
|
||||
<Grid.GestureRecognizers>
|
||||
<TapGestureRecognizer Tapped="TapGestureRecognizer_OnTapped" NumberOfTapsRequired="1" />
|
||||
</Grid.GestureRecognizers>
|
||||
|
||||
<Label Grid.Column="0"
|
||||
Text="{Binding Text, Source={x:Reference ThisControl}}"
|
||||
FontSize="15"
|
||||
VerticalOptions="Center"
|
||||
TextColor="AliceBlue"
|
||||
HorizontalOptions="Start"/>
|
||||
|
||||
<Label Grid.Column="1"
|
||||
Text="{Binding DateText, Source={x:Reference ThisControl}}"
|
||||
FontSize="12"
|
||||
VerticalOptions="Center"
|
||||
TextColor="Gray"
|
||||
Margin="10,0,0,0"/> </Grid>
|
||||
</Border>
|
||||
</ContentView>
|
||||
51
WguApp/Controls/CustomButton.xaml.cs
Normal file
51
WguApp/Controls/CustomButton.xaml.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WguApp.Controls;
|
||||
|
||||
public partial class CustomButton : ContentView
|
||||
{
|
||||
|
||||
public event EventHandler? Clicked;
|
||||
|
||||
public static readonly BindableProperty TextProperty =
|
||||
BindableProperty.Create(
|
||||
propertyName: nameof(Text),
|
||||
returnType: typeof(string),
|
||||
declaringType: typeof(CustomButton),
|
||||
defaultValue: "Text",
|
||||
defaultBindingMode: BindingMode.OneWay);
|
||||
|
||||
public static readonly BindableProperty DateTextProperty =
|
||||
BindableProperty.Create(
|
||||
propertyName: nameof(DateText),
|
||||
returnType: typeof(string),
|
||||
declaringType: typeof(CustomButton),
|
||||
defaultValue: "//",
|
||||
defaultBindingMode: BindingMode.OneWay);
|
||||
|
||||
public string Text
|
||||
{
|
||||
get => (string)GetValue(TextProperty);
|
||||
set => SetValue(TextProperty, value);
|
||||
}
|
||||
|
||||
public string DateText
|
||||
{
|
||||
get => (string)GetValue(DateTextProperty);
|
||||
set => SetValue(DateTextProperty, value);
|
||||
}
|
||||
|
||||
public CustomButton()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void TapGestureRecognizer_OnTapped(object? sender, TappedEventArgs e)
|
||||
{
|
||||
Clicked?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user