Click here to Skip to main content
15,891,749 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: WPF Toolbox Calendar - Slow when connecting to a database Pin
Glyn12329-Jul-09 2:10
Glyn12329-Jul-09 2:10 
QuestionHow to call a WCF service from silverlight application Pin
Nekkantidivya29-Jul-09 0:54
Nekkantidivya29-Jul-09 0:54 
AnswerRe: How to call a WCF service from silverlight application Pin
Michael Sync29-Jul-09 4:33
Michael Sync29-Jul-09 4:33 
AnswerRe: How to call a WCF service from silverlight application Pin
Arun Jacob5-Aug-09 0:27
Arun Jacob5-Aug-09 0:27 
Questionwpf + asp.net3.5 Pin
bhavna432129-Jul-09 0:21
bhavna432129-Jul-09 0:21 
AnswerRe: wpf + asp.net3.5 Pin
#realJSOP29-Jul-09 3:13
mve#realJSOP29-Jul-09 3:13 
AnswerRe: wpf + asp.net3.5 Pin
Christian Graus29-Jul-09 10:52
protectorChristian Graus29-Jul-09 10:52 
QuestionTextbox Overriding OnRender and FormattedText problem [modified] Pin
Member 232448328-Jul-09 10:47
Member 232448328-Jul-09 10:47 
I created a custom textbox inheriting from wpf textbox and overriding OnRender. I used FormattedText to set background colors of few words in the textbox. Somehow the fonts are becoming bold, not sure why. How to get-rid of that? Here is my code.


<br />
if (this.Text != "")<br />
            {<br />
                FormattedText formattedText = new FormattedText(<br />
                  this.Text,<br />
                   CultureInfo.InvariantCulture,<br />
                   FlowDirection.LeftToRight,<br />
                   new Typeface(this.FontFamily,this.FontStyle,this.FontWeight,this.FontStretch),<br />
                   this.FontSize,<br />
                   this.Foreground);  //Text that matches the textbox's<br />
<br />
<br />
                double leftMargin = 4.0 + this.BorderThickness.Left;<br />
                double topMargin = 2 + this.BorderThickness.Top;<br />
                formattedText.MaxTextWidth = this.ViewportWidth; // space for scrollbar<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 />
                //Background hilight<br />
                if (HighlightText != null && HighlightText.Length > 0)<br />
                {<br />
                    foreach (string text in HighlightText)<br />
                    {<br />
                        int txtEnd = this.Text.Length;<br />
                        int index = 0;<br />
                        int lastIndex = this.Text.LastIndexOf(text, StringComparison.OrdinalIgnoreCase);<br />
<br />
                        while (index <= lastIndex)<br />
                        {<br />
                            index = this.Text.IndexOf(text, index, StringComparison.OrdinalIgnoreCase);<br />
<br />
                            Geometry geom = formattedText.BuildHighlightGeometry(new Point(leftMargin, topMargin - this.VerticalOffset), index, text.Length);<br />
                            if (geom != null)<br />
                            {<br />
                                drawingContext.DrawGeometry(Brushes.Yellow, null, geom);<br />
                            }<br />
                            index += 1;<br />
                        }<br />
<br />
                    }<br />
                }<br />
<br />
                drawingContext.DrawText(formattedText, new Point(leftMargin, topMargin - this.VerticalOffset));<br />
<br />
            }<br />




Thanks.

modified on Tuesday, July 28, 2009 5:35 PM

AnswerRe: Textbox Overriding OnRender and FormattedText problem Pin
Member 232448328-Jul-09 13:53
Member 232448328-Jul-09 13:53 
QuestionWPF Designer fails loading assembly Pin
vbnetter28-Jul-09 7:43
vbnetter28-Jul-09 7:43 
AnswerRe: WPF Designer fails loading assembly Pin
Christian Graus28-Jul-09 11:14
protectorChristian Graus28-Jul-09 11:14 
GeneralRe: WPF Designer fails loading assembly Pin
vbnetter29-Jul-09 3:43
vbnetter29-Jul-09 3:43 
QuestionEmbed excel workbook inside WPF Pin
maesi198028-Jul-09 3:38
maesi198028-Jul-09 3:38 
AnswerRe: Embed excel workbook inside WPF Pin
Christian Graus28-Jul-09 22:25
protectorChristian Graus28-Jul-09 22:25 
QuestionImage Stretch programatically in WPF. [modified] Pin
Krishna Aditya28-Jul-09 1:11
Krishna Aditya28-Jul-09 1:11 
AnswerRe: Image Stretch programatically in WPF. Pin
Super Lloyd28-Jul-09 2:46
Super Lloyd28-Jul-09 2:46 
AnswerRe: Image Stretch programatically in WPF. Pin
Mark Salsbery28-Jul-09 6:21
Mark Salsbery28-Jul-09 6:21 
GeneralRe: Image Stretch programatically in WPF. Pin
Krishna Aditya28-Jul-09 20:16
Krishna Aditya28-Jul-09 20:16 
QuestionAuto apply application-level resource-dictionary theme to all controls in program? Pin
FocusedWolf27-Jul-09 20:10
FocusedWolf27-Jul-09 20:10 
AnswerRe: Auto apply application-level resource-dictionary theme to all controls in program? Pin
Pete O'Hanlon27-Jul-09 22:23
mvePete O'Hanlon27-Jul-09 22:23 
GeneralRe: Auto apply application-level resource-dictionary theme to all controls in program? Pin
FocusedWolf28-Jul-09 5:52
FocusedWolf28-Jul-09 5:52 
Questionwpf Pin
bhavna432127-Jul-09 18:26
bhavna432127-Jul-09 18:26 
AnswerRe: wpf Pin
Pete O'Hanlon27-Jul-09 20:09
mvePete O'Hanlon27-Jul-09 20:09 
AnswerRe: wpf Pin
#realJSOP27-Jul-09 23:49
mve#realJSOP27-Jul-09 23:49 
QuestionPrism, XAP and dynamic loading Pin
User 527145427-Jul-09 8:01
User 527145427-Jul-09 8:01 

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.