Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions maui/samples/Gallery/ControlList.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
<Assembly Name="BottomSheet" />
<Assembly Name="NumericEntry" />
<Assembly Name="NumericUpDown" />
<Assembly Name="Calendar" />
<Assembly Name="OtpInput" />
<Assembly Name="Expander" />
<Assembly Name="Calendar" />
<Assembly Name="Accordion" />
<Assembly Name="Cards" />
<Assembly Name="Cards" />
<Assembly Name="Popup"/>
<Assembly Name="OtpInput" />
</Assemblies>
</SampleBrowser>
</SampleBrowser>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added maui/samples/Gallery/Resources/Images/savings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions maui/samples/Gallery/SampleList/CalendarSamplesList.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<Sample Title="Selection" SampleName="DateSelection"/>
<Sample Title="Calendar Identifier" SampleName="CalendarIdentifier"/>
<Sample Title="Appointment Booking" SampleName="AppointmentBooking"/>
<Sample Title ="Flight Booking" SampleName="FlightBooking"/>
<Sample Title="Color Scheme" SampleName="HighlightDates" />
<Sample Title="Customization" SampleName="AppearanceCustomization" />
</Control>
Expand Down
10 changes: 5 additions & 5 deletions maui/samples/Gallery/SampleList/CircularChartSamplesList.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
<!--<Sample SearchTags="CenterElevation" Name="CenterElevation" SampleName="CenterElevation" Title="Center elevation"/>-->
</CardLayout>
</SubCategory>
<!--<SubCategory Title="Radial Bar">
--><!--<CardLayout>-->
<SubCategory Title="Radial Bar">
<CardLayout>
<Sample SearchTags="radialbar" Name="RadialBarChart" SampleName="RadialBarChart" Title="Radial bar"/>
<!--<Sample SearchTags="radialbar" Name="CustomizedRadialBarChart" SampleName="CustomizedRadialBarChart" Title="Customized legend"/>-->
<!--</CardLayout>-->
<!--</SubCategory>-->
<Sample SearchTags="radialbar" Name="CustomizedRadialBarChart" SampleName="CustomizedRadialBarChart" Title="Customized legend"/>
</CardLayout>
</SubCategory>
</Category>
<Category Title="Interaction">
<Sample SearchTags="tooltip" Name="Tooltip" SampleName="Tooltip" Title="Tooltip" Description="This sample showcases the tooltip feature. On mobile, tap the data points, and on desktop, mouse over to the data points to raise the tooltip."/>
Expand Down
1 change: 1 addition & 0 deletions maui/samples/Gallery/SampleList/TabViewSamplesList.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<Sample Title="Getting Started" SampleName="TabViewGettingStarted" Description="This sample shows a simple use case of the Tab View." SearchTags="tabs, tab view, tabbed view, navigation"/>
<Sample Title="Fit To Content" SampleName="SizeToContent" Description="This sample shows how to display the tabs based on the each tabs text size." SearchTags="tabs, tab view, tabbed view, autofit, auto, sizetofit, tab width"/>
<Sample Title="Customization" SampleName="Customization" SearchTags="tabs, tab view, tabbed view, customization"/>
<Sample Title="Center Button" SampleName="CenterButton" SearchTags="tabs, tab view, tabbed view, center button" StatusTag="New"/>
</Control>
</ControlCategory>
</SyncfusionControls>
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<Grid.BindingContext>
<local:ItemViewModel />
</Grid.BindingContext>

<BottomSheet:SfBottomSheet x:Name="BottomSheet" HalfExpandedRatio="{OnPlatform Android=0.5, iOS=0.6}" FullExpandedRatio="0.9" CollapsedHeight="180" Background="{AppThemeBinding Light={StaticResource SampleBrowserBackgroundLight}, Dark={StaticResource SampleBrowserBackgroundDark}}" CornerRadius="10, 10, 0, 0" ContentPadding="16,16,16,0">

