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
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.
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.
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.
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.
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public override string ToString()
new GalleryPageFactory(() => new ListViewCoreGalleryPage(), "ListView Gallery"),
new GalleryPageFactory(() => new PickerCoreGalleryPage(), "Picker Gallery"),
new GalleryPageFactory(() => new ProgressBarCoreGalleryPage(), "Progress Bar Gallery"),
new GalleryPageFactory(() => new RadioButtonControlPage(), "RadioButton Feature Matrix"),
new GalleryPageFactory(() => new RadioButtonCoreGalleryPage(), "RadioButton Gallery"),
new GalleryPageFactory(() => new ScrollViewCoreGalleryPage(), "ScrollView Gallery"),
new GalleryPageFactory(() => new SearchBarCoreGalleryPage(), "Search Bar Gallery"),
Expand All @@ -79,7 +80,6 @@ public override string ToString()
new GalleryPageFactory(() => new SliderControlPage(), "Slider Feature Matrix"),
new GalleryPageFactory(() => new CollectionViewFeaturePage(), "CollectionView Feature Matrix"),
new GalleryPageFactory(() => new CarouselViewFeaturePage(), "CarouselView Feature Matrix"),

};

public CorePageView(Page rootPage)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:Maui.Controls.Sample"
x:Class="Maui.Controls.Sample.RadioButtonControlMainPage"
x:DataType="local:RadioButtonViewModel"
Title="RadioButtonFeature">

<ContentPage.ToolbarItems>
<ToolbarItem Text="Options"
Clicked="NavigateToOptionsPage_Clicked"
AutomationId="Options"/>
</ContentPage.ToolbarItems>

<Grid Padding="20"
RowDefinitions="*, Auto, Auto, Auto, Auto"
ColumnDefinitions="0.5*, 0.5*"
RowSpacing="10">

<!-- RadioButton Control -->

<VerticalStackLayout HorizontalOptions="Center"
Grid.ColumnSpan="2"
Grid.Row="0"
Grid.Column="0">
<Label Text="Theme Preferences"/>
<VerticalStackLayout RadioButtonGroup.SelectedValue="{Binding SelectedValue}"
RadioButtonGroup.GroupName="{Binding GroupName}">
<RadioButton CheckedChanged="RadioButton_CheckedChanged"
Content="{Binding Content}"
IsChecked="{Binding IsChecked}"
IsVisible="{Binding IsVisible}"
IsEnabled="{Binding IsEnabled}"
GroupName="{Binding GroupName}"
Value="One"
BorderColor="{Binding BorderColor}"
BorderWidth="{Binding BorderWidth}"
CharacterSpacing="{Binding CharacterSpacing}"
CornerRadius="{Binding CornerRadius}"
FlowDirection="{Binding FlowDirection}"
FontAttributes="{Binding FontAttributes}"
FontAutoScalingEnabled="{Binding FontAutoScalingEnabled}"
FontFamily="{Binding FontFamily}"
FontSize="{Binding FontSize}"
TextColor="{Binding TextColor}"
TextTransform="{Binding TextTransform}"
Margin="10"
VerticalOptions="Center"
AutomationId="RadioButtonControlOne"/>

<RadioButton x:Name="RadioButtonControlTwo"
CheckedChanged="RadioButton_CheckedChanged"
Content="Light Mode"
GroupName="{Binding GroupName}"
IsEnabled="{Binding IsEnabled}"
Margin="10"
Value="Two"
VerticalOptions="Center"
AutomationId="RadioButtonControlTwo"/>

<RadioButton x:Name="RadioButtonControlThree"
Content="System Default"
GroupName="{Binding GroupName}"
CheckedChanged="RadioButton_CheckedChanged"
IsEnabled="{Binding IsEnabled}"
Margin="10"
Value="Three"
VerticalOptions="Center"
AutomationId="RadioButtonControlThree"/>
</VerticalStackLayout>

<Label Text="Notification Settings"/>
<VerticalStackLayout>
<RadioButton x:Name="RadioButtonControlFour"
Content="All Notifications"
GroupName="Notification"
CheckedChanged="RadioButton_CheckedChanged"
Margin="10"
VerticalOptions="Center"
AutomationId="RadioButtonControlFour"/>

<RadioButton x:Name="RadioButtonControlFive"
Content="Important Only"
GroupName="Notification"
Margin="10"
CheckedChanged="RadioButton_CheckedChanged"
VerticalOptions="Center"
AutomationId="RadioButtonControlFive"/>
</VerticalStackLayout>
</VerticalStackLayout>

<Label Grid.Row="3"
Grid.Column="0"
Text="Selected Theme:"
FontSize="16"
VerticalTextAlignment="Start"
HorizontalTextAlignment="Start"
Margin="0,0,10,10"/>
<Label Grid.Row="3"
Grid.Column="1"
x:Name="SelectedValueLabelOne"
FontSize="16"
AutomationId="SelectedValueLabelOne"/>

<Label Grid.Row="4"
Grid.Column="0"
Text="Selected Notification Level:"
FontSize="16"
VerticalTextAlignment="Start"
HorizontalTextAlignment="Start"
Margin="0,0,10,10"/>
<Label Grid.Row="4"
Grid.Column="1"
x:Name="SelectedValueLabelTwo"
FontSize="16"
AutomationId="SelectedValueLabelTwo"/>
</Grid>
</ContentPage>
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using System;
using Microsoft.Maui.Controls;

namespace Maui.Controls.Sample;

public class RadioButtonControlPage : NavigationPage
{
public RadioButtonControlPage()
{
PushAsync(new RadioButtonControlMainPage());
}
}

public partial class RadioButtonControlMainPage : ContentPage
{
private RadioButtonViewModel _viewModel;

public RadioButtonControlMainPage()
{
InitializeComponent();
_viewModel = new RadioButtonViewModel();
BindingContext = _viewModel;
}

private async void NavigateToOptionsPage_Clicked(object sender, EventArgs e)
{
BindingContext = _viewModel = new RadioButtonViewModel();
RadioButtonControlTwo.IsChecked = false;
RadioButtonControlThree.IsChecked = false;
RadioButtonControlFour.IsChecked = false;
RadioButtonControlFive.IsChecked = false;
SelectedValueLabelOne.Text = string.Empty;
SelectedValueLabelTwo.Text = string.Empty;
await Navigation.PushAsync(new RadioButtonOptionsPage(_viewModel));
}

private void RadioButton_CheckedChanged(object sender, CheckedChangedEventArgs e)
{
if (e.Value)
{
var radioButton = sender as RadioButton;
if (radioButton != null && radioButton.GroupName == "Theme")
{
SelectedValueLabelOne.Text = radioButton.Content.ToString();
}
else
{
SelectedValueLabelTwo.Text = radioButton.Content.ToString();
}
}
}
}
Loading
Loading