using C1.Xaml.RichTextBox;
using C1.Xaml.RichTextBox.Documents;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

// The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236

namespace AppBar.Tools
{
    public sealed partial class InsertTableTool : UserControl
    {
        public C1RichTextBox RichTextBox
        {
            get;
            set;
        }

        public InsertTableTool(C1RichTextBox rtb)
        {
            this.InitializeComponent();
            RichTextBox = rtb;
        }

        private void btnInsertTable_Click(object sender, RoutedEventArgs e)
        {
            int rows = (int)numRowsBox.Value;
            int cols = (int)numColsBox.Value;
            if (RichTextBox != null && rows > 0 && cols > 0)
                RichTextBox.Selection.Start.InsertTable(rows, cols);
        }
    }
}
