csharpc-sharpdotnetxamlavaloniauicross-platformcross-platform-xamlavaloniaguimulti-platformuser-interfacedotnetcore
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.9 KiB
57 lines
1.9 KiB
using Avalonia.Controls;
|
|
using Avalonia.Interactivity;
|
|
using Avalonia.Media;
|
|
|
|
namespace ControlCatalog.Pages
|
|
{
|
|
public partial class DrawerPageRtlPage : UserControl
|
|
{
|
|
public DrawerPageRtlPage()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void OnRtlToggled(object? sender, RoutedEventArgs e)
|
|
{
|
|
if (DemoDrawer == null) return;
|
|
DemoDrawer.FlowDirection = RtlCheckBox.IsChecked == true
|
|
? FlowDirection.RightToLeft
|
|
: FlowDirection.LeftToRight;
|
|
}
|
|
|
|
private void OnPlacementChanged(object? sender, SelectionChangedEventArgs e)
|
|
{
|
|
if (DemoDrawer == null) return;
|
|
DemoDrawer.DrawerPlacement = PlacementCombo.SelectedIndex switch
|
|
{
|
|
0 => DrawerPlacement.Left,
|
|
1 => DrawerPlacement.Right,
|
|
_ => DrawerPlacement.Left
|
|
};
|
|
}
|
|
|
|
private void OnToggleDrawer(object? sender, RoutedEventArgs e)
|
|
{
|
|
if (DemoDrawer == null) return;
|
|
DemoDrawer.IsOpen = !DemoDrawer.IsOpen;
|
|
}
|
|
|
|
private void OnMenuItemClick(object? sender, RoutedEventArgs e)
|
|
{
|
|
if (sender is not Button button) return;
|
|
var item = button.Tag?.ToString() ?? "Home";
|
|
|
|
DetailTitleText.Text = item;
|
|
DetailDescriptionText.Text = item switch
|
|
{
|
|
"Home" => "Toggle RTL to see the drawer flip to the right edge.\nGestures are mirrored: drag from right edge to open, drag right to close.",
|
|
"Profile" => "View and edit your profile information here.",
|
|
"Messages" => "Your messages and notifications appear here.",
|
|
"Settings" => "Configure application preferences and options.",
|
|
_ => $"Content for {item}"
|
|
};
|
|
|
|
DemoDrawer.IsOpen = false;
|
|
}
|
|
}
|
|
}
|
|
|