Windows Presentation Foundation (WPF) ForumHow to use Windows Presentation Foundation (WPF) productively to create visually appealing and differentiating applications and to improve user experience.43e1b4ad-eb8d-427f-90a9-161e7af74457© 2009 Microsoft Corporation. All rights reserved.2010-02-10T08:12:00Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/acfe3120-a850-4897-8fda-0d42d631ff70TextFormatter exception2010-02-06T16:10:27Z2010-02-10T08:12:21ZViv Phillipshttp://social.msdn.microsoft.com/Profile/en-US/?user=Viv%20Phillips<pre lang="x-c#">FormattedText ft = new FormattedText(&quot;Hello&quot;, CultureInfo.CurrentCulture, FlowDirection.LeftToRight, new Typeface(&quot;Verdana&quot;), 100, Brushes.Black); double d = ft.MinWidth;</pre> Why does the second line throw an ArgumentNullException<br/>Stack : MS.Internal.TextFormatting.TextFormatterImp.VerifyTextFormattingArguments(...)<br/><br/>Value cannot be null<br/>Parameter name: textSourcehttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/eb19e33f-1d87-4ee8-8339-d2a9280f6e84styling error in WPF2010-01-20T07:31:51Z2010-02-10T08:07:31ZHiran.Repakulahttp://social.msdn.microsoft.com/Profile/en-US/?user=Hiran.RepakulaHi Every one, <div><br/></div> <div><br/></div> <div>Am facing 2 problems while using styles in WPF</div> <div><br/></div> <div><strong>1. &nbsp; &nbsp; &nbsp;</strong>when am styling statusbar and toolbar am getting this error</div> <div><br/></div> <div> <div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Could not load type 'Microsoft.Windows.Design.Metadata.ProvideMetadataAttribute' from assembly 'Microsoft.Windows.Design.Extensibility, Version=3.5.0.0, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</div> <div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Line '1' Position '364'</div> <div><br/></div> <div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;and on degin it shows shows PROBLEM LOADING and down RELOAD THE DESIGNER.</div> <div><br/></div> <div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;when i click reload the error will go and when i rebuild or debug the application it comes again.</div> <div><br/></div> <div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Every time i rebuild or debug i have to click Reload The Designer to see the design. How to remove this error.</div> <div><br/></div> <div><strong>2. &nbsp; &nbsp; </strong>Am also applying styles for my datagrid(WPF Toolkit), in this i have applied styles to datagridcolumnheader, everything is fine</div> <div><br/></div> <div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;but when the total columns length is less than datagrid width, the column headers will get style and the remaining part will be the same old.</div> <div><br/></div> <div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;its looking very odd, when i searched for this i came to know that we have to apply style for datagridcolumncontainer, but i&nbsp;don't&nbsp;know how to apply style for that,</div> <div><br/></div> <div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Can anyone help me on this 2 issues.</div> <div><br/></div> <div>Thanks in Advance</div> <div><br/></div> <div><br/></div> <div><br/></div> <div><br/></div> </div><hr class="sig">Hiran Repakulahttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/448386fb-f5f1-4d07-bac2-10f660c527dbRibbonTab.IsOpen became False by unknown cause!2010-02-10T07:52:08Z2010-02-10T07:52:09ZKelmenhttp://social.msdn.microsoft.com/Profile/en-US/?user=KelmenI have a problem with the RibbonTab.IsOpen chg to False by unknown reason!<br/><br/>I have a custom Popup stick on the RibbonBar, being used as data validation message.<br/>When a DatePicker got invalid value, and upon PreviewLostKeyboardFocus, I will show the custom popup.<br/>Everytime the validation logic is kicking in, it will hide the Popup, and show it only when got error.<br/><br/>If I execute a lostfocus for the DatePicker with invalid date, to popup error, worked ok.<br/>if I execute the lostfocus twice in rapid succession, the RibbonTab disappear!<br/><br/>I debug through the RibbonTab.OnPropertyChanged event, the disappearance is likely due to the IsOpen been set to False.<br/>Which my custom Popup happened to have the same prop name.<br/>I verify the arguement, and has no idea why this happened....<br/><br/>anyone?http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/96d53221-a2f5-43a2-993d-a33a83631780How can i get reference to element inside DataTemplate of a ListView?2010-02-09T20:00:35Z2010-02-10T07:48:10ZDeniddhttp://social.msdn.microsoft.com/Profile/en-US/?user=DeniddHello,<br/>I've got a ListView with one item in it&nbsp;- TabControl.<br/>I'm trying to get reference to element inside a TabItem (myTxt). <br/><br/> <pre>&lt;ListView Name=&quot;lstDetailsView&quot;&gt; &lt;ItemsControl.ItemTemplate&gt; &lt;DataTemplate&gt; &lt;TabControl Name=&quot;MainTabs&quot;&gt; &lt;TabItem&gt; &lt;TextBox Name=&quot;myTxt&quot; /&gt; &lt;/TabItem&gt; &lt;/TabControl&gt; &lt;/DataTemplate&gt; &lt;/ItemsControl.ItemTemplate&gt; &lt;/ListView&gt; </pre> <br/><br/>Help Please,<br/><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">Thank you!<br/><br/></span></span></span></span>http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/d2b80692-0f88-44df-8ea2-939b207aa228Changing the database connection string in a wpf web application2010-02-05T16:48:04Z2010-02-10T07:45:52ZSimon Allporthttp://social.msdn.microsoft.com/Profile/en-US/?user=Simon%20AllportHi,<br/>I have published a web wpf application and the application in visual studio has a app.config file with the database connection string in. Now that the application is published and ready to go on a new server and pointing to a new database. I try and change the config file within the deployed folder&nbsp; (wpfapp.exe.config)&nbsp; and rerun the application in my browser and the application still seems to be pointing to the original database. <br/><br/>Could someone please help me with this.<br/><br/>Thanks<br/><br/>Simonhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/b595eba1-1292-4833-85cf-6665b1424472How to Access ChildControls Value on SelectionChanged Event of Listbox ?2010-02-10T07:44:11Z2010-02-10T07:44:12ZVijay1984http://social.msdn.microsoft.com/Profile/en-US/?user=Vijay1984<span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small"><strong>&nbsp;</strong><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small"><font size=2 color="#0000ff"><font size=2 color="#0000ff"> <p><strong>H! Friends <br/><br/>Thanks Nagaarjun for the reply <br/><br/>I did try above Code but getting exception so sending you my xaml code as a whole with explanations. below than tell me how to do it?<br/><br/>I got this xaml where i am using datatemplate for Listbox in which i have One Image control and another Two are Texblocks as you can see in below Xaml. Now what i want is On Selectionchanged event i want to access the 2nd Texblock with Name &quot;friendID&quot; in my C# Selectionchanged event. How can i get access these controls and their text value in code behind.<br/><br/>&lt;</strong></p> </font></font></span></span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small"><font size=2 color="#0000ff"> <p>&nbsp;</p> </font></span></span></span> <p>&nbsp;</p> </span></span><span style="font-size:xx-small"><strong><span style="color:#a31515;font-size:x-small"><span style="color:#a31515;font-size:x-small">Grid</span></span><span style="color:#ff0000;font-size:x-small"><span style="color:#ff0000;font-size:x-small"> Margin</span></span></strong></span><span style="font-size:xx-small"><strong><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">=&quot;15.5,8,8,8&quot;&gt;<br/></span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">&lt;</span></span><span style="color:#a31515;font-size:x-small"><span style="color:#a31515;font-size:x-small">Grid.Resources</span></span></strong></span><span style="font-size:xx-small"><strong><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">&gt;<br/></span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">&lt;</span></span><span style="color:#a31515;font-size:x-small"><span style="color:#a31515;font-size:x-small">DataTemplate</span></span><span style="color:#ff0000;font-size:x-small"><span style="color:#ff0000;font-size:x-small"> x</span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">:</span></span><span style="color:#ff0000;font-size:x-small"><span style="color:#ff0000;font-size:x-small">Key</span></span></strong></span><span style="font-size:xx-small"><strong><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">=&quot;ItemTemplate1&quot;<br/></span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">&lt;</span></span><span style="color:#a31515;font-size:x-small"><span style="color:#a31515;font-size:x-small">StackPanel</span></span><span style="color:#ff0000;font-size:x-small"><span style="color:#ff0000;font-size:x-small"> Orientation</span></span></strong></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small"><span style="font-size:xx-small"><strong>=&quot;Vertical&quot;&gt;<br/></strong></span></span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small"><br/><span style="font-size:xx-small"><strong>&lt;</strong></span></span></span><span style="font-size:xx-small"><strong><span style="color:#a31515;font-size:x-small"><span style="color:#a31515;font-size:x-small">Image</span></span><span style="color:#ff0000;font-size:x-small"><span style="color:#ff0000;font-size:x-small"> x</span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">:</span></span><span style="color:#ff0000;font-size:x-small"><span style="color:#ff0000;font-size:x-small">Name</span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">=&quot;ImgFriendImage&quot;</span></span><span style="color:#ff0000;font-size:x-small"><span style="color:#ff0000;font-size:x-small"> Source</span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">=&quot;{</span></span><span style="color:#a31515;font-size:x-small"><span style="color:#a31515;font-size:x-small">Binding</span></span><span style="color:#ff0000;font-size:x-small"><span style="color:#ff0000;font-size:x-small"> Friendimage</span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">}&quot;</span></span><span style="color:#ff0000;font-size:x-small"><span style="color:#ff0000;font-size:x-small"> Height</span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">=&quot;125&quot;</span></span><span style="color:#ff0000;font-size:x-small"><span style="color:#ff0000;font-size:x-small"> Width</span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">=&quot;125&quot;</span></span><span style="color:#ff0000;font-size:x-small"><span style="color:#ff0000;font-size:x-small"> Margin</span></span></strong></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small"><span style="font-size:xx-small"><strong>=&quot;10,0,0,0&quot;/&gt;<br/></strong></span></span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small"><br/><span style="font-size:xx-small"><strong>&lt;</strong></span></span></span><span style="font-size:xx-small"><strong><span style="color:#a31515;font-size:x-small"><span style="color:#a31515;font-size:x-small">TextBlock</span></span><span style="color:#ff0000;font-size:x-small"><span style="color:#ff0000;font-size:x-small"> x</span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">:</span></span><span style="color:#ff0000;font-size:x-small"><span style="color:#ff0000;font-size:x-small">Name</span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">=&quot;txtFriendfName&quot;</span></span><span style="color:#ff0000;font-size:x-small"><span style="color:#ff0000;font-size:x-small"> Text</span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">=&quot;{</span></span><span style="color:#a31515;font-size:x-small"><span style="color:#a31515;font-size:x-small">Binding</span></span><span style="color:#ff0000;font-size:x-small"><span style="color:#ff0000;font-size:x-small"> Friendname</span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">}&quot;</span></span><span style="color:#ff0000;font-size:x-small"><span style="color:#ff0000;font-size:x-small"> Width</span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">=&quot;Auto&quot;</span></span><span style="color:#ff0000;font-size:x-small"><span style="color:#ff0000;font-size:x-small"> Height</span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">=&quot;Auto&quot;</span></span><span style="color:#ff0000;font-size:x-small"><span style="color:#ff0000;font-size:x-small"> FontSize</span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">=&quot;18.667&quot;</span></span><span style="color:#ff0000;font-size:x-small"><span style="color:#ff0000;font-size:x-small"> Margin</span></span></strong></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small"><span style="font-size:xx-small"><strong>=&quot;10,0,0,0&quot;/&gt;<br/></strong></span></span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small"><br/><span style="font-size:xx-small"><strong>&lt;</strong></span></span></span><span style="font-size:xx-small"><strong><span style="color:#a31515;font-size:x-small"><span style="color:#a31515;font-size:x-small">TextBlock</span></span><span style="color:#ff0000;font-size:x-small"><span style="color:#ff0000;font-size:x-small"> x</span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">:</span></span><span style="color:#ff0000;font-size:x-small"><span style="color:#ff0000;font-size:x-small">Name</span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">=&quot;txtFriendID&quot;</span></span><span style="color:#ff0000;font-size:x-small"><span style="color:#ff0000;font-size:x-small"> Text</span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">=&quot;{</span></span><span style="color:#a31515;font-size:x-small"><span style="color:#a31515;font-size:x-small">Binding</span></span><span style="color:#ff0000;font-size:x-small"><span style="color:#ff0000;font-size:x-small"> Friendid</span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">}&quot;</span></span><span style="color:#ff0000;font-size:x-small"><span style="color:#ff0000;font-size:x-small"> TextWrapping</span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">=&quot;Wrap&quot;</span></span><span style="color:#ff0000;font-size:x-small"><span style="color:#ff0000;font-size:x-small"> Visibility</span></span></strong></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small"><span style="font-size:xx-small"><strong>=&quot;Hidden&quot;/&gt;<br/></strong></span></span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small"><br/><span style="font-size:xx-small"><strong>&lt;/</strong></span></span></span><span style="color:#a31515;font-size:x-small"><span style="color:#a31515;font-size:x-small"><span style="font-size:xx-small"><strong>StackPanel</strong></span></span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small"><span style="font-size:xx-small"><strong>&gt;<br/></strong></span></span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small"><br/><span style="font-size:xx-small"><strong>&lt;/</strong></span></span></span><span style="color:#a31515;font-size:x-small"><span style="color:#a31515;font-size:x-small"><span style="font-size:xx-small"><strong>DataTemplate</strong></span></span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small"><span style="font-size:xx-small"><strong>&gt;<br/></strong></span></span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small"><br/><span style="font-size:xx-small"><strong>&lt;/</strong></span></span></span><span style="color:#a31515;font-size:x-small"><span style="color:#a31515;font-size:x-small"><span style="font-size:xx-small"><strong>Grid.Resources</strong></span></span></span><span style="font-size:xx-small"><strong><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">&gt;<br/></span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">&lt;</span></span><span style="color:#a31515;font-size:x-small"><span style="color:#a31515;font-size:x-small">ListBox</span></span><span style="color:#ff0000;font-size:x-small"><span style="color:#ff0000;font-size:x-small"> x</span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">:</span></span><span style="color:#ff0000;font-size:x-small"><span style="color:#ff0000;font-size:x-small">Name</span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">=&quot;frndListBox&quot;</span></span><span style="color:#ff0000;font-size:x-small"><span style="color:#ff0000;font-size:x-small"> ItemsSource</span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">=&quot;{</span></span><span style="color:#a31515;font-size:x-small"><span style="color:#a31515;font-size:x-small">Binding</span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">}&quot;</span></span><span style="color:#ff0000;font-size:x-small"><span style="color:#ff0000;font-size:x-small"> ItemTemplate</span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">=&quot;{</span></span><span style="color:#a31515;font-size:x-small"><span style="color:#a31515;font-size:x-small">DynamicResource</span></span><span style="color:#ff0000;font-size:x-small"><span style="color:#ff0000;font-size:x-small"> ItemTemplate1</span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">}&quot;</span></span><span style="color:#ff0000;font-size:x-small"><span style="color:#ff0000;font-size:x-small"> Margin</span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">=&quot;0,37.5,0,116.5&quot;</span></span><span style="color:#ff0000;font-size:x-small"><span style="color:#ff0000;font-size:x-small"> HorizontalAlignment</span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">=&quot;Left&quot;</span></span><span style="color:#ff0000;font-size:x-small"><span style="color:#ff0000;font-size:x-small"> Width</span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">=&quot;276&quot;</span></span><span style="color:#ff0000;font-size:x-small"><span style="color:#ff0000;font-size:x-small"> d</span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">:</span></span><span style="color:#ff0000;font-size:x-small"><span style="color:#ff0000;font-size:x-small">LayoutOverrides</span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">=&quot;GridBox&quot;</span></span><span style="color:#ff0000;font-size:x-small"><span style="color:#ff0000;font-size:x-small"> SelectionChanged</span></span></strong></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small"><span style="font-size:xx-small"><strong>=&quot;frndListBox_SelectionChanged&quot; /&gt;<br/>&lt;/Grid&gt;<br/><br/><br/><br/>Please do reply me.&nbsp; Thank you<br/><br/>Regards<br/>Vijay Gaur</strong></span></span></span>http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/5aa966a2-3dac-442f-a9df-0d37fff2ee5eNon-scrolling object on top of a WPF scrollviewer2010-02-09T18:43:52Z2010-02-10T07:27:08Zjoowahttp://social.msdn.microsoft.com/Profile/en-US/?user=joowaHello<br/> <br/> I'm working on a WPF application which has a scrollviewer. This scrollviewer shows multiple rectangles untherneath eachother (with an itemtemplate, one object is called a &quot;theme&quot;). Now I need the name of each &quot;theme&quot; 'floating' on top of each row but they have to stay on the left side of the screen (without moving if i scroll). I tried using an adorner but this didn't give a good result. I can't use a separate bar on the left on the screen, because I'd loose too much space on the UI. <br/> <br/> So the problem is I need the name of each theme on top of its own rectangle. The rectangle has to scroll, but not its name so it stays visible. Is there anything I could do within the itemtemplate itself (because that's the only place the name of the 'current' theme is known), or maybe another solution? <br/> <br/> Thanks in advance (excuse me for my bad English)<br/> Joachimhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/c48b5942-2fcc-4634-b6c2-88deb3257520Need help implementing find and replace.2010-02-06T09:06:15Z2010-02-10T07:25:25Znaturefreak827http://social.msdn.microsoft.com/Profile/en-US/?user=naturefreak827I am trying to use the code from the example in this article by&nbsp;<span style="font-family:Arial, Helvetica, Georgia, sans-serif;font-size:14px">Zhou Yong</span>&nbsp;&nbsp;<a href="http://shevaspace.blogspot.com/2007/11/how-to-search-text-in-wpf-flowdocument.html">http://shevaspace.blogspot.com/2007/11/how-to-search-text-in-wpf-flowdocument.html</a>&nbsp;How would I use this to find and select text in a richtextbox located on a different window?&nbsp;http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/3316b547-c983-407e-a977-c24d12744345How to Access ChildControls Value on SelectionChanged Event of Listbox ?2010-02-09T13:49:27Z2010-02-10T07:17:54ZVijay1984http://social.msdn.microsoft.com/Profile/en-US/?user=Vijay1984H! Friends<br/><br/>i got a query with respect to Lsitbox.<br/><br/>i have a Listbox in which i have a <strong>Textblock and Image</strong> controls as a ListboxItem.<br/>Now what i want is when i select an item in Listbox i want to access the values of Textblock and Image in the SelectionChange Event of Listbox.<br/>Can anybody tell me how can i do that ? How can i access values of texblock and Image on Selectionchange event of Listbox.?<br/><br/>Please do reply friends<br/><br/>Thank You <br/><br/>Regards<br/>Vijay Gaurhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/0b22ceba-3d20-4cec-8528-ec78a4bed396WPF UserControls - Size Problem2010-02-05T09:20:54Z2010-02-10T07:16:55ZDaanyohttp://social.msdn.microsoft.com/Profile/en-US/?user=DaanyoHello Everybody<br/><br/>I'm creating my own WPF UserControls and i have some problems with the Size of the Controls in the Designermode. <br/>If i drag one of my UserControls from the Toolbox (by the way: I'm working with VisualStudio 2008 and Windows&nbsp;XP), it has a height of 200 and a width of 120. <br/><br/>This is my XAML file for the CheckBox:<br/> <pre> &lt;Grid Name=&quot;grid&quot;&gt; &lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition Width=&quot;{Binding RelativeSource = {RelativeSource FindAncestor, AncestorType = {x:Type UserControl}}, Path = LeftGridWidth}&quot; /&gt; &lt;ColumnDefinition /&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;Label Name=&quot;lbl&quot; Content=&quot;label&quot; Grid.Column=&quot;{Binding RelativeSource = {RelativeSource FindAncestor, AncestorType = {x:Type UserControl}}, Path = LabelColumn}&quot;&gt; &lt;/Label&gt; &lt;CheckBox VerticalContentAlignment=&quot;Center&quot; Name=&quot;chk&quot; IsChecked=&quot;True&quot; IsEnabled=&quot;True&quot; VerticalAlignment=&quot;Center&quot; HorizontalAlignment=&quot;Left&quot; Grid.Column=&quot;{Binding RelativeSource = {RelativeSource FindAncestor, AncestorType = {x:Type UserControl}}, Path = CheckBoxColumn}&quot; Margin=&quot;7,0,0,0&quot; &gt;&lt;/CheckBox&gt;</pre> I have already tried to set the Size of the Grid in this XAML file, but the problem wasn't fixed. <br/>I also tried to create a property in the code behind to set the size, but it didn't help too. <br/><br/>I hope there is someone who can help me to solve my problem..<br/><br/>http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/7b9c8c65-349b-4772-abd2-e221ccb664e9contextmenu with multiple columns2010-02-08T17:44:37Z2010-02-10T07:15:33ZAlexander Gnauckhttp://social.msdn.microsoft.com/Profile/en-US/?user=Alexander%20GnauckI want to create a context menu which has multiple columns. It should look like this:<br/> <br/> Item_11 | Item_12 | Item_13<br/> Item_21 | Item_22 | Item_23<br/> Item_31 | Item_32 | Item_33<br/> <br/> With the MenuStrip from SWF in .NET 2. this was very easy using a Tablelayout. BarBreak in the standard SWF menus does the same.<br/> <br/> I tried a Grid inside the ContextMenu, but this does not render correct and highlights all menuitems when the mouse hovers into the context menu.<br/> Any ideas? <br/> <br/> Thanks,<br/> Alex<br/> <br/> <hr> Alexander Gnauck, AG-Softwarehttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/457f1f83-9130-4fd9-806f-c75a1cf6d098How to capture a Mouse position on the screen regardless of current form2010-02-05T08:15:22Z2010-02-10T07:02:58ZDinesh2521http://social.msdn.microsoft.com/Profile/en-US/?user=Dinesh2521I need to capture the current Mouse/Cursor(In Case if any document/Notepad open)&nbsp; position regardless of current form. How to capture those coordinates using c#/VB?http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/ea2ad5ac-3796-4366-9717-62d54c30dcaeWPF TextBox Problem2010-02-05T08:11:24Z2010-02-10T06:58:04ZAhamed.Mohideenhttp://social.msdn.microsoft.com/Profile/en-US/?user=Ahamed.Mohideen<span id="ctl00_ContentPlaceHolder1_lblDescription" style="color:darkblue"><span style="font-family:Arial;color:black">Hi EveryBody,<br/> <br/> I have 2 Prj. 1) WPF Prj 2) VS2008 WinForm contains 1 form with a button<br/> <br/> WPF Prj Name: CheckWPFTextBox Window Name: WndMessage123<br/> WPF Prj have 1 TextBox, now I convert the WPF App [Windows Application] into Class Library through Prj Properties change output Type.<br/> <br/> Now In Windows Form, I include the Reference of CheckWPFTextBox.dll then from the button click <br/> <br/> CheckWPFTextBox .WndMessage123 aa = new CheckWPFTextBox .WndMessage123();<br/> aa.ShowDialog(); <br/> <br/> Now we can able to write the Text into the TextBox but, When I change the aa.ShowDialog(); into aa.Show(); I can't able to write the Text. Why ? Please give the Solution... <br/> <br/> Regards<br/> Ahamed</span> </span><hr class="sig">amhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/d6cb6ff0-b84a-409b-b80a-6c867c48693ePerformance differences for image scaling when using Image or DrawImage2010-02-05T07:51:29Z2010-02-10T06:51:44ZLeifOhttp://social.msdn.microsoft.com/Profile/en-US/?user=LeifOHi,<br/><br/>my application needs to scale images, and as most things in WPF there are several options. Two of them are:<br/><br/>1. Use the Image class with a ScaleTransform<br/>2. Use the DrawingVisual class and scale the image with the DrawingContext's&nbsp;DrawImage method.<br/><br/>Are there any performance differences with these two methods, e.g. regarding what's done in SW/HW and what memory needs to&nbsp;be transferred to, or kept in, the&nbsp;display card's&nbsp;memory ?<br/><br/>Regards,<br/>Leifhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/9a69ad58-fa98-4cfb-ab83-02801cbc054bXBAP limitations2010-02-05T07:34:40Z2010-02-10T06:39:46Znanou425http://social.msdn.microsoft.com/Profile/en-US/?user=nanou425<p style="line-height:18pt;margin:4.8pt 0cm 6pt"><strong><span style="font-family:'Arial','sans-serif';color:black;font-size:10pt">XBAP limitations .NET 3.5<br/></span></strong><span style="font-family:'Arial','sans-serif';color:black;font-size:10pt"><br/><em>Is those limitations always avalaible for XBAP 4.0?</em><br/><br/>Regards,</span></p> <p style="line-height:18pt;margin:4.8pt 0cm 6pt"><span>Not Permitted</span></p> <p style="line-height:18pt;text-indent:-18pt;margin:0cm 0cm 1.2pt 18pt;tab-stops:list 36.0pt"><span style="font-family:Wingdings;color:black;font-size:10pt"><span style="">&sect;<span style="font:7pt &quot;Times New Roman&quot;">&nbsp; </span></span></span><span style="font-family:'Arial','sans-serif';color:black;font-size:10pt">Stand-alone Windows.</span></p> <p style="line-height:18pt;text-indent:-18pt;margin:0cm 0cm 1.2pt 18pt;tab-stops:list 36.0pt"><span style="font-family:Wingdings;color:black;font-size:10pt"><span style="">&sect;<span style="font:7pt &quot;Times New Roman&quot;">&nbsp; </span></span></span><span style="font-family:'Arial','sans-serif';color:black;font-size:10pt">Most standard dialogs.</span></p> <p style="line-height:18pt;text-indent:-18pt;margin:0cm 0cm 1.2pt 18pt;tab-stops:list 36.0pt"><span style="font-family:Wingdings;color:black;font-size:10pt"><span style="">&sect;<span style="font:7pt &quot;Times New Roman&quot;">&nbsp; </span></span></span><span style="font-family:'Arial','sans-serif';color:black;font-size:10pt">Interop with Windows controls or ActiveX controls.</span></p> <p style="line-height:18pt;text-indent:-18pt;margin:0cm 0cm 1.2pt 18pt;tab-stops:list 36.0pt"><span style="font-family:Wingdings;color:black;font-size:10pt"><span style="">&sect;<span style="font:7pt &quot;Times New Roman&quot;">&nbsp; </span></span></span><span style="font-family:'Arial','sans-serif';color:black;font-size:10pt">Access to OS drag and drop.</span></p> <p style="line-height:18pt;text-indent:-18pt;margin:0cm 0cm 1.2pt 18pt;tab-stops:list 36.0pt"><span style="font-family:Wingdings;color:black;font-size:10pt"><span style="">&sect;<span style="font:7pt &quot;Times New Roman&quot;">&nbsp; </span></span></span><span style="font-family:'Arial','sans-serif';color:black;font-size:10pt">Bitmap Effects (these are deprecated in .NET 3.5 SP1).</span></p> <p style="line-height:18pt;text-indent:-18pt;margin:0cm 0cm 1.2pt 18pt;tab-stops:list 36.0pt"><span style="font-family:Wingdings;color:black;font-size:10pt"><span style="">&sect;<span style="font:7pt &quot;Times New Roman&quot;">&nbsp; </span></span></span><span style="font-family:'Arial','sans-serif';color:black;font-size:10pt">Shader Effects</span></p> <p style="line-height:18pt;text-indent:-18pt;margin:0cm 0cm 1.2pt 18pt;tab-stops:list 36.0pt"><span style="font-family:Wingdings;color:black;font-size:10pt"><span style="">&sect;<span style="font:7pt &quot;Times New Roman&quot;">&nbsp; </span></span></span><span style="font-family:'Arial','sans-serif';color:black;font-size:10pt">Direct Database communication</span></p> <p style="line-height:18pt;margin:4.8pt 0cm 6pt">&nbsp;</p>http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/27cb9b1f-1fb0-4f3a-9c28-8ac5619f9c77How can I solve the problem when I want to close OSK process?2010-02-05T07:14:30Z2010-02-10T06:29:39Zzenonihttp://social.msdn.microsoft.com/Profile/en-US/?user=zenoniAs I follow <a href="http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/138e57d3-7ee3-42a1-b43d-65900a56cb57">this topic</a> to call the OSK keyboard,<br/> <br/> I got the problem when I need to close the &quot;OSK&quot;.<br/> <br/> This is the ERROR that I got.<br/> &lt;!-- coloro:#FF0000--&gt;<span style="color:#ff0000">&lt;!-- /coloro--&gt;System.InvalidOperationException was unhandled by user code<br/> Message=&quot;Cannot process request because the process has exited.&quot;&lt;!-- colorc--&gt;</span> &lt;!-- /colorc--&gt; <br/> <br/> <br/> This is a code that I used.<br/> <pre lang="x-c#">private System.Diagnostics.Process _p = null; private void passwordBox1_GotFocus(object sender, RoutedEventArgs e) { if (_p == null) _p = System.Diagnostics.Process.Start(&quot;osk.exe&quot;); else { _p.Kill(); _p.Dispose(); _p = null; } }</pre> <br/> I got a error at <br/> <pre lang="x-c#">_p.Kill();<br/> </pre> line.<br/> <br/> Thank in advancehttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/5b1c3c97-82f7-43ca-b4dc-0ea2264a1727Is it possible to add a MenuStrip to a WPF application?2010-02-05T15:16:58Z2010-02-10T06:12:43ZPhilKnoxhttp://social.msdn.microsoft.com/Profile/en-US/?user=PhilKnoxI'm working in Visual Studio 2010 (Beta 2).&nbsp; I can't find menustrip in the toolbox (I opened &quot;All WPF Controls&quot; in the toolbox.&nbsp; I've done it in the past with a &quot;Forms&quot; application in 2008.&nbsp; Is this changed to a different command or process in 2010?&nbsp; Is it not possible in WPF?&nbsp; Or am I just being the ultimate newbie and missing it?&nbsp; Thanks for any help.http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/72d5540b-eb5b-437b-99bb-d1e7cf3aa822How to let Grid become 3d2010-02-10T05:44:23Z2010-02-10T05:44:24Zask000http://social.msdn.microsoft.com/Profile/en-US/?user=ask000How to let Grid&nbsp; become 3d in wpf,<br/>I want make 3D interface ,<br/>who can help me?http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/3a546a20-fb46-4fb1-accb-2df0ada755a6WPF Generic Exception2007-02-06T18:19:10Z2010-02-10T05:42:45Zh1http://social.msdn.microsoft.com/Profile/en-US/?user=h1<p>Hello,</p> <p>I've been doing WPF stuff for a few month now.  I still don't know how to take advantage of WPF exception when I'm in debug mode.  The exception is too generic:</p> <p>Cannot create instance of 'Window1' defined in assembly 'TestApp, Version=1.0.2593.18516, Culture=neutral, PublicKeyToken=null'. Exception has been thrown by the target of an invocation.  Error in markup file 'Window1.xaml' Line 1 Position 9.</p> <p>There is infact nothing wrong with line1 Position9...Am I missing an option or something.</p> <p>Thanks</p> <p>Houman</p>http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/23e74fad-93e6-457d-9f89-e6ed8de1bfe3How to change TextBox focus color?2010-02-05T15:30:45Z2010-02-10T05:31:25ZTulehtihttp://social.msdn.microsoft.com/Profile/en-US/?user=TulehtiI want change TextBox keyboard focus color. Is this possible?<br/> <br/> I have try this example (not seems to workin) http://msdn.microsoft.com/en-us/library/ms771588.aspx<br/>http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/3b88ec8b-29c8-4211-bf75-75be1891c948Eventhandlers for events raised by controls within DataTemplate2010-02-09T16:57:43Z2010-02-10T05:04:07Zeeerrp11http://social.msdn.microsoft.com/Profile/en-US/?user=eeerrp11<div>I have a DataTemplate put inside a xaml resource file which does not have a codebehind file (.cs or .vb).</div> <div>I am using this DataTemplate as a staticresource on&nbsp;ItemTemplate &nbsp;of&nbsp;ListBox which is present on a window.</div> <div>My DataTemplate has got a Button control inside. If I want to hookup a buttonClick event handler to click event, where do I have to put my eventhandler code. As the DataTemplate does not have a codebehind file, I do not understand what to do?</div> <div><br/></div> <div>Any suggestion is really appricated.</div>http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/2463e243-c5e7-4129-863d-e4650249768cCollapsing all treeviewitems except for the selected one.2010-02-04T21:28:27Z2010-02-10T04:36:51ZDieterDWorkshttp://social.msdn.microsoft.com/Profile/en-US/?user=DieterDWorksHow can I collapse all treeviewitems except for the selected one?<br/>I don't see any option to collapse or expand an item. I also don't see an option to do it automaticly.http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/5f55a966-8ea4-4e88-8ddf-9dee36273cfaUppercase on cell DataGrid2010-01-12T02:29:57Z2010-02-10T04:34:59ZMilton Abehttp://social.msdn.microsoft.com/Profile/en-US/?user=Milton%20AbeHey people!<br/> <br/> Well, I'm trying to force the entry (and the reading) of a WPF DataGrid to be always UPPERCASE. I have searched through the Internet without a good solution... Everything would be programatically set. So far I have this piece of code:<br/> <br/> <br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return new DataGridTextColumn<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Header = new TextBlock { Text = columnHeader, ToolTip = toolTipText },<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Binding = new Binding(metaField.FullName.Replace('.', '_')),<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IsReadOnly = isReadOnly,<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CellStyle = style<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; };<br/> <br/> What am I missing? the uppercase stuff should be set on CellStyle? If so, how could I implement this?<br/> <br/> Thanks in advance!<br/> Milton<br/>http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/f2093753-7946-4c5e-8249-a11f7233416aadd a storyboard to a button for foreground property2010-02-05T14:45:09Z2010-02-10T03:32:57ZMauroGvhttp://social.msdn.microsoft.com/Profile/en-US/?user=MauroGv<p>Hi,<br/>I would add a storyboard to button when it clicked.<br/>I'm just trying to change the foreground for two seconds.<br/>This is the code I wrote:<br/><br/></p> <pre lang=x-xml>&lt;MenuItem&gt; &lt;MenuItem.Template&gt; &lt;ControlTemplate&gt; &lt;!-- In handler click other working code--&gt; &lt;Button Name=&quot;executeButton&quot; Click=&quot;executeButton_Click&quot; &gt; &lt;Button.Triggers&gt; &lt;EventTrigger RoutedEvent=&quot;Button.Click&quot;&gt; &lt;BeginStoryboard&gt; &lt;Storyboard&gt; &lt;ColorAnimation Duration=&quot;00:00:02&quot; Storyboard.TargetProperty=&quot;Foreground&quot; To=&quot;Red&quot; /&gt; &lt;/Storyboard&gt; &lt;/BeginStoryboard&gt; &lt;/EventTrigger&gt; &lt;/Button.Triggers&gt; Execute &lt;/Button&gt; &lt;/ControlTemplate&gt; &lt;/MenuItem.Template&gt; &lt;/MenuItem&gt;</pre> The code is not running when I Click on Button.<br/>Is my Button.Trigger in wrong?<br/><br/>Best Regards,<br/>Mauro<hr class="sig">Maurohttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/80068698-b6db-4550-bd8c-641ffa208d33Having a stackpanel in a listbox with a bound displaymember path2010-02-01T11:08:47Z2010-02-10T07:37:14ZSimon Allporthttp://social.msdn.microsoft.com/Profile/en-US/?user=Simon%20AllportHi, <br/>I am wondering if anyone can help me, I have a listbox bound to a object and I want the displaymember path to have a stackpanel so that I can show a image and some text.<br/><br/>&lt;<span style="font-size:x-small;color:#a31515"><span style="font-size:x-small;color:#a31515">ListBox</span></span><span style="font-size:x-small"> </span><span style="font-size:x-small;color:#ff0000"><span style="font-size:x-small;color:#ff0000">Name</span></span><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">=&quot;lbWaitingList&quot;</span></span><span style="font-size:x-small;color:#ff0000"><span style="font-size:x-small;color:#ff0000"> </span></span><span style="font-size:x-small;color:#ff0000"><span style="font-size:x-small;color:#ff0000">DisplayMemberPath</span></span><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">=&quot;Fullname&quot;</span></span><span style="font-size:x-small;color:#ff0000"><span style="font-size:x-small;color:#ff0000"> ItemsSource</span></span><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">=&quot;{</span></span><span style="font-size:x-small;color:#a31515"><span style="font-size:x-small;color:#a31515">Binding</span></span><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">}&quot;</span></span><span style="font-size:x-small;color:#ff0000"><span style="font-size:x-small;color:#ff0000"> SelectedValuePath</span></span><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">=&quot;PatientID&quot; /&gt;</span></span><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff"><br/><br/></span></span>Thanks<br/><br/>Simon<br/><br/><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff"><font size=2 color="#0000ff"><font size=2 color="#0000ff"> <p>&nbsp;</p> </font></font></span><font size=2 color="#0000ff"> <p>&nbsp;</p> </font></span> <p><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff"><br/></span></span></p>http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/adff0315-9a00-4491-a3bc-c5482648acc9Can an XBAP WPF application access the url bar2010-02-08T22:21:53Z2010-02-10T03:14:36ZJohny79http://social.msdn.microsoft.com/Profile/en-US/?user=Johny79Is there anyway for a WPF to access the internet explorer URL bar and programmatically change the url? Is there such a class to handle that from the .NET framework or is it even possible?http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/9cd8fcca-6fff-4ca2-84b7-b5edcd50769aSystem.Window.SystemColors list? Themes?2010-02-03T14:39:00Z2010-02-10T02:54:57ZShimmy Weitzhandlerhttp://social.msdn.microsoft.com/Profile/en-US/?user=Shimmy%20WeitzhandlerDoes anyone know about nice themes for WPF, using System.Windows.SystemColors?<br/>Or else I am looking for a list of all the SystemColors and where each of them affects the application.<br/><br/>Any examples, links or just anything is welcommed.<hr class="sig">Shimmyhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/dc450909-0512-4864-987d-c9137dee4bc3Write over an image in ink canvas2010-02-10T02:35:21Z2010-02-10T02:35:22Zoptimus_primehttp://social.msdn.microsoft.com/Profile/en-US/?user=optimus_primeHow is it that the the pen/brush on Ink Canvas can also write over an image? <div>How to achieve that?</div>http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/34f56ba3-07b1-433c-b2bc-b576b0fd55c9Fade in when ItemsSource of ListView (ListBox) is changed2010-02-10T02:13:57Z2010-02-10T02:13:57Zshtreberhttp://social.msdn.microsoft.com/Profile/en-US/?user=shtreberI am trying to accomplish a small visual effect of fading in all items when ItemsSource is changed. This effect should be simple animation that would animate opacity property from 0 to 1 but&nbsp;there are two problems I am not able to solve here:<br/><br/>1. There seems not to be available an event that is raised when ItemsSource property is changed... I saw some sollutions for code-behind file only, but I'd like to accomplish this in pure XAML<br/><br/>2. I am not sure how to execute this animation on the &quot;content&quot; of ListView/ListBox... By content I mean the part of the control where items are shown. Will I have to go with the ControlTemplate here?<br/><br/>Thanks!http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/836735e5-3d0b-41f5-b428-f2c76ccc5c7eCan you query whether a menu popup has opened to the left or right?2010-02-05T17:20:50Z2010-02-10T01:36:20ZKofoedhttp://social.msdn.microsoft.com/Profile/en-US/?user=Kofoed<p>I have defined a style for the Menu control that overrides the default style and creates my own popups/etc.&nbsp; I add some HorizontalOffset to the SubMenu popup, however when it's opened to the LEFT, the horizontal offset is incorrect - I need to adjust it in this case.<br/><br/>Is there a way to query whether the popup has opened to the left or right of it's invoker?</p>http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/b4fc5bb0-9e45-47ee-ad81-a974615ea607Can not set image without getting distorted2010-02-09T22:32:04Z2010-02-10T00:56:05Zkpaxhttp://social.msdn.microsoft.com/Profile/en-US/?user=kpaxHi, <div><br/></div> <div>I'm using .NET 3.5 SP1 and I've a simple problem with images when placed as a content of button or inside a grid. Please&nbsp;run the below code by using a 16x16 image for Open16.png:</div> <div> <pre lang=x-xml>&lt;Window x:Class=&quot;WpfApp.Window1&quot; xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot; xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot; Title=&quot;Window1&quot; Height=&quot;300&quot; Width=&quot;300&quot;&gt; &lt;Window.Resources&gt; &lt;Style x:Key=&quot;SmallImageButtonStyle&quot; TargetType=&quot;{x:Type Button}&quot;&gt; &lt;Setter Property=&quot;Width&quot; Value=&quot;25&quot; /&gt; &lt;Setter Property=&quot;Height&quot; Value=&quot;25&quot; /&gt; &lt;Setter Property=&quot;Margin&quot; Value=&quot;3 2 3 2&quot; /&gt; &lt;Setter Property=&quot;ContentTemplate&quot;&gt; &lt;Setter.Value&gt; &lt;DataTemplate&gt; &lt;Image Source=&quot;{Binding}&quot; Width=&quot;16&quot; Height=&quot;16&quot; /&gt; &lt;/DataTemplate&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Style&gt; &lt;/Window.Resources&gt; &lt;StackPanel&gt; &lt;Grid&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition Height=&quot;Auto&quot;/&gt; &lt;RowDefinition Height=&quot;Auto&quot;/&gt; &lt;/Grid.RowDefinitions&gt; &lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition Width=&quot;Auto&quot;/&gt; &lt;ColumnDefinition Width=&quot;Auto&quot;/&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;Button Style=&quot;{StaticResource SmallImageButtonStyle}&quot; Content=&quot;/Resources/Open16.png&quot; /&gt; &lt;Image Source=&quot;/Resources/Open16.png&quot; Width=&quot;16&quot; Height=&quot;16&quot; Grid.Column=&quot;1&quot; /&gt; &lt;/Grid&gt; &lt;Button Style=&quot;{StaticResource SmallImageButtonStyle}&quot; Content=&quot;/Resources/Open16.png&quot; /&gt; &lt;Image Source=&quot;/Resources/Open16.png&quot; Width=&quot;16&quot; Height=&quot;16&quot; /&gt; &lt;/StackPanel&gt; &lt;/Window&gt;</pre> The result that I see is the images which are directly inside a button or grid are distorted. Except the last image which is directly under the StackPanel. I don't know whether I'm correct for using word distorted; what I mean is the images doesn't show up as the original image. &nbsp;How can I fix this distortion problem?</div> <div><br/></div> <div>Thanks in advance</div>http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/83ba4a28-a5e1-43f8-ae3f-ee5695733c16Transparent Windows with regular WindowStyle?2010-02-09T11:58:56Z2010-02-10T00:03:45ZPedro At Algumacoisa Nethttp://social.msdn.microsoft.com/Profile/en-US/?user=Pedro%20At%20Algumacoisa%20NetAllowsTransparency says it requires&nbsp;WindowStyle set as None. <div>Is it possible to have transparency with regular window borders?</div>http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/4bfb7fea-13a1-441b-aca5-4a37ca974c2aWhy doesn't string compare work as I expect?2010-02-09T23:20:45Z2010-02-09T23:53:23Zk0065126http://social.msdn.microsoft.com/Profile/en-US/?user=k0065126The following four lines of code all evaluate to -1, but I cannot work out why.<br/><br/> <pre lang="x-c#">int what = &quot;A&quot;.CompareTo(&quot;M&quot;); // evaluates to -1 what = &quot;a&quot;.CompareTo(&quot;M&quot;); // evaluates to -1, why? what = String.Compare(&quot;a&quot;, &quot;M&quot;, StringComparison.CurrentCultureIgnoreCase); // evaluates to -1 what = String.Compare(&quot;a&quot;, &quot;M&quot;, StringComparison.CurrentCulture); // evaluates to -1 but should be +1 shouldn't it?</pre> Vivhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/b0ae485b-86a2-4f21-9e29-e6e4a9c48f51Disabling V-Sync possible?2010-02-09T18:08:23Z2010-02-09T23:53:13ZJohn Archerhttp://social.msdn.microsoft.com/Profile/en-US/?user=John%20ArcherHi there!<br/> <br/> For my own performance tests I want to get the maximum possible frame rate at my PC for my WPF app having a Viewport3D element inside. I know that WPF tries to stay as close to 60 fps (or my actual monitor refresh rate!?) if possible (like XNA does), but in XNA I can disable this behaviour with graphics.SynchronizeWithVerticalRetrace = false; Is there something similar within WPF?<br/> <br/> As I just use a simple Storyboard-Double-Animation, I tried to set the Storyboard.DesiredFrameRate at 100 e.g. But this has no effect, fps is at around 60. If I set the property to 5, the fps is between 8 and 12 - so at least there is an effect.<br/> <br/> Thanks a lot for your help!<br/> <br/> Greetings<br/> Archerhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/ae5066d7-ca3d-4da3-b3c5-348861d96c8cData Template Control Positioning2010-02-09T15:33:45Z2010-02-09T22:31:24Zswalker27http://social.msdn.microsoft.com/Profile/en-US/?user=swalker27I have a set of Data Templates based on data type. I also have a&nbsp;Data Template Selector that will select what kind of control to use if a certain data type is detected through a list of variables. My question is this:<br/><br/>Is there a way to set a position (x,y for canvas or row/column for grid)&nbsp;for the dynamically created control? If this is hard to understand, let me know.<br/><br/>Thanks..http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/b7d7490b-df05-4c04-9887-9f90bbb08127How to get location of element on the Ink canvas2010-02-09T13:41:43Z2010-02-09T22:28:48Zcoder_shttp://social.msdn.microsoft.com/Profile/en-US/?user=coder_sHi, <br/><br/>I want to get the location of a Textbox control which is on the ink canvas. I have tried Inkcanvas.GetLeft(element).. etc but in my case sometime it gives 'NaN'. So I want to know any other method for doing this.<br/><br/>Any idea?<br/><br/>Thankshttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/3f49d459-4746-4ffe-8efe-dab3a2c5bb42A Serious Memory and CPU leak with TextBox base control2008-06-10T07:08:26Z2010-02-09T22:09:29ZDuy T. Doanhttp://social.msdn.microsoft.com/Profile/en-US/?user=Duy%20T.%20Doan Guys,<br>Let me know if it's not a bug of WPF.<br><br>Let's create a project  like this:<br><br>Main Windows if Window1.xaml with a button that launch second window2.xaml<br><br>cs for button in window1.cs<br><br><font color="#0000ff" size=2><font color="#0000ff" size=2> <p>private</font></font> <font color="#0000ff" size=2><font color="#0000ff" size=2>void</font></font><font size=2> Button_Click(</font><font color="#0000ff" size=2><font color="#0000ff" size=2>object</font></font><font size=2> sender, </font><font color="#2b91af" size=2><font color="#2b91af" size=2>RoutedEventArgs</font></font><font size=2> e)<br>{<br></font><font color="#2b91af" size=2><font color="#2b91af" size=2>Window2</font></font><font size=2> _f = </font><font color="#0000ff" size=2><font color="#0000ff" size=2>new</font></font> <font color="#2b91af" size=2><font color="#2b91af" size=2>Window2</font></font><font size=2>();<br>_f.Owner = </font><font color="#0000ff" size=2><font color="#0000ff" size=2>this</font></font><font size=2>;<br>_f.Show();<br>}</p></font><br>xaml of window2.xaml<br><font color="#0000ff" size=2><font color="#0000ff" size=2> <p>&lt;</font></font><font color="#a31515" size=2><font color="#a31515" size=2>Window</font></font><font color="#ff0000" size=2><font color="#ff0000" size=2> x</font></font><font color="#0000ff" size=2><font color="#0000ff" size=2>:</font></font><font color="#ff0000" size=2><font color="#ff0000" size=2>Class</font></font><font color="#0000ff" size=2><font color="#0000ff" size=2>=&quot;WpfApplication1.Window2&quot;</p></font></font><font size=2> <p></font><font color="#ff0000" size=2><font color="#ff0000" size=2>xmlns</font></font><font color="#0000ff" size=2><font color="#0000ff" size=2>=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;</p></font></font><font size=2> <p></font><font color="#ff0000" size=2><font color="#ff0000" size=2>xmlns</font></font><font color="#0000ff" size=2><font color="#0000ff" size=2>:</font></font><font color="#ff0000" size=2><font color="#ff0000" size=2>x</font></font><font color="#0000ff" size=2><font color="#0000ff" size=2>=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;</p></font></font><font size=2> <p></p> <p></font><font color="#ff0000" size=2><font color="#ff0000" size=2>WindowStartupLocation</font></font><font color="#0000ff" size=2><font color="#0000ff" size=2>=&quot;CenterScreen&quot;</font></font><font size=2> </p> <p></font><font color="#ff0000" size=2><font color="#ff0000" size=2>Title</font></font><font color="#0000ff" size=2><font color="#0000ff" size=2>=&quot;Window2&quot;</font></font><font color="#ff0000" size=2><font color="#ff0000" size=2> Height</font></font><font color="#0000ff" size=2><font color="#0000ff" size=2>=&quot;300&quot;</font></font><font color="#ff0000" size=2><font color="#ff0000" size=2> Width</font></font><font color="#0000ff" size=2><font color="#0000ff" size=2>=&quot;300&quot;&gt;</p></font></font><font color="#a31515" size=2><font color="#a31515" size=2> <p></font></font><font color="#0000ff" size=2><font color="#0000ff" size=2>&lt;</font></font><font color="#a31515" size=2><font color="#a31515" size=2>Grid</font></font><font color="#0000ff" size=2><font color="#0000ff" size=2>&gt;</p></font></font><font color="#a31515" size=2><font color="#a31515" size=2> <p></font></font><font color="#0000ff" size=2><font color="#0000ff" size=2>&lt;</font></font><font color="#a31515" size=2><font color="#a31515" size=2>Grid.RowDefinitions</font></font><font color="#0000ff" size=2><font color="#0000ff" size=2>&gt;</p></font></font><font color="#a31515" size=2><font color="#a31515" size=2> <p></font></font><font color="#0000ff" size=2><font color="#0000ff" size=2>&lt;</font></font><font color="#a31515" size=2><font color="#a31515" size=2>RowDefinition</font></font><font color="#0000ff" size=2><font color="#0000ff" size=2> /&gt;</p></font></font><font color="#a31515" size=2><font color="#a31515" size=2> <p></font></font><font color="#0000ff" size=2><font color="#0000ff" size=2>&lt;</font></font><font color="#a31515" size=2><font color="#a31515" size=2>RowDefinition</font></font><font color="#0000ff" size=2><font color="#0000ff" size=2> /&gt;</p></font></font><font color="#a31515" size=2><font color="#a31515" size=2> <p></font></font><font color="#0000ff" size=2><font color="#0000ff" size=2>&lt;</font></font><font color="#a31515" size=2><font color="#a31515" size=2>RowDefinition</font></font><font color="#0000ff" size=2><font color="#0000ff" size=2> /&gt;</p></font></font><font color="#a31515" size=2><font color="#a31515" size=2> <p></font></font><font color="#0000ff" size=2><font color="#0000ff" size=2>&lt;</font></font><font color="#a31515" size=2><font color="#a31515" size=2>RowDefinition</font></font><font color="#0000ff" size=2><font color="#0000ff" size=2> /&gt;</p></font></font><font color="#a31515" size=2><font color="#a31515" size=2> <p></font></font><font color="#0000ff" size=2><font color="#0000ff" size=2>&lt;/</font></font><font color="#a31515" size=2><font color="#a31515" size=2>Grid.RowDefinitions</font></font><font color="#0000ff" size=2><font color="#0000ff" size=2>&gt;</p></font></font><font color="#a31515" size=2><font color="#a31515" size=2> <p></p> <p></font></font><font color="#0000ff" size=2><font color="#0000ff" size=2>&lt;</font></font><font color="#a31515" size=2><font color="#a31515" size=2>TextBox</font></font><font color="#ff0000" size=2><font color="#ff0000" size=2> Width</font></font><font color="#0000ff" size=2><font color="#0000ff" size=2>=&quot;100&quot;</font></font><font color="#ff0000" size=2><font color="#ff0000" size=2> Height</font></font><font color="#0000ff" size=2><font color="#0000ff" size=2>=&quot;21&quot;</font></font><font color="#ff0000" size=2><font color="#ff0000" size=2> Grid.Row</font></font><font color="#0000ff" size=2><font color="#0000ff" size=2>=&quot;0&quot;/&gt;</p></font></font><font color="#a31515" size=2><font color="#a31515" size=2> <p></font></font><font color="#0000ff" size=2><font color="#0000ff" size=2>&lt;</font></font><font color="#a31515" size=2><font color="#a31515" size=2>RichTextBox</font></font><font color="#ff0000" size=2><font color="#ff0000" size=2> Width</font></font><font color="#0000ff" size=2><font color="#0000ff" size=2>=&quot;200&quot;</font></font><font color="#ff0000" size=2><font color="#ff0000" size=2> Height</font></font><font color="#0000ff" size=2><font color="#0000ff" size=2>=&quot;50&quot;</font></font><font color="#ff0000" size=2><font color="#ff0000" size=2> Grid.Row</font></font><font color="#0000ff" size=2><font color="#0000ff" size=2>=&quot;1&quot;/&gt;</p></font></font><font color="#a31515" size=2><font color="#a31515" size=2> <p></font></font><font color="#0000ff" size=2><font color="#0000ff" size=2>&lt;</font></font><font color="#a31515" size=2><font color="#a31515" size=2>PasswordBox</font></font><font color="#ff0000" size=2><font color="#ff0000" size=2> Width</font></font><font color="#0000ff" size=2><font color="#0000ff" size=2>=&quot;100&quot;</font></font><font color="#ff0000" size=2><font color="#ff0000" size=2> Height</font></font><font color="#0000ff" size=2><font color="#0000ff" size=2>=&quot;21&quot;</font></font><font color="#ff0000" size=2><font color="#ff0000" size=2> Grid.Row</font></font><font color="#0000ff" size=2><font color="#0000ff" size=2>=&quot;2&quot;/&gt;</p></font></font><font color="#a31515" size=2><font color="#a31515" size=2> <p></font></font><font color="#0000ff" size=2><font color="#0000ff" size=2>&lt;</font></font><font color="#a31515" size=2><font color="#a31515" size=2>ComboBox</font></font><font color="#ff0000" size=2><font color="#ff0000" size=2> Width</font></font><font color="#0000ff" size=2><font color="#0000ff" size=2>=&quot;100&quot;</font></font><font color="#ff0000" size=2><font color="#ff0000" size=2> Height</font></font><font color="#0000ff" size=2><font color="#0000ff" size=2>=&quot;21&quot;</font></font><font color="#ff0000" size=2><font color="#ff0000" size=2> Grid.Row</font></font><font color="#0000ff" size=2><font color="#0000ff" size=2>=&quot;3&quot;/&gt;</p></font></font><font color="#a31515" size=2><font color="#a31515" size=2> <p></font></font><font color="#0000ff" size=2><font color="#0000ff" size=2>&lt;/</font></font><font color="#a31515" size=2><font color="#a31515" size=2>Grid</font></font><font color="#0000ff" size=2><font color="#0000ff" size=2>&gt;</p> <p>&lt;/</font></font><font color="#a31515" size=2><font color="#a31515" size=2>Window</font></font><font color="#0000ff" size=2><font color="#0000ff" size=2>&gt;<br><br>Build and run .exe file (not in Debug mode).<br>Click button to show Window2<br>Open Window Task Manager and set it on top, click on window2 to activate it.<br>Look for this application in Task Manager process.<br>Now click in textbox to focus, don't do anything.<br><br>Look into Memory of this application in Task Manager, memory will increase by 4K step forever until textbox loose focus.<br><br>I test this symptom for many computer and OS, it gives me the same result.<br><br>Hope that MSFT guys give this a try and advise for solution.<br><br>Thanks for any input.<br></p></font></font><hr size="1" align="left" width="25%">Duy T. Doanhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/05dc431e-731e-415d-88ac-daa028f0a03eUsing a ContextMenu Resource More Than Once2010-02-09T00:41:08Z2010-02-09T21:54:11ZBill Gates IIhttp://social.msdn.microsoft.com/Profile/en-US/?user=Bill%20Gates%20II<p style="margin:0in 0in 10pt"><span style="font-family:Calibri;font-size:small">I have a<span style="">&nbsp; </span>ContextMenu I created as a resource since the menu is used in different places. When I connect the ContextMenu to the second control I get an error about how It's already connected to a logical parent. While I get why I'm getting the error, I don't see how to work around this short of me creating the menu indevidually for each control.</span></p><hr class="sig">Bill Gates look out!http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/2a286b30-8451-4180-b3cb-eeee9e622fd4TextBox With Predefined Rows And Columns2010-02-04T13:49:20Z2010-02-09T21:27:21ZSatya Bulusuhttp://social.msdn.microsoft.com/Profile/en-US/?user=Satya%20BulusuTeam<br/> <br/> I need to create a text box of 30 rows and 80 columns&nbsp; i.e. basically fixed content sized TextBox (<strong>Not fixed Sized</strong> ) fpr any FontFamily and for any FontSize. <br/> <br/> I understand that the TextBox Width and Height changes depending up on FontFamily and FontSize and which is okay to me.<br/> <br/> Once 80th column is reached I want my text box to wrap to next row. Once 30th row is ended (after Row # 30 and Column#80 ) I want to start at the beginning i.e. row 1 column 1<br/> <br/> How can I do this? Is this possible in WPF?<br/> <br/> I don't mind using any other control like Rich Text Box or any other WPF control. But that should be an editable text based one<br/> <br/> Could any one please shed some light?<br/> <br/> Thanks in advance,<br/> Satyahttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/cf53bf41-395c-4265-beb4-7f1fb83ab4beUserControl Binding issues2010-02-09T14:27:07Z2010-02-09T21:25:51ZpymWPFhttp://social.msdn.microsoft.com/Profile/en-US/?user=pymWPFHello,<br/> <br/> I have created a simple UserControl:<br/> <pre lang="x-c#">public partial class UserControl1 : UserControl, INotifyPropertyChanged { public UserControl1() { InitializeComponent(); this.DataContext = this; } private string mDisplayName; public string DisplayName { get { return mDisplayName; } set { mDisplayName = value; if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(&quot;DisplayName&quot;)); } } public event PropertyChangedEventHandler PropertyChanged; }</pre> XAML:<br/> <pre lang=x-xml> &lt;Grid&gt; &lt;TextBlock Text=&quot;{Binding DisplayName}&quot;/&gt; &lt;/Grid&gt;</pre> <br/> Now I create a WPF app to use it (added reference and xmlns:ctl):<br/> <pre lang=x-xml> &lt;Grid&gt; &lt;ctl:UserControl1 DisplayName=&quot;Mike&quot;/&gt; &lt;/Grid&gt; </pre> Works!<br/> <br/> BUT...<br/> <br/> If I try to bind the control's DisplayName to something like this:<br/> <pre lang=x-xml> &lt;Grid&gt; &lt;ctl:UserControl1 DisplayName=&quot;{Binding Name}&quot;/&gt; &lt;/Grid&gt; </pre> I get this error:<br/> <strong>A 'Binding' cannot be set on the 'DisplayName' property of type 'UserControl1'. A 'Binding' can only be set on a DependencyProperty of a DependencyObject.</strong> <br/> <br/> What can I do to support Binding my Control's properties???<br/> <br/> Thanks a lot!!!