using Microsoft.AspNetCore.Components;
namespace Connected.Components;
///
/// Binds an object's property to a column by its property name
///
public partial class TableColumn : ColumnBase
{
T InternalValue
{
get => Value;
set
{
if (!EqualityComparer.Default.Equals(value, Value))
{
Value = value;
ValueChanged.InvokeAsync(value);
}
}
}
///
/// Specifies the name of the object's property bound to the column
///
[Parameter] public T Value { get; set; }
[Parameter] public EventCallback ValueChanged { get; set; }
[Parameter]
public T FooterValue
{
get { return _footerValue; }
set { _footerValue = value; _footerValueAvailable = true; }
}
private T _footerValue;
private bool _footerValueAvailable = false;
///
/// Used if no FooterValue is available
///
[Parameter] public string FooterText { get; set; }
///
/// Specifies which string format should be used.
///
[Parameter] public string DataFormatString { get; set; }
[Parameter] public bool ReadOnly { get; set; }
private string GetFormattedString(T item)
{
if (DataFormatString != null)
{
return string.Format(DataFormatString, item);
}
else
{
return item?.ToString();
}
}
}