123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- 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_Office.CustomControl
- {
- /// <summary>
- /// WritableComboBox.xaml 的交互逻辑
- /// </summary>
- public partial class WritableComboBox : UserControl
- {
- public WritableComboBox()
- {
- InitializeComponent();
- }
- private void writableComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- if (this.writableComboBox.SelectedIndex == this.writableComboBox.Items.Count - 1)
- {
- this.writableTextBox.Width = this.writableComboBox.ActualWidth - 18;
- Trace.WriteLine(this.writableComboBox.ActualWidth);
- this.writableTextBox.Visibility = Visibility.Visible;
- <<<<<<< Updated upstream
-
- }
- else
- {
- if (this.writableTextBox != null) {
- this.writableTextBox.Visibility = Visibility.Hidden;
- }
- this.SelectedIndex=this.writableComboBox.SelectedIndex.ToString();
- =======
- }
- else
- {
- if (this.writableTextBox != null)
- {
- this.writableTextBox.Visibility = Visibility.Collapsed;
- }
- >>>>>>> Stashed changes
- }
- this.SelectedIndex = this.writableComboBox.SelectedIndex.ToString();
- }
- public string SelectedIndex
- {
- get { return (string)GetValue(SelectedIndexProperty); }
- set { SetValue(SelectedIndexProperty, value); }
- }
- // Using a DependencyProperty as the backing store for MyProperty. This enables animation, styling, binding, etc...
- public static readonly DependencyProperty SelectedIndexProperty =
- DependencyProperty.Register("SelectedIndex", typeof(string), typeof(WritableComboBox), new PropertyMetadata(""));
- public string Text
- {
- get { return (string)GetValue(TextProperty); }
- set { SetValue(TextProperty, value); }
- }
- // Using a DependencyProperty as the backing store for MyProperty. This enables animation, styling, binding, etc...
- public static readonly DependencyProperty TextProperty =
- <<<<<<< Updated upstream
- DependencyProperty.Register("Text", typeof(string), typeof(WritableComboBox), new PropertyMetadata(""));
- private void writableTextBox_TextChange(object sender, TextChangedEventArgs e)
- {
- if (this.writableComboBox.SelectedIndex == this.writableComboBox.Items.Count - 1)
- {
- Text = this.writableTextBox.Text;
- }
- else { Text = ""; }
- }
- =======
- DependencyProperty.Register("Text", typeof(string), typeof(WritableComboBox), new PropertyMetadata(""));
- private void writableTextBox_TextChange(object sender, TextChangedEventArgs e)
- {
- if (this.writableComboBox.SelectedIndex == this.writableComboBox.Items.Count - 1)
- {
- Text = this.writableTextBox.Text;
- }
- else { Text = ""; }
- }
- >>>>>>> Stashed changes
- }
- }
|