Click here to Skip to main content
Click here to Skip to main content
 
Add your own
alternative version

Creating Actionlinks in a Silverlight RichTextBox

, 28 Mar 2010 CPOL
Extending the Silverlight RichTextBox so that it supports interactive text
InteractiveText.zip
InteractiveText
ActionLink.Contracts
Properties
ActionLink.Implementation
Properties
InteractiveText
Properties
RichTextBox.suo
RichTextBox.Web
ClientBin
Desert.jpg
smilie.jpg
Properties
RichTextBox
Bin
Debug
System.ComponentModel.Composition.dll
System.ComponentModel.Composition.Packaging.Toolkit.dll
System.ComponentModel.DataAnnotations.dll
System.Windows.Controls.Data.dll
System.Windows.Controls.Data.Input.dll
System.Windows.Controls.dll
System.Windows.Data.dll
System.Xml.Linq.dll
Images
Annotation_New.png
Bold.png
calendar.png
Copy.png
Cut.png
datagrid.png
edit.png
edit_16.png
hand.png
Hyperlink.png
Hyperlink_big.png
Image.png
Italic.png
logo.png
ltr.png
New.png
Open.png
Paste.png
Paste_big.png
Print.png
Print_big.png
rtl.png
Save.png
Underline.png
view.png
Properties
RichTextBox.csproj.user
sampleNew.sav
// ----------------------------------------------------------------------------------
// Microsoft Developer & Platform Evangelism
// 
// Copyright (c) Microsoft Corporation. All rights reserved.
// 
// THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, 
// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES 
// OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
// ----------------------------------------------------------------------------------
// The example companies, organizations, products, domain names,
// e-mail addresses, logos, people, places, and events depicted
// herein are fictitious.  No association with any real company,
// organization, product, domain name, email address, logo, person,
// places, or events is intended or should be inferred.
// ----------------------------------------------------------------------------------

using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Data;
using System.Resources;
using System.Threading;

namespace RichNotepad
{
    public class BoolToFlowDirectionConverter : IValueConverter
    {

        #region IValueConverter Members

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            bool val = bool.Parse(value.ToString());

            if (targetType == typeof(string))
            {
                ResourceManager resourceManager = new ResourceManager("RichNotepad.Strings", GetType().Assembly);

                return (string)resourceManager.GetString("txt_Header_Direction", Thread.CurrentThread.CurrentUICulture);
            }
            else
            {
                if (val)
                    return FlowDirection.RightToLeft;
                else
                    return FlowDirection.LeftToRight;
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            FlowDirection fd = (FlowDirection)Enum.Parse(typeof(FlowDirection), value.ToString(), true);

            if (fd == FlowDirection.RightToLeft)
                return true;
            else
                return false;

        }

        #endregion
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Marc Schluper
Web Developer
United States United States
Marc Schluper studied Applied Mathematics at Technical University Eindhoven, The Netherlands.
His employer is Kronos Hiring Solutions in Beaverton, OR.
He is married and has two children.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150327.1 | Last Updated 29 Mar 2010
Article Copyright 2010 by Marc Schluper
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid