private void mnuFilterCols_BuildSubMenu()
        {
            try
            {
                if (ColumnNameFilters != null)
                {
                    mnuFilterCols = new MenuItem()
                    {
                        Header = ContextMenuChoices.Split(',')[3], FontWeight = FontWeights.Bold
                    };
                    string[] saFilters = ColumnNameFilters.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    foreach (string sFilter in saFilters)
                    {
                        string sTagText   = sFilter;
                        string sMenuTexts = sFilter;
                        if (sFilter.Contains("|"))
                        {
                            sMenuTexts = sFilter.Split('|')[0];
                            sTagText   = sFilter.Split('|')[1];
                        }

                        MenuItem mnuFilter = new MenuItem()
                        {
                            Header = string.Format(ContextMenuChoices.Split(',')[4], sMenuTexts), IsCheckable = true, StaysOpenOnClick = true, Tag = sTagText
                        };
                        mnuFilter.Unchecked += (sender, e) => { mnuFilter_Unchecked(); };
                        mnuFilter.Checked   += (sender, e) => { mnuFilter_Checked(sender); };
                        mnuFilterCols.Items.Add(mnuFilter);
                    }
                }
            }
            catch (Exception ex)
            { StdErrOut(ex, MethodInfo.GetCurrentMethod().Name); }
        }
        private void contextMenu_BuildStaticMenu()
        {
            try
            {
                // mnuFrozenRetain()
                theContextMenu = new ContextMenu()
                {
                    FontSize = 11, StaysOpen = true
                };
                //theContextMenu.KeyDown += (server, e) => { wordFilter = e.Key.ToString(); contextMenu_BuildMenu(); };
                theContextMenu.PreviewKeyDown += (server, e) => { ContextMenu_PreviewKeyDown(e); };

                mnuAlpha = new MenuItem()
                {
                    Header = ContextMenuChoices.Split(',')[0], FontWeight = FontWeights.Bold, IsCheckable = true, StaysOpenOnClick = true
                };
                mnuAlpha.Click += (sender, e) => { contextMenu_BuildMenu(); };

                mnuShowAll = new MenuItem()
                {
                    Header = ContextMenuChoices.Split(',')[1], FontWeight = FontWeights.Bold, IsCheckable = true, StaysOpenOnClick = true
                };
                mnuShowAll.Checked += (sender, e) => { VisibleColumns = AllColumnsHeaders; };
                mnuShowAll.Click   += (sender, e) => { if (mnuShowAll.IsChecked == false)
                                                       {
                                                           VisibleColumns_Initialize();
                                                       }
                };

                mnuFreeze = new MenuItem()
                {
                    Header = ContextMenuChoices.Split(',')[2], FontWeight = FontWeights.Bold, IsCheckable = true, StaysOpenOnClick = true
                };
                mnuFreeze.Checked   += (sender, e) => { dataGrid_FreezeColumns(); };
                mnuFreeze.Unchecked += (sender, e) => { HeaderColumnIndex = 0; dataGrid_FreezeColumns(); };

                mnuRowHeaders = new MenuItem()
                {
                    Header = ContextMenuChoices.Split(',')[3], FontWeight = FontWeights.Bold, IsCheckable = true, StaysOpenOnClick = true
                };
                mnuRowHeaders.Checked   += (sender, e) => { dataGrid.RowHeaderWidth = double.NaN; };
                mnuRowHeaders.Unchecked += (sender, e) => { dataGrid.RowHeaderWidth = 0; };

                mnuFilterCols_BuildSubMenu();

                if (mnuFilterCols != null)
                {
                    theContextMenu.Items.Add(mnuFilterCols);
                }
                theContextMenu.Items.Add(mnuShowAll);
                theContextMenu.Items.Add(mnuFreeze);
                theContextMenu.Items.Add(mnuAlpha);
                theContextMenu.Items.Add(mnuRowHeaders);
            }
            catch (Exception ex)
            { StdErrOut(ex, MethodInfo.GetCurrentMethod().Name); }
        }
 private void dataGrid_FreezeColumns()
 {
     try
     {
         dataGrid.FrozenColumnCount = HeaderColumnIndex;
         mnuFreeze.IsChecked        = HeaderColumnIndex > 0;
         mnuFreeze.Header           =
             ContextMenuChoices.Split(',')[2] + "   " + "".PadRight(dataGrid.FrozenColumnCount, '□') + "|";
         settings_SaveFrozenColumnCount();
     }
     catch (Exception ex)
     { StdErrOut(ex, MethodInfo.GetCurrentMethod().Name); }
 }