Skip to content

Commit

Permalink
Renamed RingSegment to CircleSegment
Browse files Browse the repository at this point in the history
  • Loading branch information
XamlBrewer committed Nov 6, 2018
1 parent 19f9937 commit 62d0fe2
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 46 deletions.
Binary file modified Assets/ArcSegment.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/CircleSegment.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Assets/Composition.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/Gallery.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed Assets/RingSegment.png
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,25 @@

namespace XamlBrewer.Uwp.Controls
{
public class RingSegment : CompositionPathHost
public class CircleSegment : CompositionPathHost
{
public static readonly DependencyProperty CenterPointXProperty =
DependencyProperty.Register(nameof(CenterPointX), typeof(double), typeof(RingSegment), new PropertyMetadata(0d, Render));
DependencyProperty.Register(nameof(CenterPointX), typeof(double), typeof(CircleSegment), new PropertyMetadata(0d, Render));

public static readonly DependencyProperty CenterPointYProperty =
DependencyProperty.Register(nameof(CenterPointY), typeof(double), typeof(RingSegment), new PropertyMetadata(0d, Render));
DependencyProperty.Register(nameof(CenterPointY), typeof(double), typeof(CircleSegment), new PropertyMetadata(0d, Render));

public static readonly DependencyProperty RadiusProperty =
DependencyProperty.Register(nameof(Radius), typeof(double), typeof(RingSegment), new PropertyMetadata(0d, Render));
DependencyProperty.Register(nameof(Radius), typeof(double), typeof(CircleSegment), new PropertyMetadata(0d, Render));

public static readonly DependencyProperty StartAngleProperty =
DependencyProperty.Register(nameof(StartAngle), typeof(double), typeof(RingSegment), new PropertyMetadata(0d, Render));
DependencyProperty.Register(nameof(StartAngle), typeof(double), typeof(CircleSegment), new PropertyMetadata(0d, Render));

public static readonly DependencyProperty SweepAngleProperty =
DependencyProperty.Register(nameof(SweepAngle), typeof(double), typeof(RingSegment), new PropertyMetadata(0d, Render));
DependencyProperty.Register(nameof(SweepAngle), typeof(double), typeof(CircleSegment), new PropertyMetadata(0d, Render));

public static readonly DependencyProperty IsPieProperty =
DependencyProperty.Register(nameof(IsPie), typeof(bool), typeof(RingSegment), new PropertyMetadata(false, Render));
DependencyProperty.Register(nameof(IsPie), typeof(bool), typeof(CircleSegment), new PropertyMetadata(false, Render));

private const double Degrees2Radians = Math.PI / 180;

Expand Down Expand Up @@ -65,23 +65,23 @@ public bool IsPie
set { SetValue(IsPieProperty, value); }
}

public RingSegment()
public CircleSegment()
{
this.InitializeComponent();

Loaded += RingSegment_Loaded;
Unloaded += RingSegment_Unloaded;
Loaded += CircleSegment_Loaded;
Unloaded += CircleSegment_Unloaded;
}

private void RingSegment_Loaded(object sender, RoutedEventArgs e)
private void CircleSegment_Loaded(object sender, RoutedEventArgs e)
{
Render(this, null);
}

private void RingSegment_Unloaded(object sender, RoutedEventArgs e)
private void CircleSegment_Unloaded(object sender, RoutedEventArgs e)
{
Loaded -= RingSegment_Loaded;
Unloaded -= RingSegment_Unloaded;
Loaded -= CircleSegment_Loaded;
Unloaded -= CircleSegment_Unloaded;
}

protected override void Render()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,25 @@ namespace XamlBrewer.Uwp.Controls
public abstract partial class CompositionPathHost : UserControl
{
public static readonly DependencyProperty StartPointXProperty =
DependencyProperty.Register(nameof(StartPointX), typeof(double), typeof(RingSegment), new PropertyMetadata(0d, new PropertyChangedCallback(Render)));
DependencyProperty.Register(nameof(StartPointX), typeof(double), typeof(CompositionPathHost), new PropertyMetadata(0d, new PropertyChangedCallback(Render)));

public static readonly DependencyProperty StartPointYProperty =
DependencyProperty.Register(nameof(StartPointY), typeof(double), typeof(RingSegment), new PropertyMetadata(0d, Render));
DependencyProperty.Register(nameof(StartPointY), typeof(double), typeof(CompositionPathHost), new PropertyMetadata(0d, Render));

public static readonly DependencyProperty StrokeThicknessProperty =
DependencyProperty.Register(nameof(StrokeThickness), typeof(double), typeof(RingSegment), new PropertyMetadata(1.0, Render));
DependencyProperty.Register(nameof(StrokeThickness), typeof(double), typeof(CompositionPathHost), new PropertyMetadata(1.0, Render));

public static readonly DependencyProperty StrokeProperty =
DependencyProperty.Register(nameof(Stroke), typeof(Color), typeof(RingSegment), new PropertyMetadata((Color)Application.Current.Resources["SystemAccentColor"], Render));
DependencyProperty.Register(nameof(Stroke), typeof(Color), typeof(CompositionPathHost), new PropertyMetadata((Color)Application.Current.Resources["SystemAccentColor"], Render));

public static readonly DependencyProperty FillProperty =
DependencyProperty.Register(nameof(Fill), typeof(Color), typeof(RingSegment), new PropertyMetadata(Colors.Transparent, Render));
DependencyProperty.Register(nameof(Fill), typeof(Color), typeof(CompositionPathHost), new PropertyMetadata(Colors.Transparent, Render));

public static readonly DependencyProperty IsClosedProperty =
DependencyProperty.Register(nameof(IsClosed), typeof(bool), typeof(RingSegment), new PropertyMetadata(false, Render));
DependencyProperty.Register(nameof(IsClosed), typeof(bool), typeof(CompositionPathHost), new PropertyMetadata(false, Render));

public static readonly DependencyProperty IsStrokeRoundedProperty =
DependencyProperty.Register(nameof(IsStrokeRounded), typeof(bool), typeof(RingSegment), new PropertyMetadata(false, Render));
DependencyProperty.Register(nameof(IsStrokeRounded), typeof(bool), typeof(CompositionPathHost), new PropertyMetadata(false, Render));

public double StartPointX
{
Expand Down
2 changes: 1 addition & 1 deletion XamlBrewer.Uwp.ArcPathSample/ViewModels/ShellViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public ShellViewModel()
Menu.Add(new MenuItem() { Glyph = Icon.GetIcon("HomeIcon"), Text = "Home", NavigationDestination = typeof(HomePage) });
Menu.Add(new MenuItem() { Glyph = Icon.GetIcon("TopLayerIcon"), Text = "XAML", NavigationDestination = typeof(ArcSegmentPage) });
Menu.Add(new MenuItem() { Glyph = Icon.GetIcon("MiddleLayerIcon"), Text = "Composition", NavigationDestination = typeof(Win2DPage) });
Menu.Add(new MenuItem() { Glyph = Icon.GetIcon("DonutIcon"), Text = "Ring Segment", NavigationDestination = typeof(CircleSegmentPage) });
Menu.Add(new MenuItem() { Glyph = Icon.GetIcon("DonutIcon"), Text = "Circle Segment", NavigationDestination = typeof(CircleSegmentPage) });
Menu.Add(new MenuItem() { Glyph = Icon.GetIcon("PacmanIcon"), Text = "Gallery", NavigationDestination = typeof(GalleryPage) });
Menu.Add(new MenuItem() { Glyph = Icon.GetIcon("SquaresIcon"), Text = "Squares", NavigationDestination = typeof(SquaresPage) });
SecondMenu.Add(new MenuItem() { Glyph = Icon.GetIcon("InfoIcon"), Text = "About", NavigationDestination = typeof(AboutPage) });
Expand Down
22 changes: 11 additions & 11 deletions XamlBrewer.Uwp.ArcPathSample/Views/CircleSegmentPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
Margin="6 0 0 0"
TextLineBounds="TrimToCapHeight"
FontFamily="Segoe UI">
<Run Text="Ring Segment Control" />
<Run Text="Circle Segment Control" />
</TextBlock>
<Path Data="{StaticResource DonutIcon}"
Fill="{StaticResource PageTitleBrush}"
Expand Down Expand Up @@ -61,7 +61,7 @@
<Grid Background="{StaticResource LighteningBrush}"
Height="400"
Width="400">
<controls:RingSegment x:Name="RingSegment"
<controls:CircleSegment x:Name="CircleSegment"
Radius="100"
IsPie="True"
CenterPointX="200"
Expand All @@ -74,38 +74,38 @@
<StackPanel VerticalAlignment="Top"
Grid.Column="1">
<Slider Header="Centerpoint X"
Value="{Binding CenterPointX, ElementName=RingSegment, Mode=TwoWay}"
Value="{Binding CenterPointX, ElementName=CircleSegment, Mode=TwoWay}"
Maximum="400" />
<Slider Header="Radius"
Value="{Binding Radius, ElementName=RingSegment, Mode=TwoWay}"
Value="{Binding Radius, ElementName=CircleSegment, Mode=TwoWay}"
Maximum="200"
FontFamily="Segoe UI" />
<Slider Header="Start angle"
Value="{Binding StartAngle, ElementName=RingSegment, Mode=TwoWay}"
Value="{Binding StartAngle, ElementName=CircleSegment, Mode=TwoWay}"
Maximum="360" />
<ToggleSwitch Header="Closed"
IsOn="{Binding IsClosed, ElementName=RingSegment, Mode=TwoWay}"
IsOn="{Binding IsClosed, ElementName=CircleSegment, Mode=TwoWay}"
OnContent="Yes"
OffContent="No" />
<ToggleSwitch Header="Rounded Stroke"
IsOn="{Binding IsStrokeRounded, ElementName=RingSegment, Mode=TwoWay}"
IsOn="{Binding IsStrokeRounded, ElementName=CircleSegment, Mode=TwoWay}"
OnContent="Yes"
OffContent="No" />
</StackPanel>
<StackPanel VerticalAlignment="Top"
Grid.Column="2">
<Slider Header="Centerpoint Y"
Value="{Binding CenterPointY, ElementName=RingSegment, Mode=TwoWay}"
Value="{Binding CenterPointY, ElementName=CircleSegment, Mode=TwoWay}"
Maximum="400" />
<Slider Header="Stroke Thickness"
Value="{Binding StrokeThickness, ElementName=RingSegment, Mode=TwoWay}"
Value="{Binding StrokeThickness, ElementName=CircleSegment, Mode=TwoWay}"
Maximum="40"
StepFrequency=".5" />
<Slider Header="Sweep angle"
Value="{Binding SweepAngle, ElementName=RingSegment, Mode=TwoWay}"
Value="{Binding SweepAngle, ElementName=CircleSegment, Mode=TwoWay}"
Maximum="360" />
<ToggleSwitch Header="Pie"
IsOn="{Binding IsPie, ElementName=RingSegment, Mode=TwoWay}"
IsOn="{Binding IsPie, ElementName=CircleSegment, Mode=TwoWay}"
OnContent="Yes"
OffContent="No" />
</StackPanel>
Expand Down
22 changes: 11 additions & 11 deletions XamlBrewer.Uwp.ArcPathSample/Views/GalleryPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,28 +68,28 @@
HorizontalTextAlignment="Center">Pie Chart</TextBlock>
</Grid>
<Grid Grid.Row="1">
<controls:RingSegment Radius="100"
<controls:CircleSegment Radius="100"
IsPie="True"
CenterPointX="150"
CenterPointY="150"
StartAngle="-45"
SweepAngle="90"
Fill="Maroon" />
<controls:RingSegment Radius="100"
<controls:CircleSegment Radius="100"
IsPie="True"
CenterPointX="130"
CenterPointY="150"
StartAngle="45"
SweepAngle="270"
Fill="Silver" />
<controls:RingSegment Radius="100"
<controls:CircleSegment Radius="100"
IsPie="True"
CenterPointX="130"
CenterPointY="150"
StartAngle="135"
SweepAngle="90"
Fill="Black" />
<controls:RingSegment Radius="100"
<controls:CircleSegment Radius="100"
IsPie="True"
CenterPointX="130"
CenterPointY="150"
Expand All @@ -105,14 +105,14 @@
</Grid>
<Grid Grid.Row="1"
Grid.Column="1">
<controls:RingSegment Radius="100"
<controls:CircleSegment Radius="100"
CenterPointX="150"
CenterPointY="150"
StrokeThickness="30"
IsStrokeRounded="True"
StartAngle="135"
SweepAngle="270" />
<controls:RingSegment Radius="100"
<controls:CircleSegment Radius="100"
CenterPointX="150"
CenterPointY="150"
StrokeThickness="28"
Expand All @@ -129,35 +129,35 @@
</Grid>
<Grid Grid.Row="1"
Grid.Column="2">
<controls:RingSegment Radius="70"
<controls:CircleSegment Radius="70"
CenterPointX="150"
CenterPointY="150"
Stroke="Maroon"
Fill="Maroon"
StrokeThickness="90"
StartAngle="0"
SweepAngle="120" />
<controls:RingSegment Radius="100"
<controls:CircleSegment Radius="100"
CenterPointX="150"
CenterPointY="150"
StrokeThickness="30"
StartAngle="120"
SweepAngle="120" />
<controls:RingSegment Radius="100"
<controls:CircleSegment Radius="100"
CenterPointX="150"
CenterPointY="150"
StrokeThickness="30"
Stroke="RoyalBlue"
StartAngle="240"
SweepAngle="120" />
<controls:RingSegment Radius="70"
<controls:CircleSegment Radius="70"
CenterPointX="150"
CenterPointY="150"
StrokeThickness="30"
Stroke="Silver"
StartAngle="120"
SweepAngle="180" />
<controls:RingSegment Radius="70"
<controls:CircleSegment Radius="70"
CenterPointX="150"
CenterPointY="150"
StrokeThickness="30"
Expand Down
2 changes: 1 addition & 1 deletion XamlBrewer.Uwp.ArcPathSample/Views/SquaresPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ private void SquareOfSquaresPage_Loaded(object sender, Windows.UI.Xaml.RoutedEve
var random = new Random((int)DateTime.Now.Ticks);
foreach (var square in Squares.Squares)
{
var segment = new RingSegment()
var segment = new CircleSegment()
{
Height = square.ActualHeight,
Width = square.ActualWidth,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
<Compile Include="Controls\EllipticalArc.xaml.cs">
<DependentUpon>EllipticalArc.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\RingSegment.cs" />
<Compile Include="Controls\CircleSegment.cs" />
<Compile Include="Controls\UIElementExtensions.cs" />
<Compile Include="Mvvm\BindableBase.cs" />
<Compile Include="Mvvm\DelegateCommand.cs" />
Expand Down

0 comments on commit 62d0fe2

Please sign in to comment.