Skip to content

Commit

Permalink
v20.2.0.36
Browse files Browse the repository at this point in the history
  • Loading branch information
SyncfusionBuild committed Jul 5, 2022
1 parent 882fb72 commit fb1f2b5
Show file tree
Hide file tree
Showing 847 changed files with 92,015 additions and 0 deletions.
28 changes: 28 additions & 0 deletions SampleBrowser.Maui.Core.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31717.71
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleBrowser.Maui.Core", "SampleBrowser.Maui.Core\SampleBrowser.Maui.Core.csproj", "{CEADB581-2FB8-43E3-B6F8-71BA6E548B3E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
Release-Xml|Any CPU = Release-Xml|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{CEADB581-2FB8-43E3-B6F8-71BA6E548B3E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CEADB581-2FB8-43E3-B6F8-71BA6E548B3E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CEADB581-2FB8-43E3-B6F8-71BA6E548B3E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CEADB581-2FB8-43E3-B6F8-71BA6E548B3E}.Release|Any CPU.Build.0 = Release|Any CPU
{CEADB581-2FB8-43E3-B6F8-71BA6E548B3E}.Release-Xml|Any CPU.ActiveCfg = Release-Xml|Any CPU
{CEADB581-2FB8-43E3-B6F8-71BA6E548B3E}.Release-Xml|Any CPU.Build.0 = Release-Xml|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0EC937FE-D5BD-449B-B8E0-EC08568B3DE1}
EndGlobalSection
EndGlobal
190 changes: 190 additions & 0 deletions SampleBrowser.Maui.Core/Controls/CardViewExt/CardViewExt.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
#region Copyright Syncfusion Inc. 2001-2022.
// Copyright Syncfusion Inc. 2001-2022. All rights reserved.
// Use of this code is subject to the terms of our license.
// A copy of the current license can be obtained at any time by e-mailing
// [email protected]. Any infringement will be prosecuted under
// applicable laws.
#endregion
namespace SampleBrowser.Maui.Core
{
public class CardViewExt : ContentView
{
internal Image expandImageButton;
private readonly Label titleLabel;

private readonly Frame outerFrame;
private readonly Grid parentGrid;

private readonly Grid parentStack;
internal Grid titleLayout;
private readonly TapGestureRecognizer tapGestureRecognizer;

/// <summary>
///
/// </summary>
public static readonly BindableProperty MainContentProperty =
BindableProperty.Create(nameof(MainContent), typeof(View), typeof(CardViewExt), null);

public View MainContent
{
get => (View)GetValue(MainContentProperty);
set => SetValue(MainContentProperty, value);
}

/// <summary>
///
/// </summary>
public static readonly BindableProperty TitleProperty =
BindableProperty.Create(nameof(Title), typeof(string), typeof(CardViewExt), String.Empty, propertyChanged: OnTitleChanged);

public string Title
{
get => (string)GetValue(TitleProperty);
set => SetValue(TitleProperty, value);
}

static void OnTitleChanged(BindableObject bindable, object oldValue, object newValue) => (bindable as CardViewExt)?.UpdateTitle((string)newValue);

void UpdateTitle(string newValue)
{
this.titleLabel.Text = newValue;
this.InvalidateLayout();


}

public object Clone()
{
return this.MemberwiseClone();
}


public CardViewExt()
{
this.tapGestureRecognizer = new TapGestureRecognizer();
this.tapGestureRecognizer.Tapped += TapGestureRecognizer_Tapped;

this.expandImageButton = new Image
{
WidthRequest = 25,
HeightRequest = 25,
Source = "expandicon.png"
};

if (!string.IsNullOrEmpty(RunTimeDevice.PlatformInfo))
{
if (RunTimeDevice.PlatformInfo.Equals("Android", StringComparison.OrdinalIgnoreCase))
{
this.expandImageButton.Margin = new Microsoft.Maui.Thickness(0, 3, 5, 0);
}
else if (RunTimeDevice.PlatformInfo.Equals("MacCatalyst", StringComparison.OrdinalIgnoreCase))
{
this.expandImageButton.Margin = new Microsoft.Maui.Thickness(0, 3, 0, 0);
}
else if (RunTimeDevice.PlatformInfo.Equals("ios", StringComparison.OrdinalIgnoreCase))
{
this.expandImageButton.Margin = new Microsoft.Maui.Thickness(0, 3, 0, 0);
}
}

this.expandImageButton.HorizontalOptions = LayoutOptions.End;
this.expandImageButton.BackgroundColor = Colors.Transparent;

this.titleLabel = new Label
{
HorizontalOptions = LayoutOptions.Start,
HorizontalTextAlignment = Microsoft.Maui.TextAlignment.Start,
Text = this.Title,
TextColor = Colors.Black,
FontFamily = "Roboto",
FontSize = 16
};
if (!string.IsNullOrEmpty(RunTimeDevice.PlatformInfo))
{
if (RunTimeDevice.PlatformInfo.Equals("Android", StringComparison.OrdinalIgnoreCase))
{
this.titleLabel.Margin = new Microsoft.Maui.Thickness(0, -3, 0, 0);
}
else if (RunTimeDevice.PlatformInfo.Equals("ios", StringComparison.OrdinalIgnoreCase) || RunTimeDevice.PlatformInfo.Equals("MacCatalyst", StringComparison.OrdinalIgnoreCase))
{
this.titleLabel.Margin = new Microsoft.Maui.Thickness(0, -18, 0, 0);
}
}

this.MainContent = new ContentView
{
VerticalOptions = LayoutOptions.Fill,
HorizontalOptions = LayoutOptions.Fill
};

this.titleLayout = new Grid
{
HorizontalOptions = LayoutOptions.Fill,
HeightRequest = 40
};
this.titleLayout.ColumnDefinitions.Add(new ColumnDefinition() { Width = Microsoft.Maui.GridLength.Star });
this.titleLayout.ColumnDefinitions.Add(new ColumnDefinition() { Width = Microsoft.Maui.GridLength.Auto });
this.titleLayout.Add(this.titleLabel, 0, 0);
this.titleLayout.Add(this.expandImageButton, 1, 0);
this.titleLayout.GestureRecognizers.Add(this.tapGestureRecognizer);

this.parentStack = new Grid
{
Padding = new Microsoft.Maui.Thickness(10, 10, 10, 10)
};
this.parentStack.RowDefinitions.Add(new RowDefinition() { Height = Microsoft.Maui.GridLength.Auto });
this.parentStack.RowDefinitions.Add(new RowDefinition() { Height = Microsoft.Maui.GridLength.Star });
this.parentStack.RowSpacing = 5;
this.parentStack.Add(this.titleLayout, 0, 0);

this.outerFrame = new Frame
{
CornerRadius = 8,
HorizontalOptions = LayoutOptions.Fill,
VerticalOptions = LayoutOptions.Fill,
HasShadow = false,
BorderColor = Color.FromArgb("#E0E0E0"),
BackgroundColor = Colors.Transparent
};

this.parentGrid = new Grid()
{
Children = { this.outerFrame, this.parentStack },
};

if (RunTimeDevice.IsMobileDevice())
{
this.parentGrid.Padding = new Microsoft.Maui.Thickness(9, 10, 9, 4);
}
else
{
this.parentGrid.Padding = new Microsoft.Maui.Thickness(5);
}

this.Content = this.parentGrid;

if (!RunTimeDevice.IsMobileDevice())
{
this.WidthRequest = 450;
}
}

private void TapGestureRecognizer_Tapped(object? sender, EventArgs e)
{

if (RunTimeDevice.IsMobileDevice())
{
this.parentStack.Children.Remove(this.MainContent);
Navigation.PushAsync(new PopUpPageExt(this.MainContent, this) { Title = this.Title }, true);
}
}

public void OnAppearing()
{
if (this.MainContent != null && !this.parentStack.Children.Contains(this.MainContent))
{
this.parentStack.Add(this.MainContent, 0, 1);
}
}
}
}
78 changes: 78 additions & 0 deletions SampleBrowser.Maui.Core/Controls/CardViewExt/PopupPageExt.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#region Copyright Syncfusion Inc. 2001-2022.
// Copyright Syncfusion Inc. 2001-2022. All rights reserved.
// Use of this code is subject to the terms of our license.
// A copy of the current license can be obtained at any time by e-mailing
// [email protected]. Any infringement will be prosecuted under
// applicable laws.
#endregion
namespace SampleBrowser.Maui.Core
{
public class PopUpPageExt : ContentPage
{
private Grid? rootGrid;
private readonly SampleView? SampleView;
private readonly CardViewExt? cardViewExt;

public PopUpPageExt(View? view, CardViewExt? card)
{
this.BackgroundColor = Colors.White;
this.Padding = new Thickness(10);
this.rootGrid = new Grid() { Padding = 10 };
var samplePageType = GetSamplePage(card);
SampleView = Activator.CreateInstance(samplePageType!.SampleType!) as SampleView;
var newView = PopUpPageExt.GetSampleView(SampleView, view, card);
this.cardViewExt = card;
this.rootGrid.Children.Add(newView);
this.Content = this.rootGrid;
}


private static View? GetSampleView(SampleView? newView, View? view, CardViewExt? card)
{
if (newView?.ScrollView?.Content is VerticalStackLayout verticalStackLayout && verticalStackLayout.Children.Count > 0)
{
foreach (var item in verticalStackLayout.Children)
{
if (item is CardViewExt ext)
{
if ((item as CardViewExt)?.Title == card?.Title)
{

CardViewExt duplicatedCardView = ext;
newView?.OnExpandedViewAppearing(duplicatedCardView!.MainContent as View);
return duplicatedCardView.MainContent;
}
}
}
}
return view;
}

private SamplePage? GetSamplePage(View? view)
{
if (view?.Parent is SamplePage)
{
return view.Parent as SamplePage;
}
else
{
if (view?.Parent != null)
return GetSamplePage(view.Parent as View);
}
return null;
}

protected override void OnDisappearing()
{
this.rootGrid?.Children.Clear();

if (this.cardViewExt != null && this.SampleView != null && this.cardViewExt.MainContent != null)
{
this.SampleView.OnExpandedViewDisappearing(this.cardViewExt.MainContent);
}
this.rootGrid = null;
this.Content = null;
base.OnDisappearing();
}
}
}
28 changes: 28 additions & 0 deletions SampleBrowser.Maui.Core/Controls/ScrollViewExt/ScrollViewExt.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#region Copyright Syncfusion Inc. 2001-2022.
// Copyright Syncfusion Inc. 2001-2022. All rights reserved.
// Use of this code is subject to the terms of our license.
// A copy of the current license can be obtained at any time by e-mailing
// [email protected]. Any infringement will be prosecuted under
// applicable laws.
#endregion
namespace SampleBrowser.Maui.Core
{
public class ScrollViewExt : ScrollView
{

public ScrollViewExt()
{
}

protected override void OnParentSet()
{
base.OnParentSet();

if (this.Parent is SampleView view)
{
view.ScrollView = this;
}
}

}
}
Loading

0 comments on commit fb1f2b5

Please sign in to comment.