Beispiel #1
0
        private void ShowArticle()
        {
            StackPanel     sp  = new StackPanel();
            RadRichTextBox rtb = new RadRichTextBox();

            var reqItem = RequirementViewModelLocator.GetRequirementVM().GetRequirement(SelectedItem.ID, null);
            XamlFormatProvider provider = new XamlFormatProvider();
            RadDocument        document;

            if (reqItem.Content != null)
            {
                document = provider.Import(reqItem.Content);
            }
            else
            {
                document = new RadDocument();
            }
            rtb.Document            = document;
            rtb.Document.LayoutMode = DocumentLayoutMode.Flow;
            sp.Children.Add(rtb);

            var window = new RadWindow
            {
                WindowStartupLocation = WindowStartupLocation.CenterOwner,
                Header  = SelectedItem.ArticleHeader,
                Content = sp,
                Width   = 700,
                Height  = 500,
            };

            window.Show();
        }
 private RadDocument GetSampleDocument()
 {
     IDocumentFormatProvider xamlProvider = new XamlFormatProvider();
     using (Stream stream = Application.GetResourceStream(GetResourceUri(SampleDocumentPath)).Stream)
     {
         return xamlProvider.Import(stream);
     }
 }
Beispiel #3
0
        public MainWindow()
        {
            InitializeComponent();

            using (Stream stream = Application.GetResourceStream(new Uri("MailMerge;component/SampleData/SampleData.xaml", UriKind.Relative)).Stream)
            {
                XamlFormatProvider provider = new XamlFormatProvider();
                RadDocument        document = provider.Import(stream);
                this.editor.Document = document;
            }

            this.editor.Document.MailMergeDataSource.ItemsSource = new ExamplesDataContext().Employees;
        }
        public MainPage()
        {
            InitializeComponent();

            using (Stream stream = Application.GetResourceStream(new Uri("MailMerge;component/SampleData/SampleData.xaml", UriKind.Relative)).Stream)
            {
                XamlFormatProvider provider = new XamlFormatProvider();
                RadDocument document = provider.Import(stream);
                this.editor.Document = document;
            }

            this.editor.Document.MailMergeDataSource.ItemsSource = new ExamplesDataContext().Employees;
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Grid          grid          = new Grid();
            RowDefinition rowDefinition = new RowDefinition();

            rowDefinition.Height = GridLength.Auto;
            grid.RowDefinitions.Add(rowDefinition);
            grid.RowDefinitions.Add(new RowDefinition());

            StackPanel panel = new StackPanel();

            panel.Orientation = Orientation.Horizontal;
            panel.SetValue(Grid.RowProperty, 0);

            InsertButton("Print", btnPrint_Click, panel);
            InsertButton("Close", btnClose_Click, panel);

            grid.Children.Add(panel);

            XamlFormatProvider provider        = new XamlFormatProvider();
            string             documentContent = provider.Export(this.radRichTextBox.Document);

            RadRichTextBox rtb = new RadRichTextBox();

            rtb.Document                      = provider.Import(documentContent);
            rtb.IsReadOnly                    = true;
            rtb.IsFocusable                   = false;
            rtb.IsSelectionEnabled            = false;
            rtb.IsContextMenuEnabled          = false;
            rtb.IsSelectionMiniToolBarEnabled = false;
            rtb.SetValue(Grid.RowProperty, 1);

            grid.Children.Add(rtb);

            window.Height           = 100;
            window.Width            = 100;
            this.window.WindowState = WindowState.Maximized;
            this.window.Content     = grid;
            this.window.Show();
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Grid grid = new Grid();
            RowDefinition rowDefinition = new RowDefinition();
            rowDefinition.Height = GridLength.Auto;
            grid.RowDefinitions.Add(rowDefinition);
            grid.RowDefinitions.Add(new RowDefinition());

            StackPanel panel = new StackPanel();
            panel.Orientation = Orientation.Horizontal;
            panel.SetValue(Grid.RowProperty, 0);

            InsertButton("Print", btnPrint_Click, panel);
            InsertButton("Close", btnClose_Click, panel);

            grid.Children.Add(panel);
            
            XamlFormatProvider provider = new XamlFormatProvider();
            string documentContent = provider.Export(this.radRichTextBox.Document);

            RadRichTextBox rtb = new RadRichTextBox();
            rtb.Document = provider.Import(documentContent);
            rtb.IsReadOnly = true;
            rtb.IsFocusable = false;
            rtb.IsSelectionEnabled = false;
            rtb.IsContextMenuEnabled = false;
            rtb.IsSelectionMiniToolBarEnabled = false;
            rtb.SetValue(Grid.RowProperty, 1);

            grid.Children.Add(rtb);

            window.Height = 100;
            window.Width = 100;
            this.window.WindowState = WindowState.Maximized;
            this.window.Content = grid;
            this.window.Show();
        }
        private void ShowArticle(Object element)
        {
            StackPanel     sp  = new StackPanel();
            RadRichTextBox rtb = new RadRichTextBox();

            if (SelectedItem != null)
            {
                var reqItem = RequirementViewModelLocator.GetRequirementVM().GetRequirement(SelectedItem.Requirement_ID, null);
                XamlFormatProvider provider = new XamlFormatProvider();
                RadDocument        document;
                if (reqItem.Content != null)
                {
                    document = provider.Import(reqItem.Content);
                }
                else
                {
                    document = new RadDocument();
                }
                rtb.Document            = document;
                rtb.Document.LayoutMode = DocumentLayoutMode.Flow;
                sp.Children.Add(rtb);


                var window = new RadWindow
                {
                    Header  = SelectedItem.ArticleHeader,
                    Content = sp,
                    Width   = 700,
                    Height  = 500,
                };
                window.WindowStartupLocation = WindowStartupLocation.CenterOwner;
                //Point mousePos = Mouse.GetPosition((IInputElement)element);
                //window.Left = mousePos.X;
                //window.Top = mousePos.Y;
                window.Show();
            }
        }