Click here to Skip to main content
15,887,027 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: Regarding treeview using MVVM pattern Pin
Mike Fuchs8-Jul-10 22:38
Mike Fuchs8-Jul-10 22:38 
GeneralRe: Regarding treeview using MVVM pattern Pin
Robert Graves6-Sep-11 9:02
Robert Graves6-Sep-11 9:02 
QuestionUserControl does not assume height of parent container Pin
ausadmin18-May-09 19:47
ausadmin18-May-09 19:47 
AnswerRe: UserControl does not assume height of parent container [modified] Pin
Mark Salsbery19-May-09 6:41
Mark Salsbery19-May-09 6:41 
GeneralRe: UserControl does not assume height of parent container Pin
ausadmin19-May-09 11:05
ausadmin19-May-09 11:05 
GeneralRe: UserControl does not assume height of parent container Pin
Mark Salsbery19-May-09 11:14
Mark Salsbery19-May-09 11:14 
GeneralRe: UserControl does not assume height of parent container Pin
mick codeproject19-Jan-10 23:10
mick codeproject19-Jan-10 23:10 
QuestionHelp with positioning text pointer in TextBox after formatting. Pin
Member 232448318-May-09 10:47
Member 232448318-May-09 10:47 
Hello all,

Basically i am trying to format single word in textbox. For eg. if user types 'Or' , 'and' i want to hilight them and bold them. This i am doing by extending textbox control and overriding OnRender. I could able to do that, but the problem is the cursor position is getting messup, in other words, when words are becoming bold cursor position is not getting adjusted accordingly, and am not sure how to do that. Here is my code
<br />
            protected override void OnRender(DrawingContext drawingContext)<br />
            {<br />
<br />
                if (this.Text != "")<br />
                {<br />
                    this.Background = new SolidColorBrush(Colors.Transparent);<br />
                    <br />
                    FormattedText formattedText = new FormattedText(<br />
                      this.Text,<br />
                        System.Threading.Thread.CurrentThread.CurrentCulture,<br />
                       FlowDirection.LeftToRight,<br />
                        new Typeface(this.FontFamily,this.FontStyle, this.FontWeight,this.FontStretch),<br />
                       this.FontSize, Brushes.Black<br />
                        );  //Text that matches the  textbox's<br />
<br />
<br />
                    double leftMargin = 4.0 + this.BorderThickness.Left;<br />
                    double topMargin = 2 + this.BorderThickness.Top;<br />
<br />
                    formattedText.MaxTextHeight = Math.Max(this.ActualHeight + this.VerticalOffset, 0); //Adjust for scrolling<br />
                    drawingContext.PushClip(new RectangleGeometry(new Rect(0, 0, this.ActualWidth, this.ActualHeight)));//restrict text to textbox<br />
<br />
<br />
                    List<Pair> ranges = dec.Ranges(this.Text);<br />
                    foreach (Pair p in ranges)<br />
                    {<br />
                        formattedText.SetForegroundBrush(Brushes.Blue, p.Start, p.Length);<br />
                        formattedText.SetFontWeight(FontWeights.Bold, p.Start, p.Length);<br />
                        <br />
                    }<br />
<br />
<br />
                    drawingContext.DrawText(formattedText, new Point(leftMargin - this.HorizontalOffset-2,topMargin));<br />
                }<br />
                //base.OnRender(drawingContext);<br />
            }<br />


Any help would be appreciated.

Thanks.
AnswerRe: Help with positioning text pointer in TextBox after formatting. Pin
Mark Salsbery18-May-09 13:49
Mark Salsbery18-May-09 13:49 
GeneralRe: Help with positioning text pointer in TextBox after formatting. Pin
Member 232448318-May-09 14:01
Member 232448318-May-09 14:01 
QuestionSilverlight newbie Pin
Xandip18-May-09 3:37
Xandip18-May-09 3:37 
AnswerRe: Silverlight newbie Pin
Pete O'Hanlon18-May-09 4:13
mvePete O'Hanlon18-May-09 4:13 
AnswerRe: Silverlight newbie Pin
Kevin McFarlane19-May-09 5:45
Kevin McFarlane19-May-09 5:45 
GeneralRe: Silverlight newbie Pin
Xandip19-May-09 19:37
Xandip19-May-09 19:37 
Questionmulti Master-Detail view Pin
daniel radford18-May-09 2:42
daniel radford18-May-09 2:42 
AnswerRe: multi Master-Detail view Pin
Mark Salsbery18-May-09 5:40
Mark Salsbery18-May-09 5:40 
GeneralRe: multi Master-Detail view Pin
daniel radford19-May-09 6:39
daniel radford19-May-09 6:39 
GeneralRe: multi Master-Detail view Pin
Mark Salsbery19-May-09 6:57
Mark Salsbery19-May-09 6:57 
GeneralRe: multi Master-Detail view Pin
daniel radford20-May-09 0:47
daniel radford20-May-09 0:47 
QuestionHelp Require: Huge DataBinding makes the Application Hang!!! Pin
Kunal Chowdhury «IN»17-May-09 20:57
professionalKunal Chowdhury «IN»17-May-09 20:57 
AnswerRe: Help Require: Huge DataBinding makes the Application Hang!!! Pin
Insincere Dave18-May-09 13:42
Insincere Dave18-May-09 13:42 
QuestionTabItem Border [SOLVED] Pin
#realJSOP15-May-09 6:11
mve#realJSOP15-May-09 6:11 
AnswerRe: TabItem Border Pin
#realJSOP18-May-09 1:03
mve#realJSOP18-May-09 1:03 
AnswerRe: TabItem Border Pin
Pete O'Hanlon18-May-09 1:56
mvePete O'Hanlon18-May-09 1:56 
GeneralRe: TabItem Border Pin
#realJSOP18-May-09 9:02
mve#realJSOP18-May-09 9:02 

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.