123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- using PDF_Master.Helper;
- using PDF_Master.ViewModels.BOTA;
- 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.BOTA
- {
- /// <summary>
- /// BOTAContent.xaml 的交互逻辑
- /// </summary>
- public partial class BOTAContent : UserControl
- {
- public BOTAContent()
- {
- InitializeComponent();
- }
- private void IconAndTextTabItem_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
- {
- var item = sender as TabItem;
- if (item != null)
- {
- ///重复点击选中项时,收起侧边栏
- if (item.IsSelected)
- {
- (this.DataContext as BOTAContentViewModel).viewContentViewModel.OpenBOTA = false;
- item.IsSelected = false;
- }
- else
- {
- (this.DataContext as BOTAContentViewModel).viewContentViewModel.OpenBOTA = true;
- item.IsSelected = true;
- }
- e.Handled = true;
- }
- }
- private void MenuThumbnail_Unchecked(object sender, RoutedEventArgs e)
- {
- //取消勾选后,如果是将选中的tabitem隐藏了,需要收起侧边栏
- var menuitem = sender as MenuItem;
- switch (menuitem.Name)
- {
- case "MenuThumbnail":
- if(TabItemThumbnail.IsSelected)
- {
- (this.DataContext as BOTAContentViewModel).viewContentViewModel.OpenBOTA = false;
- }
- break;
- case "MenuOutLine":
- if (TabItemOutLine.IsSelected)
- {
- (this.DataContext as BOTAContentViewModel).viewContentViewModel.OpenBOTA = false;
- }
- break;
- case "MenuBookMark":
- if (TabItemBookMark.IsSelected)
- {
- (this.DataContext as BOTAContentViewModel).viewContentViewModel.OpenBOTA = false;
- }
- break;
- case "MenuAnnotation":
- if (TabItemAnnotation.IsSelected)
- {
- (this.DataContext as BOTAContentViewModel).viewContentViewModel.OpenBOTA = false;
- }
- break;
- case "MenuSearch":
- if (TabItemSearch.IsSelected)
- {
- (this.DataContext as BOTAContentViewModel).viewContentViewModel.OpenBOTA = false;
- }
- break;
- case "MenuFrom":
- if (TabItemForm.IsSelected)
- {
- (this.DataContext as BOTAContentViewModel).viewContentViewModel.OpenBOTA = false;
- }
- break;
- case "MenuSign":
- if (TabItemSign.IsSelected)
- {
- (this.DataContext as BOTAContentViewModel).viewContentViewModel.OpenBOTA = false;
- }
- break;
- default:
- break;
- }
- }
- private void UserControl_SizeChanged(object sender, SizeChangedEventArgs e)
- {
- if(e.NewSize.Width<=48&&TabBOTA.SelectedItem!=null&&(TabBOTA.SelectedItem as TabItem)!=null)
- {
- (TabBOTA.SelectedItem as TabItem).IsSelected = false;
- }
- }
- }
- }
|