using PDF_Office.CustomControl; using PDF_Office.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_Office.Views.Form { /// /// SignProperty.xaml 的交互逻辑 /// public partial class SignProperty : UserControl { public SignPropertyViewModel ViewModel => DataContext as SignPropertyViewModel; public SignProperty() { 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; } } } } }