-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
- Introduced `DivisionMathConverter` for division operations in data binding. - Updated `MainWindow.xaml`, `PageNavigationView.xaml`, and `ToolBarView.xaml` to use the new `BoolToVisibilityConverter`. - Replaced old visibility converter references to ensure consistency across the application.
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System; | ||
using System.Globalization; | ||
using System.Windows.Data; | ||
|
||
namespace SketchNow.Converters | ||
{ | ||
public class DivisionMathConverter : IValueConverter | ||
{ | ||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | ||
{ | ||
if (value == null || parameter == null) | ||
return null; | ||
Check warning on line 12 in SketchNow/Converters/DivisionMathConverter.cs
|
||
|
||
double number; | ||
double divisor; | ||
|
||
if (double.TryParse(value.ToString(), out number) && double.TryParse(parameter.ToString(), out divisor)) | ||
{ | ||
return number / divisor; | ||
} | ||
|
||
return null; | ||
Check warning on line 22 in SketchNow/Converters/DivisionMathConverter.cs
|
||
} | ||
|
||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} | ||
} |