Avalonia Start
This commit is contained in:
82
LaDOSE.Src/LaDOSE.DesktopApp.Avalonia/Views/GamesView.axaml
Normal file
82
LaDOSE.Src/LaDOSE.DesktopApp.Avalonia/Views/GamesView.axaml
Normal file
@@ -0,0 +1,82 @@
|
||||
<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"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="LaDOSE.DesktopApp.Avalonia.Views.GamesView"
|
||||
xmlns:vm="using:LaDOSE.DesktopApp.Avalonia.ViewModels"
|
||||
x:DataType="vm:GamesViewModel"
|
||||
>
|
||||
<Grid Row="4" Column="1">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="*"></RowDefinition>
|
||||
<RowDefinition Height="*"></RowDefinition>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
<Button Grid.Row="0" x:Name="LoadGames" Command="{Binding LoadGames}" >Load Games</Button>
|
||||
|
||||
<ListBox Grid.Row="1" ItemsSource="{Binding Games}" x:Name="GamesListView" SelectedItem="{Binding CurrentGame}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label Content="{Binding Order}"></Label>
|
||||
<Label> - </Label>
|
||||
<Label Content="{Binding Name}"></Label>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
|
||||
</ListBox>
|
||||
<Grid Grid.Row="2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition></ColumnDefinition>
|
||||
<ColumnDefinition></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="*"></RowDefinition>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
|
||||
</Grid.RowDefinitions>
|
||||
<Button Grid.Row="0" Grid.Column="0" x:Name="AddGame" Command="{Binding AddGame}">Add Game</Button>
|
||||
|
||||
<Button Grid.Row="0" Grid.Column="1" x:Name="DeleteGame" Command="{Binding DeleteGame}">Delete Game</Button>
|
||||
<Label Grid.Row="1" Grid.Column="0">Id</Label>
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding Path=CurrentGame.Id,Mode=TwoWay}" IsReadOnly="True"></TextBox>
|
||||
|
||||
<Label Grid.Row="2" Grid.Column="0">Name</Label>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding Path=CurrentGame.Name,Mode=TwoWay}" ></TextBox>
|
||||
|
||||
<Label Grid.Row="3" Grid.Column="0">Order</Label>
|
||||
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding Path=CurrentGame.Order,Mode=TwoWay}">
|
||||
<!-- <i:Interaction.Behaviors> -->
|
||||
<!-- <behaviors:TextBoxInputRegExBehaviour RegularExpression="^\d+$" MaxLength="9" EmptyValue="0"> -->
|
||||
<!-- -->
|
||||
<!-- </behaviors:TextBoxInputRegExBehaviour> -->
|
||||
<!-- </i:Interaction.Behaviors> -->
|
||||
</TextBox>
|
||||
<Label Grid.Row="4" Grid.Column="0">LongName</Label>
|
||||
<TextBox Grid.Row="4" Grid.Column="1" Text="{Binding Path=CurrentGame.LongName,Mode=TwoWay}" ></TextBox>
|
||||
|
||||
<Label Grid.Row="5" Grid.Column="0">WpTag</Label>
|
||||
<TextBox Grid.Row="5" Grid.Column="1" Text="{Binding Path=CurrentGame.WordPressTag,Mode=TwoWay}" ></TextBox>
|
||||
<Label Grid.Row="6" Grid.Column="0">WpTagOs</Label>
|
||||
<TextBox Grid.Row="6" Grid.Column="1" Text="{Binding Path=CurrentGame.WordPressTagOs,Mode=TwoWay}" ></TextBox>
|
||||
<Label Grid.Row="7" Grid.Column="0">SmashId</Label>
|
||||
<TextBox Grid.Row="7" Grid.Column="1" Text="{Binding Path=CurrentGame.SmashId,Mode=TwoWay}">
|
||||
|
||||
</TextBox>
|
||||
|
||||
<Button Grid.Row="9" Grid.ColumnSpan="2" x:Name="Update" Command="{Binding Update}">Update</Button>
|
||||
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,23 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using LaDOSE.DesktopApp.Avalonia.ViewModels;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace LaDOSE.DesktopApp.Avalonia.Views;
|
||||
|
||||
public partial class GamesView : UserControl,IViewFor<GamesViewModel>
|
||||
{
|
||||
public GamesView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
object? IViewFor.ViewModel
|
||||
{
|
||||
get => ViewModel;
|
||||
set => ViewModel = (GamesViewModel?)value;
|
||||
}
|
||||
|
||||
public GamesViewModel? ViewModel { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<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"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="LaDOSE.DesktopApp.Avalonia.Views.InfoView">
|
||||
<Decorator x:Name="browserWrapper"/>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,24 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using LaDOSE.DesktopApp.Avalonia.ViewModels;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace LaDOSE.DesktopApp.Avalonia.Views;
|
||||
|
||||
public partial class InfoView : UserControl, IViewFor<InfoViewModel>
|
||||
{
|
||||
// private AvaloniaCefBrowser browser;
|
||||
public InfoView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
object? IViewFor.ViewModel
|
||||
{
|
||||
get => ViewModel;
|
||||
set => ViewModel = (InfoViewModel?)value;
|
||||
}
|
||||
|
||||
public InfoViewModel? ViewModel { get; set; }
|
||||
}
|
||||
52
LaDOSE.Src/LaDOSE.DesktopApp.Avalonia/Views/MainWindow.axaml
Normal file
52
LaDOSE.Src/LaDOSE.DesktopApp.Avalonia/Views/MainWindow.axaml
Normal file
@@ -0,0 +1,52 @@
|
||||
<Window xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="using:LaDOSE.DesktopApp.Avalonia.ViewModels"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:reactiveUi="http://reactiveui.net"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="LaDOSE.DesktopApp.Avalonia.Views.MainWindow"
|
||||
x:DataType="vm:MainWindowViewModel"
|
||||
Icon="/Assets/avalonia-logo.ico"
|
||||
Title="LaDOSE.DesktopApp.Avalonia">
|
||||
|
||||
<Design.DataContext>
|
||||
<!-- This only sets the DataContext for the previewer in an IDE,
|
||||
to set the actual DataContext for runtime, set the DataContext property in code (look at App.axaml.cs) -->
|
||||
<vm:MainWindowViewModel/>
|
||||
</Design.DataContext>
|
||||
|
||||
<Grid Row="4" Column="1">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="*"></RowDefinition>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
<Menu Grid.Row="0" DockPanel.Dock="Top">
|
||||
<MenuItem Header="_File">
|
||||
<MenuItem Header="_Events" Command="{Binding RoutedViewViewHost.ShowTournament}">
|
||||
</MenuItem>
|
||||
<MenuItem Header="_Games" Command="{Binding RoutedViewViewHost.ShowGames}" >
|
||||
</MenuItem>
|
||||
<MenuItem Header="_Tournaments">
|
||||
</MenuItem>
|
||||
<MenuItem Header="_EventPlayers">
|
||||
</MenuItem>
|
||||
<MenuItem Header="_Info" Command="{Binding RoutedViewViewHost.ShowInfo}" />
|
||||
<MenuItem Header="_Close" Command="{Binding CloseApp}" />
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
|
||||
<TabControl Grid.Row="1" TabStripPlacement="Left">
|
||||
<TabItem Header="{Binding Path=RoutedViewViewHost.Current}">
|
||||
<DockPanel DataContext="{Binding RoutedViewViewHost}">
|
||||
<reactiveUi:RoutedViewHost Router="{Binding Router}"/>
|
||||
</DockPanel>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
<StackPanel Grid.Row="2" Orientation="Horizontal">
|
||||
<TextBlock> User : </TextBlock>
|
||||
<TextBlock Margin="5,0,0,0"></TextBlock>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -0,0 +1,12 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace LaDOSE.DesktopApp.Avalonia.Views;
|
||||
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,212 @@
|
||||
<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"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="LaDOSE.DesktopApp.Avalonia.Views.TournamentResultView"
|
||||
xmlns:vm="using:LaDOSE.DesktopApp.Avalonia.ViewModels"
|
||||
x:DataType="vm:TournamentResultViewModel"
|
||||
>
|
||||
<Grid Row="2" Column="1">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="2*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid Row="0" Column="0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid Row="0" Column="0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Row="0" Orientation="Horizontal" Margin="0,0,0,5">
|
||||
<Label>Date :</Label>
|
||||
<StackPanel Orientation="Horizontal" Width="210">
|
||||
<DatePicker SelectedDate="{Binding From}" Width="100" BorderBrush="{x:Null}">
|
||||
</DatePicker>
|
||||
|
||||
<DatePicker SelectedDate="{Binding To}" Width="100" Margin="5,0,5,0" BorderBrush="{x:Null}">
|
||||
</DatePicker>
|
||||
</StackPanel>
|
||||
|
||||
<Label>Usefull :</Label>
|
||||
<Button Padding="5,0,5,0" x:Name="SelectMonth" Command="{Binding SelectMonth}">Month</Button>
|
||||
<Button Padding="5,0,5,0" Margin="5,0,5,0" x:Name="SelectYear" Command="{Binding SelectYear}">Year</Button>
|
||||
|
||||
</StackPanel>
|
||||
<Button Grid.Row="1" x:Name="LoadTournaments" Command="{Binding LoadTournaments}">Update</Button>
|
||||
<ListBox Grid.Row="2" ItemsSource="{Binding Tournaments}" x:Name="TournamentList" Margin="0,0,0,5"
|
||||
IsTextSearchEnabled="True" TextSearch.Text="Name"
|
||||
SelectedItems="{Binding SelectedTournaments}"
|
||||
SelectionMode="Multiple">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Margin="5,0,0,0" Text="{Binding Name}" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
|
||||
</ListBox>
|
||||
<DockPanel Grid.Row="3" Dock="Left">
|
||||
<Label>Select :</Label>
|
||||
<TextBox Width="200" Text="{Binding SelectRegex}"></TextBox>
|
||||
<Button Padding="5,0,5,0" Margin="5,0,5,0" x:Name="SelectRegexp" Command="{Binding SelectRegexp}">Select</Button>
|
||||
<Button Padding="5,0,5,0" Margin="5,0,5,0" x:Name="GetChallonge" Command="{Binding GetChallonge}">Import</Button>
|
||||
</DockPanel>
|
||||
|
||||
</Grid>
|
||||
<Grid Row="0" Column="1">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Row="0" Grid.Column="0" Orientation="Horizontal" Margin="0,0,0,6">
|
||||
<Label> Smash Slug :</Label>
|
||||
<TextBox Width="200" Text="{Binding Slug}"></TextBox>
|
||||
<Button Margin="5,0,5,0" x:Name="GetSmash" Command="{Binding GetSmash}" >Import Smash Event</Button>
|
||||
</StackPanel>
|
||||
|
||||
<Button Grid.Row="1" x:Name="UpdateEvent" Command="{Binding UpdateEvent}">Update Event</Button>
|
||||
|
||||
<ListBox Grid.Row="2" ItemsSource="{Binding Events}" Margin="0,0,0,5"
|
||||
IsTextSearchEnabled="True" TextSearch.Text="Name" SelectionMode="Multiple"
|
||||
SelectedItems="{Binding SelectedEvents}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding Id}" />
|
||||
<TextBlock Margin="5,0,0,0" Text="{Binding Name}" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
|
||||
</ListBox>
|
||||
<DockPanel Grid.Row="3" Dock="Left">
|
||||
<Label>Select :</Label>
|
||||
<TextBox Width="200" Text="{Binding SelectEventRegex}"></TextBox>
|
||||
<Button Padding="5,0,5,0" Margin="5,0,5,0" x:Name="SelectEvent" Command="{Binding SelectEvent}">Select</Button>
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<Grid Row="3">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="2*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<!--<DockPanel Grid.Row="0" Grid.ColumnSpan="3" Dock="Left">
|
||||
<Label>Select :</Label>
|
||||
<TextBox Width="200" Text="{Binding SelectRegex}"></TextBox>
|
||||
<Button Padding="5,0,5,0" Margin="5,0,5,0" x:Name="SelectRegexp">Select</Button>
|
||||
<Button x:Name="Select" >Get Tournaments Result</Button>
|
||||
</DockPanel>-->
|
||||
<Button x:Name="Select" Grid.ColumnSpan="3" Command="{Binding Select}">Get Tournaments Result</Button>
|
||||
|
||||
|
||||
<StackPanel Grid.Row="1" Grid.ColumnSpan="3" Orientation="Horizontal">
|
||||
<TextBlock> Game :</TextBlock>
|
||||
<TextBlock Margin="5,0,0,0" Text="{Binding Results.Games.Count}" />
|
||||
|
||||
</StackPanel>
|
||||
<ListBox Grid.Row="2" ItemsSource="{Binding Results.Games}" Margin="5,5,5,5"
|
||||
IsTextSearchEnabled="True" TextSearch.Text="Name"
|
||||
SelectedItem="{Binding SelectedGame}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding Id}" />
|
||||
<TextBlock Margin="5,0,0,0" Text="{Binding Name}" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
|
||||
</ListBox>
|
||||
<StackPanel Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3" Orientation="Horizontal">
|
||||
<TextBlock> Participents :</TextBlock>
|
||||
<TextBlock Margin="5,0,0,0" Text="{Binding Results.Participents.Count}" />
|
||||
|
||||
</StackPanel>
|
||||
<ListBox Grid.Row="2" Grid.Column="1" ItemsSource="{Binding Results.Participents}" Margin="5,5,5,5"
|
||||
IsTextSearchEnabled="True" TextSearch.Text="Name">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Margin="5,0,0,0" Text="{Binding Name}" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
|
||||
</ListBox>
|
||||
|
||||
<TabControl Grid.Row="2" Grid.Column="2">
|
||||
<TabItem Header="Result">
|
||||
<DataGrid x:Name="DataGrid" PropertyChanged="DataGrid_OnPropertyChanged" ItemsSource="{Binding GridDataTableView}" CanUserSortColumns="True" BorderThickness="1" BorderBrush="Gray"/>
|
||||
</TabItem>
|
||||
<TabItem Header="By Game">
|
||||
<DockPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" DockPanel.Dock="Top">
|
||||
<TextBlock> Total :</TextBlock>
|
||||
<TextBlock Text="{Binding SelectedGameResult.Count}" />
|
||||
</StackPanel>
|
||||
<ListBox ItemsSource="{Binding SelectedGameResult}" Margin="5,5,5,5"
|
||||
IsTextSearchEnabled="True" TextSearch.Text="Name" DockPanel.Dock="Top">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Margin="5,0,0,0" Text="{Binding Player}" />
|
||||
<TextBlock Margin="5,0,0,0" Text="{Binding Point}" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
|
||||
</ListBox>
|
||||
|
||||
</DockPanel>
|
||||
</TabItem>
|
||||
<TabItem Header="HTML">
|
||||
<DockPanel>
|
||||
<Button x:Name="CopyHtml" DockPanel.Dock="Top" Command="{Binding CopyHtml}">Copy HTML to clipboard</Button>
|
||||
<TextBox Text="{Binding Html}" />
|
||||
</DockPanel>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
|
||||
<Button Grid.Row="4" Grid.ColumnSpan="3" x:Name="Export" Command="{Binding Export}">Export</Button>
|
||||
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,56 @@
|
||||
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Data;
|
||||
using LaDOSE.DesktopApp.Avalonia.ViewModels;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace LaDOSE.DesktopApp.Avalonia.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for ShellView.xaml
|
||||
/// </summary>
|
||||
public partial class TournamentResultView : UserControl, IViewFor<TournamentResultViewModel>
|
||||
{
|
||||
public TournamentResultView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
|
||||
object? IViewFor.ViewModel
|
||||
{
|
||||
get => ViewModel;
|
||||
set => ViewModel = (TournamentResultViewModel)value;
|
||||
}
|
||||
|
||||
public TournamentResultViewModel? ViewModel { get; set; }
|
||||
|
||||
private void DataGrid_OnPropertyChanged(object? sender, AvaloniaPropertyChangedEventArgs e)
|
||||
{
|
||||
if (e.Property.Name == "ItemsSource")
|
||||
{
|
||||
Trace.WriteLine("Changed Binding");
|
||||
|
||||
var grid = (sender as DataGrid);
|
||||
grid.Columns.Clear();
|
||||
var data = ViewModel.GridDataTable;
|
||||
|
||||
foreach (DataColumn? view in data.Columns)
|
||||
{
|
||||
|
||||
grid.Columns.Add(new DataGridTextColumn()
|
||||
{
|
||||
Header = view.ColumnName,
|
||||
CanUserSort = true,
|
||||
Binding = new Binding($"Row.ItemArray[{view.Ordinal}]")
|
||||
});
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user