1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Globalization;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- namespace PDF_Office.DataConvert
- {
- public class WidthConvert : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- if (value == null)
- {
- return 0;
- }
- else
- {
- if (value is double)
- {
- double width = (double)value;
- width = width - SystemParameters.VerticalScrollBarWidth-8;
- return Math.Max(0, width);
- }
- else
- {
- return 0;
- }
- }
- }
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
- public class SearchWidthConvert : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- if (value == null)
- {
- return 0;
- }
- else
- {
- if (value is double)
- {
- double width = (double)value;
- width = width - SystemParameters.VerticalScrollBarWidth-20;
- return Math.Max(0, width);
- }
- else
- {
- return 0;
- }
- }
- }
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
- public class WidthMultiConvert : IMultiValueConverter
- {
- public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
- {
- if (values == null || values.Length==0)
- {
- return 0;
- }
- else
- {
- if (values[0] is double)
- {
- double width = (double)values[0];
- width = width - SystemParameters.VerticalScrollBarWidth - 8;
- return Math.Max(0, width);
- }
- else
- {
- return 0;
- }
- }
- }
- public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
- }
|