WPF Load a text file into a rtb, and WPF web integration
I need to please know the code on how I can select a textfile using a file dialog in WPF, and add a textfile to a RTB within the form.
Also, can WPF applications be integrated within websites (such as a homepage) for example?
Thanks.
Kirtan PatelPosted Dec 11, 2009, 11:07 AM
Code For loading Text File into RichTextBox Control is Here
if my answer helps you then check "do you like this answer" check box please :)
using Microsoft.Win32;
using System.IO;
private void btnLoadFile_Click(object sender, RoutedEventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
if (ofd.ShowDialog() == true)
{
string TextData = File.ReadAllText(ofd.FileName);
Paragraph p = new Paragraph();
p.Inlines.Add(TextData);
FlowDocument fd = new FlowDocument();
fd.Blocks.Add(p);
richTextBox1.Document = fd;
}
}
you can build Silver Light Application that uses XAML (WPF) language so it can run on web.