123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- 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.CustomControl.CompositeControl
- {
- /// <summary>
- /// ThicknessContentPop.xaml 的交互逻辑
- /// </summary>
- public partial class SlidContentPop : UserControl
- {
- public event EventHandler<double> OpacityValueChangedHandler;
- public bool isOpenLayout { get; private set; }
- public SlidContentPop()
- {
- InitializeComponent();
- }
- public void SetOpacity(double opacity)
- {
- bool changeFromDropBox = false;
- if(opacity == 0.25)
- {
- if (OpacityDropBox.SelectedIndex != 0)
- changeFromDropBox = true;
- OpacityDropBox.SelectedIndex = 0;
- }
- else if(opacity == 0.50)
- {
- if (OpacityDropBox.SelectedIndex != 1)
- changeFromDropBox = true;
- OpacityDropBox.SelectedIndex = 1;
- }
- else if(opacity == 0.75)
- {
- if (OpacityDropBox.SelectedIndex != 2)
- changeFromDropBox = true;
- OpacityDropBox.SelectedIndex = 2;
- }
- else if(opacity ==1)
- {
- if (OpacityDropBox.SelectedIndex != 3)
- changeFromDropBox = true;
- OpacityDropBox.SelectedIndex = 3;
- }
- if (changeFromDropBox == false)
- OpacitySlider.Value = opacity;
- }
- private void OpacitySlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
- {
- OpacityValueChangedHandler?.Invoke(this, e.NewValue);
- }
- private void OpacityDropBox_DropDownClosed(object sender, EventArgs e)
- {
- isOpenLayout = false;
- }
- private void OpacityDropBox_DropDownOpened(object sender, EventArgs e)
- {
- isOpenLayout = true;
- }
- private void OpacityDropBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- switch(OpacityDropBox.SelectedIndex)
- {
- case 0:
- OpacitySlider.Value = 0.25;
- break;
- case 1:
- OpacitySlider.Value = 0.50;
- break;
- case 2:
- OpacitySlider.Value = 0.75;
- break;
- case 3:
- OpacitySlider.Value = 1;
- break;
- }
- }
- }
- }
|