Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to bind AuraTabView Items to ObservableCollection #27

Closed
Shadow4walker opened this issue Oct 28, 2021 · 10 comments
Closed

How to bind AuraTabView Items to ObservableCollection #27

Shadow4walker opened this issue Oct 28, 2021 · 10 comments
Milestone

Comments

@Shadow4walker
Copy link

it used to work in previous releases with some modified in the Data Template but now in "0.1.4.1" I got some exception System.ArgumentNullException: 'Value cannot be null. (Parameter 'target')'""
the Exception happened in Aura.UI.Controls.Generators.AuraTabItemContainerGenerator.CreateContainer

View

<AuraTabView TabStripPlacement="Left" Items="{Binding Peoples}">
    <AuraTabView.ItemTemplate>
        <DataTemplate>
            <StackPanel>
                <TextBlock Text="{Binding Name}" />
                <TextBlock Text="{Binding Age}" />
            </StackPanel>
        </DataTemplate>
    </AuraTabView.ItemTemplate>
</AuraTabView>

VM

    private protected ObservableCollection<Person> Peoples { get; } = new();

Person

public class Person {
    public Person(string name, string age) {
        Name = name;
        Age = age;
    }

    public string Name { get; }
    public string Age { get; }
}
@PieroCastillo
Copy link
Owner

Next I'm going to add support for Observable Collection, the current problem is there's not information about how to add it, I'm gonna ask it to the core devs (sorry for reply so late, I had problems with my internet connection)

@PieroCastillo
Copy link
Owner

wait... how are you using it? the items what are you using should implement IAuraTabItemTemplate

@Shadow4walker
Copy link
Author

i've switched to Avalonia TabControl.
already tried with IAuraTabItemTemplate and the items just not displayed! can u give me example project with the worked solution

@PieroCastillo
Copy link
Owner

you're right, I remember with Avalonia 0.10.1 works fine... but now it's broken, I'm gonna work now to fix it

@PieroCastillo
Copy link
Owner

PieroCastillo commented Nov 4, 2021

to display items it's ok, I'm gonna add a sample adding/deleting items, and using data Templates
https://github.com/PieroCastillo/Aura.UI/tree/master/MVVMSamples/AuraTabViewMVVMSample
image

@Shadow4walker
Copy link
Author

it's done, now should work like the Avalonia sample https://github.com/PieroCastillo/Aura.UI/blob/master/MVVMSamples/AuraTabViewMVVMSample/ViewModels/MainWindowViewModel.cs https://github.com/PieroCastillo/Aura.UI/blob/master/MVVMSamples/AuraTabViewMVVMSample/Views/MainWindow.axaml

all working great thank you.
btw have you considered adding those two suggestions ScrollAble header Header with Remove item event it would be easier to just integrate this two suggestion by default within AuraTabView rather than edit template in each use

@PieroCastillo
Copy link
Owner

I think now I can close this issue :), also, could you open another issue specifing other details about the closing bug?

@Shadow4walker
Copy link
Author

just wanted to tell you this issue still exist after your last update you may check is using your samples!

System.ArgumentNullException: 'Value cannot be null. (Parameter 'target')'

@PieroCastillo
Copy link
Owner

Fill the property "IsClosable"

@PieroCastillo PieroCastillo moved this to In Progress in Aura.UI Roadmap Jan 7, 2022
@PieroCastillo PieroCastillo added this to the v0.1.5 milestone Jan 7, 2022
@PieroCastillo PieroCastillo moved this from In Progress to Done in Aura.UI Roadmap Jan 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

2 participants