public void ShowDialogInternal(Inline orgInline, Action<Inline, Inline> replaceCurrentImageCallback, string executeToolName, RadRichTextBox owner)
        {
            this.SetOwner(owner);
            this.originalInline = orgInline;
            if (orgInline is ImageInline)
            {
                this.originalImageInline = (ImageInline)orgInline;
            }
            else if (orgInline is FloatingImageBlock)
            {
                this.originalImageInline = ((FloatingImageBlock)orgInline).ImageInline;
            }
            else
            {
                throw new InvalidOperationException("Unable to find image element.");
            }

            RadBitmap image = new RadBitmap(this.originalImageInline.ImageSource);
            this.isRotated = false;
            this.originalAspect = new Size(this.originalImageInline.Width / image.Width, this.originalImageInline.Height / image.Height);
            this.originalRotateAngle = this.originalImageInline.RotateAngle;


            this.replaceCurrentImageCallback = replaceCurrentImageCallback;
            this.ImageEditorUI.Image = image;

            this.ShowDialog();
            this.StartExecuteTool(executeToolName);
        }
        private void ShowDialogInternal(Inline targetInline, Action<Inline, Inline> replaceCallback, RadRichTextBox owner)
        {
            if (targetInline is ImageInline)
            {
                this.originalImageInline = (ImageInline)targetInline;
            }
            else if (targetInline is FloatingImageBlock)
            {
                this.originalImageInline = ((FloatingImageBlock)targetInline).ImageInline;
            }
            else
            {
                throw new InvalidOperationException("Unable to find image element.");
            }
            this.SetOwner(owner);
            this.replaceCurrentInlineCallback = replaceCallback;
            this.originalInline = targetInline;

            this.ShowDialog();

            this.Dispatcher.BeginInvoke(new Action(() =>
            {
                this.FillUI(this.originalInline);
            }));
        }
 public void InitializeComponent() {
     if (_contentLoaded) {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/Procbel.Apps.Silverlight.Modules.Incidencias;component/Views/CreateTicketUserCon" +
                 "trol.xaml", System.UriKind.Relative));
     this.HtmlProvider = ((HtmlDataProvider)(this.FindName("HtmlProvider")));
     this.richTextBox = ((RadRichTextBox)(this.FindName("richTextBox")));
 }
        private void ShowDialogInternal(SpellCheckingUIManager spellCheckingUIManager, RadRichTextBox owner)
        {
            this.spellCheckingUIManager = spellCheckingUIManager;
            this.SetOwner(owner);

            if (this.TryLoadIncorrectSentence())
            {
                this.buttonEditCustomDictionary.IsEnabled = spellCheckingUIManager.HasCustomDictionary();
                this.ShowDialog();
            }
        }
 public void InitializeComponent() {
     if (_contentLoaded) {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/Procbel.Apps.Silverlight.Modules.Incidencias;component/Views/EditTicketUserContr" +
                 "ol.xaml", System.UriKind.Relative));
     this.HtmlProvider = ((HtmlDataProvider)(this.FindName("HtmlProvider")));
     this.richTextBox = ((RadRichTextBox)(this.FindName("richTextBox")));
     this.uploadBackground = ((System.Windows.Shapes.Rectangle)(this.FindName("uploadBackground")));
     this.RadUpload1 = ((RadUpload)(this.FindName("RadUpload1")));
 }
Пример #6
0
        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();
        }
Пример #7
0
 private void EnableEditableFields(RadRichTextBox richTextBox)
 {
     this.tbReplaceText.IsEnabled = richTextBox.IsReadOnly;
 }
