public static void SetTrace(SourceLevels level, TraceOptions options)
        {
            if (_listener == null)
              {
            _listener = new BindingErrorTraceListener();
            PresentationTraceSources.DataBindingSource.Listeners.Add(_listener);
              }

              _listener.TraceOutputOptions = options;
              PresentationTraceSources.DataBindingSource.Switch.Level = level;
        }
        public static void CloseTrace()
        {
            if (_listener == null)
              {
            return;
              }

              _listener.Flush();
              _listener.Close();
              PresentationTraceSources.DataBindingSource.Listeners.Remove(_listener);
              _listener = null;
        }