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

Binding issues #334

Closed
JeremyWu917 opened this issue Aug 6, 2022 · 3 comments · Fixed by #335
Closed

Binding issues #334

JeremyWu917 opened this issue Aug 6, 2022 · 3 comments · Fixed by #335
Assignees
Labels
bug Something isn't working locked-due-to-inactivity

Comments

@JeremyWu917
Copy link
Contributor

Please see below info ⚓

image

image

@JeremyWu917 JeremyWu917 added the bug Something isn't working label Aug 6, 2022
JeremyWu917 added a commit to JeremyWu917/wpfui that referenced this issue Aug 6, 2022
@Ecss11
Copy link

Ecss11 commented Aug 6, 2022

This is just an example. In practice, you may need to create a new collection and build yourself. In this case, you have to create your own item sources in order to bind, more information they can be find in the Win.UI.Demo solution under project source code.

From DataViewModel.cs (Remember to check Data.xaml.cs and Data.cs under Views/Page for more information about binding):

DataGridItemCollection = new List<Customer>()
{
    new()
    {
        Email = "john.doe@example.com",
        FirstName = "John",
        LastName = "Doe",
        IsMember = true,
        Status = OrderStatus.Processing
    },
    new()
    {
        Email = "chloe.clarkson@example.com",
        FirstName = "Chloe",
        LastName = "Clarkson",
        IsMember = true,
        Status = OrderStatus.Processing
    },
    new()
    {
        Email = "eric.brown@example.com",
        FirstName = "Eric",
        LastName = "Brown",
        IsMember = false,
        Status = OrderStatus.New
    },
    new()
    {
        Email = "john.doe@example.com",
        FirstName = "John",
        LastName = "Doe",
        IsMember = true,
        Status = OrderStatus.Processing
    },
    new()
    {
        Email = "chloe.clarkson@example.com",
        FirstName = "Chloe",
        LastName = "Clarkson",
        IsMember = true,
        Status = OrderStatus.Shipped
    },
    new()
    {
        Email = "eric.brown@example.com",
        FirstName = "Eric",
        LastName = "Brown",
        IsMember = false,
        Status = OrderStatus.Received
    }
};

@Ecss11
Copy link

Ecss11 commented Aug 6, 2022

Forgot my first reply, I see what you are asking, it could be a simple fix by just change "{Binding ListBoxItemCollection}" in Data.xaml.cs to "{Binding ViewModel.ListBoxItemCollection}", hope that will fix the issue. @JeremyWu917

@JeremyWu917
Copy link
Contributor Author

@voidswordQQJ
thanks and it works ☕

@pomianowski pomianowski linked a pull request Aug 13, 2022 that will close this issue
pomianowski added a commit that referenced this issue Aug 13, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working locked-due-to-inactivity
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants