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 { /// /// FreetextAnnotProperty.xaml 的交互逻辑 /// public partial class FreetextAnnotProperty : UserControl { 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(); } 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"; } } }