Windows Presentation Foundation (WPF) ForumHow to use Windows Presentation Foundation (WPF) productively to create visually appealing and differentiating applications and to improve user experience.© 2009 Microsoft Corporation. All rights reserved.Wed, 25 Nov 2009 06:18:48 Z43e1b4ad-eb8d-427f-90a9-161e7af74457http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/6d7b7a51-ca1c-4083-b1d9-94c9f8f2880dhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/6d7b7a51-ca1c-4083-b1d9-94c9f8f2880ddotBombhttp://social.msdn.microsoft.com/Profile/en-US/?user=dotBombEditing Simple Styles: ComboBox Background<p>Hi, I am using the SimpleStyle ComboBox from WPF SimpleStyles VS 2008 project I downloaded from MSDN, and I would just like to change the background of the control using the Background property on the control.  What I've tried to do isn't quite working.  I think the answer lies in properly setting a Binding on the Background Property of PART_EditableTextBox.  <br/><br/>Thank you up front for any assistance.  <br/><br/>Dan</p><hr class="sig">-DKTue, 24 Nov 2009 23:42:06 Z2009-11-25T06:18:48Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/f94a8e71-22fb-46e0-9f60-db7011928a4ehttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/f94a8e71-22fb-46e0-9f60-db7011928a4eChrissteven81http://social.msdn.microsoft.com/Profile/en-US/?user=Chrissteven81How to setup a Binding StyleI have like 15 Textboxes in a Control, each textbox inherits a style that sets several properties. Howerver, each textbox currently has its text binding but I have a lot or redudance in the bindings. I want to be able to build a style for the binding and have the textbox add the path and mode to the exisiting binding. for instance each textbox has <span style="font-size:x-small;color:#008000"><span style="font-size:x-small;color:#008000"><span style="font-size:x-small;color:#008000"><span style="font-size:x-small;color:#008000"><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"><br/><br/><br/> <pre lang=x-xml>&lt;Binding NotifyOnValidationError=&quot;True&quot; NotifyOnTargetUpdated=&quot;True&quot; NotifyOnSourceUpdated=&quot;True&quot; ValidatesOnExceptions=&quot;True&quot; UpdateSourceTrigger=&quot;LostFocus&quot; /&gt;</pre> in addition to the Path and Mode.<br/><br/>But I dont want to type this over and over again for every textbox i add. is there a way to place half of the binding properties in a style and the other half set them in the textbox?<br/><br/><br/><br/>Thanks</span></span></span></span></span></span></span></span>Fri, 20 Nov 2009 17:16:08 Z2009-11-25T06:11:49Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/469f21db-c9cb-4e9c-a29a-b90722032cd1http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/469f21db-c9cb-4e9c-a29a-b90722032cd1yuanzhifeihttp://social.msdn.microsoft.com/Profile/en-US/?user=yuanzhifeiHow to find the winform control's parent WindowsFormsHost?<p align=left>XAML:</p> <p align=left> </p> <p align=left>&lt;Window x:Class=&quot;WpfApplicationExam.WindowHostTest&quot;<br>    xmlns=&quot;<a title="http://schemas.microsoft.com/winfx/2006/xaml/presentation" href="http://schemas.microsoft.com/winfx/2006/xaml/presentation">http://schemas.microsoft.com/winfx/2006/xaml/presentation</a>&quot;<br>    xmlns:x=&quot;<a title="http://schemas.microsoft.com/winfx/2006/xaml" href="http://schemas.microsoft.com/winfx/2006/xaml">http://schemas.microsoft.com/winfx/2006/xaml</a>&quot;<br>    xmlns:wf=&quot;clr-namespace<img alt="Tongue Tied" src="http://forums.microsoft.com/MSDN/emoticons/emotion-7.gif">ystem.Windows.Forms;assembly=System.Windows.Forms&quot;<br>    Title=&quot;WindowHostTest&quot; Height=&quot;300&quot; Width=&quot;300&quot; Loaded=&quot;Window_Loaded&quot;<br>    &gt;<br>    &lt;Grid Name=&quot;grid1&quot;&gt;<br>       <strong><font color="#ff0000">&lt;<font color="#ff0000">WindowsFormsHost</font> Name=&quot;txtTest1&quot; Margin=&quot;120,75,0,0&quot; <font color="#ff0000">HorizontalAlignment</font>=&quot;Left&quot; Width=&quot;133&quot; Height=&quot;72&quot; VerticalAlignment=&quot;Top&quot;&gt;<br>            &lt;wf:TextBox x:Name=&quot;txtTest&quot; Multiline=&quot;True&quot; Width=&quot;133&quot; Height=&quot;72&quot; ReadOnlyChanged=&quot;txtTest_ReadOnlyChanged&quot;/&gt;<br>        &lt;/WindowsFormsHost&gt;<br></font></strong>    &lt;/Grid&gt;<br>&lt;/Window&gt;</p> <p align=left> </p> <p align=left>I want to get txtTest's WindowsFormsHost's name by:</p> <p align=left> </p> <p align=left>WindowsFormsHost host = txtTest.Parent as WindowsFormsHost;</p> <p align=left> </p> <p align=left>but occur a exception:</p> <p align=left>Error 1 Cannot convert type 'System.Windows.Forms.Control' to 'System.Windows.Forms.Integration.WindowsFormsHost' via a reference conversion, boxing conversion, unboxing conversion, wrapping conversion, or null type conversion D:\Frank\Code\WPF Sample Code\WpfExam\WpfApplicationExam\WindowHostTest.xaml.cs 44 37 WpfApplicationExam<br></p> <p align=left>How to get WindowsFormsHost,thanks?</p>Fri, 21 Mar 2008 09:01:24 Z2009-11-25T06:08:15Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/c4cb16aa-182a-43e6-a08b-78776501eb1ehttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/c4cb16aa-182a-43e6-a08b-78776501eb1eGraeme.Rhttp://social.msdn.microsoft.com/Profile/en-US/?user=Graeme.RHow do I call a function (with parameters) from xaml?<p>Hi, I want to insert a calculated value (QuotePrice) to a record's field in a datagrid.<br/>The calculation uses one field from the current record (ItemType, which is used to determine CostPrice and MarkUp) and two fields from the parent record (NumberOfItems and SubsidyType). I.e. I want to pass three parameters to the formula.</p> <p>How do I call a formula with three parameters from xaml?<br/>Is there an alternative way to do this?<br/><br/>I want to call function getQuotePrice in the window's code:</p> <p>Partial Public Class fdlgQuote<br/><br/>    ' Lots of omitted code<br/>    '...<br/><br/>    Public Function getQuotePrice(Byval CostPrice As Double, NumberOfItems As Integer, SubsidyType As Integer) As Double<br/>        '...<br/>        ' 20+ lines of code and function calls to determine QuotePrice<br/>        '...<br/><br/>        Return QuotePrice<br/>    End Function</p> <p>End Class<br/><br/>This is the abbreviated layout of my window:</p> <p>&lt;Window x:Class=&quot;fdlgQuote&quot;<br/>    xmlns=&quot;<a href="http://schemas.microsoft.com/winfx/2006/xaml/presentation">http://schemas.microsoft.com/winfx/2006/xaml/presentation</a>&quot;<br/>    xmlns:x=&quot;<a href="http://schemas.microsoft.com/winfx/2006/xaml">http://schemas.microsoft.com/winfx/2006/xaml</a>&quot;<br/>    xmlns:local=&quot;clr-namespace:MyProject&quot;<br/>    xmlns:WpfToolkit=&quot;clr-namespace:Microsoft.Windows.Controls;assembly=WpfToolkit&quot;&gt;<br/><br/>&lt;Window.Resources&gt;<br/>    &lt;!-- Master --&gt;<br/>    &lt;CollectionViewSource x:Key=&quot;MasterView&quot; /&gt; &lt;!-- of tblQuote --&gt;<br/>    &lt;!-- Details --&gt;<br/>    &lt;CollectionViewSource x:Key=&quot;DetailQuoteItemView&quot; Source=&quot;{Binding Source={StaticResource MasterView}, Path='tblQuoteItems'}&quot; /&gt; <br/>    &lt;!-- ComboBoxes --&gt;<br/>    &lt;CollectionViewSource x:Key=&quot;cvsSubsidyType&quot; /&gt; &lt;!-- of tlkpSubsidyType --&gt;<br/>    &lt;CollectionViewSource x:Key=&quot;cvsProduct&quot; /&gt; &lt;!-- of tlkpProduct --&gt;<br/>&lt;/Window.Resources&gt;<br/><br/>&lt;Grid DataContext=&quot;{Binding Source={StaticResource MasterView}}&quot;&gt;<br/>       &lt;ComboBox Name=&quot;cboFkSubsidyType&quot; <br/>                 SelectedValue=&quot;{Binding Path=fkSubsidyType}&quot; SelectedValuePath=&quot;uidSubsidyType&quot; DisplayMemberPath=&quot;SubsidyType&quot; <br/>                 ItemsSource=&quot;{Binding Source={StaticResource cvsSubsidyType}}&quot;/&gt;<br/>        &lt;TextBox Name=&quot;txtNumberOfItems&quot; <br/>                 Text=&quot;{Binding Path=NumberOfItems}&quot;/&gt;</p> <p>    &lt;WpfToolkit:DataGrid x:Name=&quot;dgQuoteItem&quot;<br/>                                 ItemsSource=&quot;{Binding Source={StaticResource DetailQuoteItemView}}&quot;&gt;<br/>        &lt;WpfToolkit:DataGrid.Columns&gt;<br/>            &lt;WpfToolkit:DataGridComboBoxColumn Header=&quot;Product&quot; <br/>                                               x:Name=&quot;cboFkProduct&quot; <br/>                                               SelectedValueBinding=&quot;{Binding fkProduct}&quot; SelectedValuePath=&quot;uidProduct&quot; DisplayMemberPath=&quot;Product&quot; <br/>                                               ItemsSource=&quot;{Binding Source={StaticResource cvsProduct}}&quot; /&gt;<br/>            &lt;WpfToolkit:DataGridTextColumn Header=&quot;Quote Price&quot; Binding=&quot;{Binding QuotePrice}&quot; /&gt; &lt;!-- Calculated value --&gt;<br/>        &lt;/WpfToolkit:DataGrid.Columns&gt;<br/>    &lt;/WpfToolkit:DataGrid&gt;<br/>&lt;/Grid&gt;<br/>&lt;/Window&gt;</p> <p> Thanks, Graeme</p>Wed, 25 Nov 2009 01:22:02 Z2009-11-25T06:00:19Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/1bf01a90-e7b6-48e6-b0a4-1ad8f305ba0chttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/1bf01a90-e7b6-48e6-b0a4-1ad8f305ba0cRussell_Eubankshttp://social.msdn.microsoft.com/Profile/en-US/?user=Russell_EubanksBinding to XML in WPFI have an XML column in a table in a SQL Server database. I want to read this column, then two-way databind its fields into WPF controls or a WPF DataGrid. What is the best .NET object to use for this and what would be the proper syntax? I'm using VS 2010 Beta 2.Fri, 13 Nov 2009 03:24:42 Z2009-11-25T05:36:08Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/ee326eb2-e7ba-49f2-9f79-17af592f4819http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/ee326eb2-e7ba-49f2-9f79-17af592f4819Mark Bostlemanhttp://social.msdn.microsoft.com/Profile/en-US/?user=Mark%20BostlemanCan't get a DataGrid to updateI have a WPF Toolkit DataGrid bound to an ObservableCollection&lt;Car&gt; in my view model.  Car has a PropertyChanged event and the setters of each of its two string properties fire the event.  I also have the grid's SelectedItem property of the grid bound to a property in the view model of type Car, also called SelectedItem.<br/><br/>On the same window as the grid, I have buttons for add, modify and delete.  Add and modify open a dialog window with two textboxes, one for each Car property.  Delete just shows a confirm dialog then does the delete.<br/><br/>For add and delete, I add or delete an item from the ObservableCollection and the grid updates itself as expected.  However, for modify it does not.  At first, my Car did not use PropertyChanged and after some searching I found that it needed to for the grid to update when an individual item's properties changed.  But now that I am using PropertyChanged, the grid still doesn't update.<br/><br/>I've tried changing the values of the SelectedItem in my view model as well as directly changing the item on the collection.<br/><br/>What am I doing wrong?Wed, 25 Nov 2009 04:33:08 Z2009-11-25T05:33:44Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/ca6fede8-93df-42ed-ac5b-7e63be5573d0http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/ca6fede8-93df-42ed-ac5b-7e63be5573d0jippershttp://social.msdn.microsoft.com/Profile/en-US/?user=jipperssearching and listing WPF resource dictionaries in a folder<p>I'm making a WPF application that is going to have multiple skins branded in by our build system. Ideally we would like the application to list off the skins available as builds will have one to many skins.</p> <p>At runtime is there a way to enumerate all the Resource Dictionaries in a specific folder? Or at the very least produce a list of the XAML which I can parse for specific names?</p> I want to avoid hard coding the XAML filenames in my C# as this is a changing situation.Fri, 20 Nov 2009 01:25:57 Z2009-11-25T05:26:42Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/771edd62-ba1e-4e85-b0a6-65bc000f9314http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/771edd62-ba1e-4e85-b0a6-65bc000f9314ZiadKhttp://social.msdn.microsoft.com/Profile/en-US/?user=ZiadKSelective Binding for CollectionsHello, I have a 4-level TreeView that is bound to custom classes that have generic base collections.<br/> <br/> In order to display the data, I am using the following hierarchical data template:<br/> <pre lang=x-xml>&lt;HierarchicalDataTemplate ItemsSource=&quot;{Binding Level2}&quot;&gt;<br/> <br/> &lt;TextBlock Tag=&quot;lvl1&quot; Text=&quot;{Binding Name}&quot; /&gt;<br/> <br/> &lt;HierarchicalDataTemplate.ItemTemplate&gt;<br/> &lt;HierarchicalDataTemplate ItemsSource=&quot;{Binding Level3}&quot;&gt;<br/> <br/> &lt;TextBlock Tag=&quot;lvl2&quot; Text=&quot;{Binding Name}&quot;&gt;&lt;/TextBlock&gt;<br/> <br/> &lt;HierarchicalDataTemplate.ItemTemplate&gt;<br/> &lt;HierarchicalDataTemplate ItemsSource=&quot;{Binding Level4}&quot;&gt;<br/> <br/> &lt;TextBlock Tag=&quot;lvl3&quot; Text=&quot;{Binding Name}&quot;&gt;&lt;/TextBlock&gt;<br/> <br/> &lt;HierarchicalDataTemplate.ItemTemplate&gt;<br/> &lt;HierarchicalDataTemplate&gt;<br/> &lt;TextBlock Tag=&quot;lvl4&quot; Text=&quot;{Binding Name}&quot;&gt;&lt;/TextBlock&gt;<br/> &lt;/HierarchicalDataTemplate&gt;<br/> &lt;/HierarchicalDataTemplate.ItemTemplate&gt;<br/> <br/> &lt;/HierarchicalDataTemplate&gt;<br/> &lt;/HierarchicalDataTemplate.ItemTemplate&gt;<br/> <br/> &lt;/HierarchicalDataTemplate&gt;<br/> &lt;/HierarchicalDataTemplate.ItemTemplate&gt;<br/> <br/> &lt;/HierarchicalDataTemplate&gt;</pre> <br/> I am setting the tree view's ItemsSource (Level1) in the code-behind class.<br/> <br/> Now this works fine and the data is being displayed correctly. However, I don't want to display level 3 items unless they have children (the level 4 collection has items). Is it possible to do that using xaml (i.e. modifying the above piece of code)?Mon, 23 Nov 2009 13:14:19 Z2009-11-25T05:24:18Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/daca7b71-2893-4564-8379-097aabcdd553http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/daca7b71-2893-4564-8379-097aabcdd553Kofoedhttp://social.msdn.microsoft.com/Profile/en-US/?user=KofoedTreeView - can you override how the keyboard navigation works?In a TreeView control, the items are navigated via the keyboard with the arrow keys.  I'm wondering if it's possible to override this behavior so that the nodes are navigable via the TAB key instead?  <br/><br/>I want to do this because I actually have a control I'm creating that's derived from TreeView and TreeviewItem ... but of course the default keyboard navigation still exists, i just want to change it.Mon, 09 Nov 2009 22:10:40 Z2009-11-25T05:17:36Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/679e44d1-6106-4399-81c0-31578f262db9http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/679e44d1-6106-4399-81c0-31578f262db9Atervanhttp://social.msdn.microsoft.com/Profile/en-US/?user=AtervanRun WPF application on windows xp sp3 correctlyI created WPF application that not work correctly on windows xp SP3.Tue, 24 Nov 2009 11:21:39 Z2009-11-25T05:13:49Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/900f9dd5-d96d-4be2-87a9-81393534f9e3http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/900f9dd5-d96d-4be2-87a9-81393534f9e3nrbhttp://social.msdn.microsoft.com/Profile/en-US/?user=nrbselection change in wpf<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:10pt;font-family:Arial">Hi</span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:10pt;font-family:Arial">I’m trying to convert some code written in .net 2.0 to WPF</span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:10pt;font-family:Arial">Is there something equaling in WPF to the .net 2.0 combo box <strong>selectionChangeCommitted</strong> event ?</span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:10pt;font-family:Arial">Meaning that I want the event to be fired only after a user change the item in the combo and not when it’s done by code </span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:10pt;font-family:Arial">Thanks </span></p> <p align=left><font face=Arial size=2></font> </p>Wed, 05 Sep 2007 10:20:21 Z2009-11-25T05:07:47Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/b8987d4e-88d8-40f0-a852-05ef74439ddfhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/b8987d4e-88d8-40f0-a852-05ef74439ddfOlaf Rabbachinhttp://social.msdn.microsoft.com/Profile/en-US/?user=Olaf%20Rabbachin"Global" pick-lists with change-notification (EntityFramework)Hi folks,<br/> <br/> in my WPF-app (tabbed MDI / MVVM), there can be numerous open windows. In these windows/tabs, there may be ComboBoxes that serve as pick-lists. For instance, for a Contact-entity, there could be a combo that shows the available person-titles; each Contact would have to be associated with one of those titles.<br/> <br/> Ultimately, I would like any open window/tab containing such a title-lookup to automatically update its list of titles (i.e. the combobox) whenever there is a change, such as a new title or one that has been updated. <br/> Also, since these pick-lists only change on rare occasions, their content is being made available by means of a static class that itself holds a reference to the &quot;cache&quot;-class which holds an <em>ObservableCollection(Of Title)</em> .<br/> The problem is that WPF (or the EntityFramework?) doesn't seem to like this approach - as long as my cached data is an ObservableCollection, I can't seem to successfully bind a ComboBox'es SelectedItem to the underlying entity (i.e., the ComboBox'es SelectedItem-prop will equal Nothing). <br/> If I instead use a <em>List(Of Title)</em> , the binding will work just fine, but then I won't have any change-notification.<br/> <br/> Any ideas of how to doing this right ..?<br/> <br/> Cheers,<br/> OlafMon, 23 Nov 2009 15:45:31 Z2009-11-25T05:03:20Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/7a539305-1489-4b37-a812-b4dd783098c7http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/7a539305-1489-4b37-a812-b4dd783098c7Olaf Rabbachinhttp://social.msdn.microsoft.com/Profile/en-US/?user=Olaf%20RabbachinNotifying subscribers of a cached set of dataHi folks,<br/> <br/> I have a collection of records that is being used throughout an application for i.e. pick-lists. For the sake of an example, let's assume that there is many different windows in which the user administers contacts and can pick an (academic) title from a combobox, with the combo bound to the collection I mentioned before.<br/> Since there's only rare occasions at which the collection of titles changes, that collection is being loaded when it's first needed and kept in a &quot;cache&quot; (i.e. a shared/static class/collection). At runtime, there can be a number of open windows in which a title-combo is part of the window. Now, the user opens a window in which (s)he i.e. adds a new title to the collection (or changes an existing one).<br/> <br/> What approach would I have to take in order to automatically have all open windows with a title-combo be notified of the change? I seem to be running in circles around this ...<hr class="sig">Cheers,<br/>OlafWed, 18 Nov 2009 13:03:05 Z2009-11-25T05:02:08Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/1fd9ab1e-7f88-4a72-a7e0-cb47290ace27http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/1fd9ab1e-7f88-4a72-a7e0-cb47290ace27subho100http://social.msdn.microsoft.com/Profile/en-US/?user=subho100Multiple object selection by rubber band with Rotate Resize and Move in WPFHi<br/>I am trying to develop a graphical application which allows users to drop objects on a canvas. I have created button for each shape which when clicked, add a shape on the canvas. The shape is surronded by a contentcontrol. This contentcontrol is attached to a style with the microsoft rotate, resize and move classes. Thus, the shape can be rotated, resized and moved. Now I am planning to create a select-deselect tool. The user may select (using rubberband) more than one object and perform rotate, resize and move on them together. Then, on clicking outside the selection, the objects rests on the canvas again retaining the changes.<br/>I don't have any designer canvas or designer item (shapes for adding) concept in my app. So, on rubberband selection, I get the objects as per the rubberband's coordinates, width and height. After getting the objects, I detach them from the main canvas and add them to another canvas bounded by the same contentcontrol. The selection is perfect but I cannot perform resize as the objects insode the new canvas and contentcontrol are - Contentcontrol containing a shape. As this contentcontrol have fixed size, it doesnot allow me.<br/>So I tried another way, on selection I remove the styled contentcontrol from the objects and took the shpes only and added it to a new canvas bounded by a styled contentcontrol. Now The shapes looses the size and they also loose their position on screen.<br/>It would be great if someone helps me telling me the way how to achieve this functionality (keeping in mind that I don't have designer canvas ot item architecture). <br/>NB: The code is quite big so I was unable to post it. But I think the exaplanation was quite vivid.Wed, 25 Nov 2009 04:44:31 Z2009-11-25T04:44:32Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/1becaac1-dd43-4a70-a47c-39f5a494a8a0http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/1becaac1-dd43-4a70-a47c-39f5a494a8a0RuiLopeshttp://social.msdn.microsoft.com/Profile/en-US/?user=RuiLopesChanging datagrid cell background according to valueHi all, <br/> <br/> I think the title says it all.. I would like to change a datagrid background cell evreytime the content has a specific value..<br/> <br/> I currently have this:<br/> <br/> <pre lang=x-xml> &lt;toolkit:DataGrid.CellStyle&gt; &lt;Style TargetType=&quot;toolkit:DataGridCell&quot; &gt; &lt;Style.Triggers&gt; &lt;Trigger Property=&quot;HasContent&quot; Value=&quot;True&quot;&gt; &lt;Setter Property=&quot;Background&quot; Value=&quot;SeaGreen&quot;/&gt; &lt;/Trigger&gt; &lt;/Style.Triggers&gt; &lt;/Style&gt; &lt;/toolkit:DataGrid.CellStyle&gt; </pre> which works fine.. however, when I try to adapt it and change the property to &quot;Content&quot; and the Value to &quot;10&quot; I get nothing!!!!<br/> <br/> Can you guys help me?<br/> <br/> PS: I'm working with the toolkit datagrid and the data source is an array of doubles..<br/> <br/> Thanks in advance<br/> <br/>Wed, 11 Nov 2009 08:43:50 Z2009-11-25T04:40:45Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/d9d111e2-4c36-4643-8f80-f8c4ce32934chttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/d9d111e2-4c36-4643-8f80-f8c4ce32934cSaji dkhttp://social.msdn.microsoft.com/Profile/en-US/?user=Saji%20dkSetting focus on the ListView Hi all,<br/><br/>i want to select the listview while form load event. In my application i have created the list view through xaml as follows<br/><br/> <pre lang=x-xml>&lt;ListView Name=&quot;lvDetail&quot; Grid.Row=&quot;1&quot; Grid.Column=&quot;0&quot; VerticalAlignment=&quot;Stretch&quot; HorizontalAlignment=&quot;Stretch&quot; Grid.ColumnSpan=&quot;6&quot; ItemsSource=&quot;{Binding}&quot; SelectionChanged=&quot;lvDetail_SelectionChanged&quot; Focusable=&quot;True&quot;&gt; &lt;/ListView&gt;</pre> <br/>data population is done through code behind as follows<br/><br/> <pre lang="x-c#"> GridView grdView = new GridView(); lvDetail.View = grdView; GridViewColumn grdViewCol; foreach (string str in disList) { char[] seperator = { ',' }; string[] strProperty = str.Split(seperator); grdViewCol = new GridViewColumn(); grdViewCol.Header = strProperty[(int)PropertyType.HeaderCol]; grdViewCol.DisplayMemberBinding = new System.Windows.Data.Binding(strProperty[(int)PropertyType.BinderCol]); grdView.Columns.Add(grdViewCol); } </pre> <br/><br/>the content of the list view is the list of my businesslayer object. Everthing is working well except to focus my grid programatically while form load. i used different code from different web sites..<br/><br/>Looking forward to hear from you..<br/><br/>Thanks in advance<br/>Saji<br/>Wed, 25 Nov 2009 04:15:31 Z2009-11-25T04:32:10Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/704f6b19-4df5-4466-8ee3-c1de6f87a737http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/704f6b19-4df5-4466-8ee3-c1de6f87a737Russell_Eubankshttp://social.msdn.microsoft.com/Profile/en-US/?user=Russell_EubanksMaking a Grid the content of a RowDetailsTemplate DataTemplate in a WPF DataGridI have built a Grid of content dynamically in code and I want this Grid to be used as the DataTemplate in the RowDetailsTemplate of a WPF DataGrid. The DataGrid looks like this:<br/><br/> <pre lang=x-xml>&lt;DataGrid Name=&quot;dataGridHouseholdMembers&quot; Grid.Row=&quot;0&quot; Grid.Column=&quot;0&quot; ItemsSource=&quot;{Binding HouseholdMembers}&quot; AutoGenerateColumns=&quot;False&quot; Style=&quot;{StaticResource dataGridStyle}&quot; RowDetailsVisibilityMode=&quot;VisibleWhenSelected&quot;&gt; &lt;DataGrid.Columns&gt; &lt;DataGridComboBoxColumn x:Name=&quot;dataGridComboBoxColumnRelationship&quot; ClipboardContentBinding=&quot;{Binding Path=RelationshipToPrimaryContact}&quot; Header=&quot;Relationship&quot; SelectedItemBinding=&quot;{Binding Path=RelationshipToPrimaryContact}&quot; SelectedValueBinding=&quot;{Binding Path=RelationshipToPrimaryContact}&quot; TextBinding=&quot;{Binding Path=RelationshipToPrimaryContact}&quot; /&gt; &lt;DataGridTextColumn Binding=&quot;{Binding FirstName}&quot; ClipboardContentBinding=&quot;{x:Null}&quot; Header=&quot;First Name&quot; /&gt; &lt;DataGridTextColumn Binding=&quot;{Binding MiddleName}&quot; ClipboardContentBinding=&quot;{x:Null}&quot; Header=&quot;Middle Name&quot; /&gt; &lt;DataGridTextColumn Binding=&quot;{Binding LastName}&quot; ClipboardContentBinding=&quot;{x:Null}&quot; Header=&quot;Last Name&quot; /&gt; &lt;DataGridComboBoxColumn x:Name=&quot;dataGridComboBoxColumnSuffix&quot; ClipboardContentBinding=&quot;{Binding Path=Suffix}&quot; Header=&quot;Suffix&quot; SelectedItemBinding=&quot;{Binding Path=Suffix}&quot; SelectedValueBinding=&quot;{Binding Path=Suffix}&quot; TextBinding=&quot;{Binding Path=Suffix}&quot; /&gt; &lt;DataGridTextColumn Binding=&quot;{Binding DateOfBirth, StringFormat=d}&quot; ClipboardContentBinding=&quot;{x:Null}&quot; Header=&quot;Birth Date&quot; /&gt; &lt;DataGridComboBoxColumn x:Name=&quot;dataGridComboBoxColumnGender&quot; ClipboardContentBinding=&quot;{Binding Path=Gender}&quot; Header=&quot;Gender&quot; SelectedItemBinding=&quot;{Binding Path=Gender}&quot; SelectedValueBinding=&quot;{Binding Path=Gender}&quot; TextBinding=&quot;{Binding Path=Gender}&quot;&gt; &lt;DataGridComboBoxColumn.ItemsSource&gt; &lt;col:ArrayList&gt; &lt;sys:String&gt;F&lt;/sys:String&gt; &lt;sys:String&gt;M&lt;/sys:String&gt; &lt;sys:String&gt;X&lt;/sys:String&gt; &lt;/col:ArrayList&gt; &lt;/DataGridComboBoxColumn.ItemsSource&gt; &lt;/DataGridComboBoxColumn&gt; &lt;/DataGrid.Columns&gt; &lt;DataGrid.RowDetailsTemplate&gt; &lt;DataTemplate&gt; &lt;GroupBox Name=&quot;groupBoxPersonDemographics&quot;&gt;&lt;/GroupBox&gt; &lt;/DataTemplate&gt; &lt;/DataGrid.RowDetailsTemplate&gt; &lt;/DataGrid&gt;</pre> I want to do something like: <span style="font-family:Consolas;font-size:x-small"><span style="font-family:Consolas;font-size:x-small"> <p>groupBoxPersonDemographics.Content = _gridPersonDemographics;<br/><br/>but when I try to do so I get the message that groupBoxpersonDemographics is not in context.<br/><br/>What is the proper syntax to load the grid as the content of the DataTemplate? Can I do it prior to loading any data into the DataGrid (I only want the row details to be visible for the SelectedItem) or must I do it when the <span style="font-family:Consolas;font-size:x-small"><span style="font-family:Consolas;font-size:x-small">RowDetailsVisibilityChanged event fires for the DataGrid?</span></span></p> </span></span>Mon, 23 Nov 2009 22:44:13 Z2009-11-25T03:10:12Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/19fe8f97-0226-4c63-be07-26b904058c07http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/19fe8f97-0226-4c63-be07-26b904058c07porkchopyumhttp://social.msdn.microsoft.com/Profile/en-US/?user=porkchopyumHow can I get the session from the session IDMy WPF application is in partial trust so I can't use SaveFileDialog for downloads. Instead, I create links that call an asmx webservice. I need to somehow pass the session over since clicking on a hyperlink doesn't pass the session. I need the currentuser from the session to determine what version of the download I should give them. I thought that I could encrpyt the session ID and then pass it as a query string parameter. I got the session ID over but I can't figure out how to actually get the session from the session ID. <br/> <br/> Does anyone have any ideas? Or maybe a better way to do this?<br/> <br/> Here's the code on the asmx side.<br/> <br/> <div style="color:Black;background-color:White"> <pre>[WebMethod(EnableSession = <span style="color:Blue">true</span> )] [ScriptMethod(UseHttpGet = <span style="color:Blue">true</span> )] <span style="color:Blue">public</span> <span style="color:Blue">void</span> Download(<span style="color:Blue">string</span> label, <span style="color:Blue">string</span> key, <span style="color:Blue">string</span> redirect) { <span style="color:Blue">try</span> { <span style="color:Blue">string</span> sharedCookie = Security.DecryptValue(redirect); <span style="color:Blue">string</span> [] sharedArgs = Strings.Chop(sharedCookie, <span style="color:#a31515">&quot;;&quot;</span> ); <span style="color:Blue">string</span> sessionID = Strings.Chop(sharedArgs[0], <span style="color:#a31515">&quot;=&quot;</span> )[1]; <span style="color:Green">//Rest of code...</span> } <span style="color:Blue">catch</span> (Exception ex) { HandleDownloadException(ex, Context.Response); <span style="color:Blue">return</span> ; } } </pre> </div> <br/> <br/> <br/> Thanks,<br/> ZiyanTue, 24 Nov 2009 16:21:21 Z2009-11-25T02:00:11Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/b0f77818-dcd9-4922-b525-77ccaf333181http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/b0f77818-dcd9-4922-b525-77ccaf333181StevenIBhttp://social.msdn.microsoft.com/Profile/en-US/?user=StevenIBconcurrency violation the deletecommand affected 0 of the expected 1 records.for C# using WPF dataset to sqlHello,<br/><br/>sorry for the long Title, but as said i am getting error message: concurrency violation the deletecommand affected 0 of the expected 1 records., this happens when i go and add a new/ or insert new to sql database using Dataset/dataadaptor, I am using WPF as for the Gui interface and using C# for the backend programming, here is the code right now i got that error's out on sqlda.Update(sqlds, &quot;Workers&quot;); and i seen there are ways of fixing this but i only seen it fixed for VB and sadly i dont know VB to well. so if anyone can let me know how to fix in C# that would be awesome, here is the code below of the delete event:<br/><br/> <pre> private void btn_delete_Click(object sender, RoutedEventArgs e) { if (Listview1.SelectedItems.Count &gt; 0) { if (MessageBox.Show(&quot;Are you sure you want to delete &quot; + (Listview1.SelectedItem as DataRowView)[&quot;First_Name&quot;].ToString() + &quot; &quot; +(Listview1.SelectedItem as DataRowView)[&quot;Last_Name&quot;].ToString(), &quot;Are you sure?&quot;, MessageBoxButton.YesNo) == MessageBoxResult.Yes) { SqlCommandBuilder sq = new SqlCommandBuilder(sqlda); sqlds.Tables[&quot;Workers&quot;].Rows[Listview1.SelectedIndex].Delete(); MessageBox.Show(&quot;Record Deleted Successfully&quot;); //sqlds.AcceptChanges(); sqlda.Update(sqlds, &quot;Workers&quot;); } } else MessageBox.Show(&quot;Please select then click on delete button&quot;); }</pre> Thank youTue, 24 Nov 2009 00:10:23 Z2009-11-25T01:19:26Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/cab43b33-bbde-4416-960b-7f084249bff6http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/cab43b33-bbde-4416-960b-7f084249bff6Jimbo Mxhttp://social.msdn.microsoft.com/Profile/en-US/?user=Jimbo%20MxBlack Line at top of all WPF applications in Windows 7 AeroI've been noticing that my WPF application acts strangely. But the more I've been looking the more I see the same peculiarity and realize it's more than just my application, but WPF apps in general.<br/><br/>I'm running Win7 with VB2010 and .NET 4.0 installed. I have noticed that when using the Aero Peek function of the Win7 interface, a black line appears between the title bar and the client area. When the window is displayed for real the black line disappears and the entire window contents shift upward about 3-4 pixels.<br/><br/>It is happening for all WPF applications I am currently running, including VS2010's IDE, my own applications, and even programs like XamlPadX.<br/><br/>I'm running Win7 Pro, Dell Precision 390, 4GB, Core 2 Duo, NVIDIA Quaddro FX3500.<br/><br/>Is anyone else seeing this behavior? I only have this computer so I can't check another Win7 machine.Wed, 25 Nov 2009 01:04:34 Z2009-11-25T01:04:35Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/96843cde-22b0-44cd-8856-fef24ebe7151http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/96843cde-22b0-44cd-8856-fef24ebe7151Johny79http://social.msdn.microsoft.com/Profile/en-US/?user=Johny79Cannot catch client exception at all<p>Hi all,<br/>I am using wsHttpbinding for an internet application using WCF service and WPF. I am running into a bug when I make more than 40 consecutive calls. If make make about 30 calls then it doesn't crash and after that I can make more than 60 calls. Then after a certain point it would crash again. I am trying to catch this error and I cannot seem to catch it at all. The error I am getting is <strong>An unhandle exception of type 'System.Reflection.TargetInvocationException' occurred in Unknown module.  Additional information: Exception has been thrown by the target of invocation. <br/><br/></strong>I have tried all these catches and none of them are catching the exception. Even in the WCF Service I have added the try/catch exceptions to but cannot catch it either. It looks like the call never made it to the WCF service.  Am I doing something wrong?<br/><br/>Here are my catch blocks<br/></p> <pre> catch (FaultException er) { MessageBox.Show(er.Message); } catch (CommunicationException er) { MessageBox.Show(er.Message); } catch (TimeoutException er) { MessageBox.Show(er.Message); } catch (System.Reflection.TargetInvocationException er) { MessageBox.Show(string.Format(&quot;Inner: {0}\n\n Message: {1}&quot;, er.InnerException.Message, er.Message)); } catch (Exception er) { MessageBox.Show(er.Message); } </pre>Wed, 25 Nov 2009 00:50:57 Z2009-11-25T00:50:58Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/1561536c-644c-4764-b791-2e3c88259585http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/1561536c-644c-4764-b791-2e3c88259585Eliezer Reishttp://social.msdn.microsoft.com/Profile/en-US/?user=Eliezer%20ReisRichText Preserving and Removing FormattingsHi,<br/> <br/> I need keep the formatting of my RichText's text. The user of my system will edit some information in a formulary, so when he save the text I wanna save it in the database and when user desire load the formulary again I have to preserve the formatation. Moreover, I have a DataGrid that show the registers of database but I wanna remove the formatting of texts that appear on this DataGrid.<br/> <br/> Anyone has any ideia?<br/> <br/> Cheers.<br/> <br/>Tue, 24 Nov 2009 23:17:37 Z2009-11-25T00:47:18Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/14466080-5fcd-496d-a285-394b6f787dd7http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/14466080-5fcd-496d-a285-394b6f787dd7Kofoedhttp://social.msdn.microsoft.com/Profile/en-US/?user=KofoedPopup with AllowsTransparency="True" is allowing click events to pass through?I have a Popup with the AllowsTransparency property set to true, and I'm defining a custom border (rounded edges) for it.  I have a ListBox on the popup ... the problem is that when I click on an item in the listbox, the mouse click goes through the popup and ends up putting focus or clicking on a control that happens to be underneath the popup.<br/><br/>Is there a way around this?  I tried adding another Grid layer below the ListBox that had IsHitTestVisible=&quot;False&quot;, but that didn't work.Tue, 24 Nov 2009 18:44:44 Z2009-11-24T23:58:24Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/b4faccd1-8daf-4f46-b09a-929075f90a67http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/b4faccd1-8daf-4f46-b09a-929075f90a67MDMourahttp://social.msdn.microsoft.com/Profile/en-US/?user=MDMouraStyle and Menu. Who invented this?!Hello,<br/> <br/> I have the following MenuItem style:<br/> <br/> <pre lang="x-c#"> Style style = new Style { TargetType = typeof(MenuItem) }; Trigger over = new Trigger { Property = MenuItem.IsMouseOverProperty, Value = true }; over.Setters.Add(new Setter(Control.BackgroundProperty, new SolidColorBrush((Color)ColorConverter.ConvertFromString(&quot;#FFCC00&quot;)))); over.Setters.Add(new Setter(Control.ForegroundProperty, new SolidColorBrush((Color)ColorConverter.ConvertFromString(&quot;#202020&quot;)))); over.Setters.Add(new Setter(Control.BorderBrushProperty, Brushes.Red)); style.Triggers.Add(over);</pre> <br/> And I am applying to all menu items as follows:<br/> <pre lang="x-c#"> Menu menu = new Menu { ItemContainerStyle = style };</pre> The problems I have is:<br/> <br/> 1. When the mouse is over a Menu Item I don't get a red border. I get a gray one. This is really strange.<br/>     However, if click it, it becomes red. This makes no sense. What am I doing wrong?<br/> <br/> 2. The styles are not applied to the Menu Items that have a submenu. Have no idea why.<br/> <br/> 3. I am not able to style the buttons on the submenus.<br/> <br/> Could someone, please, help me out with this?<br/> <br/> I am starting with WPF and styling is driving me crazy.<br/> <br/> Thanks,<br/> Miguel<br/>Mon, 23 Nov 2009 00:04:15 Z2009-11-24T23:50:13Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/57b6daf9-60d3-4b27-992d-3524600a03f5http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/57b6daf9-60d3-4b27-992d-3524600a03f5Wonko_TheSanehttp://social.msdn.microsoft.com/Profile/en-US/?user=Wonko_TheSaneBinding ItemsControl in MVVMHi,<br/> <br/> One thing I'd love to solve before the long weekend...<br/> <br/> I have a MVVM app.<br/> <br/> The ViewModel is defined partially as:<br/> <br/> <pre lang="x-c#">public partial class MyViewModel { // Initialized elsewhere, etc. private Story mMyStory; public static readonly DependencyProperty StoryProperty = DependencyProperty.Register( &quot;Story&quot;, typeof(Story), typeof(MyViewModel)); public Story MyStory { get { return mMyStory; } set { SetProperty(&quot;Story&quot;, ref mMyStory, value); } } } public partial class Story : ObservableItem // implements INPC { // Assume mChapters is initialized and implements INPC private ObservableCollection&lt;Chapter&gt; mChapters; public static readonly DependencyProperty ChaptersProperty = DependencyProperty.Register( &quot;Chapters&quot;, typeof(ObservableCollection&lt;Chapters&gt;), typeof(Story)); public ObservableCollection&lt;Chapter&gt; Chapters { get { return mChapters; } set { SetProperty(&quot;Chapters&quot;, ref mChapters, value); } } }</pre> My View code-behind sets up the ViewModel and sets the DataContext of the View to the ViewModel.<br/> <pre lang="x-c#">m_viewModel = new MyViewModel(this.FullName); this.DataContext = m_viewModel;</pre> <br/> What I am having trouble with is getting the &quot;Chapters&quot; to show up properly in a ItemsControl in the View.  I want the ItemTemplate to contain a user control, with the user control's DataContext set to be a Chapter (this control works when creating one directly).<br/> <br/> This is what I have so far:<br/> <pre lang=x-xml>&lt;ItemsControl x:Name=&quot;chaptersPresentation&quot; HorizontalAlignment=&quot;Stretch&quot; Padding=&quot;5&quot; ItemsSource=&quot;{Binding Story.Chapters}&quot;&gt; &lt;ItemsControl.ItemsPanel&gt; &lt;ItemsPanelTemplate&gt; &lt;StackPanel Orientation=&quot;Horizontal&quot; HorizontalAlignment=&quot;Stretch&quot;/&gt; &lt;/ItemsPanelTemplate&gt; &lt;/ItemsControl.ItemsPanel&gt; &lt;ItemsControl.ItemTemplate&gt; &lt;DataTemplate&gt; &lt;Border Background=&quot;Yellow&quot; Margin=&quot;2&quot;&gt; &lt;StackPanel&gt; &lt;local:MyCustomControl x:Name=&quot;imageControl&quot; Style=&quot;{StaticResource ChapterStyle}&quot; /&gt; &lt;/StackPanel&gt; &lt;/Border&gt; &lt;/DataTemplate&gt; &lt;/ItemsControl.ItemTemplate&gt; &lt;/ItemsControl&gt;</pre> <br/> <br/> But I get an InvalidCastException: Unable to cast object of type '...MyViewModel' to type 'System.Windows.DependencyObject'<br/> <br/> Thanks,<br/> WtSTue, 24 Nov 2009 21:17:29 Z2009-11-24T23:33:38Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/828f9b12-4973-4fef-87bc-231f56c83522http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/828f9b12-4973-4fef-87bc-231f56c83522MDMourahttp://social.msdn.microsoft.com/Profile/en-US/?user=MDMouraMaster Page in WPFHello,<br/> <br/> I have created a WPF window with a Dock Panel and a menu on docked to top.<br/> <br/> Is it possible to use this as a &quot;master page&quot; and dock other xaml files to the middle section of the Dock Panel?<br/> <br/> Is this possible in WPF?<br/> <br/> Thanks,<br/> MiguelThu, 19 Nov 2009 22:53:01 Z2009-11-24T23:26:20Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/4950ce97-03b9-402e-aa85-ed6814750185http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/4950ce97-03b9-402e-aa85-ed6814750185John Dunnhttp://social.msdn.microsoft.com/Profile/en-US/?user=John%20DunnRemoving AdornerLayer from ScrollContentPresenterIs there a way to remove the automatically generated AdornerLayer in the ScrollContentPresenter? I need my Adorner to go outside the extents of the ScrollViewer. The workaround posted here ( <a href="http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/350dfb88-a145-48d5-8227-0db2e6fd9229">http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/350dfb88-a145-48d5-8227-0db2e6fd9229</a> ) will not work. My Adorner needs to track the position of the objects its adorning so if I reach around to the topmost Window adorner, when content is scrolled in an inner ScrollViewer the Adorner doesn't move. I've tried hooking up to LayoutChanged on the UIElement I want to track but since that gets triggered anytime layout changes for the entire application it's much too slow.Tue, 24 Nov 2009 23:19:13 Z2009-11-24T23:19:14Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/a2f47686-62e7-42ba-886e-4bcbcce54b71http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/a2f47686-62e7-42ba-886e-4bcbcce54b71miesch1http://social.msdn.microsoft.com/Profile/en-US/?user=miesch1How to animate a child control in response to a parent event or triggerHi all,<br/><br/>I have a custom button which inherits from Button. I have styled my custom button with a custom arrow by setting the button's template according to an ArrowDirection dependency property. Here is the relevant xaml for setting a button with a left arrow:<br/> <div style="color:black;background-color:white"> <pre> <span style="color:blue">&lt;</span><span style="color:#a31515">Style</span> <span style="color:red">TargetType</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">{x:Type local:SoftKeyButton}</span><span style="color:black">&quot;</span><span style="color:blue">&gt;</span> <span style="color:blue">&lt;</span><span style="color:#a31515">Style.Triggers</span><span style="color:blue">&gt;</span> <span style="color:blue">&lt;</span><span style="color:#a31515">MultiTrigger</span><span style="color:blue">&gt;</span> <span style="color:blue">&lt;</span><span style="color:#a31515">MultiTrigger.Conditions</span><span style="color:blue">&gt;</span> <span style="color:blue">&lt;</span><span style="color:#a31515">Condition</span> <span style="color:red">Property</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">ArrowDirection</span><span style="color:black">&quot;</span> <span style="color:red">Value</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">Left</span><span style="color:black">&quot;</span><span style="color:blue">/&gt;</span> <span style="color:blue">&lt;</span><span style="color:#a31515">Condition</span> <span style="color:red">Property</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">IsEnabled</span><span style="color:black">&quot;</span> <span style="color:red">Value</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">True</span><span style="color:black">&quot;</span><span style="color:blue">/&gt;</span> <span style="color:blue">&lt;/</span><span style="color:#a31515">MultiTrigger.Conditions</span><span style="color:blue">&gt;</span> <span style="color:blue">&lt;</span><span style="color:#a31515">Setter</span> <span style="color:red">Property</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">Template</span><span style="color:black">&quot;</span> <span style="color:red">Value</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">{StaticResource LeftArrowControlTemplate}</span><span style="color:black">&quot;</span> <span style="color:blue">/&gt;</span> <span style="color:blue">&lt;/</span><span style="color:#a31515">MultiTrigger</span><span style="color:blue">&gt;</span> <span style="color:blue">&lt;/</span><span style="color:#a31515">Style.Triggers</span><span style="color:blue">&gt;</span> <span style="color:blue">&lt;/</span><span style="color:#a31515">Style</span><span style="color:blue">&gt;</span> </pre> </div> <br/>with a corresponding ControlTemplate:<br/> <div style="color:black;background-color:white"> <pre> <span style="color:blue">&lt;</span><span style="color:#a31515">ControlTemplate</span> <span style="color:red">x:Key</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">LeftArrowControlTemplate</span><span style="color:black">&quot;</span> <span style="color:red">TargetType</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">{x:Type local:SoftKeyButton}</span><span style="color:black">&quot;</span><span style="color:blue">&gt;</span> <span style="color:blue">&lt;</span><span style="color:#a31515">DockPanel</span> <span style="color:red">LastChildFill</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">True</span><span style="color:black">&quot;</span><span style="color:blue">&gt;</span> <span style="color:blue">&lt;</span><span style="color:#a31515">local</span><span style="color:blue">:</span><span style="color:#a31515">Arrow</span> <span style="color:red">DockPanel.Dock</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">Left</span><span style="color:black">&quot;</span> <span style="color:red">HorizontalAlignment</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">Left</span><span style="color:black">&quot;</span> <span style="color:red">VerticalAlignment</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">Center</span><span style="color:black">&quot;</span> <span style="color:red">Content</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">M 0,10 l 10,-10 l 0,20 Z</span><span style="color:black">&quot;</span><span style="color:blue">/&gt;</span> <span style="color:blue">&lt;</span><span style="color:#a31515">ContentPresenter</span> <span style="color:red">Margin</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">2</span><span style="color:black">&quot;</span> <span style="color:red">HorizontalAlignment</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">Left</span><span style="color:black">&quot;</span> <span style="color:red">VerticalAlignment</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">Center</span><span style="color:black">&quot;</span> <span style="color:red">RecognizesAccessKey</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">True</span><span style="color:black">&quot;</span><span style="color:blue">/&gt;</span> <span style="color:blue">&lt;/</span><span style="color:#a31515">DockPanel</span><span style="color:blue">&gt;</span> <span style="color:blue">&lt;/</span><span style="color:#a31515">ControlTemplate</span><span style="color:blue">&gt;</span> </pre> </div> <br/>In the arrow's style, I am trying to update just the arrow in response to the parent Button's click event. I guess I don't understand attached properties like I should, but I was hoping that I would be able to do something like this below where I listen for the parent's IsPressed property to change.<br/><br/> <div style="color:black;background-color:white"> <pre> <span style="color:blue">&lt;</span><span style="color:#a31515">Style</span> <span style="color:red">TargetType</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">{x:Type local:Arrow}</span><span style="color:black">&quot;</span><span style="color:blue">&gt;</span> <span style="color:blue">&lt;</span><span style="color:#a31515">Setter</span> <span style="color:red">Property</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">Focusable</span><span style="color:black">&quot;</span> <span style="color:red">Value</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">false</span><span style="color:black">&quot;</span><span style="color:blue">/&gt;</span> <span style="color:blue">&lt;</span><span style="color:#a31515">Setter</span> <span style="color:red">Property</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">Template</span><span style="color:black">&quot;</span><span style="color:blue">&gt;</span> <span style="color:blue">&lt;</span><span style="color:#a31515">Setter.Value</span><span style="color:blue">&gt;</span> <span style="color:blue">&lt;</span><span style="color:#a31515">ControlTemplate</span> <span style="color:red">TargetType</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">{x:Type local:Arrow}</span><span style="color:black">&quot;</span><span style="color:blue">&gt;</span> <span style="color:blue"><span style="color:#000000">&lt;Border <br/>                        Name=&quot;Border&quot;<br/>                        Margin=&quot;0&quot; <br/>                        CornerRadius=&quot;2&quot; <br/>                        Background=&quot;{StaticResource NormalBrush}&quot;<br/>                        BorderBrush=&quot;{StaticResource NormalBorderBrush}&quot;<br/>                        BorderThickness=&quot;1&quot;&gt;<br/>                        &lt;Path<br/>                          HorizontalAlignment=&quot;Center&quot;<br/>                          VerticalAlignment=&quot;Center&quot;<br/>                          Fill=&quot;{StaticResource GlyphBrush}&quot;<br/>                          Data=&quot;{Binding Path=Content,RelativeSource={RelativeSource TemplatedParent}}&quot; /&gt;<br/>                    &lt;/Border&gt;<br/></span></span> <span style="color:blue">&lt;</span><span style="color:#a31515">ControlTemplate.Triggers</span><span style="color:blue">&gt;</span> <span style="background-color:yellow">&lt;</span><span style="background-color:yellow">Trigger Property=&quot;local:SoftKeyButton.IsPressed&quot; Value=&quot;true&quot;</span><span style="background-color:yellow">&gt;</span> <span style="color:blue">&lt;</span><span style="color:#a31515">Setter</span> <span style="color:red">TargetName</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">Border</span><span style="color:black">&quot;</span> <span style="color:red">Property</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">Background</span><span style="color:black">&quot;</span> <span style="color:red">Value</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">{StaticResource PressedBrush}</span><span style="color:black">&quot;</span> <span style="color:blue">/&gt;</span> <span style="color:blue">&lt;</span><span style="color:#a31515">Setter</span> <span style="color:red">TargetName</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">Border</span><span style="color:black">&quot;</span> <span style="color:red">Property</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">BorderBrush</span><span style="color:black">&quot;</span> <span style="color:red">Value</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">{StaticResource PressedBorderBrush}</span><span style="color:black">&quot;</span> <span style="color:blue">/&gt;</span> <span style="color:blue">&lt;/</span><span style="color:#a31515">Trigger</span><span style="color:blue">&gt;</span> <span style="color:blue">&lt;/</span><span style="color:#a31515">ControlTemplate.Triggers</span><span style="color:blue">&gt;</span> <span style="color:blue">&lt;/</span><span style="color:#a31515">ControlTemplate</span><span style="color:blue">&gt;</span> <span style="color:blue">&lt;/</span><span style="color:#a31515">Setter.Value</span><span style="color:blue">&gt;</span> <span style="color:blue">&lt;/</span><span style="color:#a31515">Setter</span><span style="color:blue">&gt;</span> <span style="color:blue">&lt;/</span><span style="color:#a31515">Style</span><span style="color:blue">&gt;</span> </pre> </div> <br/>I realize that this isn't the correct syntax, but what do I need to change so that I can update this style when the parent button is pressed? I have also tried setting up an EventTrigger here as well, but it doesn't work either. Any tips would be appreciated. Thanks and have a great day!<br/><br/>-MikeMon, 23 Nov 2009 16:01:54 Z2009-11-24T22:28:40Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/721fc8ba-a9a7-48cc-b249-5ae5c69f9dffhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/721fc8ba-a9a7-48cc-b249-5ae5c69f9dffWindowsRichhttp://social.msdn.microsoft.com/Profile/en-US/?user=WindowsRichCannot move Image from one Canvas to another Canvas<p>WPF 3.0<br/>I want to take an Image off of one canvas and add it to another<br/>Routine is:</p> <p>private void setSessionDraggedImage(Image i)<br/>  {<br/>            sessionCarousel.xamDataCarousel1.DataItems.Remove(i);<br/>            if (i.Parent == null)<br/>            {<br/>                Image newi = new Image();<br/>                svCanvas.Children.Add(newi);<br/>                svCanvas.Children.Remove(newi); <br/>                svCanvas.Children.Add(i);    // error thrown<br/>                i.MouseMove += new MouseEventHandler(pageDragging);<br/>                i.MouseLeftButtonUp += new MouseButtonEventHandler(pageDraggingStops);<br/>                i.CaptureMouse();<br/>            }<br/>  }</p> <p><br/>Error occurs at the line &quot;svCanvas.Children.Add(i);&quot;<br/>Note that i.Parent == null before the line is hit<br/>Note that I can add &amp; remove a new Image to the target Canvas.<br/>At the point of the error, it appears that i.Parent has been set to the new canvas &quot;under the covers&quot;, but an error is still thrown<br/>WHY?</p> <p>System.ArgumentException was unhandled<br/>  Message=&quot;Specified Visual is already a child of another Visual or the root of a CompositionTarget.&quot;<br/>  Source=&quot;PresentationCore&quot;<br/>  StackTrace:<br/>       at System.Windows.Media.VisualCollection.Add(Visual visual)<br/>       at System.Windows.Controls.UIElementCollection.AddInternal(UIElement element)<br/>       at System.Windows.Controls.UIElementCollection.Add(UIElement element)<br/>       at com.Surfmark.SMCreator.SMCreator.setSessionDraggedImage(Image i) in C:\svn\testprojects\SMCreator\SMCreator.xaml.cs:line 821<br/>       at com.Surfmark.SMCreator.SMCreator.pageDragStarts(Image i) in C:\svn\testprojects\SMCreator\SMCreator.xaml.cs:line 842<br/>       at com.Surfmark.SMCreator.SMCreator.carouselImage_MouseLeftDown(Object sender, RoutedEventArgs e) in C:\svn\testprojects\SMCreator\SMCreator.xaml.cs:line 678<br/>       at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)<br/>       at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)<br/>       at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)<br/>       at System.Windows.UIElement.CrackMouseButtonEventAndReRaiseEvent(DependencyObject sender, MouseButtonEventArgs e)<br/>       at System.Windows.UIElement.OnPreviewMouseDownThunk(Object sender, MouseButtonEventArgs e)<br/>       at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)<br/>       at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)<br/>       at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)<br/>       at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)<br/>       at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)<br/>       at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)<br/>       at System.Windows.Input.InputManager.ProcessStagingArea()<br/>       at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)<br/>       at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)<br/>       at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)<br/>       at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean&amp; handled)<br/>       at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean&amp; handled)<br/>       at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean&amp; handled)<br/>       at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)<br/>       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)<br/>       at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)<br/>       at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)<br/>       at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)<br/>       at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)<br/>       at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)<br/>       at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG&amp; msg)<br/>       at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)<br/>       at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)<br/>       at System.Windows.Threading.Dispatcher.Run()<br/>       at System.Windows.Application.RunDispatcher(Object ignore)<br/>       at System.Windows.Application.RunInternal(Window window)<br/>       at System.Windows.Application.Run(Window window)<br/>       at System.Windows.Application.Run()<br/>       at com.Surfmark.SMCreator.App.Main() in C:\svn\testprojects\SMCreator\obj\Debug\App.g.cs:line 0<br/>       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)<br/>       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)<br/>       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()<br/>       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)<br/>       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)<br/>       at System.Threading.ThreadHelper.ThreadStart()<br/>  InnerException:</p>Tue, 24 Nov 2009 15:50:05 Z2009-11-24T21:52:13Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/6f0998f5-1b6a-406e-b579-9062c59ecefchttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/6f0998f5-1b6a-406e-b579-9062c59ecefcCraig Berntsonhttp://social.msdn.microsoft.com/Profile/en-US/?user=Craig%20BerntsonGet TreeView "node" from ContextMenuI have a TreeView that is populated using XmlDataProvider and has an applied HierarchicalDataTemplate. There are no TreeViewItems creating the nodes. How do I determine which node is gettng the click to display the context menu?<br/><br/>I can use a TreeViewItem if that makes it easier and someone shows me how to use it with a HierarchicalDataTemplate.<hr class="sig">Craig Berntson MCSD, Visual FoxPro MVP www.craigberntson.comWed, 18 Nov 2009 23:11:44 Z2009-11-24T20:37:22Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/5b68509f-0405-4bbd-9686-19e82644fb34http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/5b68509f-0405-4bbd-9686-19e82644fb34Stefan Schorhttp://social.msdn.microsoft.com/Profile/en-US/?user=Stefan%20SchorWPF on Displays which are not part of the Desktop &lt;!-- /* Font Definitions */ @font-face {font-family:&quot;Cambria Math&quot;; panose-1:2 4 5 3 5 4 6 3 2 4; mso-font-charset:1; mso-generic-font-family:roman; mso-font-format:other; mso-font-pitch:variable; mso-font-signature:0 0 0 0 0 0;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:-520092929 1073786111 9 0 415 0;} @font-face {font-family:Consolas; panose-1:2 11 6 9 2 2 4 3 2 4; mso-font-charset:0; mso-generic-font-family:modern; mso-font-pitch:fixed; mso-font-signature:-520092929 1073806591 9 0 415 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-unhide:no; mso-style-qformat:yes; mso-style-parent:&quot;&quot;; margin:0cm; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:&quot;Times New Roman&quot;; mso-bidi-theme-font:minor-bidi; mso-fareast-language:EN-US;} p.MsoPlainText, li.MsoPlainText, div.MsoPlainText {mso-style-noshow:yes; mso-style-priority:99; mso-style-link:&quot;Plain Text Char&quot;; margin:0cm; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.5pt; font-family:Consolas; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin; mso-bidi-font-family:&quot;Times New Roman&quot;; mso-bidi-theme-font:minor-bidi; mso-fareast-language:EN-US;} span.PlainTextChar {mso-style-name:&quot;Plain Text Char&quot;; mso-style-noshow:yes; mso-style-priority:99; mso-style-unhide:no; mso-style-locked:yes; mso-style-link:&quot;Plain Text&quot;; mso-ansi-font-size:10.5pt; mso-bidi-font-size:10.5pt; font-family:Consolas; mso-ascii-font-family:Consolas; mso-hansi-font-family:Consolas;} .MsoChpDefault {mso-style-type:export-only; mso-default-props:yes; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:&quot;Times New Roman&quot;; mso-bidi-theme-font:minor-bidi; mso-fareast-language:EN-US;} @page Section1 {size:612.0pt 792.0pt; margin:70.85pt 70.85pt 2.0cm 70.85pt; mso-header-margin:36.0pt; mso-footer-margin:36.0pt; mso-paper-source:0;} div.Section1 {page:Section1;} --&gt; <p class=MsoPlainText>Hello,</p> <p class=MsoPlainText> </p> <p class=MsoPlainText>I am currently developing a windows xp solution where an external display is used to display hardware related information. This display is therefore not mounted next to the pc with the primary display - in our case it is mounted in another room (next to the observed hardware).</p> <p class=MsoPlainText> </p> <p class=MsoPlainText>Because just hardware related information is displayed we don't need mouse and keyboard interaction.</p> <p class=MsoPlainText>We just want to use WPF because it is very powerful and allows us to use XAML and Co as usual for developing and</p> <p class=MsoPlainText>designing the graphical output.</p> <p class=MsoPlainText> </p> <p class=MsoPlainText>Now to my problem:</p> <p class=MsoPlainText>To use WPF on this display as far as I know I have to add it into the desktop. But by using this approach we have to face the situation that the user is able to interact with the display. He is able to use the mouse pointer and can move windows o this area of the desktop. All of this is not desired. In best case the user should not be aware that this display exists at all.</p> <p class=MsoPlainText> </p> <p class=MsoPlainText>Is there anybody out there with an idea how to use WPF and display it on a display which is not part of the desktop?</p> <p class=MsoPlainText>- Maybe create a special WPF &quot;Window&quot; which renders directly to the graphics card output?</p> <p class=MsoPlainText>- Replace the graphics card memory part by another target area?</p> <p class=MsoPlainText>- Take something from Remote Desktop Connections?</p> <p class=MsoPlainText>- Take something from VirtualDesktops, Second Desktops?</p> <p class=MsoPlainText>- ...</p> <p class=MsoPlainText> </p> <p class=MsoPlainText>Any idea?</p> <p class=MsoPlainText> </p> <p class=MsoPlainText> </p> <p class=MsoPlainText>Best regards,</p> <p class=MsoPlainText> </p> <p class=MsoPlainText>stefan</p> <p class=MsoPlainText> </p>Tue, 10 Nov 2009 18:43:19 Z2009-11-24T20:21:52Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/b65d7448-d8e8-445d-a484-ed6de3d60726http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/b65d7448-d8e8-445d-a484-ed6de3d60726OdomaeBhttp://social.msdn.microsoft.com/Profile/en-US/?user=OdomaeBPasswordBox for loginI have a login menu wherein I am trying to capture the password(and store it for length and other verification)<br/> public void login(object sender, RoutedEventArgs e)<br/> {<br/>     DisplayBox = new PasswordBox();<br/>     Mygrid.Children.Add(DisplayBox);<br/> <br/> }<br/> <br/> void OnClick(object sender, RoutedEventArgs e)<br/> {<br/>     //Check password strength<br/>    if (Display.Length &lt; 4)<br/>         MessageBox.Display(&quot;Password error&quot;);<br/> }<br/> <br/> How do I get the full password in my OnClick() routine to do the check?<br/> <br/>Tue, 24 Nov 2009 17:15:07 Z2009-11-24T19:49:36Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/cfb1a0e7-262a-41b4-a528-68d70d7abe26http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/cfb1a0e7-262a-41b4-a528-68d70d7abe26xkrjahttp://social.msdn.microsoft.com/Profile/en-US/?user=xkrjaCustom control and data binding in generic.xamlI'm starting out with custom controls in WPF and I don't understand how to create data binding in the generic.xaml. This is an example generic.xaml I have:<br/> <br/> <pre lang=x-xml>&lt;ResourceDictionary xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot; xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot; xmlns:local=&quot;clr-namespace:EngineBase&quot; xmlns:d=&quot;http://schemas.microsoft.com/expression/blend/2008&quot;&gt; &lt;Style TargetType=&quot;{x:Type local:CustomControl1}&quot;&gt; &lt;Setter Property=&quot;Template&quot;&gt; &lt;Setter.Value&gt; &lt;ControlTemplate TargetType=&quot;{x:Type local:CustomControl1}&quot;&gt; &lt;Grid x:Name=&quot;grid&quot; Background=&quot;Transparent&quot; RenderTransformOrigin=&quot;0.5,0.5&quot;&gt; &lt;TextBlock Margin=&quot;8&quot; Text=&quot;{Binding MyText}&quot; Name=&quot;textblock1&quot; TextWrapping=&quot;Wrap&quot; Foreground=&quot;White&quot;/&gt; &lt;/Grid&gt; &lt;/ControlTemplate&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Style&gt; &lt;/ResourceDictionary&gt;</pre> As you can see I want to bind the 'Text' property of 'textblock1' to a property called 'MyText'. So, in the cs-file I have this:<br/> <br/> <pre lang="x-c#">using System.Windows; using System.Windows.Controls; namespace EngineBase { public class CustomControl1 : Button { public static readonly DependencyProperty MyTextProperty = DependencyProperty.Register(&quot;MyText&quot;, typeof(string), typeof(CustomControl1), new PropertyMetadata(new PropertyChangedCallback(CustomControl1.OnMyTextPropertyChanged))); public string MyText { get { return (string)GetValue(MyTextProperty); } set { SetValue(MyTextProperty, value); } } static CustomControl1() { DefaultStyleKeyProperty.OverrideMetadata(typeof(CustomControl1), new FrameworkPropertyMetadata(typeof(CustomControl1))); } private static void OnMyTextPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { CustomControl1 myControl = d as CustomControl1; //Now what??? } } } </pre> But this doesn't seem to be enough to cause 'textblock1' to bind to the 'MyText' property. Do I need to inherit the 'INotifiyPropertyChanged' interface to the 'MyText' wrapper or is there another way when I'm creating custom dependency properties? <br/> <br/> Thanks for help!Wed, 21 Oct 2009 08:00:10 Z2009-11-24T19:45:18Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/1e98c1ca-fa63-4fd6-b4cd-13729868ce30http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/1e98c1ca-fa63-4fd6-b4cd-13729868ce30CTRLIThttp://social.msdn.microsoft.com/Profile/en-US/?user=CTRLITPassing Hight-Lighted Text in other applications or Windows to WPF ApplicationWe have a contact management system that has the ability to place a call to their telephone. We are looking for ways to integrate with other applications and Windows in general w/o using TAPI due to its complexity.<br/><br/>As an alternative, we were thinking of have a hotkey designated that would take any hightlighted text and pass to our application. Say for instance you were in Notepad where you have a list of phone numbers. I would like to call one of them by highlighting the phone number and hitting F10 (or whatever key) and our application will interpret this by taking the hightlighted value and pasing to our internal methods to then place the call.<br/><br/>Let me know if anyone has any direction in accomplishing this sort of feature.<br/><br/>Thanks,<br/><br/>SteveThu, 19 Nov 2009 03:29:09 Z2009-11-24T19:40:47Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/d50f6974-a47a-4926-b755-6cdbe40faad2http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/d50f6974-a47a-4926-b755-6cdbe40faad2marck68http://social.msdn.microsoft.com/Profile/en-US/?user=marck68SPECIAL CHARACTERS IN XAML via VB.netHello<br/> <br/> I need to create Xaml code via vb.net.<br/> <br/> In particular I need to create a line like thsi one:<br/> <br/>  Stringbuilder.Append(&quot;Currency=&quot;&quot;{Binding Path= &quot; &amp; PathName &amp; &quot;,Mode=TwoWay}&quot;&quot; /&gt;&quot;)<br/> <br/> where the Pathname is a string .<br/> <br/> My problem is that because this pathname is typed by the user there is a chance that someone will use characters like // \\ etc.<br/> <br/> <br/> I would like to allow the user to use those characters but if i do so during the generation of xaml code with <br/> <br/> <br/> <br/>         <br/>         xaml = Stringbuilder.ToString<br/>         Dim sr As New MemoryStream(Encoding.ASCII.GetBytes(xaml))<br/>         Dim pc As New ParserContext()<br/> <br/> i get en exception<br/> <br/> <br/> <br/> <br/> so how can I make those character acceptable in a parsercontext?Tue, 24 Nov 2009 19:37:25 Z2009-11-24T19:37:26Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/357f88af-cf84-43eb-a7bb-0d89c0d81014http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/357f88af-cf84-43eb-a7bb-0d89c0d81014Tony Widjajahttp://social.msdn.microsoft.com/Profile/en-US/?user=Tony%20WidjajaGroupBox looks different between .Net4 and .Net4 Client Profile<p>We've just noticed that the WPF GroupBox visual look is different depending on whether the project is built for .Net4 or .Net4 Client Profile. The one for .Net4 have a groupbox header that occupies the whole top bar, while .Net4 ClientProfile GroupBox looks just like the old style one. Is there any reason behind this? Also, will there be other wpf control visual diferences between the two?<br/><br/>Tony</p><hr class="sig">TWTue, 24 Nov 2009 19:23:55 Z2009-11-24T20:18:54Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/2bdef20b-71d2-4186-be99-a9ef54ec6120http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/2bdef20b-71d2-4186-be99-a9ef54ec6120dlusignanhttp://social.msdn.microsoft.com/Profile/en-US/?user=dlusignanHelp with event in Custom ControlHi! I devellop a CustomControl with a layout like a TileList. Everything is fine except that when I double click an item in the list, the SelectedItem and SelectIndex are null and -1. Does anyone knows why?<br/><br/>Here's my Generic.xaml:<br/><br/> <div style="background-color:white;color:black"> <pre><span style="color:blue">&lt;</span><span style="color:#a31515">ResourceDictionary</span> <span style="color:red">xmlns</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">http://schemas.microsoft.com/winfx/2006/xaml/presentation</span><span style="color:black">&quot;</span> <span style="color:red">xmlns:x</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">http://schemas.microsoft.com/winfx/2006/xaml</span><span style="color:black">&quot;</span> <span style="color:red">xmlns:local</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">clr-namespace:eXtendedControl</span><span style="color:black">&quot;</span><span style="color:blue">&gt;</span> <span style="color:blue">&lt;</span><span style="color:#a31515">Style</span> <span style="color:red">TargetType</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">{x:Type local:TileList}</span><span style="color:black">&quot;</span><span style="color:blue">&gt;</span> <span style="color:blue">&lt;</span><span style="color:#a31515">Setter</span> <span style="color:red">Property</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">Template</span><span style="color:black">&quot;</span><span style="color:blue">&gt;</span> <span style="color:blue">&lt;</span><span style="color:#a31515">Setter.Value</span><span style="color:blue">&gt;</span> <span style="color:blue">&lt;</span><span style="color:#a31515">ControlTemplate</span> <span style="color:red">TargetType</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">{x:Type local:TileList}</span><span style="color:black">&quot;</span><span style="color:blue">&gt;</span> <span style="color:blue">&lt;</span><span style="color:#a31515">Border</span> <span style="color:red">SnapsToDevicePixels</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">true</span><span style="color:black">&quot;</span> <span style="color:red">Background</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">{TemplateBinding Background}</span><span style="color:black">&quot;</span> <span style="color:red">BorderBrush</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">{TemplateBinding BorderBrush}</span><span style="color:black">&quot;</span> <span style="color:red">BorderThickness</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">{TemplateBinding BorderThickness}</span><span style="color:black">&quot;</span> <span style="color:red">HorizontalAlignment</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">{TemplateBinding HorizontalAlignment}</span><span style="color:black">&quot;</span> <span style="color:red">VerticalAlignment</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">{TemplateBinding VerticalAlignment}</span><span style="color:black">&quot;</span> <span style="color:red">Padding</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">{TemplateBinding Padding}</span><span style="color:black">&quot;</span><span style="color:blue">&gt;</span> <span style="color:blue">&lt;</span><span style="color:#a31515">ItemsPresenter</span> <span style="color:red">SnapsToDevicePixels</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">{TemplateBinding SnapsToDevicePixels}</span><span style="color:black">&quot;</span><span style="color:blue">/&gt;</span> <span style="color:blue">&lt;/</span><span style="color:#a31515">Border</span><span style="color:blue">&gt;</span> <span style="color:blue">&lt;/</span><span style="color:#a31515">ControlTemplate</span><span style="color:blue">&gt;</span> <span style="color:blue">&lt;/</span><span style="color:#a31515">Setter.Value</span><span style="color:blue">&gt;</span> <span style="color:blue">&lt;/</span><span style="color:#a31515">Setter</span><span style="color:blue">&gt;</span> <span style="color:blue">&lt;</span><span style="color:#a31515">Setter</span> <span style="color:red">Property</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">ItemsPanel</span><span style="color:black">&quot;</span><span style="color:blue">&gt;</span> <span style="color:blue">&lt;</span><span style="color:#a31515">Setter.Value</span><span style="color:blue">&gt;</span> <span style="color:blue">&lt;</span><span style="color:#a31515">ItemsPanelTemplate</span><span style="color:blue">&gt;</span> <span style="color:blue">&lt;</span><span style="color:#a31515">WrapPanel</span> <span style="color:red">IsItemsHost</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">True</span><span style="color:black">&quot;</span><span style="color:blue">&gt;</span> <span style="color:blue">&lt;/</span><span style="color:#a31515">WrapPanel</span><span style="color:blue">&gt;</span> <span style="color:blue">&lt;/</span><span style="color:#a31515">ItemsPanelTemplate</span><span style="color:blue">&gt;</span> <span style="color:blue">&lt;/</span><span style="color:#a31515">Setter.Value</span><span style="color:blue">&gt;</span> <span style="color:blue">&lt;/</span><span style="color:#a31515">Setter</span><span style="color:blue">&gt;</span> <span style="color:blue">&lt;</span><span style="color:#a31515">Setter</span> <span style="color:red">Property</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">ItemContainerStyle</span><span style="color:black">&quot;</span><span style="color:blue">&gt;</span> <span style="color:blue">&lt;</span><span style="color:#a31515">Setter.Value</span><span style="color:blue">&gt;</span> <span style="color:blue">&lt;</span><span style="color:#a31515">Style</span> <span style="color:red">TargetType</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">{x:Type FrameworkElement}</span><span style="color:black">&quot;</span><span style="color:blue">&gt;</span> &lt;Setter Property=&quot;Width&quot; Value=&quot;{Binding TileWidth, RelativeSource={RelativeSource FindAncestor ,AncestorType={x:Type local:TileList}}}&quot;/&gt; &lt;Setter Property=&quot;Height&quot; Value=&quot;{Binding TileHeight, RelativeSource={RelativeSource FindAncestor ,AncestorType={x:Type local:TileList}}}&quot;/&gt; &lt;Setter Property=&quot;HorizontalAlignment&quot; Value=&quot;{Binding TileHorizontalAlignment, RelativeSource={RelativeSource FindAncestor ,AncestorType={x:Type local:TileList}}}&quot;/&gt; &lt;Setter Property=&quot;VerticalAlignment&quot; Value=&quot;{Binding TileVerticalAlignment, RelativeSource={RelativeSource FindAncestor ,AncestorType={x:Type local:TileList}}}&quot;/&gt; <span style="color:blue">&lt;/</span><span style="color:#a31515">Style</span><span style="color:blue">&gt;</span> <span style="color:blue">&lt;/</span><span style="color:#a31515">Setter.Value</span><span style="color:blue">&gt;</span> <span style="color:blue">&lt;/</span><span style="color:#a31515">Setter</span><span style="color:blue">&gt;</span> <span style="color:blue">&lt;/</span><span style="color:#a31515">Style</span><span style="color:blue">&gt;</span> <span style="color:blue">&lt;/</span><span style="color:#a31515">ResourceDictionary</span><span style="color:blue">&gt;</span> </pre> </div> <br/>Here's my C# TileList.cs:<br/> <div style="background-color:white;color:black"> <pre><span style="color:blue">using</span> System.Windows; <span style="color:blue">using</span> System.Windows.Controls; <span style="color:blue">using</span> System.Windows.Controls.Primitives; <span style="color:blue">using</span> System.IO; <span style="color:blue">namespace</span> eXtendedControl { <span style="color:blue">public</span> <span style="color:blue">class</span> TileList : Selector { <span style="color:blue">static</span> TileList() { DefaultStyleKeyProperty.OverrideMetadata(<span style="color:blue">typeof</span>(TileList), <span style="color:blue">new</span> FrameworkPropertyMetadata(<span style="color:blue">typeof</span>(TileList))); } <span style="color:blue">public</span> <span style="color:blue">double</span> TileWidth { <span style="color:blue">get</span> { <span style="color:blue">return</span> (<span style="color:blue">double</span>)GetValue(TileWidthProperty); } <span style="color:blue">set</span> { SetValue(TileWidthProperty, value); } } <span style="color:blue">public</span> <span style="color:blue">static</span> <span style="color:blue">readonly</span> DependencyProperty TileWidthProperty = DependencyProperty.Register(<span style="color:#a31515">&quot;TileWidth&quot;</span>, <span style="color:blue">typeof</span>(<span style="color:blue">double</span>), <span style="color:blue">typeof</span>(TileList)); <span style="color:blue">public</span> <span style="color:blue">double</span> TileHeight { <span style="color:blue">get</span> { <span style="color:blue">return</span> (<span style="color:blue">double</span>)GetValue(TileHeightProperty); } <span style="color:blue">set</span> { SetValue(TileHeightProperty, value); } } <span style="color:blue">public</span> <span style="color:blue">static</span> <span style="color:blue">readonly</span> DependencyProperty TileHeightProperty = DependencyProperty.Register(<span style="color:#a31515">&quot;TileHeight&quot;</span>, <span style="color:blue">typeof</span>(<span style="color:blue">double</span>), <span style="color:blue">typeof</span>(TileList)); <span style="color:blue">public</span> HorizontalAlignment TileHorizontalAlignment { <span style="color:blue">get</span> { <span style="color:blue">return</span> (HorizontalAlignment)GetValue(TileHorizontalAlignmentProperty); } <span style="color:blue">set</span> { SetValue(TileHorizontalAlignmentProperty, value); } } <span style="color:blue">public</span> <span style="color:blue">static</span> <span style="color:blue">readonly</span> DependencyProperty TileHorizontalAlignmentProperty = DependencyProperty.Register(<span style="color:#a31515">&quot;TileHorizontalAlignment&quot;</span>, <span style="color:blue">typeof</span>(HorizontalAlignment), <span style="color:blue">typeof</span>(TileList)); <span style="color:blue">public</span> VerticalAlignment TileVerticalAlignment { <span style="color:blue">get</span> { <span style="color:blue">return</span> (VerticalAlignment)GetValue(TileVerticalAlignmentProperty); } <span style="color:blue">set</span> { SetValue(TileVerticalAlignmentProperty, value); } } <span style="color:blue">public</span> <span style="color:blue">static</span> <span style="color:blue">readonly</span> DependencyProperty TileVerticalAlignmentProperty = DependencyProperty.Register(<span style="color:#a31515">&quot;TileVerticalAlignment&quot;</span>, <span style="color:blue">typeof</span>(VerticalAlignment), <span style="color:blue">typeof</span>(TileList)); } } </pre> </div> <br/><br/>Thanks for helping me.<br/><br/>DanielTue, 24 Nov 2009 19:19:25 Z2009-11-24T19:19:26Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/38f583c4-5818-4485-b5e2-b630385a2dedhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/38f583c4-5818-4485-b5e2-b630385a2dedJimbo Mxhttp://social.msdn.microsoft.com/Profile/en-US/?user=Jimbo%20MxVS2010 on Windows 7: Taskbar Snapshot Not Updating[rant]I am reposting this message because an MSFT moderator moved the original message to a dead forum, effectively deleting the question. If someone has a suggestion for a better forum, please let me know and I will post the question there. However the &quot;Where is the forum for...&quot; forum is NOT the proper location.[/rant]<br/><br/>I've been looking through the Win7 support provided by .NET 4.0, but I haven't discovered how to resolve this one. My application is logging information to the main window. However when I hover over the Taskbar Icon for the running program, changes aren't updated. I thought Win7 was supposed to handle live updates on the Taskbar icon previews as well as Aero Peek, etc.<br/><br/>Am I missing something or do I have to manually tell the Taskbar whenever my main window has updated itself?Tue, 24 Nov 2009 19:16:27 Z2009-11-24T19:16:28Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/b60718da-f571-4715-b2bc-c3bf240e3e0ehttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/b60718da-f571-4715-b2bc-c3bf240e3e0eTTK12http://social.msdn.microsoft.com/Profile/en-US/?user=TTK12What is going on with rtb?Here are the stats from clr profiler after clearing text in trb and calling GC: <div>==========================================<br/> <div><br/></div> <div> <div>System.Windows.Documents.TextTreeTextElementNode System.Windows.Documents.TextTreeTextElementNode-&gt;System.Windows.Documents.TextTreeTextElementNode-&gt;(System.Windows.Documents.TextTreeTextElementNode):<span style="white-space:pre"> </span>  27 MB    (100.00%)  (4 objects,  0.0 bytes (0.00%))</div> <div><br/></div> <div>Referred to by:</div> <div><span style="white-space:pre"> </span> 7.5 MB    (27.98%) from<span style="white-space:pre"> </span>System.Windows.Documents.TextTreeTextElementNode<span style="white-space:pre"> </span>System.Windows.Documents.TextPointer-&gt;System.Windows.Documents.TextTreeTextElementNode-&gt;(System.Windows.Documents.Run,System.Windows.Documents.TextTreeTextElementNode)</div> <div><span style="white-space:pre"> </span>  19 MB    (72.02%) from<span style="white-space:pre"> </span>System.Windows.Documents.TextTreeTextElementNode<span style="white-space:pre"> </span>System.Windows.Documents.TextTreeTextElementNode-&gt;System.Windows.Documents.TextTreeTextElementNode-&gt;(System.Windows.Documents.Span,System.Windows.Documents.TextTreeTextElementNode)</div> <div><br/></div> <div>Referring to:</div> <div><span style="white-space:pre"> </span> 9.9 kB    (0.04%) to<span style="white-space:pre"> </span>System.Windows.Documents.TextTreeTextElementNode<span style="white-space:pre"> </span>System.Windows.Documents.TextTreeTextElementNode-&gt;System.Windows.Documents.TextTreeTextElementNode-&gt;(System.Windows.Documents.TextTreeTextElementNode,System.Windows.Documents.TextTreeTextNode)</div> <div><span style="white-space:pre"> </span> 512 bytes (0.00%) to<span style="white-space:pre"> </span>System.Windows.Documents.Span<span style="white-space:pre"> </span>System.Windows.Documents.TextTreeTextElementNode-&gt;System.Windows.Documents.Span-&gt;(MS.Internal.Text.TypographyProperties,System.Windows.Documents.Paragraph,System.Windows.Threading.Dispatcher)</div> <div><span style="white-space:pre"> </span> 280 bytes (0.00%) to<span style="white-space:pre"> </span>System.Windows.Documents.TextTreeTextElementNode<span style="white-space:pre"> </span>System.Windows.Documents.TextTreeTextElementNode-&gt;System.Windows.Documents.TextTreeTextElementNode-&gt;(System.Windows.Documents.Run,System.Windows.Documents.TextTreeTextElementNode)</div> <div><span style="white-space:pre"> </span>  27 MB    (99.96%) to<span style="white-space:pre"> </span>System.Windows.Documents.TextTreeTextElementNode<span style="white-space:pre"> </span>System.Windows.Documents.TextTreeTextElementNode-&gt;System.Windows.Documents.TextTreeTextElementNode-&gt;(System.Windows.Documents.Paragraph,System.Windows.Documents.TextTreeFixupNode)</div> <div><span style="white-space:pre"> </span> 998 bytes (0.00%) to<span style="white-space:pre"> </span>System.Windows.Documents.TextTreeTextElementNode<span style="white-space:pre"> </span>System.Windows.Documents.TextTreeTextElementNode-&gt;System.Windows.Documents.TextTreeTextElementNode-&gt;(System.Windows.Documents.Span,System.Windows.Documents.TextTreeTextElementNode)</div> <div><br/></div> <div><br/></div> <div>==========================================</div> <div><br/></div> <div> System.Windows.Documents.TextContainer System.Windows.Controls.RichTextBox-&gt;System.Windows.Documents.TextContainer-&gt;(MS.Internal.Documents.UndoManager,System.Windows.Documents.FlowDocument,System.Windows.Documents.Highlights,...):<span style="white-space:pre"> </span>  27 MB    (100.00%)</div> <div>  System.Windows.Documents.TextSelection System.Windows.Documents.TextContainer-&gt;System.Windows.Documents.TextSelection-&gt;(System.EventHandler,System.Windows.Documents.TextEditor,System.Windows.Documents.TextPointer):<span style="white-space:pre"> </span>  27 MB    (100.00%)  (1 object,  0.0 bytes (0.00%))</div> <div>   System.Windows.Documents.TextPointer System.Windows.Documents.TextSelection-&gt;System.Windows.Documents.TextPointer-&gt;(System.Windows.Documents.TextContainer):<span style="white-space:pre"> </span>  19 MB    (72.02%)</div> <div>   System.Windows.Documents.TextSelectionHighlightLayer System.Windows.Documents.TextSelection-&gt;System.Windows.Documents.TextSelectionHighlightLayer-&gt;(System.Windows.Documents.TextPointer,System.Windows.Documents.TextSelection):<span style="white-space:pre"> </span> 7.5 MB    (27.98%)</div> <div><br/></div> <div><br/></div> <div>==========================================</div> <div><br/></div> <div> System.Windows.Documents.TextTreeFixupNode System.Windows.Documents.TextTreeTextElementNode-&gt;System.Windows.Documents.TextTreeFixupNode-&gt;(System.Windows.Documents.TextTreeRootNode):<span style="white-space:pre"> </span>  27 MB    (100.00%)</div> <div>  System.Windows.Documents.TextTreeTextElementNode System.Windows.Documents.TextTreeFixupNode-&gt;System.Windows.Documents.TextTreeTextElementNode-&gt;(System.Windows.Documents.Paragraph,System.Windows.Documents.TextTreeFixupNode):<span style="white-space:pre"> </span>  27 MB    (100.00%)  (4312 objects,  0.0 bytes (0.00%))</div> <div>   System.Windows.Documents.TextTreeTextElementNode(1) System.Windows.Documents.TextTreeTextElementNode-&gt;System.Windows.Documents.TextTreeTextElementNode-&gt;(System.Windows.Documents.TextTreeTextElementNode):<span style="white-space:pre"> </span>  21 MB    (77.01%)</div> <div>   System.Windows.Documents.TextTreeTextElementNode System.Windows.Documents.TextTreeTextElementNode-&gt;System.Windows.Documents.TextTreeTextElementNode-&gt;(System.Windows.Documents.TextTreeTextElementNode,System.Windows.Documents.TextTreeTextNode):<span style="white-space:pre"> </span> 3.7 MB    (13.96%)</div> <div>   System.Windows.Documents.Paragraph System.Windows.Documents.TextTreeTextElementNode-&gt;System.Windows.Documents.Paragraph-&gt;(System.Windows.Documents.TextTreeTextElementNode,System.Windows.EffectiveValueEntry [],System.Windows.Threading.Dispatcher):<span style="white-space:pre"> </span> 1.8 MB    (6.58%)</div> <div>   System.Windows.Documents.Paragraph System.Windows.Documents.TextTreeTextElementNode-&gt;System.Windows.Documents.Paragraph-&gt;(System.Windows.EffectiveValueEntry [],System.Windows.Style,System.Windows.Threading.Dispatcher,...):<span style="white-space:pre"> </span> 318 kB    (1.16%)</div> <div><br/></div> <div><br/></div> </div> </div>Wed, 18 Nov 2009 18:50:39 Z2009-11-24T19:16:03Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/d5b236fd-1bad-43ae-ac15-3486b4fa76bchttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/d5b236fd-1bad-43ae-ac15-3486b4fa76bcdhenryhttp://social.msdn.microsoft.com/Profile/en-US/?user=dhenryXPS Print PageRangeHello,<br> <br>I need to enable the ability to print a range of pages of an XPSDocument. I am using code similar to the example taken from MSDN as below:<br><br> <div style="border-right:#7f9db9 1px solid;border-top:#7f9db9 1px solid;font-size:11px;overflow:auto;border-left:#7f9db9 1px solid;line-height:100%! important;border-bottom:#7f9db9 1px solid;font-family:Courier New;background-color:white"> <table style="border-top-width:0px;border-left-width:0px;margin:2px 0px;width:99%;border-bottom:#eee 0px solid;border-collapse:collapse;background-color:#fff;border-right-width:0px" cellspacing=0 cellpadding=0> <colgroup> <col style="padding-left:10px;font-size:11px;border-bottom:#f7f7f7 1px solid;font-family:Courier New;white-space:nowrap"> <tbody> <tr> <td><font style="font-size:11px">PrintDialog pDialog = </font><font style="color:blue">new</font><font style="font-size:11px"> PrintDialog();  </font></td></tr> <tr> <td style="background-color:#f7f7f7">pDialog.PageRangeSelection = PageRangeSelection.AllPages;  </td></tr> <tr> <td>pDialog.UserPageRangeEnabled = </font><font style="color:blue">true</font><font style="font-size:11px">;  </font></td></tr> <tr> <td style="background-color:#f7f7f7"> </td></tr> <tr> <td></font><font style="color:green">// Display the dialog. This returns true if the user presses the Print button. </font><font style="font-size:11px"> </font></td></tr> <tr> <td style="background-color:#f7f7f7">Nullable&lt;Boolean&gt; print = pDialog.ShowDialog();  </td></tr> <tr> <td></font><font style="color:blue">if</font><font style="font-size:11px"> (print == </font><font style="color:blue">true</font><font style="font-size:11px">)  </font></td></tr> <tr> <td style="background-color:#f7f7f7">{  </td></tr> <tr> <td>XpsDocument xpsDocument = </font><font style="color:blue">new</font><font style="font-size:11px"> XpsDocument(</font><font style="color:blue">&quot;C:\\FixedDocumentSequence.xps&quot;</font><font style="font-size:11px">, FileAccess.ReadWrite);  </font></td></tr> <tr> <td style="background-color:#f7f7f7">FixedDocumentSequence fixedDocSeq = xpsDocument.GetFixedDocumentSequence();  </td></tr> <tr> <td>pDialog.PrintDocument(fixedDocSeq.DocumentPaginator, </font><font style="color:blue">&quot;Test print job&quot;</font><font style="font-size:11px">);  </font></td></tr> <tr> <td style="background-color:#f7f7f7">}  </td></tr> <tr> <td> </td></tr></tbody></table></div><br>A user can select a range on the PrintDialog, but when the document prints, it prints all the pages - not just the range.<br><br>Using Vista 32 bit with Studio 2008, WPF 3.0 Application.<br><br>Any Ideas?<br><br>Thanks,<br><br>DavidFri, 09 Jan 2009 01:24:40 Z2009-11-24T18:54:06Z