<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: The Missing .NET #4: Cue Banner in WPF (I mean, Watermark in WPF)</title>
	<atom:link href="http://www.ageektrapped.com/blog/the-missing-net-4-cue-banner-in-wpf-i-mean-watermark-in-wpf/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ageektrapped.com/blog/the-missing-net-4-cue-banner-in-wpf-i-mean-watermark-in-wpf/</link>
	<description>Trapped online since 2004</description>
	<lastBuildDate>Tue, 09 Mar 2010 17:02:57 -0500</lastBuildDate>
	<generator>http://wordpress.org/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Eze</title>
		<link>http://www.ageektrapped.com/blog/the-missing-net-4-cue-banner-in-wpf-i-mean-watermark-in-wpf/comment-page-1/#comment-681</link>
		<dc:creator>Eze</dc:creator>
		<pubDate>Wed, 10 Feb 2010 18:36:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.ageektrapped.com/blog/the-missing-net-4-cue-banner-in-wpf-i-mean-watermark-in-wpf/#comment-681</guid>
		<description>Nice work!
But, these code makes Blend2 crash (there are no problem in VS):



    
        
            
        
    
    
        Geek
        Cool Guy
    

</description>
		<content:encoded><![CDATA[<p>Nice work!<br />
But, these code makes Blend2 crash (there are no problem in VS):</p>
<p>        Geek<br />
        Cool Guy</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug</title>
		<link>http://www.ageektrapped.com/blog/the-missing-net-4-cue-banner-in-wpf-i-mean-watermark-in-wpf/comment-page-1/#comment-668</link>
		<dc:creator>Doug</dc:creator>
		<pubDate>Mon, 05 Oct 2009 15:05:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.ageektrapped.com/blog/the-missing-net-4-cue-banner-in-wpf-i-mean-watermark-in-wpf/#comment-668</guid>
		<description>I really dig the approach here to the problem and will be using it, however the GotFocus, LostFocus and Loaded event handlers are never removed and are set using strong references. Since this is a static class and the class never removes the event handlers, the targeted controls will never be garbaged collected. This is a pretty significant memory leak.

Instead of using += to set event handlers you should use the DependencyPropertyDescriptor method that Brian used for the Visibility issue. Internally the WPF Dependency system uses weak refrences for event handlers thus the memory leak issue is avoided. I will post example code showing my solution derived from yours. Thanks for the good work!</description>
		<content:encoded><![CDATA[<p>I really dig the approach here to the problem and will be using it, however the GotFocus, LostFocus and Loaded event handlers are never removed and are set using strong references. Since this is a static class and the class never removes the event handlers, the targeted controls will never be garbaged collected. This is a pretty significant memory leak.</p>
<p>Instead of using += to set event handlers you should use the DependencyPropertyDescriptor method that Brian used for the Visibility issue. Internally the WPF Dependency system uses weak refrences for event handlers thus the memory leak issue is avoided. I will post example code showing my solution derived from yours. Thanks for the good work!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bleeding_gums</title>
		<link>http://www.ageektrapped.com/blog/the-missing-net-4-cue-banner-in-wpf-i-mean-watermark-in-wpf/comment-page-1/#comment-667</link>
		<dc:creator>bleeding_gums</dc:creator>
		<pubDate>Fri, 02 Oct 2009 06:37:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.ageektrapped.com/blog/the-missing-net-4-cue-banner-in-wpf-i-mean-watermark-in-wpf/#comment-667</guid>
		<description>Very nice!

I found an issue when I was trying to show an animated image in the Adorner. The  image would only change when the adorner was hidden and reloaded. The solution I found was here:
http://stackoverflow.com/questions/583808/animation-inside-an-adorner-calling-onrender

Adding:
base.AddVisualChild(contentPresenter);
as the last call in the CueBannerAdorner constructor fixed this.</description>
		<content:encoded><![CDATA[<p>Very nice!</p>
<p>I found an issue when I was trying to show an animated image in the Adorner. The  image would only change when the adorner was hidden and reloaded. The solution I found was here:<br />
<a href="http://stackoverflow.com/questions/583808/animation-inside-an-adorner-calling-onrender" rel="nofollow">http://stackoverflow.com/questions/583808/animation-inside-an-adorner-calling-onrender</a></p>
<p>Adding:<br />
base.AddVisualChild(contentPresenter);<br />
as the last call in the CueBannerAdorner constructor fixed this.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Everett Fitzgibbons</title>
		<link>http://www.ageektrapped.com/blog/the-missing-net-4-cue-banner-in-wpf-i-mean-watermark-in-wpf/comment-page-1/#comment-610</link>
		<dc:creator>Everett Fitzgibbons</dc:creator>
		<pubDate>Thu, 12 Mar 2009 16:39:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.ageektrapped.com/blog/the-missing-net-4-cue-banner-in-wpf-i-mean-watermark-in-wpf/#comment-610</guid>
		<description>First, nice tool! Microsoft should have this in their toolbox!!!

My problem is similiar to the TextBox problem not showing CueBanner when external events update the bound value...

I cannot get the ComboBox to work. I have two (2) ComboBoxes for a Master-Detail UI. When the SelectedItem in MasterComboBox1 changes, I need DetailComboBox2 to show the CueBanner. I am setting the selectedItem to null, and the TextBox of the ComboBox clears - yet no CueBanner. There seems to be a disconnect between the Dependency Properties ComboBox.TextProperty and ComboBox.SelectedxxxProperty. I either get the value and the CueBanner superimposed or nothing at all. 

Any help resolving this would be much appreciated. Thank You.</description>
		<content:encoded><![CDATA[<p>First, nice tool! Microsoft should have this in their toolbox!!!</p>
<p>My problem is similiar to the TextBox problem not showing CueBanner when external events update the bound value&#8230;</p>
<p>I cannot get the ComboBox to work. I have two (2) ComboBoxes for a Master-Detail UI. When the SelectedItem in MasterComboBox1 changes, I need DetailComboBox2 to show the CueBanner. I am setting the selectedItem to null, and the TextBox of the ComboBox clears &#8211; yet no CueBanner. There seems to be a disconnect between the Dependency Properties ComboBox.TextProperty and ComboBox.SelectedxxxProperty. I either get the value and the CueBanner superimposed or nothing at all. </p>
<p>Any help resolving this would be much appreciated. Thank You.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: WPFRookie</title>
		<link>http://www.ageektrapped.com/blog/the-missing-net-4-cue-banner-in-wpf-i-mean-watermark-in-wpf/comment-page-1/#comment-604</link>
		<dc:creator>WPFRookie</dc:creator>
		<pubDate>Tue, 17 Feb 2009 17:15:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.ageektrapped.com/blog/the-missing-net-4-cue-banner-in-wpf-i-mean-watermark-in-wpf/#comment-604</guid>
		<description>i might be missing something, but how can the Cuebanner text be set programatically.

Mybextbox.CueBanner = &quot;This is my CueText&quot;;</description>
		<content:encoded><![CDATA[<p>i might be missing something, but how can the Cuebanner text be set programatically.</p>
<p>Mybextbox.CueBanner = &#8220;This is my CueText&#8221;;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JP Chow</title>
		<link>http://www.ageektrapped.com/blog/the-missing-net-4-cue-banner-in-wpf-i-mean-watermark-in-wpf/comment-page-1/#comment-596</link>
		<dc:creator>JP Chow</dc:creator>
		<pubDate>Mon, 12 Jan 2009 22:46:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.ageektrapped.com/blog/the-missing-net-4-cue-banner-in-wpf-i-mean-watermark-in-wpf/#comment-596</guid>
		<description>Sorry I&#039;m spamming your blog now. 

It seems that the above code does compile, however it breaks the Design view in VS2008.  The TextBox that I&#039;ve put the CueBannerService in is now highlighted with an error of &quot;Object reference not set to an instance of an object.&quot;

If I remove the line with setting the event of TextChanged the design view works fine. 

Any thoughts?</description>
		<content:encoded><![CDATA[<p>Sorry I&#8217;m spamming your blog now. </p>
<p>It seems that the above code does compile, however it breaks the Design view in VS2008.  The TextBox that I&#8217;ve put the CueBannerService in is now highlighted with an error of &#8220;Object reference not set to an instance of an object.&#8221;</p>
<p>If I remove the line with setting the event of TextChanged the design view works fine. </p>
<p>Any thoughts?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JP Chow</title>
		<link>http://www.ageektrapped.com/blog/the-missing-net-4-cue-banner-in-wpf-i-mean-watermark-in-wpf/comment-page-1/#comment-595</link>
		<dc:creator>JP Chow</dc:creator>
		<pubDate>Mon, 12 Jan 2009 19:39:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.ageektrapped.com/blog/the-missing-net-4-cue-banner-in-wpf-i-mean-watermark-in-wpf/#comment-595</guid>
		<description>I&#039;ve modified CueBannerPropertyChanged to specifically check for a TextBox and add a new event handler for TextChanged.

private static void CueBannerPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
      {
         Control control = (Control)d;
         TextBox tb = (TextBox)d;
         tb.Loaded += control_Loaded;
         control.Loaded += control_Loaded;
         if (d is TextBox)
         {
            tb.GotFocus += control_GotFocus;
            tb.LostFocus += control_Loaded;
            tb.TextChanged += textbox_Changed;
         }

then in my textbox_Changed

private static void textbox_Changed(object sender, RoutedEventArgs e)
      {
         TextBox c = (TextBox)sender;
         if (c.Text != &quot;&quot;)
         {
            RemoveCueBanner(c);
         }
      }</description>
		<content:encoded><![CDATA[<p>I&#8217;ve modified CueBannerPropertyChanged to specifically check for a TextBox and add a new event handler for TextChanged.</p>
<p>private static void CueBannerPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)<br />
      {<br />
         Control control = (Control)d;<br />
         TextBox tb = (TextBox)d;<br />
         tb.Loaded += control_Loaded;<br />
         control.Loaded += control_Loaded;<br />
         if (d is TextBox)<br />
         {<br />
            tb.GotFocus += control_GotFocus;<br />
            tb.LostFocus += control_Loaded;<br />
            tb.TextChanged += textbox_Changed;<br />
         }</p>
<p>then in my textbox_Changed</p>
<p>private static void textbox_Changed(object sender, RoutedEventArgs e)<br />
      {<br />
         TextBox c = (TextBox)sender;<br />
         if (c.Text != &#8220;&#8221;)<br />
         {<br />
            RemoveCueBanner(c);<br />
         }<br />
      }</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JP Chow</title>
		<link>http://www.ageektrapped.com/blog/the-missing-net-4-cue-banner-in-wpf-i-mean-watermark-in-wpf/comment-page-1/#comment-594</link>
		<dc:creator>JP Chow</dc:creator>
		<pubDate>Mon, 12 Jan 2009 18:10:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.ageektrapped.com/blog/the-missing-net-4-cue-banner-in-wpf-i-mean-watermark-in-wpf/#comment-594</guid>
		<description>Sorry I didn&#039;t clarify. I mean if the textbox is not in focus but the text within it gets updated via something else (ie. another class method) setting it. The adorner stays on and the updated text is underneath.  I&#039;m still a bit green at WPF and I&#039;m trying to figure out how to set an event with something like &quot;OnContentUpdate&quot; for a textbox. I&#039;ll post back if I can figure something out.</description>
		<content:encoded><![CDATA[<p>Sorry I didn&#8217;t clarify. I mean if the textbox is not in focus but the text within it gets updated via something else (ie. another class method) setting it. The adorner stays on and the updated text is underneath.  I&#8217;m still a bit green at WPF and I&#8217;m trying to figure out how to set an event with something like &#8220;OnContentUpdate&#8221; for a textbox. I&#8217;ll post back if I can figure something out.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jason Kemp</title>
		<link>http://www.ageektrapped.com/blog/the-missing-net-4-cue-banner-in-wpf-i-mean-watermark-in-wpf/comment-page-1/#comment-592</link>
		<dc:creator>Jason Kemp</dc:creator>
		<pubDate>Sat, 10 Jan 2009 00:40:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.ageektrapped.com/blog/the-missing-net-4-cue-banner-in-wpf-i-mean-watermark-in-wpf/#comment-592</guid>
		<description>JP:

If you look at the GotFocus event handler, you can see that we call the RemoveCueBanner() method if there is text in the textbox.</description>
		<content:encoded><![CDATA[<p>JP:</p>
<p>If you look at the GotFocus event handler, you can see that we call the RemoveCueBanner() method if there is text in the textbox.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JP Chow</title>
		<link>http://www.ageektrapped.com/blog/the-missing-net-4-cue-banner-in-wpf-i-mean-watermark-in-wpf/comment-page-1/#comment-591</link>
		<dc:creator>JP Chow</dc:creator>
		<pubDate>Fri, 09 Jan 2009 23:09:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.ageektrapped.com/blog/the-missing-net-4-cue-banner-in-wpf-i-mean-watermark-in-wpf/#comment-591</guid>
		<description>Awesome, thanks for posting this! Saved me a bunch of effort.

I have a question though, how would we have the adorner disappear once the Text property in the TextBox changes?</description>
		<content:encoded><![CDATA[<p>Awesome, thanks for posting this! Saved me a bunch of effort.</p>
<p>I have a question though, how would we have the adorner disappear once the Text property in the TextBox changes?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
