HomePagePrinterModSizeContent.xaml.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using PDF_Master.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter;
  2. using System.Windows.Controls;
  3. namespace PDF_Master.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.KeyDown += TextBox_Num_KeyDown;
  17. CustomRatioUpDown.Button_Add.Click += Button_Add_Click;
  18. CustomRatioUpDown.Button_Sub.Click += Button_Sub_Click;
  19. CustomRatioUpDown.TextBox_Num.Text = ((HomePagePrinterModSizeContentViewModel)this.DataContext).DisplayRatio;
  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. }