private void RichTextRibbon_Loaded(object sender, RoutedEventArgs e)
        {
            ParseData();

            InitializeReportTab();

            //Bind the listview
            Binding bind = new Binding();
            if (recipients != null)
            {
                foreach (string key in CustomerInfoCollection.Keys)
                {
                    RibbonComboBoxItem comboBoxItem = new RibbonComboBoxItem() { Content = key };
                    recipients.Items.Add(comboBoxItem);
                }
                recipients.SetBinding(RibbonComboBox.ItemsSourceProperty, bind);
                recipients.SelectionChanged += Recipients_SelectionChanged;
                recipients.SelectedIndex = 0;
            }

        }
        /// <summary>
        /// Handler for Load event of main RichTextBox object
        /// </summary>
        void OnRichTextBox_Loaded(object sender, RoutedEventArgs e)
        {
            this.Resources.MergedDictionaries.Add(Microsoft.Windows.Controls.Ribbon.PopularApplicationSkins.Office2007Black);

            FocusManager.SetIsFocusScope(this, true);
            FocusManager.SetIsFocusScope(this.m_Crl, true);
            FocusManager.SetIsFocusScope(this.m_rbbtPaste, true);
            this.m_rbbtPaste.Focus();
            //### FontFamily
            //object value = this.RichTextBox.Selection.GetPropertyValue(TextElement.FontFamilyProperty);
            //this.SelectRibbonCbxItem(this.m_rcbxFontName,(value == DependencyProperty.UnsetValue) ? null : value.ToString());

            ////### FontSize
            //value = this.RichTextBox.Selection.GetPropertyValue(TextElement.FontSizeProperty);
            //this.SelectRibbonCbxItem(this.m_rcbxFontSize,(value == DependencyProperty.UnsetValue) ? null : String.Format("{0:0}",value.ToString()));

            this.IsSpellCheckEnabled = false;

            //### Fill insert custom text menu
            if (null != this.InsertCustomTextItems)
            {
                foreach (string strTextItem in this.InsertCustomTextItems.Keys)
                {
                    //MenuItem menuItem = new MenuItem();
                    //menuItem.Tag = strTextItem;
                    //menuItem.Header = this.InsertCustomTextItems[strTextItem];
                    //menuItem.Click += new RoutedEventHandler(InsertCustomTextMenuItem_Click);
                    //menuItem.Command = this.m_rbtbBold.Command;

                    //this.m_rbInsertActiveText.Items.Add(menuItem);
                    RibbonComboBoxItem ribbonComboBoxItem = new RibbonComboBoxItem();
                    ribbonComboBoxItem.Content = this.InsertCustomTextItems[strTextItem];
                    ribbonComboBoxItem.Tag = strTextItem;
                    this.m_rbInsertActiveText.Items.Add(ribbonComboBoxItem);
                }
            }
            this.m_rbbtPaste.IsEnabled = true;
        }
        /// <summary>
        /// Constructor
        /// </summary>
        public RichTextEditor()
        {
            InitializeComponent();

            foreach (FontFamily family in System.Windows.Media.Fonts.SystemFontFamilies)
            {
                RibbonComboBoxItem rci = new RibbonComboBoxItem();
                rci.Content = family.Source;
                rci.FontFamily = family;
                rci.FontSize = 13;
                m_rcbxFontName.Items.Add(rci);
            }

            this.CommandBindings.Add(new CommandBinding(RichTextEditor.HotKeySave, this.SaveDocCommandExecuted));
            RichTextEditor.HotKeySave.InputGestures.Add(new KeyGesture(Key.S, ModifierKeys.Alt));

            this.CommandBindings.Add(new CommandBinding(RichTextEditor.HotKeySaveAs, this.SaveAsDocCommandExecuted));
            RichTextEditor.HotKeySaveAs.InputGestures.Add(new KeyGesture(Key.A, ModifierKeys.Alt));

            this.CommandBindings.Add(new CommandBinding(RichTextEditor.HotKeyOpen, this.OpenDocCommandExecuted));
            RichTextEditor.HotKeyOpen.InputGestures.Add(new KeyGesture(Key.O, ModifierKeys.Control));

            this.CommandBindings.Add(new CommandBinding(RichTextEditor.HotKeyUndo, this.UndoCommandExecuted));
            RichTextEditor.HotKeyUndo.InputGestures.Add(new KeyGesture(Key.Z, ModifierKeys.Control));

            this.CommandBindings.Add(new CommandBinding(RichTextEditor.HotKeyRedo, this.RedoCommandExecuted));
            RichTextEditor.HotKeyRedo.InputGestures.Add(new KeyGesture(Key.Y, ModifierKeys.Control));

            this.CommandBindings.Add(new CommandBinding(RichTextEditor.HotKeyNew, this.NewDocCommandExecuted));
            RichTextEditor.HotKeyNew.InputGestures.Add(new KeyGesture(Key.N, ModifierKeys.Control));

            this.BindRibbonCommands();

            /**/
            //### Attach background handler to update edit control's UI when RichTextBox's selection changes.
            this.RichTextBox.Selection.Changed += new EventHandler(OnRichTextBox_SelectionChanged);
            this.RichTextBox.ContextMenuOpening += new ContextMenuEventHandler(OnRichTextBox_ContextMenuOpening);
            this.RichTextBox.TextChanged += new TextChangedEventHandler(OnRichTextBox_TextChanged);

            this.RichTextBox.Loaded += new RoutedEventHandler(OnRichTextBox_Loaded);

            //### Enforce the first update. MiscCommands.InstallTableCallbacks(this.m_RTB);
            this.OnRichTextBox_SelectionChanged(this, null);
            this.Document.FontFamily = new FontFamily("Tahoma");
            this.m_RTB.FontFamily = new FontFamily("Tahoma");
            this.DataContext = this;

            this.m_colorPickerFont.ColorAutomatic = Brushes.Black.Color;
            this.m_colorBackgroundPickerFont.ColorAutomatic = Brushes.White.Color;

            this.m_colorPickerFont.ColorChanged += new ColorChangedEventHandler(OnFontColorChanged);
            this.m_colorBackgroundPickerFont.ColorChanged += new ColorChangedEventHandler(OnFontBackgroundColorChanged);
        }