Click here to Skip to main content
15,890,579 members
Home / Discussions / WPF
   

WPF

 
QuestionXML into XAML? Pin
_iobuf11-Sep-08 12:48
_iobuf11-Sep-08 12:48 
AnswerRe: XML into XAML? Pin
chaiguy133713-Sep-08 8:04
chaiguy133713-Sep-08 8:04 
QuestionAdding a ScrollBar property to ListBox properties Pin
Jonso11-Sep-08 9:03
Jonso11-Sep-08 9:03 
AnswerRe: Adding a ScrollBar property to ListBox properties Pin
chaiguy133713-Sep-08 8:01
chaiguy133713-Sep-08 8:01 
QuestionCreating readonly objects in a WPF RichTextBox Pin
Spacedmc11-Sep-08 7:33
Spacedmc11-Sep-08 7:33 
AnswerRe: Creating readonly objects in a WPF RichTextBox Pin
Pete O'Hanlon11-Sep-08 8:48
mvePete O'Hanlon11-Sep-08 8:48 
GeneralRe: Creating readonly objects in a WPF RichTextBox Pin
Spacedmc11-Sep-08 9:56
Spacedmc11-Sep-08 9:56 
GeneralRe: Creating readonly objects in a WPF RichTextBox Pin
Spacedmc11-Sep-08 12:09
Spacedmc11-Sep-08 12:09 
Just incase anyone hits the same issues as I did, the solution to this problem is quite simple and was solved using an InlineUIContainer and TextBlock (although it took me ages to figure it out) and I've pasted the code snipped below for your reference:


void rtb2_SelectionChanged(object sender, RoutedEventArgs e)
{
Match m = Regex.Match(rtb2.Selection.Text.ToString(), "<.*>");
if(m.Success)
{
string tag = m.ToString();
TextRange tr = new TextRange(rtb2.Selection.Start,rtb2.Selection.End);
System.IO.MemoryStream ms = new System.IO.MemoryStream();
tr.Save(ms, DataFormats.Rtf);
string rtbString = ASCIIEncoding.Default.GetString(ms.ToArray());
System.Text.RegularExpressions.Regex findTags =
new System.Text.RegularExpressions.Regex("<.*>");
rtbString = findTags.Replace(rtbString, "");
System.IO.MemoryStream msOut = new System.IO.MemoryStream();
System.IO.StreamWriter sw = new System.IO.StreamWriter(msOut);
sw.Write(rtbString);
sw.Flush();
msOut.Seek(0, System.IO.SeekOrigin.Begin);
tr.Load(msOut, DataFormats.Rtf);
TextBlock myTextBlock = new TextBlock(new Run(tag));
myTextBlock.Background = Brushes.WhiteSmoke;
TextPointer tp = rtb2.CaretPosition.GetInsertionPosition(LogicalDirection.Forward);
InlineUIContainer myInlineUIContainer = new InlineUIContainer(myTextBlock, tp);
}

And there you have it, my first codeproject solution Smile | :) Hope it proves useful to someone!

Happy coding,
Drew
GeneralRe: Creating readonly objects in a WPF RichTextBox Pin
Pete O'Hanlon11-Sep-08 12:26
mvePete O'Hanlon11-Sep-08 12:26 
GeneralRe: Creating readonly objects in a WPF RichTextBox Pin
chaiguy133713-Sep-08 7:50
chaiguy133713-Sep-08 7:50 
QuestionCan not Convert System.Windows.Controls to System.Windows.Forms.Controls [modified] Pin
bruze11-Sep-08 3:29
bruze11-Sep-08 3:29 
AnswerRe: Can not Convert System.Windows.Controls to System.Windows.Forms.Controls Pin
chaiguy133713-Sep-08 7:56
chaiguy133713-Sep-08 7:56 
QuestionWPF Control Like Asp.net's Datalist Pin
divyesh14329-Sep-08 20:39
divyesh14329-Sep-08 20:39 
QuestionIs it possible to have a transparent "hole" in a layer of WPF? Pin
chaiguy13378-Sep-08 14:52
chaiguy13378-Sep-08 14:52 
AnswerRe: Is it possible to have a transparent "hole" in a layer of WPF? [modified] Pin
Pete O'Hanlon9-Sep-08 10:51
mvePete O'Hanlon9-Sep-08 10:51 
GeneralRe: Is it possible to have a transparent "hole" in a layer of WPF? Pin
chaiguy13379-Sep-08 11:09
chaiguy13379-Sep-08 11:09 
GeneralRe: Is it possible to have a transparent "hole" in a layer of WPF? Pin
Pete O'Hanlon9-Sep-08 11:12
mvePete O'Hanlon9-Sep-08 11:12 
GeneralRe: Is it possible to have a transparent "hole" in a layer of WPF? Pin
chaiguy13379-Sep-08 11:22
chaiguy13379-Sep-08 11:22 
QuestionComposite Application Guidance Pin
Jammer8-Sep-08 0:52
Jammer8-Sep-08 0:52 
AnswerRe: Composite Application Guidance Pin
Pete O'Hanlon8-Sep-08 1:07
mvePete O'Hanlon8-Sep-08 1:07 
GeneralRe: Composite Application Guidance Pin
Jammer8-Sep-08 1:12
Jammer8-Sep-08 1:12 
QuestionHow to make a WPF control appear on top of all other controls? Pin
Pravinc19848-Sep-08 0:43
Pravinc19848-Sep-08 0:43 
AnswerRe: How to make a WPF control appear on top of all other controls? Pin
Insincere Dave8-Sep-08 6:30
Insincere Dave8-Sep-08 6:30 
GeneralRe: How to make a WPF control appear on top of all other controls? Pin
Pravinc19848-Sep-08 18:55
Pravinc19848-Sep-08 18:55 
GeneralRe: How to make a WPF control appear on top of all other controls? Pin
chaiguy13379-Sep-08 11:17
chaiguy13379-Sep-08 11:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.