Onebeld / PleasantUI

Graphical user interface library for Avalonia with its own controls
MIT License
28 stars 1 forks source link

DataGrid not showing #1

Open waylaa opened 11 months ago

waylaa commented 11 months ago

The title says it all. The DataGrid from the Avalonia.Controls.DataGrid library doesnt show up at all on the UI.

CollectionsPage.axaml:

    <Panel>
        <DataGrid x:Name="Data">
            <DataGrid.Columns>
                <DataGridTextColumn Header="First Name" />
                <DataGridTextColumn Header="Last Name" />
            </DataGrid.Columns>
        </DataGrid>
    </Panel>

MainWindow.axaml:


    <Design.DataContext>
        <vm:MainWindowViewModel />
    </Design.DataContext>

    <PleasantWindow.TitleBarContent>
        <TextBox VerticalAlignment="Center"
                 HorizontalAlignment="Stretch"
                 Margin="50, 0, 50, 0"
                 Watermark="Search for a collection" />
    </PleasantWindow.TitleBarContent>

    <NavigationView IsOpen="False"
                    SelectionMode="AlwaysSelected"
                    Header="{x:Null}"
                    BindWindowSettings="True">

        <NavigationViewItem x:Name="CollectionsScreenPage"
                            IsSelected="True"
                            Header="Collections"
                            Icon="{StaticResource HomeScreenRegular}" />

        <NavigationViewItem x:Name="SettingsScreenPage"
                            Header="Settings"
                            DockPanel.Dock="Bottom" Margin="0 0 0 5"
                            Icon="{StaticResource SettingsRegular}" />

        <Panel />
    </NavigationView>

MainWindow.axaml.cs:

public partial class MainWindow : PleasantWindow
{
    public MainWindow()
    {
        InitializeComponent();

        CollectionsScreenPage.FuncControl += Ioc.Default.GetRequiredService<CollectionsPage>;
        SettingsScreenPage.FuncControl += Ioc.Default.GetRequiredService<SettingsPage>;

        Closing += OnClosing;
    }

    protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
    {
        base.OnApplyTemplate(e);

        if (OperatingSystem.IsMacOS())
        {
            EnableTitleBarMargin = true;
            TitleBarType = PleasantTitleBarType.Classic;
        }

        Ioc.Default.GetRequiredService<MainWindowViewModel>().NotificationManager = new PleasantNotificationManager(this)
        {
            Position = NotificationPosition.TopRight,
            MaxItems = 3,
            ZIndex = 1
        };
    }

    private void OnClosing(object? sender, WindowClosingEventArgs e)
        => PleasantSettings.Instance.Save();
}
waylaa commented 11 months ago

I don't know if there's a workaround or an alternative (but still similar in functionality) to the DataGrid.

Onebeld commented 11 months ago

Hi! DataGrip is not showing up because no styles have been created for it yet. I will add them a little later

waylaa commented 11 months ago

Okay, i will wait. Thank you for your response.