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

  • Home
  • SEARCH
  • 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 540281
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:13:27+00:00 2026-05-13T10:13:27+00:00

How can I bind a WPF TextBlock to a text file? I want for

  • 0

How can I bind a WPF TextBlock to a text file? I want for the TextBlock to display the content of the file.

  • 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-13T10:13:27+00:00Added an answer on May 13, 2026 at 10:13 am

    You need to read the file into a string in memory and bind to that string instead.

    View model:

    class ViewModel
    {
        public string FileText { get; set; }
        public void ReadFile(string path)
        {
            FileText = File.ReadAllText(path);
        }
    }
    

    XAML:

    <TextBlock Text="{Binding FileText}"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

With WPF how can I bind the IsEnabled property of a Button to the
Please tell me how can i bind a hashtable to a WPF Combobox. I
I'm playing around with WPF Binding and variables. Apparently one can only bind DependencyProperties.
I have a dataset which i bind to datagrid from wpf toolkit(forced to use
Okay, so I'm fairly new to WPF and data binding, but I've searched and
Being a new to WPF/XAML/MVVM, I've got a question. In my View, I have
I am using Reactive extensions for NET (Rx) with Caliburn.Micro in my WPF app.
That's the best way I could think of to phrase my question, here is
(Note - this is a re-post as my first question got posted under wrong
I am looking for a datagrid which contains objects from my class. class user

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.