This repository has been archived by the owner on May 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
47 changed files
with
1,763 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
Xamarin.Forms.Controls/GalleryPages/TwoPaneViewGalleries/GridUsingDualScreenInfo.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
xmlns:d="http://xamarin.com/schemas/2014/forms/design" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
mc:Ignorable="d" | ||
x:Class="Xamarin.Forms.Controls.GalleryPages.TwoPaneViewGalleries.GridUsingDualScreenInfo"> | ||
<ContentPage.Content> | ||
<Grid x:Name="grid"> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="{Binding Column1Width}"></ColumnDefinition> | ||
<ColumnDefinition Width="{Binding Column2Width}"></ColumnDefinition> | ||
<ColumnDefinition Width="{Binding Column3Width}"></ColumnDefinition> | ||
</Grid.ColumnDefinitions> | ||
|
||
<Label Text="I should be one side of the hinge"></Label> | ||
<Label Grid.Column="2" Text="I should be on the other side of the hinge"></Label> | ||
|
||
</Grid> | ||
</ContentPage.Content> | ||
</ContentPage> |
59 changes: 59 additions & 0 deletions
59
Xamarin.Forms.Controls/GalleryPages/TwoPaneViewGalleries/GridUsingDualScreenInfo.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
using Xamarin.Forms; | ||
using Xamarin.Forms.Xaml; | ||
|
||
namespace Xamarin.Forms.Controls.GalleryPages.TwoPaneViewGalleries | ||
{ | ||
[XamlCompilation(XamlCompilationOptions.Compile)] | ||
public partial class GridUsingDualScreenInfo : ContentPage | ||
{ | ||
public DualScreen.DualScreenInfo DualScreenInfo { get; } | ||
public GridUsingDualScreenInfo() | ||
{ | ||
InitializeComponent(); | ||
DualScreenInfo = new DualScreen.DualScreenInfo(grid); | ||
BindingContext = this; | ||
} | ||
|
||
protected override void OnAppearing() | ||
{ | ||
base.OnAppearing(); | ||
DualScreenInfo.PropertyChanged += DualScreenInfo_PropertyChanged; | ||
} | ||
|
||
protected override void OnDisappearing() | ||
{ | ||
base.OnDisappearing(); | ||
DualScreenInfo.PropertyChanged -= DualScreenInfo_PropertyChanged; | ||
} | ||
|
||
void DualScreenInfo_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) | ||
{ | ||
if (DualScreenInfo.SpanningBounds.Length > 0) | ||
{ | ||
Column1Width = DualScreenInfo.SpanningBounds[0].Width; | ||
Column2Width = DualScreenInfo.HingeBounds.Width; | ||
Column3Width = DualScreenInfo.SpanningBounds[1].Width; | ||
} | ||
else | ||
{ | ||
Column1Width = 100; | ||
Column2Width = 0; | ||
Column3Width = 100; | ||
} | ||
|
||
OnPropertyChanged(nameof(Column1Width)); | ||
OnPropertyChanged(nameof(Column2Width)); | ||
OnPropertyChanged(nameof(Column3Width)); | ||
} | ||
|
||
public double Column1Width { get; set; } | ||
public double Column2Width { get; set; } | ||
public double Column3Width { get; set; } | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
Xamarin.Forms.Controls/GalleryPages/TwoPaneViewGalleries/OpenCompactWindow.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
xmlns:d="http://xamarin.com/schemas/2014/forms/design" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
mc:Ignorable="d" | ||
x:Class="Xamarin.Forms.Controls.GalleryPages.TwoPaneViewGalleries.OpenCompactWindow"> | ||
<ContentPage.Content> | ||
<StackLayout> | ||
<Button Text="Open Compact Window" | ||
Clicked="Button_Clicked" | ||
VerticalOptions="CenterAndExpand" | ||
HorizontalOptions="CenterAndExpand" /> | ||
</StackLayout> | ||
</ContentPage.Content> | ||
</ContentPage> |
58 changes: 58 additions & 0 deletions
58
Xamarin.Forms.Controls/GalleryPages/TwoPaneViewGalleries/OpenCompactWindow.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
using Xamarin.Forms; | ||
using Xamarin.Forms.Xaml; | ||
|
||
namespace Xamarin.Forms.Controls.GalleryPages.TwoPaneViewGalleries | ||
{ | ||
[XamlCompilation(XamlCompilationOptions.Compile)] | ||
public partial class OpenCompactWindow : ContentPage | ||
{ | ||
public OpenCompactWindow() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
async void Button_Clicked(object sender, EventArgs e) | ||
{ | ||
ContentPage page = new ContentPage() { BackgroundColor = Color.Purple }; | ||
var button = new Button() | ||
{ | ||
Text = "Close this Window" | ||
}; | ||
|
||
var layout = new StackLayout() | ||
{ | ||
Children = | ||
{ | ||
new Label(){ Text = "rabbit"},new Label(){ Text = "rabbit"},new Label(){ Text = "rabbit"},new Label(){ Text = "rabbit"},new Label(){ Text = "rabbit"},new Label(){ Text = "rabbit"},new Label(){ Text = "rabbit"},new Label(){ Text = "rabbit"},new Label(){ Text = "rabbit"},new Label(){ Text = "rabbit"},new Label(){ Text = "rabbit"},new Label(){ Text = "rabbit"},new Label(){ Text = "rabbit"},new Label(){ Text = "rabbit"},new Label(){ Text = "rabbit"}, | ||
button | ||
}, | ||
BackgroundColor = Color.Yellow, | ||
HorizontalOptions = LayoutOptions.Fill, | ||
VerticalOptions = LayoutOptions.Fill | ||
}; | ||
|
||
|
||
layout.BatchCommitted += Layout_BatchCommitted; | ||
page.Content = layout; | ||
|
||
var args = await DualScreen.DualScreenHelper.OpenCompactMode(page); | ||
|
||
button.Command = new Command(async () => | ||
{ | ||
await args.Close(); | ||
}); | ||
} | ||
|
||
void Layout_BatchCommitted(object sender, Internals.EventArg<VisualElement> e) | ||
{ | ||
if (sender is StackLayout layout) | ||
System.Diagnostics.Debug.WriteLine($"{layout.Bounds}"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
...n.Forms.Controls/GalleryPages/VisualStateManagerGalleries/CompareStateTriggerGallery.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<ContentPage | ||
xmlns="http://xamarin.com/schemas/2014/forms" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
x:Class="Xamarin.Forms.Controls.GalleryPages.VisualStateManagerGalleries.CompareStateTriggerGallery" | ||
Title="CompareStateTrigger"> | ||
<ContentPage.Resources> | ||
<ResourceDictionary> | ||
|
||
<Style x:Key="CompareStateTriggerGridStyle" TargetType="Grid"> | ||
<Setter Property="VisualStateManager.VisualStateGroups"> | ||
<VisualStateGroupList> | ||
<VisualStateGroup> | ||
<VisualState x:Name="Wide"> | ||
<VisualState.StateTriggers> | ||
<CompareStateTrigger Property="{Binding IsChecked, Source={x:Reference CheckBox}}" Value="True" /> | ||
</VisualState.StateTriggers> | ||
<VisualState.Setters> | ||
<Setter Property="BackgroundColor" Value="Green" /> | ||
</VisualState.Setters> | ||
</VisualState> | ||
<VisualState x:Name="Narrow"> | ||
<VisualState.StateTriggers> | ||
<CompareStateTrigger Property="{Binding IsChecked, Source={x:Reference CheckBox}}" Value="False" /> | ||
</VisualState.StateTriggers> | ||
<VisualState.Setters> | ||
<Setter Property="BackgroundColor" Value="Red" /> | ||
</VisualState.Setters> | ||
</VisualState> | ||
</VisualStateGroup> | ||
</VisualStateGroupList> | ||
</Setter> | ||
</Style> | ||
|
||
</ResourceDictionary> | ||
</ContentPage.Resources> | ||
<ContentPage.Content> | ||
<Grid | ||
Style="{StaticResource CompareStateTriggerGridStyle}"> | ||
<Frame | ||
HorizontalOptions="Center" | ||
VerticalOptions="Center" | ||
BackgroundColor="White" | ||
CornerRadius="12" | ||
Margin="24"> | ||
<StackLayout | ||
Orientation="Horizontal"> | ||
<CheckBox | ||
x:Name="CheckBox" | ||
VerticalOptions="Center"/> | ||
<Label | ||
Text="Checked/Uncheck the CheckBox to modify the Grid BackgroundColor" | ||
VerticalOptions="Center"/> | ||
</StackLayout> | ||
</Frame> | ||
</Grid> | ||
</ContentPage.Content> | ||
</ContentPage> |
10 changes: 10 additions & 0 deletions
10
...orms.Controls/GalleryPages/VisualStateManagerGalleries/CompareStateTriggerGallery.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace Xamarin.Forms.Controls.GalleryPages.VisualStateManagerGalleries | ||
{ | ||
public partial class CompareStateTriggerGallery : ContentPage | ||
{ | ||
public CompareStateTriggerGallery() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
...in.Forms.Controls/GalleryPages/VisualStateManagerGalleries/DeviceStateTriggerGallery.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ContentPage | ||
xmlns="http://xamarin.com/schemas/2014/forms" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
x:Class="Xamarin.Forms.Controls.GalleryPages.VisualStateManagerGalleries.DeviceStateTriggerGallery" | ||
Title="DeviceStateTrigger"> | ||
<ContentPage.Resources> | ||
<ResourceDictionary> | ||
|
||
<Style x:Key="DeviceStateTriggerGridStyle" TargetType="Grid"> | ||
<Setter Property="VisualStateManager.VisualStateGroups"> | ||
<VisualStateGroupList> | ||
<VisualStateGroup> | ||
<VisualState | ||
x:Name="Android"> | ||
<VisualState.StateTriggers> | ||
<DeviceStateTrigger Device="Android" /> | ||
</VisualState.StateTriggers> | ||
<VisualState.Setters> | ||
<Setter Property="BackgroundColor" Value="Blue" /> | ||
</VisualState.Setters> | ||
</VisualState> | ||
<VisualState | ||
x:Name="iOS"> | ||
<VisualState.StateTriggers> | ||
<DeviceStateTrigger Device="iOS" /> | ||
</VisualState.StateTriggers> | ||
<VisualState.Setters> | ||
<Setter Property="BackgroundColor" Value="Red" /> | ||
</VisualState.Setters> | ||
</VisualState> | ||
<VisualState | ||
x:Name="UWP"> | ||
<VisualState.StateTriggers> | ||
<DeviceStateTrigger Device="UWP" /> | ||
</VisualState.StateTriggers> | ||
<VisualState.Setters> | ||
<Setter Property="BackgroundColor" Value="Green" /> | ||
</VisualState.Setters> | ||
</VisualState> | ||
</VisualStateGroup> | ||
</VisualStateGroupList> | ||
</Setter> | ||
</Style> | ||
|
||
</ResourceDictionary> | ||
</ContentPage.Resources> | ||
<ContentPage.Content> | ||
<Grid | ||
Style="{StaticResource DeviceStateTriggerGridStyle}"> | ||
<Label | ||
Text="This page changes the color based on the device where the App is running." | ||
HorizontalOptions="Center" | ||
VerticalOptions="Center"/> | ||
</Grid> | ||
</ContentPage.Content> | ||
</ContentPage> |
10 changes: 10 additions & 0 deletions
10
...Forms.Controls/GalleryPages/VisualStateManagerGalleries/DeviceStateTriggerGallery.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace Xamarin.Forms.Controls.GalleryPages.VisualStateManagerGalleries | ||
{ | ||
public partial class DeviceStateTriggerGallery : ContentPage | ||
{ | ||
public DeviceStateTriggerGallery() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
...orms.Controls/GalleryPages/VisualStateManagerGalleries/DualScreenStateTriggerGallery.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ContentPage | ||
xmlns="http://xamarin.com/schemas/2014/forms" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
x:Class="Xamarin.Forms.Controls.GalleryPages.VisualStateManagerGalleries.DualScreenStateTriggerGallery" | ||
xmlns:dualScreen="clr-namespace:Xamarin.Forms.DualScreen;assembly=Xamarin.Forms.DualScreen" | ||
Title="DualScreenStateTrigger Gallery"> | ||
<ContentPage.Content> | ||
<Grid> | ||
<VisualStateManager.VisualStateGroups> | ||
<VisualStateGroup> | ||
<VisualState x:Name="NotSpanned"> | ||
<VisualState.StateTriggers> | ||
<dualScreen:SpanModeStateTrigger SpanMode="SinglePane"/> | ||
</VisualState.StateTriggers> | ||
<VisualState.Setters> | ||
<Setter Property="BackgroundColor" Value="Red" /> | ||
</VisualState.Setters> | ||
</VisualState> | ||
<VisualState x:Name="Spanned"> | ||
<VisualState.StateTriggers> | ||
<dualScreen:SpanModeStateTrigger SpanMode="Wide" /> | ||
</VisualState.StateTriggers> | ||
<VisualState.Setters> | ||
<Setter Property="BackgroundColor" Value="Green" /> | ||
</VisualState.Setters> | ||
</VisualState> | ||
</VisualStateGroup> | ||
</VisualStateManager.VisualStateGroups> | ||
</Grid> | ||
</ContentPage.Content> | ||
</ContentPage> |
10 changes: 10 additions & 0 deletions
10
...s.Controls/GalleryPages/VisualStateManagerGalleries/DualScreenStateTriggerGallery.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace Xamarin.Forms.Controls.GalleryPages.VisualStateManagerGalleries | ||
{ | ||
public partial class DualScreenStateTriggerGallery : ContentPage | ||
{ | ||
public DualScreenStateTriggerGallery() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} | ||
} |
Oops, something went wrong.