using System.Windows;
using System.ComponentModel;
using System.Windows.Controls;
using System.Collections.Specialized;
namespace CustomUI
{
///
/// 分段按钮控件,类似IOS的SegmentControl
///
/// add by zhidf 2017.7.9
public class SegmentControl : ListBox
{
#region private fields
#endregion
#region DependencyProperty
#region CornerRadius
///
/// 获取或者设置空间的边框圆角
///
[Bindable(true), Description("获取或者设置空间的边框圆角")]
public CornerRadius CornerRadius
{
get { return (CornerRadius)GetValue(CornerRadiusProperty); }
set { SetValue(CornerRadiusProperty, value); }
}
public static readonly DependencyProperty CornerRadiusProperty =
DependencyProperty.Register("CornerRadius", typeof(CornerRadius), typeof(SegmentControl));
#endregion
#region IsAllRound
///
/// 获取或者设置SegmentItem的四周的圆角是否与SegmentControl一致
///
[Bindable(true), Description("获取或者设置SegmentItem的四周的圆角是否与SegmentControl一致")]
public bool IsAllRound
{
get { return (bool)GetValue(IsAllRoundProperty); }
set { SetValue(IsAllRoundProperty, value); }
}
public static readonly DependencyProperty IsAllRoundProperty =
DependencyProperty.Register("IsAllRound", typeof(bool), typeof(SegmentControl), new PropertyMetadata(false));
#endregion
#endregion
#region 路由事件
#region ItemClickEvent
public static readonly RoutedEvent ItemClickEvent = EventManager.RegisterRoutedEvent("ItemClick",
RoutingStrategy.Bubble, typeof(RoutedPropertyChangedEventHandler