-
Notifications
You must be signed in to change notification settings - Fork 742
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(commandbar): Add support for native CommandBar.HorizontalContent…
…Alignment on Android. BREAKING CHANGE: Alignment of native CommandBar.Content used to be `Stretch`/`Stretch` and is now aligned with `Top`/`Left` on UWP. Use `CommandBar.HorizontalContentAlignment` and first element of content's VerticalAlignment to control.
- Loading branch information
1 parent
a81896d
commit 5e6ca82
Showing
6 changed files
with
201 additions
and
15 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
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
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
105 changes: 105 additions & 0 deletions
105
...pp/UITests.Shared/Windows_UI_Xaml_Controls/CommandBar/CommandBar_Native_With_TextBox.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,105 @@ | ||
<Page x:Class="UITests.Windows_UI_Xaml_Controls.CommandBar.CommandBar_Native_With_TextBox" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:android="http://uno.ui/android" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="using:UITests.Windows_UI_Xaml_Controls.CommandBar" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
mc:Ignorable="d android" | ||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> | ||
|
||
<Page.Resources> | ||
<android:Style x:Key="MyNativeDefaultCommandBar" | ||
TargetType="CommandBar"> | ||
<Setter Property="Background" | ||
Value="{x:Null}" /> | ||
<Setter Property="Foreground" | ||
Value="{x:Null}" /> | ||
<Setter Property="HorizontalAlignment" | ||
Value="Stretch" /> | ||
<Setter Property="VerticalAlignment" | ||
Value="Top" /> | ||
<Setter Property="Template"> | ||
<Setter.Value> | ||
<ControlTemplate TargetType="CommandBar"> | ||
<NativeCommandBarPresenter Height="44" /> | ||
</ControlTemplate> | ||
</Setter.Value> | ||
</Setter> | ||
</android:Style> | ||
|
||
<android:Style x:Key="CommandBarTypo" | ||
TargetType="TextBlock"> | ||
<Setter Property="FontWeight" | ||
Value="Bold" /> | ||
<Setter Property="Foreground" | ||
Value="Black" /> | ||
<Setter Property="TextTrimming" | ||
Value="CharacterEllipsis" /> | ||
<Setter Property="VerticalAlignment" | ||
Value="Center" /> | ||
</android:Style> | ||
</Page.Resources> | ||
|
||
<Grid> | ||
<StackPanel Margin="0,150,0,0"> | ||
<ComboBox x:Name="verticalValue" | ||
Header="Vertical Alignment" | ||
SelectedItem="Top"> | ||
<x:String>Top</x:String> | ||
<x:String>Bottom</x:String> | ||
<x:String>Center</x:String> | ||
<x:String>Stretch</x:String> | ||
</ComboBox> | ||
<ComboBox x:Name="horizontalValue" | ||
Header="Horizontal Alignment" | ||
SelectedItem="Left"> | ||
<x:String>Left</x:String> | ||
<x:String>Right</x:String> | ||
<x:String>Center</x:String> | ||
<x:String>Stretch</x:String> | ||
</ComboBox> | ||
<TextBlock> | ||
<Run Text="v:" /> | ||
<Run Text="{x:Bind MyCommandBar.VerticalContentAlignment, Mode=OneWay}" /> | ||
<Run Text="h:" /> | ||
<Run Text="{x:Bind MyCommandBar.HorizontalContentAlignment, Mode=OneWay}" /> | ||
</TextBlock> | ||
</StackPanel> | ||
<StackPanel> | ||
<CommandBar x:Name="MyCommandBar" | ||
IsDynamicOverflowEnabled="False" | ||
android:Style="{StaticResource MyNativeDefaultCommandBar}" | ||
VerticalContentAlignment="{Binding SelectedItem, ElementName=verticalValue, Mode=TwoWay}" | ||
HorizontalContentAlignment="{Binding SelectedItem, ElementName=horizontalValue, Mode=TwoWay}" | ||
Background="Gray"> | ||
<CommandBar.Content> | ||
<TextBox Text="Hello Title 2 !" | ||
Foreground="Black" | ||
x:Name="InnerTextBox" /> | ||
</CommandBar.Content> | ||
<CommandBar.PrimaryCommands> | ||
<AppBarButton Content="Hello"> | ||
</AppBarButton> | ||
</CommandBar.PrimaryCommands> | ||
</CommandBar> | ||
<CommandBar x:Name="TextBlockCommandBar" | ||
IsDynamicOverflowEnabled="False" | ||
android:Style="{StaticResource MyNativeDefaultCommandBar}" | ||
VerticalContentAlignment="{Binding SelectedItem, ElementName=verticalValue, Mode=TwoWay}" | ||
HorizontalContentAlignment="{Binding SelectedItem, ElementName=horizontalValue, Mode=TwoWay}" | ||
Background="Gray"> | ||
<CommandBar.Content> | ||
<TextBlock Text="Hello Title 2 !" | ||
Foreground="Black" | ||
VerticalAlignment="Center" | ||
x:Name="InnerTextBlock" /> | ||
</CommandBar.Content> | ||
<CommandBar.PrimaryCommands> | ||
<AppBarButton Content="Hello"> | ||
</AppBarButton> | ||
</CommandBar.PrimaryCommands> | ||
</CommandBar> | ||
</StackPanel> | ||
</Grid> | ||
</Page> |
32 changes: 32 additions & 0 deletions
32
...UITests.Shared/Windows_UI_Xaml_Controls/CommandBar/CommandBar_Native_With_TextBox.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,32 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Runtime.InteropServices.WindowsRuntime; | ||
using Uno.UI.Samples.Controls; | ||
using Windows.Foundation; | ||
using Windows.Foundation.Collections; | ||
using Windows.UI.Xaml; | ||
using Windows.UI.Xaml.Controls; | ||
using Windows.UI.Xaml.Controls.Primitives; | ||
using Windows.UI.Xaml.Data; | ||
using Windows.UI.Xaml.Input; | ||
using Windows.UI.Xaml.Media; | ||
using Windows.UI.Xaml.Navigation; | ||
|
||
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238 | ||
|
||
namespace UITests.Windows_UI_Xaml_Controls.CommandBar | ||
{ | ||
/// <summary> | ||
/// An empty page that can be used on its own or navigated to within a Frame. | ||
/// </summary> | ||
[SampleControlInfo("CommandBar")] | ||
public sealed partial class CommandBar_Native_With_TextBox : Page | ||
{ | ||
public CommandBar_Native_With_TextBox() | ||
{ | ||
this.InitializeComponent(); | ||
} | ||
} | ||
} |
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