mirror of
https://github.com/libretro/MesenCE.git
synced 2026-11-11 03:01:50 -10:00
* Code: Add auto-formatting rules for C++ projects (clang-format) and enforce code style via "clang-format" and "dotnet format" * fix ui format warnings
51 lines
1.2 KiB
C#
51 lines
1.2 KiB
C#
using Avalonia.Controls;
|
|
using Avalonia.Controls.Primitives;
|
|
using Avalonia.Controls.Shapes;
|
|
using Avalonia.Styling;
|
|
using DataBoxControl.Primitives;
|
|
using System;
|
|
|
|
namespace DataBoxControl;
|
|
|
|
public class DataBoxRow : ListBoxItem
|
|
{
|
|
private Rectangle? _bottomGridLine;
|
|
|
|
protected override Type StyleKeyOverride => typeof(DataBoxRow);
|
|
|
|
internal DataBox? DataBox { get; set; }
|
|
|
|
internal DataBoxCellsPresenter? CellsPresenter { get; set; }
|
|
|
|
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
|
|
{
|
|
base.OnApplyTemplate(e);
|
|
|
|
_bottomGridLine = e.NameScope.Find<Rectangle>("PART_BottomGridLine");
|
|
|
|
InvalidateBottomGridLine();
|
|
|
|
CellsPresenter = e.NameScope.Find<DataBoxCellsPresenter>("PART_CellsPresenter");
|
|
|
|
if(CellsPresenter is { }) {
|
|
CellsPresenter.DataBox = DataBox;
|
|
CellsPresenter.Attach();
|
|
}
|
|
}
|
|
|
|
private void InvalidateBottomGridLine()
|
|
{
|
|
if(_bottomGridLine is { } && DataBox is { }) {
|
|
bool newVisibility =
|
|
DataBox.GridLinesVisibility == DataBoxGridLinesVisibility.Horizontal
|
|
|| DataBox.GridLinesVisibility == DataBoxGridLinesVisibility.All;
|
|
|
|
if(newVisibility != _bottomGridLine.IsVisible) {
|
|
_bottomGridLine.IsVisible = newVisibility;
|
|
}
|
|
|
|
_bottomGridLine.Fill = DataBox.HorizontalGridLinesBrush;
|
|
}
|
|
}
|
|
}
|