More style testing
This commit is contained in:
		@@ -0,0 +1,19 @@
 | 
				
			|||||||
 | 
					using ReactiveUI.SourceGenerators;
 | 
				
			||||||
 | 
					using Avalonia.Media;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace StarsAssistant.ViewModels.DataGridColumn;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public partial class PopulationCapacity(int value) : ViewModelBase
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    [Reactive] private int _value = value;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public IBrush BackgroundColor => _value switch
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        < 25 => Brushes.Khaki,
 | 
				
			||||||
 | 
					        <= 33 => Brushes.PaleGreen,
 | 
				
			||||||
 | 
					        <= 50 => Brushes.Khaki,
 | 
				
			||||||
 | 
					        > 100 => Brushes.LightCoral,
 | 
				
			||||||
 | 
					        > 99 => Brushes.LightGray,
 | 
				
			||||||
 | 
					        _ => Brushes.White
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -189,7 +189,8 @@ public partial class PlayerPlanetViewModel : ViewModelBase
 | 
				
			|||||||
 
 | 
					 
 | 
				
			||||||
    public int MaxTerraforming => Planet.MaxTerraforming ?? 0; 
 | 
					    public int MaxTerraforming => Planet.MaxTerraforming ?? 0; 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public int CapacityPercent => Planet.CapacityPercent ?? 0; 
 | 
					    // public int CapacityPercent => Planet.CapacityPercent ?? 0; 
 | 
				
			||||||
 | 
					    public DataGridColumn.PopulationCapacity CapacityPercent => new(Planet.CapacityPercent ?? 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public int ScanRange => Planet.ScanRange ?? 0; 
 | 
					    public int ScanRange => Planet.ScanRange ?? 0; 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,6 +3,7 @@
 | 
				
			|||||||
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
 | 
					             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
 | 
				
			||||||
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
 | 
					             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
 | 
				
			||||||
             xmlns:vm="using:StarsAssistant.ViewModels"
 | 
					             xmlns:vm="using:StarsAssistant.ViewModels"
 | 
				
			||||||
 | 
					             xmlns:cols="clr-namespace:StarsAssistant.Views.DataGridColumn"
 | 
				
			||||||
             mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="200"
 | 
					             mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="200"
 | 
				
			||||||
             x:Class="StarsAssistant.Views.BuColView"
 | 
					             x:Class="StarsAssistant.Views.BuColView"
 | 
				
			||||||
             x:DataType="vm:BuColViewModel">
 | 
					             x:DataType="vm:BuColViewModel">
 | 
				
			||||||
@@ -18,7 +19,12 @@
 | 
				
			|||||||
    >
 | 
					    >
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
      <DataGrid.Columns>
 | 
					      <DataGrid.Columns>
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					          
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
        <DataGridTextColumn Header="Planet" Binding="{Binding Name}" />
 | 
					        <DataGridTextColumn Header="Planet" Binding="{Binding Name}" />
 | 
				
			||||||
        <!-- Class -->
 | 
					        <!-- Class -->
 | 
				
			||||||
        <!-- Info -->
 | 
					        <!-- Info -->
 | 
				
			||||||
@@ -27,7 +33,19 @@
 | 
				
			|||||||
        <DataGridTextColumn Header="Growth" Binding="{Binding PopulationGrowth}" />
 | 
					        <DataGridTextColumn Header="Growth" Binding="{Binding PopulationGrowth}" />
 | 
				
			||||||
        <DataGridTextColumn Header="Pop T1" Binding="{Binding EnRoutePopulation}" />
 | 
					        <DataGridTextColumn Header="Pop T1" Binding="{Binding EnRoutePopulation}" />
 | 
				
			||||||
        <DataGridTextColumn Header="Pop T%" Binding="{Binding PopulationTargetPercent}" IsReadOnly="false"/>
 | 
					        <DataGridTextColumn Header="Pop T%" Binding="{Binding PopulationTargetPercent}" IsReadOnly="false"/>
 | 
				
			||||||
        <DataGridTextColumn Header="Pop %" Binding="{Binding CapacityPercent}" />
 | 
					        <!-- DataGridTextColumn Header="Pop %" 
 | 
				
			||||||
 | 
					                            Binding="{Binding CapacityPercent, StringFormat='{}{0}%'}"
 | 
				
			||||||
 | 
					        / -->
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        <DataGridTemplateColumn Header="Pop %">
 | 
				
			||||||
 | 
					          <DataGridTemplateColumn.CellTemplate>
 | 
				
			||||||
 | 
					            <DataTemplate>
 | 
				
			||||||
 | 
					              <cols:PopulationCapacity DataContext="{Binding CapacityPercent}" />
 | 
				
			||||||
 | 
					            </DataTemplate>
 | 
				
			||||||
 | 
					          </DataGridTemplateColumn.CellTemplate>
 | 
				
			||||||
 | 
					        </DataGridTemplateColumn>
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
        <!-- Terra Delta assumed -->
 | 
					        <!-- Terra Delta assumed -->
 | 
				
			||||||
        <DataGridTextColumn Header="Value" Binding="{Binding Value}" />
 | 
					        <DataGridTextColumn Header="Value" Binding="{Binding Value}" />
 | 
				
			||||||
        <!-- Effective Value including Terra Delta -->
 | 
					        <!-- Effective Value including Terra Delta -->
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -0,0 +1,14 @@
 | 
				
			|||||||
 | 
					<UserControl xmlns="https://github.com/avaloniaui"
 | 
				
			||||||
 | 
					             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
 | 
				
			||||||
 | 
					             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
 | 
				
			||||||
 | 
					             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
 | 
				
			||||||
 | 
					             xmlns:vm="using:StarsAssistant.ViewModels.DataGridColumn"
 | 
				
			||||||
 | 
					             mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
 | 
				
			||||||
 | 
					             x:Class="StarsAssistant.Views.DataGridColumn.PopulationCapacity"
 | 
				
			||||||
 | 
					             x:DataType="vm:PopulationCapacity">
 | 
				
			||||||
 | 
					    <Border Background="{Binding BackgroundColor}">
 | 
				
			||||||
 | 
					        <TextBlock Text="{Binding Value, StringFormat='{}{0}%'}" 
 | 
				
			||||||
 | 
					            VerticalAlignment="Center" HorizontalAlignment="Right"
 | 
				
			||||||
 | 
					        />
 | 
				
			||||||
 | 
					    </Border>
 | 
				
			||||||
 | 
					</UserControl>
 | 
				
			||||||
@@ -0,0 +1,13 @@
 | 
				
			|||||||
 | 
					using Avalonia;
 | 
				
			||||||
 | 
					using Avalonia.Controls;
 | 
				
			||||||
 | 
					using Avalonia.Markup.Xaml;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace StarsAssistant.Views.DataGridColumn;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public partial class PopulationCapacity : UserControl
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public PopulationCapacity()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        InitializeComponent();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user