question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Binding-Error with ListBoxItem style

See original GitHub issue

Hello,

there is a issue with the properties “HorizontalContentAlignment” and “VerticalContentAlignment” in conjunction with the ListBoxItem style. This is the error message which is shown in the Output-Window:

error

This error occurs if the ItemsSource of the ListBox is binded to a ObservableCollection an their elements change. The error message is not displayed when I do the following:

<Style TargetType="{x:Type ListBoxItem}" BasedOn="{StaticResource {x:Type ListBoxItem}}"> <Setter Property="HorizontalContentAlignment" Value="Left" /> <Setter Property="VerticalContentAlignment" Value="Top" /> </Style>

But that is not a good solution. I hope that this bug will be corrected. Thanks! 😃

Sorry for my bad English. 😄

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
TysonMNcommented, Oct 20, 2020

I think I have a fix too. I will continue working on this tomorrow.

0reactions
TysonMNcommented, Oct 20, 2020

Uploading sample project for historical reference. MaterialDesignInXamlToolkit_922-main.zip

I was planning on attaching a ZIP after I thought this issue is resolved (and I delete that repo). I thought you prefered a GitHub repo like that over an attached ZIP since the new issue template says

Seriously consider creating and linking to a test repo which takes absolutely minimal setup to illustrate how reproduce the problem.

My time is limited and .Zip files, code snippets and partial examples are often a time sink. GitHub also provides great communication and code review tools which can be utilised. … Post a full GitHub repository. Not a zip file, half baked snippet etc. …

Sorry for not also attaching a ZIP of the MWE.

Read more comments on GitHub >

github_iconTop Results From Across the Web

wpf - ListBoxItem style in <ListBox.Resources> or in < ...
Try setting OverridesDefaultStyle in the ItemContainerStyle ListBoxItem style to true to remove the binding error.
Read more >
Binding Failures in WPF - Microsoft Q&A
I get endless binding failures: (: 'System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource ...
Read more >
Problem when using ListBox ItemTemplate
I am trying to create 2 columns in the listbox with headers but I keep getting a binding error. The dataset has a...
Read more >
C# 6.0 and the .NET 4.6 Framework - Page 1365 - Google Books Result
Empty; } } Run the app, select one of the vehicles, and add text for the model ... and cause the error template...
Read more >
[Solved]-Binding Error 4 on Listview-Style-wpf
Parallel processing using the AForge.Net library and C#. ListBox in devexpress gridview in c# · RSACryptoServiceProvider helper · Check for column and bind...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found