WPF 利用附加属性 形成按钮中可选择的目录翻页

就是在按钮中可以加上 枚举的信息搜索


        public static PageEnum GetPage(DependencyObject obj)
        {
            return (PageEnum)obj.GetValue(PageProperty);
        }

        public static void SetPage(DependencyObject obj, PageEnum value)
        {
            obj.SetValue(PageProperty, value);
        }

        // Using a DependencyProperty as the backing store for Page.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty PageProperty =
            DependencyProperty.RegisterAttached("Page", typeof(PageEnum), typeof(PageHelper), new PropertyMetadata(PageEnum.None));

}

枚举

   public enum PageEnum
        {
            None,
            Home,
            Account_Manage,
            Account_InUse,
            Account_Regist,
            Account_UseLess,
            DocManage,
            OrderManage,
            StoreManage,
            TestManage,
            Orders_Temp,
            Orders_InUse
        }

调用

 xmlns:pagehelper="clr-namespace:命名空间"



     <StackPanel FlowDirection="RightToLeft"  HorizontalAlignment="Right" Height="41" Margin="347,20,0,0" VerticalAlignment="Top" Width="462" Orientation="Horizontal">
            <!--<RadioButton Click="ChangePage_Click"  Content="注册账户" pagehelper:PageHelper.Page="Account_Regist" Width="150" Height="40" Style="{StaticResource MenuRadioButtonStyle}" Margin="5,0.5,0,0.5"/>-->
            <RadioButton Click="ChangePage_Click"  Content="异常账户" pagehelper:PageHelper.Page="Account_UseLess" Width="150"  Height="40" Style="{StaticResource MenuRadioButtonStyle}" Margin="5,0,0,0"/>
            <RadioButton Click="ChangePage_Click"  Content="正常账户" pagehelper:PageHelper.Page="Account_InUse" IsChecked="True" Width="150" Height="40" Style="{StaticResource MenuRadioButtonStyle}"  Margin="5,0,0,0"/>
        </StackPanel>
  

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值