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.
Templated RadioButtons and RadioButtonGroups (#11628)
* First stab at RadioButtonGroup attached property and Templated RadioButton * RadioButtonGroupController assigning group names * Added updates for RadioButtonGroupController on selection change * More galleries! * Content property propagation * Ignore renderers if using templated views on UWP * Apply text/font properties to Content * Make RadioButton template parts constants * Cache renderer availability lookup * Add TemplateView check to CreateRenderer on iOS * Handle Checked RadioButton GroupName changes * Update WPF renderer * Update macOS and Tizen renderers * Add more unit tests, make RB Value updates propagate to RBG * Remove Text property, updated examples; throw Exception when Content is not Text and non-Text Content is not supported * Prevent Content exceptions in demo pages * Colors -> Brushes * Add default ControlTemplate example * Set up flags for Core Gallery test pages * Switch Android back to ToString for Content * Back to ToString where necessary, and using the WrapperControl for UWP * Add comment for Content * Log a nice warning if folks try to use View as Content and it's not supported * Add experimental flags for drag and drop tests * Fix crashes due to missing brush experimental flag * Make control templates from styles work alongside default templates * Catch up on which flags are still a concern * Fix infinite loop in platform tests * Attempt to fix occasionaly GroupableItemsViewController disposed crash * Make webview visible so we can verify it loaded in UI test screen shots * Fix merge Co-authored-by: Rui Marinho <me@ruimarinho.net>
- Loading branch information
Showing
50 changed files
with
1,813 additions
and
674 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
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
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
88 changes: 88 additions & 0 deletions
88
Xamarin.Forms.Controls/GalleryPages/RadioButtonGalleries/ContentProperties.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,88 @@ | ||
<?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.RadioButtonGalleries.ContentProperties"> | ||
|
||
<ContentPage.Content> | ||
<StackLayout> | ||
<Label Text="Propagate standard Text properties to Content where applicable:"/> | ||
<Label FontSize="Small" Text="TextColor: Red, CharacterSpacing: 1.5, TextTransform: Lowercase, FontAttributes: Italic, FontSize: 14, FontFamily: BaskerVille"/> | ||
<RadioButton Content="Option A" GroupName="test" | ||
TextColor="Red" | ||
CharacterSpacing="1.5" | ||
TextTransform="Lowercase" | ||
FontAttributes="Italic" | ||
FontSize="14" | ||
FontFamily="Baskerville" | ||
/> | ||
<Label FontSize="Small" Text="TextColor: Blue, CharacterSpacing: 1, TextTransform: Uppercase, FontAttributes: Bold, FontSize: 18, FontFamily: Arial"/> | ||
<RadioButton Content="Option B" GroupName="test" | ||
TextColor="Blue" | ||
TextTransform="Uppercase" | ||
FontAttributes="Bold" | ||
FontSize="18" | ||
FontFamily="Arial" | ||
/> | ||
|
||
<Label FontSize="Small" Text="The RadioButton below has its content set to Button (which makes little sense, but this is just an example). Anyway, the Text and Font properties are applied to the Button."/> | ||
|
||
<RadioButton GroupName="test" | ||
TextColor="Green" | ||
TextTransform="Uppercase" | ||
FontAttributes="Bold" | ||
FontSize="12" | ||
FontFamily="Arial"> | ||
|
||
<RadioButton.Content> | ||
<Button Text="It's a button inside a button."></Button> | ||
</RadioButton.Content> | ||
|
||
</RadioButton> | ||
|
||
<Label FontSize="Small" Text="A Content View which already has these properties set/bound should ignore the RadioButton properties."/> | ||
|
||
<RadioButton GroupName="test" | ||
TextColor="Green" | ||
TextTransform="Uppercase" | ||
FontAttributes="Bold" | ||
FontSize="12" | ||
FontFamily="Arial"> | ||
|
||
<RadioButton.Content> | ||
|
||
<Label x:Name="MainLabel" Text="Properties already set." | ||
TextColor="Purple" | ||
TextTransform="Lowercase" | ||
FontSize="Micro" | ||
FontFamily="Baskerville" | ||
FontAttributes="Italic" /> | ||
|
||
|
||
</RadioButton.Content> | ||
|
||
</RadioButton> | ||
|
||
<RadioButton GroupName="test" | ||
TextColor="Green" | ||
TextTransform="Uppercase" | ||
FontAttributes="Bold" | ||
FontSize="12" | ||
FontFamily="Arial"> | ||
|
||
<RadioButton.Content> | ||
<Label Text="Properties already bound" | ||
BindingContext="{x:Reference MainLabel}" | ||
TextColor="{Binding TextColor}" | ||
TextTransform="{Binding TextTransform}" | ||
FontSize="{Binding FontSize}" | ||
FontFamily="{Binding FontFamily}" | ||
FontAttributes="{Binding FontAttributes}" /> | ||
</RadioButton.Content> | ||
|
||
</RadioButton> | ||
</StackLayout> | ||
</ContentPage.Content> | ||
</ContentPage> |
13 changes: 13 additions & 0 deletions
13
Xamarin.Forms.Controls/GalleryPages/RadioButtonGalleries/ContentProperties.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,13 @@ | ||
using Xamarin.Forms.Xaml; | ||
|
||
namespace Xamarin.Forms.Controls.GalleryPages.RadioButtonGalleries | ||
{ | ||
[XamlCompilation(XamlCompilationOptions.Compile)] | ||
public partial class ContentProperties : ContentPage | ||
{ | ||
public ContentProperties() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} | ||
} |
Oops, something went wrong.