123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- using PDF_Master.CustomControl;
- using PDF_Master.ViewModels.Form;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Navigation;
- using System.Windows.Shapes;
- namespace PDF_Master.Views.Form
- {
- /// <summary>
- /// ButtonProperty.xaml 的交互逻辑
- /// </summary>
- public partial class ButtonProperty : UserControl
- {
- public ButtonPropertyViewModel ViewModel => DataContext as ButtonPropertyViewModel;
- public ButtonProperty()
- {
- InitializeComponent();
- this.Loaded += usercontrol_Loaded;
- BindingEvent();
- }
- private void usercontrol_Loaded(object sender, RoutedEventArgs e)
- {
- BindingEvent();
- }
- private void BindingEvent()
- {
- if (ViewModel != null)
- {
- ViewModel.SelectResetColorBtnHandler -= ViewModel_SelectResetColorBtnHandler;
- ViewModel.SelectResetColorBtnHandler += ViewModel_SelectResetColorBtnHandler;
- }
- }
- private void ViewModel_SelectResetColorBtnHandler(object sender, int e)
- {
- switch (e)
- {
- case 0:
- OneBtn.IsChecked = false;
- TwoBtn.IsChecked = false;
- ThreeBtn.IsChecked = false;
- ForthBtn.IsChecked = false;
- break;
- case 1:
- OneBtn.IsChecked = true;
- break;
- case 2:
- TwoBtn.IsChecked = true;
- break;
- case 3:
- ThreeBtn.IsChecked = true;
- break;
- case 4:
- ForthBtn.IsChecked = true;
- break;
- }
- }
- private void EditMenuItem_Click(object sender, RoutedEventArgs e)
- {
- var Btnitem = sender as MenuItem;
- if (Btnitem == null) return;
- if (ViewModel != null)
- {
- // ViewModel.ResetColorCommand?.Execute(Btnitem);
- }
- }
- private void BtnLineStyle_Click(object sender, RoutedEventArgs e)
- {
- var btn = sender as CustomIconToggleBtn;
- foreach (var item in PnlLineStyle.Children)
- {
- var btnItem = item as CustomIconToggleBtn;
- if (btnItem != null)
- {
- if (btn != btnItem)
- btnItem.IsChecked = false;
- else
- btnItem.IsChecked = true;
- }
- }
- }
- }
- }
|