private static string CaptureBindingExpression()
 {
     return($@"((BindingExpression:{WpfOutputParser.CaptureBindingPath()}; {WpfOutputParser.CaptureDataItem()}; )|(MultiBindingExpression:)){WpfOutputParser.CaptureTargetElement()}; {WpfOutputParser.CaptureTargetProperty()}");
 }
 private static string CaptureTargetElement()
 {
     return($@"target element is {WpfOutputParser.CaptureItem(nameof(WpfEntry.TargetElementType), nameof(WpfEntry.TargetElementName))}");
 }
        public WpfOutputParser()
            : base(WpfOutputParser.ProcessTextPattern)
        {
            this.AddRegex(WpfTraceCode.CannotCreateDefaultValueConverter,
                          $@"Cannot create default converter to perform '(one-way|two-way)' conversions between types '(?<{WpfEntry.SourceFullType}>.+?)' and '(?<{WpfEntry.TargetFullType}>.+?)'\. Consider using Converter property of Binding\. {WpfOutputParser.CaptureBindingExpression()}");

            this.AddRegex(WpfTraceCode.NoMentor,
                          $@"Cannot find governing FrameworkElement or FrameworkContentElement for target element\. {WpfOutputParser.CaptureBindingExpression()}");

            this.AddRegex(WpfTraceCode.NoSource,
                          $@"Cannot find source for binding with reference '(?<{WpfEntry.ExtraInfo}>.+?)'\. {WpfOutputParser.CaptureBindingExpression()}");

            this.AddRegex(WpfTraceCode.BadValueAtTransfer,
                          $@"Value produced by BindingExpression is not valid for target property\.((; Value=)| (?<DataValueType>.+?):)'(?<DataValue>.+?)' {WpfOutputParser.CaptureBindingExpression()}");

            this.AddRegex(WpfTraceCode.BadConverterForTransfer,
                          $@"'.*?' converter failed to convert value '(?<DataValue>.*?)' \(type '(?<DataValueType>.*?)'\); fallback value will be used, if available\. {WpfOutputParser.CaptureBindingExpression()}(?<{WpfEntry.ExtraInfo}>.*)");

            this.AddRegex(WpfTraceCode.NoValueToTransfer,
                          $@"Cannot retrieve value using the binding and no valid fallback value exists; using default instead\. {WpfOutputParser.CaptureBindingExpression()}");

            this.AddRegex(WpfTraceCode.CannotGetClrRawValue,
                          $@"Cannot get '.*?' value \(type '.*?'\) from '.*?' \(type '.*?'\)\. {WpfOutputParser.CaptureBindingExpression()}(?<{WpfEntry.ExtraInfo}>.*)");

            this.AddRegex(WpfTraceCode.MissingInfo,
                          $@"BindingExpression cannot retrieve value due to missing information\. {WpfOutputParser.CaptureBindingExpression()}");

            this.AddRegex(WpfTraceCode.NullDataItem,
                          $@"BindingExpression cannot retrieve value from null data item\. This could happen when binding is detached or when binding to a Nullable type that has no value\. {WpfOutputParser.CaptureBindingExpression()}");

            this.AddRegex(WpfTraceCode.ClrReplaceItem,
                          $@"BindingExpression path error: '(?<{nameof(WpfEntry.SourceProperty)}>.+?)' property not found on '(object|current item of collection)' '{WpfOutputParser.CaptureItem(nameof(WpfEntry.SourcePropertyType), nameof(WpfEntry.SourcePropertyName))}'\. {WpfOutputParser.CaptureBindingExpression()}");

            this.AddRegex(WpfTraceCode.NullItem,
                          $@"BindingExpression path error: '(?<{WpfEntry.ExtraInfo}>.*?)' property not found for '(?<{WpfEntry.ExtraInfo2}>.*?)' because data item is null\.  This could happen because the data provider has not produced any data yet\. {WpfOutputParser.CaptureBindingExpression()}");
        }
 private static string CaptureDataItem()
 {
     return($@"DataItem={WpfOutputParser.CaptureItem(nameof(WpfEntry.DataItemType), nameof(WpfEntry.DataItemName))}");
 }