Пример #8
0
        private void ShowDialogInternal(Inline targetInline, Action <Inline, Inline> replaceCallback, RadRichTextBox owner)
        {
            if (targetInline is ImageInline)
            {
                this.originalImageInline = (ImageInline)targetInline;
            }
            else if (targetInline is FloatingImageBlock)
            {
                this.originalImageInline = ((FloatingImageBlock)targetInline).ImageInline;
            }
            else
            {
                throw new InvalidOperationException("Unable to find image element.");
            }
            this.SetOwner(owner);
            this.replaceCurrentInlineCallback = replaceCallback;
            this.originalInline = targetInline;

            this.FillUI(this.originalInline);
            this.ShowDialog();
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="CustomSpellCheckerMenuBuilder"/> class. 
 /// </summary>
 /// <param name="radRichTextBox">
 /// The RadRichTextBox to create spell check suggestion for.
 /// </param>
 /// <param name="incorrectWordInfo">
 /// Info about the incorrect word.
 /// </param>
 public CustomSpellCheckerMenuBuilder(RadRichTextBox radRichTextBox, WordInfo incorrectWordInfo)
 {
     _radRichTextBox = radRichTextBox;
     _incorrectWordInfo = incorrectWordInfo;
 }
 public void RegisterCommand(RoutedCommand command, Key key, ModifierKeys modifierKeys = ModifierKeys.None, object commandParameter = null)
 {
     RadRichTextBox.RegisterCommand(command, key, modifierKeys, commandParameter);
 }
Пример #11
0
        private void ShowDropMarker(RadRichTextBox richTextBox, DragEventArgs e)
        {
            var viewPoint = e.GetPosition(richTextBox);
            var position = richTextBox.ActiveEditorPresenter.GetDocumentPositionFromViewPoint(viewPoint);

            richTextBox.ActiveEditorPresenter.UpdateScrollOffsetFromDocumentPosition(position);
            richTextBox.ActiveEditorPresenter.ShowDropMarker(position);
        }
Пример #12
0
        private void ShowDialogInternal(StyleDefinition defaultStyle, Action <StyleDefinition> applyCallback, RadRichTextBox owner)
        {
            this.defaultStyle  = defaultStyle;
            this.applyCallback = applyCallback;
            this.SetOwner(owner);
            StyleUIHelper helper = new StyleUIHelper(owner);

            FontFamily fontFamily     = helper.GetFontFamilyOfSpanStyle();
            double?    fontSize       = helper.GetFontSizeOfSpanStyle();
            Color?     foreColor      = helper.GetForeColorOfSpanStyle();
            Color?     highlightColor = helper.GetHighlightColorOfSpanStyle();
            IUnderlineUIDecorationProvider underlineDecoration = helper.GetUnderlineDecoration();
            BaselineAlignment?baselineAlignment = helper.GetBaselineAlignment();
            FontWeight?       fontWeight        = helper.GetFontWeightOfSpanStyle();
            FontStyle?        fontStyle         = helper.GetFontStyleOfSpanStyle();
            bool?strikeThrough = helper.GetStrikeThroughOfSpanStyle();

            this.SetInitialValues(fontFamily, fontSize, foreColor, highlightColor, fontWeight, fontStyle, underlineDecoration, strikeThrough, baselineAlignment);
            this.SetFontPropertiesDialog(fontFamily, fontSize, foreColor, highlightColor, underlineDecoration, baselineAlignment, fontWeight, fontStyle, strikeThrough);

            this.ShowDialog();
        }
        private void ShowDialogInternal(string text, HyperlinkInfo currentHyperlinkInfo, IEnumerable<string> bookmarkNames, Action<string, HyperlinkInfo> insertHyperlinkCallback, Action cancelCallback, RadRichTextBox owner)
        {
            this.ResetDialog();

            this.comboBookmarks.DataContext = bookmarkNames;
            this.insertHyperlinkCallback = insertHyperlinkCallback;
            this.cancelCallback = cancelCallback;
            this.callbackCalled = false;
            this.SetOwner(owner);

            if (text == null)
            {
                this.txtText.IsEnabled = false;
                this.txtText.Text = LocalizationManager.GetString("Documents_InsertHyperlinkDialog_SelectionInDocument");
            }
            else
            {
                this.txtText.IsEnabled = true;
                this.txtText.Text = text;
            }

            if (currentHyperlinkInfo != null)
            {
                this.PreselectTarget(currentHyperlinkInfo.Target);

                if (!currentHyperlinkInfo.IsAnchor)
                {
                    this.txtAddress.Text = (currentHyperlinkInfo.NavigateUri != null)? currentHyperlinkInfo.NavigateUri: string.Empty;
                }
                else
                {
                    this.PreselectBookmark(currentHyperlinkInfo.NavigateUri);
                    this.rbBookmark.IsChecked = true;
                    this.ChangeUriUIVisibility(true);
                }
            }

            this.ShowDialog();
        }
 /// <summary>
 /// Shows the dialog.
 /// </summary>
 /// <param name="spellCheckingUIManager">
 /// The spellchecking UI manager.
 /// </param>
 /// <param name="owner">
 /// The owner of the dialog.
 /// </param>
 /// <returns>
 /// A task that completes when the window is closed.
 /// </returns>
 public async Task<SpellCheckingResult> ShowDialog(SpellCheckingUIManager spellCheckingUIManager, RadRichTextBox owner)
 {
     return await ShowDialogInternal(spellCheckingUIManager, owner);
 }
 private void SetText(RadRichTextBox rrtb, string newText)
 {
     rrtb.Document = this.provider.Import(newText);
     if (!string.IsNullOrEmpty(newText))
     {
         this.HideWatermark();
     }
 }
 /// <summary>
 /// Shows the dialog for inserting hyperlinks.
 /// </summary>
 /// <param name="text">The text of the hyperlink.</param>
 /// <param name="currentHyperlinkInfo">The current hyperlink info. Null if we are not in edit mode.</param>
 /// <param name="bookmarkNames">Names of all existing bookmarks.</param>
 /// <param name="insertHyperlinkCallback">The callback that will be called on confirmation to insert the hyperlink.</param>
 /// <param name="cancelCallback">The callback that will be called on cancelation.</param>
 /// <param name="owner">The owner of the dialog.</param>
 public void ShowDialog(string text, HyperlinkInfo currentHyperlinkInfo, IEnumerable<string> bookmarkNames, Action<string, HyperlinkInfo> insertHyperlinkCallback, Action cancelCallback, RadRichTextBox owner)
 {
     this.ShowDialogInternal(text, currentHyperlinkInfo, bookmarkNames, insertHyperlinkCallback, cancelCallback, owner);
 }
 private string GetText(RadRichTextBox rrtb)
 {
     return this.provider.Export(rrtb.Document);
 }
 private bool IsTextEmpty(RadRichTextBox rrtb)
 {
     return string.IsNullOrEmpty(this.GetText(rrtb));
 }
Пример #19
0
 private void HideDropMarker(RadRichTextBox richTextBox)
 {
     richTextBox.ActiveEditorPresenter.HideDropMarker();
 }
 public NodeTextInputContextMenuBuilder(RadRichTextBox radRichTextBox)
 {
     _radRichTextBox = radRichTextBox;
 }
Пример #21
0
 public CustomMenuBuilder(RadRichTextBox radRichTextBox)
     : base(radRichTextBox)
 {
     this.radRichTextBox = radRichTextBox;
 }
 private string GetText(RadRichTextBox rrtb)
 {
     return(this.provider.Export(rrtb.Document));
 }
 public InsertVersoCommand(RadRichTextBox editor)
     : base(editor)
 {
 }
        /// <summary>
        /// Raises the <see cref="E:Closed"/> event.
        /// </summary>
        /// <param name="args">
        /// The <see cref="T:Telerik.Windows.Controls.WindowClosedEventArgs"/> instance containing the event data.
        /// </param>
        protected override void OnClosed(WindowClosedEventArgs args)
        {
            base.OnClosed(args);

            if (_richTextBox != null)
            {
                _richTextBox.Document.Selection.Clear();
            }

            _spellCheckingUIManager = null;
            _richTextBox = null;
            Owner = null;

            if (_tcs != null)
            {
                var isCanceled = DialogResult != true;
                _tcs.TrySetResult(new SpellCheckingResult(isCanceled));
            }
        }
Пример #25
0
 private static void RadRichTextBoxChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     associatedRichTextBox = e.NewValue as RadRichTextBox;
 }
        public void ShowDialogInternal(Inline orgInline, Action <Inline, Inline> replaceCurrentImageCallback, string executeToolName, RadRichTextBox owner)
        {
            this.SetOwner(owner);
            this.originalInline = orgInline;
            if (orgInline is ImageInline)
            {
                this.originalImageInline = (ImageInline)orgInline;
            }
            else if (orgInline is FloatingImageBlock)
            {
                this.originalImageInline = ((FloatingImageBlock)orgInline).ImageInline;
            }
            else
            {
                throw new InvalidOperationException("Unable to find image element.");
            }

            RadBitmap image = new RadBitmap(this.originalImageInline.ImageSource);

            this.isRotated           = false;
            this.originalAspect      = new Size(this.originalImageInline.Width / image.Width, this.originalImageInline.Height / image.Height);
            this.originalRotateAngle = this.originalImageInline.RotateAngle;


            this.replaceCurrentImageCallback = replaceCurrentImageCallback;
            this.ImageEditorUI.Image         = image;

            this.StartExecuteTool(executeToolName);
            this.ShowDialog();
        }
        private static RadWindow CreatePreviewWindow(RadRichTextBox rtb)
        {
            var printButton = new RadButton()
            {
                Content    = "Print",
                Margin     = new Thickness(10, 0, 10, 0),
                FontWeight = FontWeights.Bold,
                Width      = 80
            };

            printButton.Click += (s, e) =>
            {
                rtb.Print("MyDocument", Telerik.Windows.Documents.UI.PrintMode.Native);
            };

            var sp = new StackPanel()
            {
                Height = 26, Orientation = Orientation.Horizontal, Margin = new Thickness(10)
            };

            sp.Children.Add(new RadRichTextBoxStatusBar()
            {
                AssociatedRichTextBox = rtb, Margin = new Thickness(20, 0, 10, 0)
            });

            sp.Children.Add(new TextBlock()
            {
                Text = "Orientation:", Margin = new Thickness(10, 0, 3, 0), VerticalAlignment = VerticalAlignment.Center
            });

            var radComboBoxPageOrientation = new RadComboBox()
            {
                ItemsSource   = new string[] { "Portrait", "Landscape" },
                SelectedIndex = 0
            };

            sp.Children.Add(radComboBoxPageOrientation);

            radComboBoxPageOrientation.SelectionChanged += (s, e) =>
            {
                rtb.ChangeSectionPageOrientation((PageOrientation)Enum.Parse(typeof(PageOrientation),
                                                                             radComboBoxPageOrientation.Items[radComboBoxPageOrientation.SelectedIndex].ToString(), true));
            };

            sp.Children.Add(new TextBlock()
            {
                Text = "Size:", Margin = new Thickness(10, 0, 3, 0), VerticalAlignment = VerticalAlignment.Center
            });

            var radComboBoxPageSize = new RadComboBox()
            {
                ItemsSource   = new string[] { "A0", "A1", "A2", "A3", "A4", "A5", "Letter" },
                Height        = 25,
                SelectedIndex = 4,
            };

            sp.Children.Add(radComboBoxPageSize);

            radComboBoxPageSize.SelectionChanged += (s, e) =>
            {
                rtb.ChangeSectionPageSize(PaperTypeConverter.ToSize((PaperTypes)Enum.Parse(typeof(PaperTypes),
                                                                                           radComboBoxPageSize.Items[radComboBoxPageSize.SelectedIndex].ToString(), true)));
            };

            sp.Children.Add(printButton);

            var g = new Grid();

            g.RowDefinitions.Add(new RowDefinition()
            {
                Height = GridLength.Auto
            });
            g.RowDefinitions.Add(new RowDefinition());
            g.Children.Add(sp);
            g.Children.Add(rtb);

            Grid.SetRow(rtb, 1);

            return(new RadWindow()
            {
                Content = g,
                Width = 900,
                Height = 600,
                Header = "Print Preview",
                WindowStartupLocation = WindowStartupLocation.CenterOwner,
                Owner = WpfHelper.GetActiveWindow()
            });
        }
