public PMCCProperties(
            DashboardHelper dashboardHelper,
            IGadget gadget,
            PMCCParameters parameters,
            List <Grid> strataGridList
            )
        {
            InitializeComponent();
            this.DashboardHelper = dashboardHelper;
            this.Gadget          = gadget;
            this.Parameters      = parameters;
            this.StrataGridList  = strataGridList;

            List <string> fields       = new List <string>();
            List <string> weightFields = new List <string>();
            List <string> strataItems  = new List <string>();

            //Variable fields
            fields.Add(String.Empty);
            ColumnDataType columnDataType = ColumnDataType.Boolean | ColumnDataType.DateTime | ColumnDataType.Numeric | ColumnDataType.Text | ColumnDataType.UserDefined;

            foreach (string fieldName in DashboardHelper.GetFieldsAsList(columnDataType))
            {
                if (DashboardHelper.IsUsingEpiProject)
                {
                    if (!(fieldName == "RecStatus"))
                    {
                        fields.Add(fieldName);
                    }
                }
                else
                {
                    fields.Add(fieldName);
                }
            }

            if (fields.Contains("SYSTEMDATE"))
            {
                fields.Remove("SYSTEMDATE");
            }

            //Weight Fields
            //weightFields.Add(String.Empty);
            //columnDataType = ColumnDataType.Numeric | ColumnDataType.UserDefined;
            //foreach (string fieldName in DashboardHelper.GetFieldsAsList(columnDataType))
            //{
            //    if (DashboardHelper.IsUsingEpiProject)
            //    {
            //        if (!(fieldName == "RecStatus")) weightFields.Add(fieldName);
            //    }
            //    else
            //    {
            //        weightFields.Add(fieldName);
            //    }
            //}
            //weightFields.Sort();

            //Strata Fields
            strataItems.Add(String.Empty);
            columnDataType = ColumnDataType.Numeric | ColumnDataType.Boolean | ColumnDataType.Text | ColumnDataType.UserDefined;
            foreach (string fieldName in DashboardHelper.GetFieldsAsList(columnDataType))
            {
                if (DashboardHelper.IsUsingEpiProject)
                {
                    if (!(fieldName == "RecStatus" || fieldName == "FKEY" || fieldName == "GlobalRecordId"))
                    {
                        strataItems.Add(fieldName);
                    }
                }
                else
                {
                    strataItems.Add(fieldName);
                }
            }

            if (DashboardHelper.IsUsingEpiProject)
            {
                if (fields.Contains("RecStatus"))
                {
                    fields.Remove("RecStatus");
                }
                if (weightFields.Contains("RecStatus"))
                {
                    weightFields.Remove("RecStatus");
                }

                if (strataItems.Contains("RecStatus"))
                {
                    strataItems.Remove("RecStatus");
                }
                if (strataItems.Contains("FKEY"))
                {
                    strataItems.Remove("FKEY");
                }
                if (strataItems.Contains("GlobalRecordId"))
                {
                    strataItems.Remove("GlobalRecordId");
                }
            }

            List <string> allFieldNames = new List <string>();

            allFieldNames.AddRange(fields);
            allFieldNames.AddRange(DashboardHelper.GetAllGroupsAsList());

            cbxExposureField.ItemsSource = allFieldNames;
            cbxOutcomeField.ItemsSource  = fields;
            //cbxFieldWeight.ItemsSource = weightFields;
            lbxFieldStrata.ItemsSource = strataItems;

            if (cbxExposureField.Items.Count > 0)
            {
                cbxExposureField.SelectedIndex = -1;
                cbxOutcomeField.SelectedIndex  = -1;
            }

            //if (cbxFieldWeight.Items.Count > 0)
            //{
            //    cbxFieldWeight.SelectedIndex = -1;
            //}

            CollectionView           view             = (CollectionView)CollectionViewSource.GetDefaultView(cbxExposureField.ItemsSource);
            PropertyGroupDescription groupDescription = new PropertyGroupDescription("VariableCategory");

            view.GroupDescriptions.Add(groupDescription);

            RowFilterControl = new RowFilterControl(this.DashboardHelper, Dialogs.FilterDialogMode.ConditionalMode, (gadget as PMCCControl).DataFilters, true);
            RowFilterControl.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            panelFilters.Children.Add(RowFilterControl);

            txtMaxColumnLength.PreviewKeyDown += new KeyEventHandler(txtInput_PositiveIntegerOnly_PreviewKeyDown);

            #region Translation

            lblConfigExpandedTitleTxt.Text = DashboardSharedStrings.GADGET_CONFIG_TITLE_MPC_CONTROL;
            tbtnVariables.Title            = DashboardSharedStrings.GADGET_TABBUTTON_VARIABLES;
            tbtnVariables.Description      = DashboardSharedStrings.GADGET_TABDESC_EXPOSURE_OUTCOME;
            tbtnValueMapping.Title         = DashboardSharedStrings.GADGET_TABBUTTON_DEFINE_VALMAPPING;
            tbtnValueMapping.Description   = DashboardSharedStrings.GADGET_SPECIFY_EXPOSURE_OUTCOME;
            tbtnDisplay.Title                 = DashboardSharedStrings.GADGET_TABBUTTON_DISPLAY;
            tbtnDisplay.Description           = DashboardSharedStrings.GADGET_TABDESC_DISPLAY;
            tbtnFilters.Title                 = DashboardSharedStrings.GADGET_TABBUTTON_FILTERS;
            tbtnFilters.Description           = DashboardSharedStrings.GADGET_TABDESC_FILTERS;
            tblockPanelVariables.Content      = DashboardSharedStrings.GADGET_PANELHEADER_VARIABLES;
            tblockPanelValueMappingTxt.Text   = DashboardSharedStrings.GADGET_DEFINE_VALUE_MAPPING;
            tblockPanelDisplayTxt.Text        = DashboardSharedStrings.GADGET_PANELHEADER_DISPLAY;
            tblockExposureField.Text          = DashboardSharedStrings.GADGET_EXPOSURE_VARIABLE;
            tblockOutcomeField.Text           = DashboardSharedStrings.GADGET_CASE_CONTROL;
            tblockStrataVariable.Text         = DashboardSharedStrings.GADGET_PAIR_GROUP_ID;
            tblockAllValues.Text              = DashboardSharedStrings.GADGET_ALL_VALUES;
            tblockYesValues.Text              = DashboardSharedStrings.GADGET_YES_VALUES;
            tblockNoValues.Text               = DashboardSharedStrings.GADGET_NO_VALUES;
            tblockTitleNDescSubheaderTxt.Text = DashboardSharedStrings.GADGET_PANELSUBHEADER_TITLENDESC;
            tblockTitleTxt.Text               = DashboardSharedStrings.GADGET_GADET_TITLE;
            tblockDescTxt.Text                = DashboardSharedStrings.GADGET_DESCRIPTION;
            tblockPanelDataFilter.Content     = DashboardSharedStrings.GADGET_PANELHEADER_DATA_FILTER;
            tblockAnyFilterGadgetOnly.Content = DashboardSharedStrings.GADGET_FILTER_GADGET_ONLY;
            btnOKTxt.Text     = DashboardSharedStrings.BUTTON_OK;
            btnCancelTxt.Text = DashboardSharedStrings.BUTTON_CANCEL;
            ////expanderAdvancedOptions.Header = DashboardSharedStrings.GADGET_ADVANCED_OPTIONS;
            ////expanderDisplayOptions.Header = DashboardSharedStrings.GADGET_DISPLAY_OPTIONS;
            //tblockMainVariable.Text = DashboardSharedStrings.GADGET_FREQUENCY_VARIABLE;
            //tblockStrataVariable.Text = DashboardSharedStrings.GADGET_STRATA_VARIABLE;
            //tblockWeightVariable.Text = DashboardSharedStrings.GADGET_WEIGHT_VARIABLE;

            ////checkboxAllValues.Content = DashboardSharedStrings.GADGET_ALL_LIST_VALUES;
            ////checkboxCommentLegalLabels.Content = DashboardSharedStrings.GADGET_LIST_LABELS;
            //checkboxIncludeMissing.Content = DashboardSharedStrings.GADGET_INCLUDE_MISSING;

            //checkboxSortHighLow.Content = DashboardSharedStrings.GADGET_SORT_HI_LOW;
            //checkboxUsePrompts.Content = DashboardSharedStrings.GADGET_USE_FIELD_PROMPT;
            ////tblockOutputColumns.Text = DashboardSharedStrings.GADGET_OUTPUT_COLUMNS_DISPLAY;
            ////tblockPrecision.Text = DashboardSharedStrings.GADGET_DECIMALS_TO_DISPLAY;

            //tblockRows.Text = DashboardSharedStrings.GADGET_MAX_ROWS_TO_DISPLAY;
            //tblockBarWidth.Text = DashboardSharedStrings.GADGET_MAX_PERCENT_BAR_WIDTH;

            ////btnRun.Content = DashboardSharedStrings.GADGET_RUN_BUTTON;
            #endregion // Translation
        }
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            this.DashboardHelper = DashboardHelper;
            PMCCParameters pmccParameters = (PMCCParameters)Parameters;

            //rctLowColor.Fill = pmccParameters.LoColorFill;
            //rctHighColor.Fill = pmccParameters.HiColorFill;

            //Variables settings
            if (Parameters.ColumnNames.Count > 0)
            {
                cbxExposureField.SelectedItem = Parameters.ColumnNames[0];
            }
            cbxOutcomeField.SelectedItem = Parameters.CrosstabVariableName;
            //cbxFieldWeight.SelectedItem = Parameters.WeightVariableName;
            lbxFieldStrata.MaxHeight = lbxFieldStrata.MaxHeight + (System.Windows.SystemParameters.PrimaryScreenHeight - 768.0);
            //scrollViewerStrataProperties.Height = scrollViewerStrataProperties.Height + (System.Windows.SystemParameters.PrimaryScreenHeight - 768.0);
            if (Parameters.StrataVariableNames.Count > 0)
            {
                foreach (string s in Parameters.StrataVariableNames)
                {
                    //lbxFieldStrata.SelectedItem = s;
                    lbxFieldStrata.SelectedItems.Add(s.ToString());
                }
            }

            //2 x 2 Value mapping settings
            Update2x2ValueMappings();
            if (pmccParameters.ColumnNames.Count > 0)
            {
                //foreach (string s in yesValues)
                foreach (string s in pmccParameters.YesValues)
                {
                    if (lbxAllValues.Items.Contains(s))
                    {
                        lbxYesValues.Items.Add(s);
                        lbxAllValues.Items.Remove(s);
                    }
                }

                foreach (string s in pmccParameters.NoValues)
                {
                    if (lbxAllValues.Items.Contains(s))
                    {
                        lbxNoValues.Items.Add(s);
                        lbxAllValues.Items.Remove(s);
                    }
                }
            }

            //Display settings
            txtTitle.Text = Parameters.GadgetTitle;
            txtDesc.Text  = Parameters.GadgetDescription;
            checkboxAllValues.IsChecked          = Parameters.ShowAllListValues;
            checkboxCommentLegalLabels.IsChecked = Parameters.ShowCommentLegalLabels;
            checkboxIncludeMissing.IsChecked     = Parameters.IncludeMissing;
            //checkboxOutcomeContinuous.IsChecked = pmccParameters.TreatOutcomeAsContinuous;
            //checkboxSmartTable.IsChecked = pmccParameters.SmartTable;
            //checkboxStrataSummaryOnly.IsChecked = pmccParameters.StrataSummaryOnly;
            //checkboxRowColPercents.IsChecked = pmccParameters.ShowPercents;
            //checkboxHorizontal.IsChecked = pmccParameters.HorizontalDisplayMode;
            //txtMaxColumnLength.Text = pmccParameters.MaxColumnNameLength;

            //Color and style settings
            //checkboxConditionalShading.IsChecked = pmccParameters.ConditionalShading;

            //color gradient
            //cmbBreakType.SelectedIndex = int.Parse(pmccParameters.BreakType.ToString());
            //if (!String.IsNullOrEmpty(pmccParameters.Break1))
            //{
            //    txtPct1.Text = pmccParameters.Break1;
            //}
            //else
            //{
            //    txtPct1.Text = "0";
            //}
            //if (!String.IsNullOrEmpty(pmccParameters.Break2))
            //{
            //    txtPct2.Text = pmccParameters.Break2;
            //}
            //else
            //{
            //    txtPct2.Text = "20";
            //}
            //if (!String.IsNullOrEmpty(pmccParameters.Break3))
            //{
            //    txtPct3.Text = pmccParameters.Break3;
            //}
            //else
            //{
            //    txtPct3.Text = "40";
            //}
            //if (!String.IsNullOrEmpty(pmccParameters.Break4))
            //{
            //    txtPct4.Text = pmccParameters.Break4;
            //}
            //else
            //{
            //    txtPct4.Text = "60";
            //}
            //if (!String.IsNullOrEmpty(pmccParameters.Break5))
            //{
            //    txtPct5.Text = pmccParameters.Break5;
            //}
            //else
            //{
            //    txtPct5.Text = "80";
            //}

            CheckVariables();
        }