dotnet / dotnet/wpf

Error validation template does not actualised within ListView and DisplayMemberBinding

Open
#3,755 2 comments 0 reactions 0 assignees View on GitHub
.NET Framework Bug
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

_This issue has been moved from [a ticket on Developer Community](https://developercommunity2.visualstudio.com/t/Error-validation-template-does-not-actua/798111)._

---
Hello,

I've registered a very strange behaviour within ListView, DisplayMemberBinding and IDataErrorInfo.

Once a model implements IDataErrorInfo and INotifyPropertyChanged I can easily achieve a red adorner border - not a big deal.

But things went strange, If ListView together with DisplayMemberBinding are in use. I found out, tis behaviour was already submitted to Microsoft Connect with FeedbackID=336325. But the site is closed.

The problem is, once DataContext is bound, adorner layer border is not changed even if error is revalidated. The last one can be easily debugged. Interestingly enough, similar behaviour is notified if control goes invisible - the red border is still visible.

On the other hand, if CellTemplate/DataTemplate/Binding is used instead of DisplayMemberBinding all works as expected. In my opinion this is some sort of bug.

So, a workaround is possible but, for my case, is hard to realize because there a lot of existing custom controls/views/etc. and a lot of not more maintenable templates where templated GridViewColumn's may not work at all - it canresults in month of work to manually refactor all that. And, Loaded-event is actually heavily in use due to some specific architecture - it is currently nearly impossible (by a working hours) to redevelop all this.

I've also tried to use resource template and attached property - but don't sort it out how to define rebindable attached property.

In order to demonstrate what I mean, sample simple project, stripped down from a big project, is attached. Here is a list view within some columns binded to the same property. Columns 3 and 4 are not really working because of usage of attached property. Column 1 has a desired behaviour and used internal DataTemplate, column 2 uses DisplayMemberBinding and does not work as expected.

So, my question are:
- would it be fixed soon ?
- is some universal workaround here?

Many thanks.

Alexander Landa

---
### Original Comments

#### blaha muha on 10/29/2019, 11:45 PM:

(private comment, text removed)
#### Feedback Bot on 10/30/2019, 04:06 PM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

#### blaha muha on 10/30/2019, 05:00 PM:

Thank you!

#### blaha muha on 11/5/2019, 04:32 AM:

Hello, any progress here?

#### Siddhant Tanpure [MSFT] on 11/6/2019, 07:26 AM:

Hi Alexander Landa,

Thanks for contacting!

Could you please provide either gif or screenshots of the problem with short description? I looked at the project and I couldn’t understand what is the behavior you are expecting?

Do you have a link to this FeedbackID=336325?

Take a look at the use of ValidatesOnDataErrors to understand the red border problem: https://docs.microsoft.com/en-us/dotnet/api/system.windows.data.binding.validatesondataerrors?f1url=https%3A%2F%2Fmsdn.microsoft.com%2Fquery%2Fdev16.query%3FappId%3DDev16IDEF1%26l%3DEN-US%26k%3Dk(System.Windows.Data.Binding.ValidatesOnDataErrors);k(VS.XamlEditor);k(TargetFrameworkMoniker-.NETFramework,Version%3Dv4.6.1)%26rd%3Dtrue&view=netframework-4.8

#### blaha muha on 11/6/2019, 07:51 AM:

Hello and thank you,.

The screenshoot will not help, either screencast.

But I've described exactly how to reproduce:

after start "Column 1 has a desired behaviour and used internal DataTemplate, column 2 uses DisplayMemberBinding and does not work as expected."

The link to FeedbackID=336325 is dead, because MS has removed their (old?) feedback site completelly from the web.

#### Siddhant Tanpure [MSFT] on 11/6/2019, 08:50 AM:

Hi,


Could you please elaborate on column 2 uses DisplayMemberBinding and does not work as expected? What is the expected behavior? I can see value getting populated correctly in the project.

#### blaha muha on 11/6/2019, 09:15 AM:

Expected behavior on column 2 is like column 1. They both bound to the same property. Do you noticed a difference? Value is correct, but not the red border.

#### Siddhant Tanpure [MSFT] on 11/6/2019, 09:29 AM:

Hi, I am getting same behavior for both columns.

Both columns first value is empty with red box and after 5 seconds all textblocks become red box and empty.

#### blaha muha on 11/7/2019, 07:07 AM:

Hi, I have a different behavior in first and second columns on a first line of listview - the first has no red border, but the second one.

Do you use the same .NET-Framework version as in zipped example? May be you can attach a screenshoot from your PC, because something works/looks different.

Thank you.

#### blaha muha on 11/7/2019, 07:13 AM:

The similar wrong behavor is also described here:

https://social.msdn.microsoft.com/Forums/vstudio/en-US/90b21dfc-6a66-4d40-835f-8051b765637a/possible-bug-with-style-application-in-listview-please-confirm?forum=wpf

And this was considered as a bug by MSFT-member. 11 years ago...

#### blaha muha on 11/7/2019, 04:54 PM:

(private comment, text removed)
#### blaha muha on 11/8/2019, 08:17 AM:

Any progress here? I've already spend a lot of time with all this stuff trying to achieve expected results by overriding TexBox templates and others, but nothing does helped.

#### Siddhant Tanpure [MSFT] on 11/8/2019, 08:20 AM:

Hi Blaha muha,


Sorry, Yes, I see the same behavior and I have directed your feedback to WPF team. Thanks for pointing out the problem.

#### Feedback Bot on 11/20/2019, 11:04 AM:

We will close this report in 7 days because we don’t have enough information to investigate further. To keep the problem open, please provide the requested details.
#### blaha muha on 11/20/2019, 04:26 PM:

Hello,

can you please explain, what the heck is going on ?!!!!

There is an attached file to investigate. You staff member wrote "Sorry, Yes, I see the same behavior and I have directed your feedback to WPF team. Thanks for pointing out the problem.".

But now you write "we don’t have enough information to investigate further." !


It's always the same reaction to customer problems since years! Some bugs are still in framework since many years because nobody will fix them. Shame, really.


#### Siddhant Tanpure [MSFT] on 11/21/2019, 01:50 AM:

​Hi Blaha muha,


That was system generated message please ignore.


We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback.

#### Feedback Bot on 12/5/2019, 05:12 PM:

I have detected that for the last 35 days, this issue didn't have much product team activity and a very small amount of new votes or comments. Based on this, its severity, and affected area, it’s my experience that this issue is very unlikely to be fixed.
#### blaha muha on 12/5/2019, 05:22 PM:

If I understand correctly, you don't want to fix a bug. This bug is mostly underrated and affects seriosly our production software, which in turn can affect > 50.000 members - this is not a joke and not very funny. Ok, still wait the damage becames bigger... Thank you for nothing.

---
### Original Solutions
(no solutions)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.