Пример #28
0
 public CustomMenuBuilder(RadRichTextBox radRichTextBox)
     : base(radRichTextBox)
 {
     this.radRichTextBox = radRichTextBox;
 }
Пример #29
0
 /// <summary>
 /// Shows the dialog.
 /// </summary>
 /// <param name="richTextBox">The associated <see cref="RadRichTextBox"/>.</param>
 /// <param name="replaceCallback">The callback that will be invoked to perform replace.</param>
 /// <param name="textToFind">The text to initially set in the search field.</param>
 public void Show(RadRichTextBox richTextBox, Action<string> replaceCallback, string textToFind)
 {
     Func<string, bool> func = (param) => { replaceCallback(param); return true; };
     this.Show(richTextBox, func, textToFind);
 }
 private void RegisterCommandOrShift(RoutedCommand command, Key key, ModifierKeys modifierKeys = ModifierKeys.None, object commandParameter = null)
 {
     RadRichTextBox.RegisterCommand(command, key, modifierKeys, commandParameter);
     RadRichTextBox.RegisterCommand(command, key, modifierKeys | ModifierKeys.Shift, commandParameter);
 }
Пример #31
0
        /// <summary>
        /// Shows the dialog.
        /// </summary>
        /// <param name="richTextBox">The associated <see cref="RadRichTextBox"/>.</param>
        /// <param name="replaceCallback">The callback that will be invoked to perform replace.</param>
        /// <param name="textToFind">The text to initially set in the search field.</param>
        public void Show(RadRichTextBox richTextBox, Func<string, bool> replaceCallback, string textToFind)
        {
            this.richTextBox = richTextBox;
            this.replaceCallback = replaceCallback;
            this.initialCaretPosition = new DocumentPosition(this.richTextBox.Document.CaretPosition);
            this.initialCaretPosition.AnchorToNextFormattingSymbol();

            if (!this.IsOpen && textToFind != null)
            {
                this.TextToFind = textToFind;
            }

            this.SetOwner(richTextBox);

            if (this.selectReplaceStateService != null)
            {
                this.selectReplaceStateService.UnsubscribeFromDocumentEvents();
            }

            this.selectReplaceStateService = new DocumentSelectReplaceStateService(this.Document, this.ResetFindDialog);

            this.SetupUIAccordingToReadOnly(richTextBox);
            this.EnableButtonsAccordingToText();

            if (!this.IsOpen)
            {
                this.ResetFindDialog();
                this.Show();

                this.Dispatcher.BeginInvoke(new Action(() =>
                {
                    this.tbFindText.Focus();
                    this.tbFindText.SelectAll();
                }));
            }
        }
