Skip to content

Commit

Permalink
Add CirclePanel Sample
Browse files Browse the repository at this point in the history
  • Loading branch information
ghost1372 committed Dec 21, 2024
1 parent 4cc1cac commit 4eb7d51
Show file tree
Hide file tree
Showing 7 changed files with 10,174 additions and 6,271 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,9 @@ Install-Package DevWinUI.ContextMenu
### Clock
![DevWinUI](https://raw.githubusercontent.com/ghost1372/DevWinUI-Resources/refs/heads/main/DevWinUI-Docs/Clock.gif)

### CirclePanel
![DevWinUI](https://raw.githubusercontent.com/ghost1372/DevWinUI-Resources/refs/heads/main/DevWinUI-Docs/CirclePanel.gif)

### ProgressButton
![DevWinUI](https://raw.githubusercontent.com/ghost1372/DevWinUI-Resources/refs/heads/main/DevWinUI-Docs/ProgressButton.gif)

Expand Down
16,281 changes: 10,010 additions & 6,271 deletions dev/DevWinUI.Controls/Themes/Generic.xaml

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions dev/DevWinUI.Gallery/Assets/NavViewMenu/AppData.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,13 @@
"ImagePath": "ms-appx:///Assets/Fluent/RatingControl.png",
"IsSpecialSection": false,
"Items": [
{
"UniqueId": "DevWinUIGallery.Views.CirclePanelPage",
"Title": "CirclePanel",
"Subtitle": "CirclePanel",
"IsNew": true,
"ImagePath": "ms-appx:///Assets/Fluent/RadioButton.png"
},
{
"UniqueId": "DevWinUIGallery.Views.ClockPage",
"Title": "Clock",
Expand Down
1 change: 1 addition & 0 deletions dev/DevWinUI.Gallery/T4Templates/NavigationPageMappings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public partial class NavigationPageMappings
{"DevWinUIGallery.Views.WaveCirclePage", typeof(DevWinUIGallery.Views.WaveCirclePage)},
{"DevWinUIGallery.Views.BubblePage", typeof(DevWinUIGallery.Views.BubblePage)},
{"DevWinUIGallery.Views.GooeyPage", typeof(DevWinUIGallery.Views.GooeyPage)},
{"DevWinUIGallery.Views.CirclePanelPage", typeof(DevWinUIGallery.Views.CirclePanelPage)},
{"DevWinUIGallery.Views.ClockPage", typeof(DevWinUIGallery.Views.ClockPage)},
{"DevWinUIGallery.Views.DateTimePickerPage", typeof(DevWinUIGallery.Views.DateTimePickerPage)},
{"DevWinUIGallery.Views.CalendarWithClockPage", typeof(DevWinUIGallery.Views.CalendarWithClockPage)},
Expand Down
96 changes: 96 additions & 0 deletions dev/DevWinUI.Gallery/Views/Pages/Features/CirclePanelPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<?xml version="1.0" encoding="utf-8" ?>
<Page x:Class="DevWinUIGallery.Views.CirclePanelPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:dev="using:DevWinUI"
xmlns:local="using:DevWinUIGallery"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">

<ScrollViewer>
<StackPanel Margin="10"
dev:PanelAttach.ChildrenTransitions="Default"
Spacing="10">
<local:ControlExample DocPage="controls/circlePanel"
HeaderText="CirclePanel">
<local:ControlExample.Xaml>
<x:String>&lt;dev:CirclePanel /&gt;</x:String>
</local:ControlExample.Xaml>
<local:ControlExample.Pane>
<StackPanel Spacing="10">
<ToggleSwitch x:Name="TGKeepVertical"
Header="KeepVertical"
IsOn="True"
Toggled="TGKeepVertical_Toggled" />
<NumberBox x:Name="NBDiameter"
Header="Diameter"
Minimum="100"
SpinButtonPlacementMode="Inline"
ValueChanged="OnValueChanged"
Value="170" />
<NumberBox x:Name="NBOffset"
Header="OffsetAngle"
Minimum="0"
SpinButtonPlacementMode="Inline"
ValueChanged="OnValueChanged"
Value="0" />
</StackPanel>
</local:ControlExample.Pane>
<dev:CirclePanel x:Name="CirclePanelSample"
Diameter="{x:Bind NBDiameter.Value, Mode=OneWay}"
KeepVertical="{x:Bind TGKeepVertical.IsOn, Mode=OneWay}"
OffsetAngle="{x:Bind NBOffset.Value, Mode=OneWay}">
<dev:ClockRadioButton Content="3" />
<dev:ClockRadioButton Content="4" />
<dev:ClockRadioButton Content="5" />
<dev:ClockRadioButton Content="6" />
<dev:ClockRadioButton Content="7" />
<dev:ClockRadioButton Content="8" />
<dev:ClockRadioButton Content="9" />
<dev:ClockRadioButton Content="10" />
<dev:ClockRadioButton Content="11" />
<dev:ClockRadioButton Content="12" />
<dev:ClockRadioButton Content="1" />
<dev:ClockRadioButton Content="2" />
</dev:CirclePanel>
</local:ControlExample>
<local:ControlExample DocPage="controls/circlePanel"
HeaderText="CirclePanel">
<local:ControlExample.Xaml>
<x:String>&lt;dev:CirclePanel /&gt;</x:String>
</local:ControlExample.Xaml>
<local:ControlExample.Pane>
<StackPanel Spacing="10">
<ToggleSwitch x:Name="TGKeepVertical2"
Header="KeepVertical"
IsOn="True"
Toggled="TGKeepVertical2_Toggled" />
<NumberBox x:Name="NBDiameter2"
Header="Diameter"
Minimum="100"
SpinButtonPlacementMode="Inline"
ValueChanged="OnValueChanged2"
Value="170" />
<NumberBox x:Name="NBOffset2"
Header="OffsetAngle"
Minimum="0"
SpinButtonPlacementMode="Inline"
ValueChanged="OnValueChanged2"
Value="0" />
<Button x:Name="BtnAdd"
Click="BtnAdd_Click"
Content="Add Item" />
<Button x:Name="BtnRemove"
Click="BtnRemove_Click"
Content="Remove Item" />
</StackPanel>
</local:ControlExample.Pane>
<dev:CirclePanel x:Name="CirclePanelSample2"
Diameter="{x:Bind NBDiameter2.Value, Mode=OneWay}"
KeepVertical="{x:Bind TGKeepVertical2.IsOn, Mode=OneWay}"
OffsetAngle="{x:Bind NBOffset2.Value, Mode=OneWay}" />
</local:ControlExample>
</StackPanel>
</ScrollViewer>
</Page>
57 changes: 57 additions & 0 deletions dev/DevWinUI.Gallery/Views/Pages/Features/CirclePanelPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
namespace DevWinUIGallery.Views;

public sealed partial class CirclePanelPage : Page
{
private int currentIndex = 0;
public CirclePanelPage()
{
this.InitializeComponent();
}

private void BtnAdd_Click(object sender, RoutedEventArgs e)
{
currentIndex += 1;
CirclePanelSample2.Children.Add(new ClockRadioButton { Content = $"{currentIndex}" });
}

private void BtnRemove_Click(object sender, RoutedEventArgs e)
{
var item = CirclePanelSample2.Children.LastOrDefault();
if (item != null)
{
CirclePanelSample2.Children.Remove(item);
currentIndex -= 1;
}
}

private void TGKeepVertical_Toggled(object sender, RoutedEventArgs e)
{
UpdateCirclePanelSampleTemplate();
}

private void OnValueChanged(NumberBox sender, NumberBoxValueChangedEventArgs args)
{
UpdateCirclePanelSampleTemplate();
}

private void UpdateCirclePanelSampleTemplate()
{
CirclePanelSample?.InvalidateArrange();
CirclePanelSample?.InvalidateMeasure();
}
private void UpdateCirclePanelSample2Template()
{
CirclePanelSample2?.InvalidateArrange();
CirclePanelSample2?.InvalidateMeasure();
}

private void TGKeepVertical2_Toggled(object sender, RoutedEventArgs e)
{
UpdateCirclePanelSample2Template();
}

private void OnValueChanged2(NumberBox sender, NumberBoxValueChangedEventArgs args)
{
UpdateCirclePanelSample2Template();
}
}

0 comments on commit 4eb7d51

Please sign in to comment.