123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- using PDF_Office.CustomControl;
- using PDF_Office.ViewModels.PropertyPanel.AnnotPanel;
- 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.Controls.Primitives;
- 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.PropertyPanel.AnnotPanel
- {
- /// <summary>
- /// FreetextAnnotProperty.xaml 的交互逻辑
- /// </summary>
- public partial class FreetextAnnotProperty : UserControl
- {
- private FreetextAnnotPropertyViewModel ViewModel => DataContext as FreetextAnnotPropertyViewModel;
- public FreetextAnnotProperty()
- {
- InitializeComponent();
- this.Loaded += usercontrol_Loaded;
- this.Unloaded += usercontrol_Unloaded;
-
- }
- private void usercontrol_Loaded(object sender, RoutedEventArgs e)
- {
- //FontFamilyBox.SelectedIndex = 0;
- //FontStyleBox.SelectedIndex = 0;
- //FontSizeBox.SelectedIndex = 0;
- //ThicknessBox.SelectedIndex = 0;
- BindingEvent();
- if(ViewModel != null && string.IsNullOrEmpty(ViewModel.BasicVm.strDashStyle) == false)
- {
- var str = ViewModel.BasicVm.strDashStyle;
- if (str == "AlignLeft")
- {
- TextAlignLeftBtn.IsChecked = true;
- }
- else if(str == "AlignCenter")
- {
- TextAlignCenterBtn.IsChecked = true;
- }
- else if (str == "AlignRight")
- {
- TextAlignRightBtn.IsChecked = true;
- }
- else if (str == "AlignJustify")
- {
- TextAlignBtn.IsChecked = true;
- }
- else
- {
- TextAlignLeftBtn.IsChecked = false;
- TextAlignCenterBtn.IsChecked = false;
- TextAlignRightBtn.IsChecked = false;
- TextAlignBtn.IsChecked = false;
- }
- }
- }
- private void usercontrol_Unloaded(object sender, RoutedEventArgs e)
- {
- UnBindingEvent();
- }
- private void BindingEvent()
- {
- UnBindingEvent();
- //ThicknessBox.SelectionChanged += ThicknessBox_SelectionChanged;
- }
- private void UnBindingEvent()
- {
- // ThicknessBox.SelectionChanged -= ThicknessBox_SelectionChanged;
- }
- private void ThicknessBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- var listItem = ThicknessBox.ItemContainerGenerator.ContainerFromItem(ThicknessBox.SelectedItem) as ComboBoxItem;
- if (listItem != null)
- ThicknessText.Text = listItem.Content.ToString();
- else
- ThicknessText.Text = "1";
-
- }
- }
- }
|