public FrameworkElement CreateControl(FormItemContext context) { MatchResult result = MatchResult.No; ControlSinkBase selectedSink = null; lock (_lock) { for (int i = 0; i < _sinklist.Count; i++) { var tempresult = _sinklist[i].MatchTest(context); if (tempresult > result) { result = tempresult; selectedSink = _sinklist[i]; } } } if (result == MatchResult.No) { throw new Exception(string.Format("No suitable Control Sink for {0}.{1}", context.DataType.Name, context.PropertyInfo.Name)); } else { return(selectedSink.CreateControl(context)); } }
public void AddSink(ControlSinkBase sink) { lock (_lock) { _sinklist.Add(sink); } }