Пример #32
0
        /// <summary>
        /// Shows the dialog.
        /// </summary>
        /// <param name="richTextBox">The associated <see cref="RadRichTextBox"/>.</param>
        /// <param name="replaceCallback">The callback that will be invoked to perform replace.</param>
        /// <param name="textToFind">The text to initially set in the search field.</param>
        public void Show(RadRichTextBox richTextBox, Action <string> replaceCallback, string textToFind)
        {
            Func <string, bool> func = (param) => { replaceCallback(param); return(true); };

            this.Show(richTextBox, func, textToFind);
        }
Пример #33
0
        protected override void OnClosed(WindowClosedEventArgs args)
        {
            base.OnClosed(args);

            this.selectReplaceStateService.UnsubscribeFromDocumentEvents();

            this.replaceCallback = null;
            if (this.richTextBox.Document.Selection.IsEmpty)
            {
                initialCaretPosition.RemoveAnchorFromNextFormattingSymbol();
                this.richTextBox.Document.CaretPosition.MoveToPosition(initialCaretPosition);
            }
            else
            {
                this.richTextBox.ActiveEditorPresenter.HideCaret();
            }
            this.richTextBox.Focus();
            this.richTextBox = null;
            this.Owner = null;
        }
Пример #34
0
 public void ShowDialog(Inline targetInline, Action <Inline, Inline> replaceCurrentInlineCallback, RadRichTextBox owner)
 {
     this.ShowDialogInternal(targetInline, replaceCurrentInlineCallback, owner);
 }
