feat: 更新
This commit is contained in:
@@ -71,19 +71,19 @@ public class InverseBoolToVisibilityConverter : IValueConverter
|
||||
}
|
||||
}
|
||||
|
||||
public class ProgressToWidthConverter : IValueConverter
|
||||
public class ProgressToWidthConverter : IMultiValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is int progress)
|
||||
if (values.Length == 2 && values[0] is int progress && values[1] is double containerWidth)
|
||||
{
|
||||
// 假设进度条容器宽度为300,根据百分比计算实际宽度
|
||||
return progress * 3.0; // 300px * (progress/100)
|
||||
// 根据进度百分比计算实际宽度
|
||||
return containerWidth * progress / 100.0;
|
||||
}
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user