Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6067475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:36:43+00:00 2026-05-23T09:36:43+00:00

In a previous question I was trying to find out how to bind an

  • 0

In a previous question I was trying to find out how to bind an ObservableCollection to a control so I could both see all the strings and select all the strings and copy them from the content control. The answers to that question eventually got me the look (and seemingly the behavior)I wanted by using the following XAML. (I tried both a FlowDocumentReader and FlowDocumentScrollViewer – they behave the same.)

<Grid>
<FlowDocumentScrollViewer>
    <FlowDocument >
        <Paragraph>
            <ItemsControl ItemsSource="{Binding ErrorMessages, Mode=OneWay}" />
            <Run Text="{Binding /, Mode=OneWay}" />
        </Paragraph>
    </FlowDocument>
</FlowDocumentScrollViewer>
</Grid>

ErrorMessages is my ViewModel property that returns an ObservableCollection<string>. It binds properly to the ItemsSource and the <Run> element binds to each string in the collection. Looks good, lasts a long time. This was so close I marked my last question as answered but I still have one problem.

I right click and a menu shows up with the Select All and Copy options. Using Select All, does indeed highlight all the text, selecting Copy issues no errors, but when I go to NotePad (or Word, or TextPad etc. or a RTB on the form) and try to paste the text, nothing ever shows up. As a newcomer to WPF I suspect I’m doing something wrong but I don’t know what it is. There’s no such thing as “lookless” text is there?

[Edit -June 22 2011]
For other reasons I’ve changed the code to use a TextBlock via an ItemTemplate inside the ItemsControl as shown below, but I still can’t copy and paste.

<DataTemplate x:Key="StringCollection">
   <TextBlock TextWrapping="Wrap" Text="{Binding}" TextAlignment="Left"/>
</DataTemplate>
<!--... now down in the ItemsControl-->
<ItemsControl ItemsSource="{Binding ReceivedData, Mode=OneWay}"
      ItemTemplate="{StaticResource StringCollection}" />
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T09:36:43+00:00Added an answer on May 23, 2026 at 9:36 am

    <Run> element binds to each string in the collection.

    It only should bind to the current element if anything.

    Anyway, your document does in fact not contain any text at all if all you have is the ItemsControl. Why? Because any UIElements inside the document are automatically wrapped in a BlockUIContainer or InlineUIContainer and are no longer considered to be text.

    In general the content is copied as XAML, RTF, UnicodeText & Text (i could observe those, but there might be other formats), you can try to place some Runs in your document, their text should be copied properly and Clipboard.GetText() should return their contents.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Thanks to suggestions from a previous question , I'm busy trying out IronPython, IronRuby
This is a continuation of my previous question: Could not find an implementation of
Trying to find a workaround for my previous question , I'd like to convert
This question is in continuation to my previous question . I am trying to
I'm quoting myself on a previous question I asked to further explain: I'm trying
I'm trying to calculate age in flex. I've found this previous question What is
While trying to implement the second answer to a previous question , I am
This is related to a previous question . What I'm trying to understand now
Following on from my previous question about tables I am trying to create additional
a month ago I asked this question: Trying to find the top 3 properties

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.