Пример #35
0
 private void EnableEditableFields(RadRichTextBox richTextBox)
 {
     this.tbReplaceText.IsEnabled = richTextBox.IsReadOnly;
 }
Пример #36
0
 public static void SetRadRichTextBox(DependencyObject obj, RadRichTextBox value)
 {
     obj.SetValue(RadRichTextBoxProperty, value);
 }
Пример #37
0
        /// <summary>
        /// Creates the rich text box in the background thread.
        /// </summary>
        /// <param name="action">The action.</param>
        /// <param name="contentControl">The content control.</param>
        public static void CreateRichTextBox(Action action, RichToolTip contentControl)
        {
            var bw = new BackgroundWorker();
            DoWorkEventHandler runWorkerAction = (s, e) => contentControl.Dispatcher.BeginInvoke(
            () =>
                {
                    richTextBox = new RadRichTextBox
                    {
                        IsReadOnly = true,
                        IsSelectionEnabled = false,
                        Background = new SolidColorBrush(Colors.Transparent),
                        IsSpellCheckingEnabled = false,
                        AcceptsTab = false,
                        AcceptsReturn = false,
                        IsContextMenuEnabled = false,
                        IsImageMiniToolBarEnabled = false,
                        IsSelectionMiniToolBarEnabled = false,
                        IsTabStop = false,
                        BorderThickness = new Thickness(0),
                        Cursor = Cursors.Hand,
                        MaxWidth = 400
                    };
                });
            RunWorkerCompletedEventHandler runWOrkerComplitedHandler = null;
            runWOrkerComplitedHandler = (s, e) =>
            {
                bw.DoWork -= runWorkerAction;
                bw.RunWorkerCompleted -= runWOrkerComplitedHandler;
                action();
            };

            bw.DoWork += runWorkerAction;
            bw.RunWorkerCompleted += runWOrkerComplitedHandler;
            bw.RunWorkerAsync(richTextBox);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="InsertImageToRichtextCommand"/> class.
 /// </summary>
 /// <param name="editor">The editor.</param>
 public InsertImageToRichtextCommand(RadRichTextBox editor) : base(editor)
 {
     Ioc.SatisfyImportsOnce(this);
 }
 private bool IsTextEmpty(RadRichTextBox rrtb)
 {
     return(string.IsNullOrEmpty(this.GetText(rrtb)));
 }
        async void ISpellCheckingDialog.ShowDialog(SpellCheckingUIManager spellCheckingUIManager, RadRichTextBox owner)
        {
            var result = await ShowDialog(spellCheckingUIManager, owner);

            if (!result.IsCanceled)
                AlertForCompletion();
        }
        private void ShowDialogInternal(SpellCheckingUIManager spellCheckingUIManager, RadRichTextBox owner)
        {
            this.spellCheckingUIManager = spellCheckingUIManager;
            this.SetOwner(owner);

            if (this.TryLoadIncorrectSentence())
            {
                this.buttonEditCustomDictionary.IsEnabled = spellCheckingUIManager.HasCustomDictionary();
                this.ShowDialog();
            }
        }
        private Task<SpellCheckingResult> ShowDialogInternal(SpellCheckingUIManager spellCheckingUIManager, RadRichTextBox owner)
        {
            DialogResult = null;
            _tcs = new TaskCompletionSource<SpellCheckingResult>();
            _spellCheckingUIManager = spellCheckingUIManager;
            _richTextBox = owner;
            SetOwner(owner);
            
            if (TryLoadIncorrectSentence(true))
            {
                ButtonEditCustomDictionary.IsEnabled = spellCheckingUIManager.HasCustomDictionary();

                _selectedCulture = SpellCheck.GetCulture(_richTextBox);
                OnPropertyChanged("SelectedCulture");

                LoadAvailableCultures();

                ShowDialog();
            }
            else
            {
                _tcs.TrySetResult(new SpellCheckingResult(false));
            }

            return _tcs.Task;
        }
 /// <summary>
 /// Shows the dialog. Specified insert image callback is applied on user confirmation.
 /// </summary>
 /// <param name="selectedImage">The selected image.</param>
 /// <param name="replaceCurrentImageCallback">The insert image callback.</param>
 /// <param name="executeToolName"></param>
 /// <param name="owner">The owner of the dialog.</param>
 public void ShowDialog(Inline selectedImage, Action <Inline, Inline> replaceCurrentImageCallback, string executeToolName, RadRichTextBox owner)
 {
     this.ShowDialogInternal(selectedImage, replaceCurrentImageCallback, executeToolName, owner);
 }
Пример #44
0
        private void SetupUIAccordingToReadOnly(RadRichTextBox richTextBox)
        {
            this.tbReplaceText.IsEnabled = !richTextBox.IsReadOnly;
            if (!this.tbReplaceText.IsEnabled)
            {
                this.tbReplaceText.Text = string.Empty;
            }

            this.textBlockReplaceWith.Opacity = richTextBox.IsReadOnly ? 0.5 : 1;
        }
Пример #45
0
 private static void RadRichTextBoxChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     associatedRichTextBox = e.NewValue as RadRichTextBox;
 }