<BottomSheet:SfBottomSheet.Content>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void ComboBox_SelectionChanged(object? sender, EventArgs e)
{
AppearanceViewModel appearanceViewModel = (AppearanceViewModel)_calendar.BindingContext;
bool isCircleShape = selectionShape == "Circle";
appearanceViewModel.UpdateSelectionShape(isCircleShape);
appearanceViewModel.UpdateSelectionShape(isCircleShape);
if (isCircleShape)
{
_calendar.SelectionShape = CalendarSelectionShape.Circle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ public AppearanceViewModel()
border.Stroke = _isLightTheme ? Color.FromRgba("#6750A4") : Color.FromRgba("#D0BCFF");

Label label = new Label();
label.SetBinding(Label.TextProperty, BindingHelper.CreateBinding(
label.SetBinding(Label.TextProperty, BindingHelper.CreateBinding(
propertyName: "Date.Day",
getter: static (CalendarCellDetails context) => context.Date.Day));

label.HorizontalOptions = LayoutOptions.Center;
label.HorizontalOptions = LayoutOptions.Center;
label.VerticalOptions = LayoutOptions.Center;
label.Padding = new Thickness(2);
border.Content = label;
Expand All @@ -81,11 +81,11 @@ public AppearanceViewModel()
border.Stroke = _isLightTheme ? Color.FromRgba("#6750A4") : Color.FromRgba("#D0BCFF");

Label label = new Label();
label.SetBinding(Label.TextProperty, BindingHelper.CreateBinding(
label.SetBinding(Label.TextProperty, BindingHelper.CreateBinding(
propertyName: "Date.Day",
getter: static (CalendarCellDetails context) => context.Date.Day));

label.HorizontalOptions = LayoutOptions.Center;
label.HorizontalOptions = LayoutOptions.Center;
label.VerticalOptions = LayoutOptions.Center;
border.Content = label;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Syncfusion.Maui.ControlsGallery.Calendar.Calendar.AppointmentBooking"
xmlns:calendar="clr-namespace:Syncfusion.Maui.Toolkit.Calendar;assembly=Syncfusion.Maui.Toolkit"
xmlns:popUp="clr-namespace:Syncfusion.Maui.Toolkit.Popup;assembly=Syncfusion.Maui.Toolkit"
xmlns:buttons="clr-namespace:Syncfusion.Maui.Toolkit.Buttons;assembly=Syncfusion.Maui.Toolkit"
xmlns:localCore="clr-namespace:Syncfusion.Maui.ControlsGallery;assembly=Syncfusion.Maui.ControlsGallery" BackgroundColor="{AppThemeBinding Light={StaticResource BackgroundLight}, Dark={StaticResource BackgroundDark}}" Margin="-4,-4,-6,-6">

Expand Down Expand Up @@ -255,8 +256,13 @@
</FlexLayout>
</Grid>
<Grid Grid.Row="3" HorizontalOptions="Center" Padding="0,0,0,30">
<Button Text="Book Appointment" HorizontalOptions="Center" Clicked="AppointmentanBooking" VerticalOptions="End" WidthRequest="150" HeightRequest="50" CornerRadius="20"/>
</Grid>
<Button Text="Book Appointment" HorizontalOptions="Center" Clicked="AppointmentanBooking" VerticalOptions="End" WidthRequest="150" HeightRequest="50" CornerRadius="20"/>
<popUp:SfPopup Grid.Row="0" Grid.RowSpan="3" IsVisible="false" x:Name="popUp" FooterHeight="70" ShowHeader="True" HeaderHeight="65" ShowFooter="True" HeightRequest="200">
<popUp:SfPopup.PopupStyle>
<popUp:PopupStyle CornerRadius="15" MessageFontSize="15" HeaderFontSize="17" HeaderFontAttribute="Bold" />
</popUp:SfPopup.PopupStyle>
</popUp:SfPopup>
</Grid>
</Grid>
</Grid>
</localCore:SampleView>
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Globalization;
using Syncfusion.Maui.Toolkit.Calendar;
using Syncfusion.Maui.Toolkit.Buttons;
using Syncfusion.Maui.Toolkit.Popup;
using Color = Microsoft.Maui.Graphics.Color;

namespace Syncfusion.Maui.ControlsGallery.Calendar.Calendar
Expand All @@ -27,6 +28,13 @@ public partial class AppointmentBooking : SampleView
public AppointmentBooking()
{
InitializeComponent();

if (popUp != null)
{
popUp.FooterTemplate = GetFooterTemplate(popUp);
popUp.ContentTemplate = GetContentTemplate(popUp);
}

#if MACCATALYST
border.IsVisible = true;
border.Stroke = Colors.Transparent;
Expand All @@ -49,6 +57,128 @@ public AppointmentBooking()
#endif
}

/// <summary>
/// Method to get the dynamic color.
/// </summary>
/// <param name="resourceName">The resource name.</param>
/// <returns>The color.</returns>
Color GetDynamicColor(string? resourceName = null)
{
if (resourceName != null && App.Current != null && App.Current.Resources.TryGetValue(resourceName, out var colorValue) && colorValue is Color color)
{
return color;
}
else
{
if (App.Current != null && App.Current.RequestedTheme == AppTheme.Light)
{
return Color.FromRgb(0xFF, 0xFF, 0xFF);
}
else if (App.Current != null && App.Current.RequestedTheme == AppTheme.Dark)
{
return Color.FromRgb(0x38, 0x1E, 0x72);
}
}

return Colors.Transparent;
}

/// <summary>
/// Method to get the Ok button style.
/// </summary>
/// <returns>The button style.</returns>
Style GetOkButtonStyle()
{
return new Style(typeof(Button))
{
Setters =
{
new Setter { Property = Button.CornerRadiusProperty, Value = 15 },
new Setter { Property = Button.BorderColorProperty, Value = Color.FromArgb("#6750A4") },
new Setter { Property = Button.BorderWidthProperty, Value = 1 },
new Setter { Property = Button.BackgroundColorProperty, Value = GetDynamicColor("SfCalendarTodayHighlightColor") },
new Setter { Property = Button.TextColorProperty, Value = GetDynamicColor() },
new Setter { Property = Button.FontSizeProperty, Value = 14 },
}
};
}

/// <summary>
/// Method to get the footer template.
/// </summary>
/// <param name="popup">The pop up.</param>
/// <returns>The data template.</returns>
DataTemplate GetFooterTemplate(SfPopup popup)
{
var footerTemplate = new DataTemplate(() =>
{
var grid = new Grid
{
ColumnSpacing = 12,
Padding = new Thickness(24)
};
grid.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Star });
grid.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Star });
var oKButton = new Button
{
Text = "OK",
Style = GetOkButtonStyle(),
WidthRequest = 96,
HeightRequest = 40
};
oKButton.Clicked += (sender, args) =>
{
popup.Dismiss();
};
grid.Children.Add(oKButton);
Grid.SetColumn(oKButton, 1);
return grid;
});

return footerTemplate;
}

/// <summary>
/// Method to get the content template.
/// </summary>
/// <param name="popup">The pop up.</param>
/// <returns>The data template.</returns>
DataTemplate GetContentTemplate(SfPopup popup)
{
var contentTemplate = new DataTemplate(() =>
{
var grid = new Grid();
grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Star });
grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(0.1, GridUnitType.Star) });
var label = new Label
{
LineBreakMode = LineBreakMode.WordWrap,
Padding = new Thickness(20, 0, 0, 0),
FontSize = 16,
HorizontalOptions = LayoutOptions.Start,
HorizontalTextAlignment = TextAlignment.Start,
WidthRequest = 300,
};

label.BindingContext = popup;
label.SetBinding(Label.TextProperty, "Message");
var stackLayout = new StackLayout
{
Margin = new Thickness(0, 2, 0, 0),
HeightRequest = 1,
};

stackLayout.BackgroundColor = _isLightTheme ? Color.FromArgb("#611c1b1f") : Color.FromArgb("#61e6e1e5");
grid.Children.Add(label);
grid.Children.Add(stackLayout);
Grid.SetRow(label, 0);
Grid.SetRow(stackLayout, 1);
return grid;
});

return contentTemplate;
}

/// <summary>
/// Initialize the calendar.
/// </summary>
Expand Down Expand Up @@ -135,6 +265,8 @@ void AppointmentanBooking(object sender, EventArgs e)
BookAppointment(mobileAppointmentBooking, mobileFlexLayout);
}
#endif

popUp.Show();
}

/// <summary>
Expand All @@ -144,22 +276,29 @@ void AppointmentanBooking(object sender, EventArgs e)
/// <param name="buttonLayout">Time slot button layout.</param>
void BookAppointment(SfCalendar calendar, FlexLayout buttonLayout)
{
if (popUp == null)
{
return;
}

if (calendar.SelectedDate == null)
{
Application.Current?.Windows[0].Page?.DisplayAlert("Alert !", "Please select a date to book an appointment ", "Ok");
popUp.HeaderTitle = "Alert !";
popUp.Message = "Please select a date to book an appointment";
return;
}

if (_timeSlot == string.Empty)
{
Application.Current?.Windows[0].Page?.DisplayAlert("Alert !", "Please select a time to book an appointment ", "Ok");
popUp.HeaderTitle = "Alert !";
popUp.Message = "Please select a time to book an appointment";
return;
}

popUp.HeaderTitle = "Confirmation";
DateTime dateTime = calendar.SelectedDate.Value;
string dayText = dateTime.ToString("MMMM" + " " + dateTime.Day.ToString() + ", " + dateTime.ToString("yyyy"), CultureInfo.CurrentUICulture);
string text = "Appointment booked for " + dayText + " " + _timeSlot;
Application.Current?.Windows[0].Page?.DisplayAlert("Confirmation", text, "Ok");
popUp.Message = "Appointment booked for " + dayText + " " + _timeSlot;
calendar.SelectedDate = DateTime.Now.Date;
calendar.DisplayDate = DateTime.Now.Date;
_timeSlot = string.Empty;
Expand Down Expand Up @@ -203,7 +342,9 @@ void UpdateTimeSlotSelection(SfCalendar calendar, SfButton selectedButton, FlexL
{
if (calendar.SelectedDate == null)
{
Application.Current?.Windows[0].Page?.DisplayAlert("Alert !", "Please select a date to book an appointment ", "Ok");
popUp.HeaderTitle = "Alert !";
popUp.Message = "Please select a date to book an appointment ";
popUp.Show();
return;
}

Expand Down
Loading