public InferenceWpfControl(AimTemplateTreeInferenceNode inference)
        {
            Inference = inference;
            InitializeComponent();

            _originalBackground = Background;

            // Hide the allowed terms control that is not being used
            if (MaxNumberOfAnswers > 1)
            {
                _comboBox.Visibility = Visibility.Hidden;
                _comboBox.Height = 0;

                var cardinalityString = String.Empty;

                if (Inference.MinCardinality > 0 && Inference.MaxCardinality >= Inference.AllowedTerms.Count)
                    cardinalityString = "Select at least " + Inference.MinCardinality;
                else if (Inference.MaxCardinality < Inference.AllowedTerms.Count && Inference.MinCardinality <= 0)
                    cardinalityString = "Select less than " + (Inference.MaxCardinality + 1);
                else if (Inference.MinCardinality > 0 && Inference.MaxCardinality < Inference.AllowedTerms.Count)
                    cardinalityString = "Select at least " + Inference.MinCardinality + " and less than " +
                                        (Inference.MaxCardinality + 1);

                if (!String.IsNullOrEmpty(cardinalityString))
                    ((TextBlock)_label.Content).Text += Environment.NewLine + cardinalityString;
            }
            else
            {
                _itemsControl.Visibility = Visibility.Hidden;
                _itemsControl.Height = 0;
            }

            // Add confidence control
            if (Inference.ShouldDisplay && Inference.HasConfidence)
            {
                NodeConfidenceWpfControl = new NodeConfidenceWpfControl(Inference);
                _stackPanel.Children.Add(NodeConfidenceWpfControl);
            }

            Loaded += InferenceWpfControlLoaded;

            Inference.SelectedAllowedTermsChanged += SelectedAllowedTermsCollectionChanged;
            CheckBoxControls = new Dictionary<AimTemplateTreeAllowedTerm, CheckBox>();

            if (!Inference.ShouldDisplay)
            {
                this.Visibility = Visibility.Hidden;
                this.Height = 0;
            }
        }
        public static List<aim4_dotnet.InferenceEntity> ToSelectedInferencesList(AimTemplateTreeInferenceNode node)
        {
            var inferences = new List<aim4_dotnet.InferenceEntity>();
            bool isValid = node.Valid;

            double? confidence = null;
            if (node.HasConfidence)
                confidence = node.ConfidenceValue;

            foreach (var term in node.SelectedAllowedTerms)
            {
                inferences.Add(
                    new aim4_dotnet.InferenceEntity
                        {
                            UniqueIdentifier = NewUid,
                            TypeCode = ToNativeCodeList(term),
                            QuestionTypeCode = ToNativeCodeList(node.QuestionType),
                            QuestionIndex = node.ItemNumber,
                            AnnotatorConfidence = confidence,
                            ImageEvidence = true,
                            Label = node.Label,
                            IsPresent = true
                        });
            }

            return inferences;
        }