123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- using PDF_Master.ViewModels.PropertyPanel;
- using PDF_Master.ViewModels.PropertyPanel.PDFEdit;
- 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.PropertyPanel.PDFEdit
- {
- /// <summary>
- /// TextEditProperty.xaml 的交互逻辑
- /// </summary>
- public partial class TextEditProperty : UserControl
- {
- public TextEditPropertyViewModel ViewModel => DataContext as TextEditPropertyViewModel;
- public TextEditProperty()
- {
- InitializeComponent();
- }
- private void UserControl_Loaded(object sender, RoutedEventArgs e)
- {
- InitEventHandler();
- //不需要在cs中初始化
- //InitVariable();
- }
- private void InitEventHandler()
- {
- //FontFamilyBox.SelectionChanged -= FontFamilyBox_SelectionChanged;
- //FontStyleBox.SelectionChanged -= FontStyleBox_SelectionChanged;
- //FontSizeBox.SelectionChanged -= FontSizeBox_SelectionChanged;
- //FontColorBox.SelectedColorHandler -= FontColorBox_SelectedColorHandler;
- //FontFamilyBox.SelectionChanged += FontFamilyBox_SelectionChanged;
- //FontStyleBox.SelectionChanged += FontStyleBox_SelectionChanged;
- //FontSizeBox.SelectionChanged += FontSizeBox_SelectionChanged;
- //FontColorBox.SelectedColorHandler += FontColorBox_SelectedColorHandler;
- if (ViewModel != null)
- {
- ViewModel.ClearCheckedAglin -= ViewModel_ClearCheckedAglin;
- ViewModel.ClearCheckedAglin += ViewModel_ClearCheckedAglin;
- }
- }
- private void InitVariable()
- {
- FontTitleBox.SelectedIndex = 0;
- FontFamilyBox.SelectedIndex = 0;
- FontStyleBox.SelectedIndex = 0;
- FontSizeBox.SelectedIndex = 0;
- }
- private void ViewModel_ClearCheckedAglin(object sender, EventArgs e)
- {
- laoutAglin.ClearCheckedBtn();
- }
- private void FontSizeBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- //var listItem = FontSizeBox.ItemContainerGenerator.ContainerFromItem(FontSizeBox.SelectedItem) as ComboBoxItem;
- //if (listItem != null)
- // FontSizeText.Text = listItem.Content.ToString();
- //else
- // FontSizeText.Text = "6";
- }
- private void FontStyleBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- //var listItem = FontStyleBox.ItemContainerGenerator.ContainerFromItem(FontStyleBox.SelectedItem) as ComboBoxItem;
- //if (listItem != null)
- // FontStyleText.Text = listItem.Content.ToString();
- //else
- // FontStyleText.Text = "Regular";
- }
- private void FontFamilyBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- //var listItem = FontFamilyBox.ItemContainerGenerator.ContainerFromItem(FontFamilyBox.SelectedItem) as ComboBoxItem;
- //if (listItem != null)
- // FontFamilyText.Text = (listItem.Content as TextBlock).Text;
- //else
- // FontFamilyText.Text = "Courier New";
- }
- private void FontColorBox_SelectedColorHandler(object sender, Color e)
- {
- var data = this.DataContext as TextEditPropertyViewModel;
- if (data != null)
- {
- data.SelectedColorCommand?.Execute(e);
- }
- }
-
- private void BtnTextAlign_Click(object sender, RoutedEventArgs e)
- {
- }
-
- }
- }
|