39 lines
1.1 KiB
C#
39 lines
1.1 KiB
C#
using System;
|
|
using System.Globalization;
|
|
using Avalonia.Data.Converters;
|
|
|
|
namespace Project_Periodensystem.View.Converters
|
|
{
|
|
public class RowToYConverter : IValueConverter
|
|
{
|
|
private const double TileHeight = 80;
|
|
|
|
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
{
|
|
if (value is int row)
|
|
return row * TileHeight;
|
|
|
|
return 0;
|
|
}
|
|
|
|
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) =>
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public class ColumnToXConverter : IValueConverter
|
|
{
|
|
private const double TileWidth = 80;
|
|
|
|
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
{
|
|
if (value is int column)
|
|
return column * TileWidth;
|
|
|
|
return 0;
|
|
}
|
|
|
|
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) =>
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|