HomePagePrinterModSizeContent.xaml.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter;
  2. using System.Windows.Controls;
  3. namespace PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePagePrinter
  4. {
  5. /// <summary>
  6. /// Interaction logic for HomePagePrinterModSizeContent
  7. /// </summary>
  8. public partial class HomePagePrinterModSizeContent : UserControl
  9. {
  10. public HomePagePrinterModSizeContent()
  11. {
  12. InitializeComponent();
  13. }
  14. private void CustomRatioUpDown_Loaded(object sender, System.Windows.RoutedEventArgs e)
  15. {
  16. CustomRatioUpDown.TextBox_Num.Text = ((HomePagePrinterModSizeContentViewModel)this.DataContext).DisplayRatio;
  17. CustomRatioUpDown.TextBox_Num.KeyDown += TextBox_Num_KeyDown;
  18. CustomRatioUpDown.Button_Add.Click += Button_Add_Click;
  19. CustomRatioUpDown.Button_Sub.Click += Button_Sub_Click;
  20. }
  21. private void Button_Sub_Click(object sender, System.Windows.RoutedEventArgs e)
  22. {
  23. ((HomePagePrinterModSizeContentViewModel)this.DataContext).SetDisplayRatioCommand.Execute();
  24. }
  25. private void Button_Add_Click(object sender, System.Windows.RoutedEventArgs e)
  26. {
  27. ((HomePagePrinterModSizeContentViewModel)this.DataContext).SetDisplayRatioCommand.Execute();
  28. }
  29. private void TextBox_Num_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
  30. {
  31. if(e.Key == System.Windows.Input.Key.Enter)
  32. {
  33. ((HomePagePrinterModSizeContentViewModel)this.DataContext).SetDisplayRatioCommand.Execute();
  34. }
  35. }
  36. }
  37. }