ListBoxItem produces “System.Windows.Data Error: 4” binding error

前端 未结 3 1053
粉色の甜心
粉色の甜心 2020-12-14 01:14

I have created the fallowing ListBox:



        
3条回答
  •  半阙折子戏
    2020-12-14 01:40

    Another workaround that worked for me was to suppress these errors (actually, it seems more appropriate to call them warnings) by setting the data binding source switch level as critical in constructor of the class or a top level window -

    #if DEBUG     
        System.Diagnostics.PresentationTraceSources.DataBindingSource.Switch.Level =
            System.Diagnostics.SourceLevels.Critical;
    #endif
    

    Ref.: How to suppress the System.Windows.Data Error warning message

    Update: This is not the best solution but for warnings which are harmful this looks good to me.

提交回复
热议问题