Пример #46
0
        private static RadWindow CreatePreviewWindow(RadRichTextBox rtb)
        {
            var printButton = new RadButton
                {
                    Content = "Print",
                    Margin = new Thickness(10, 0, 10, 0),
                    FontWeight = FontWeights.Bold,
                    Width = 80
                };

            printButton.Click += (s, e) => rtb.Print("MyDocument", Telerik.Windows.Documents.UI.PrintMode.Native);

            var sp = new StackPanel { Height = 26, Orientation = Orientation.Horizontal, Margin = new Thickness(10) };
            sp.Children.Add(new RadRichTextBoxStatusBar { AssociatedRichTextBox = rtb, Margin = new Thickness(20, 0, 10, 0) });

            sp.Children.Add(new TextBlock
                {
                    Text = "Orientation:",
                    Margin = new Thickness(10, 0, 3, 0),
                    VerticalAlignment = VerticalAlignment.Center
                });

            var radComboBoxPageOrientation = new RadComboBox
                {
                    ItemsSource = new[] { "Portrait", "Landscape" },
                    SelectedIndex = 0
                };
            sp.Children.Add(radComboBoxPageOrientation);

            radComboBoxPageOrientation.SelectionChanged +=
                (s, e) => rtb.ChangeSectionPageOrientation((PageOrientation)Enum.Parse(typeof(PageOrientation),
                                                                                        radComboBoxPageOrientation.Items
                                                                                            [
                                                                                                radComboBoxPageOrientation
                                                                                                    .SelectedIndex]
                                                                                            .ToString(), true));

            sp.Children.Add(new TextBlock
                {
                    Text = "Size:",
                    Margin = new Thickness(10, 0, 3, 0),
                    VerticalAlignment = VerticalAlignment.Center
                });

            var radComboBoxPageSize = new RadComboBox
                {
                    ItemsSource = new[] { "A0", "A1", "A2", "A3", "A4", "A5", "Letter" },
                    Height = 25,
                    SelectedIndex = 4,
                };
            sp.Children.Add(radComboBoxPageSize);

            radComboBoxPageSize.SelectionChanged += (s, e) =>
                rtb.ChangeSectionPageSize(PaperTypeConverter.ToSize((PaperTypes)Enum.Parse(typeof(PaperTypes),
                                                                                            radComboBoxPageSize.Items[
                                                                                                radComboBoxPageSize
                                                                                                    .SelectedIndex]
                                                                                                .ToString(), true)));

            sp.Children.Add(printButton);

            var g = new Grid();
            g.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
            g.RowDefinitions.Add(new RowDefinition());
            g.Children.Add(sp);
            g.Children.Add(rtb);

            Grid.SetRow(rtb, 1);

            return new RadWindow
                {
                    Content = g,
                    Width = 900,
                    Height = 600,
                    Header = "Print Preview",
                    WindowStartupLocation = Telerik.Windows.Controls.WindowStartupLocation.CenterScreen
                };
        }
 /// <summary>
 /// Shows the dialog.
 /// </summary>
 /// <param name="spellCheckingUIManager">The spellchecking UI manager.</param>
 /// <param name="owner">The owner of the dialog.</param>
 public void ShowDialog(SpellCheckingUIManager spellCheckingUIManager, RadRichTextBox owner)
 {
     this.ShowDialogInternal(spellCheckingUIManager, owner);
 }