mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
Dynamically resize supporter grid columns
+ fix bootstrapper bug from yesterday
This commit is contained in:
parent
6a93624040
commit
b3a1b1c55e
@ -629,6 +629,9 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
if (Directory.Exists(AppData.Directory))
|
if (Directory.Exists(AppData.Directory))
|
||||||
{
|
{
|
||||||
|
if (Directory.Exists(AppData.OldDirectory))
|
||||||
|
Directory.Delete(AppData.OldDirectory, true);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// test to see if any files are in use
|
// test to see if any files are in use
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
xmlns:resources="clr-namespace:Bloxstrap.Resources"
|
xmlns:resources="clr-namespace:Bloxstrap.Resources"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="1500" d:DesignWidth="800"
|
d:DesignHeight="1500" d:DesignWidth="800"
|
||||||
|
SizeChanged="UiPage_SizeChanged"
|
||||||
Title="AboutPage"
|
Title="AboutPage"
|
||||||
Scrollable="True">
|
Scrollable="True">
|
||||||
<StackPanel Margin="0,0,14,14">
|
<StackPanel Margin="0,0,14,14">
|
||||||
@ -93,7 +94,7 @@
|
|||||||
</ListView.ItemTemplate>
|
</ListView.ItemTemplate>
|
||||||
<ListView.ItemsPanel>
|
<ListView.ItemsPanel>
|
||||||
<ItemsPanelTemplate>
|
<ItemsPanelTemplate>
|
||||||
<UniformGrid Columns="{Binding SupporterData.Monthly.Columns}" Margin="-4" />
|
<UniformGrid Columns="{Binding Columns}" Margin="-4" />
|
||||||
</ItemsPanelTemplate>
|
</ItemsPanelTemplate>
|
||||||
</ListView.ItemsPanel>
|
</ListView.ItemsPanel>
|
||||||
</ListView>
|
</ListView>
|
||||||
@ -122,7 +123,7 @@
|
|||||||
</ListView.ItemTemplate>
|
</ListView.ItemTemplate>
|
||||||
<ListView.ItemsPanel>
|
<ListView.ItemsPanel>
|
||||||
<ItemsPanelTemplate>
|
<ItemsPanelTemplate>
|
||||||
<UniformGrid Columns="{Binding SupporterData.OneOff.Columns}" Margin="-4" />
|
<UniformGrid Columns="{Binding Columns}" Margin="-4" />
|
||||||
</ItemsPanelTemplate>
|
</ItemsPanelTemplate>
|
||||||
</ListView.ItemsPanel>
|
</ListView.ItemsPanel>
|
||||||
</ListView>
|
</ListView>
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
using Bloxstrap.UI.ViewModels.About;
|
using System.Windows;
|
||||||
|
|
||||||
|
using Bloxstrap.UI.ViewModels.About;
|
||||||
|
|
||||||
namespace Bloxstrap.UI.Elements.About.Pages
|
namespace Bloxstrap.UI.Elements.About.Pages
|
||||||
{
|
{
|
||||||
@ -7,10 +9,15 @@ namespace Bloxstrap.UI.Elements.About.Pages
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class SupportersPage
|
public partial class SupportersPage
|
||||||
{
|
{
|
||||||
|
private readonly SupportersViewModel _viewModel = new();
|
||||||
|
|
||||||
public SupportersPage()
|
public SupportersPage()
|
||||||
{
|
{
|
||||||
DataContext = new SupportersViewModel();
|
DataContext = _viewModel;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UiPage_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||||
|
=> _viewModel.WindowResizeEvent?.Invoke(sender, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
namespace Bloxstrap.UI.ViewModels.About
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace Bloxstrap.UI.ViewModels.About
|
||||||
{
|
{
|
||||||
public class SupportersViewModel : NotifyPropertyChangedViewModel
|
public class SupportersViewModel : NotifyPropertyChangedViewModel
|
||||||
{
|
{
|
||||||
@ -8,12 +10,32 @@
|
|||||||
|
|
||||||
public string LoadError { get; set; } = "";
|
public string LoadError { get; set; } = "";
|
||||||
|
|
||||||
|
public int Columns { get; set; } = 3;
|
||||||
|
|
||||||
|
public SizeChangedEventHandler? WindowResizeEvent;
|
||||||
|
|
||||||
public SupportersViewModel()
|
public SupportersViewModel()
|
||||||
{
|
{
|
||||||
|
WindowResizeEvent += OnWindowResize;
|
||||||
|
|
||||||
// this will cause momentary freezes only when ran under the debugger
|
// this will cause momentary freezes only when ran under the debugger
|
||||||
LoadSupporterData();
|
LoadSupporterData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnWindowResize(object sender, SizeChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if (!e.WidthChanged)
|
||||||
|
return;
|
||||||
|
|
||||||
|
int newCols = (int)Math.Floor(e.NewSize.Width / 200);
|
||||||
|
|
||||||
|
if (Columns == newCols)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Columns = newCols;
|
||||||
|
OnPropertyChanged(nameof(Columns));
|
||||||
|
}
|
||||||
|
|
||||||
public async void LoadSupporterData()
|
public async void LoadSupporterData()
|
||||||
{
|
{
|
||||||
const string LOG_IDENT = "AboutViewModel::LoadSupporterData";
|
const string LOG_IDENT = "AboutViewModel::LoadSupporterData";
|
||||||
|
Loading…
Reference in New Issue
Block a user