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.Thu, 26 Nov 2009 23:57:43 Z43e1b4ad-eb8d-427f-90a9-161e7af74457http://social.expression.microsoft.com/Forums/en-US/wpf/thread/e64f2015-be16-4cd1-8535-e410022de36fhttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/e64f2015-be16-4cd1-8535-e410022de36fMSearleshttp://social.expression.microsoft.com/Profile/en-US/?user=MSearlesListView/GridView hyperlink columns for ID fieldsHi, <div><br/></div> <div>I'm trying to create a ListView/GridView that will display the results of a database query, and show any ID column as a hyperlink, which, when clicked, will open a new View of a the object. This wouldn't be too tricky except that I'm working on a database with about 30 tables, and the query is completely dynamic. Ie, could have any of the fields in the database in it. I'm OK with creating a list of commands for the hyperlinks, testing to see if the field <em>should</em> become a hyperlink, and executing the command if the hyperlink is clicked, but I'm not sure of how to create the appropriate ItemsSource. </div> <div><br/></div> <div>The query returns a DataTable... I don't know which or how many fields there will be, so how can I create an ItemsSource or DataTemplate that will allow the ID columns to be displayed as Hyperlinks?</div> <div><br/></div> <div>Warm regards,</div> <div>Matt</div> <div><br/></div> <div>Image : http://tinypic.com/r/312isk3/6  // Did this with a Grid object, but its far from ideal</div> <div><br/></div>Mon, 23 Nov 2009 23:25:35 Z2009-11-26T23:57:43Zhttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/5d1713e3-8c04-4e95-8a21-13a79bc6fe8fhttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/5d1713e3-8c04-4e95-8a21-13a79bc6fe8fMSearleshttp://social.expression.microsoft.com/Profile/en-US/?user=MSearlesCreating a ListView/GridView from dynamic columns (MVVM)Hi, <div><br/></div> <div>In the project I'm working on, the user is able to create a custom query, and query a database. What I would like to be able to do is show the results of this query in a GridView, where the ID columns are hyperlinks bound with commands to open a View of that particular database object. The query returns a DataTable, but because the user can select from a variety of 'result fields', I cannot create a class/struct with the appropriate fields and bind to them. I will have to parse the DataTable, generate the columns and somehow provide it with data, which is the bit I'm not too sure about.</div> <div><br/></div> <div>Any ideas? And, since I'm using MVVM, would it be appropriate for a ViewModel to provide say, a Grid with the appropriate controls wrapped in a ScrollViewer, or any other control for that matter?</div> <div><br/></div> <div><br/></div> <div>Warm regards,</div> <div>Matt</div> <div><br/></div>Wed, 18 Nov 2009 01:22:10 Z2009-11-26T23:24:49Zhttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/d0de4015-867a-438c-9ff4-9caeadac17ebhttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/d0de4015-867a-438c-9ff4-9caeadac17ebkukushkohttp://social.expression.microsoft.com/Profile/en-US/?user=kukushkoPerfomance problems in custom control designHi, my english is not so high, but I'll try :)<br/> <br/> I'm writing control that will be used in sound editors. The target functionality is - <br/> 1. Render wave graphs<br/> 2. Graph scaling/scrolling<br/> 3. Region selection<br/> 4. etc.<br/> <br/> All this is done, but, I have problems with render perfomance. It looks the next way:<br/> If lines of graph are close ehough to each other (extreme zig-zag graph) rendering is slow, but, if lines placed with lower density - it renders quickly. Lines count is the same for both cases. I think, this is hit-testing problem. Any ideas?<br/> Another problem is that Mouse events are fired only if mouse is over _lines_ of graph, not over entire control. How can I fix this?<br/> <br/> My control is dervied from Control class, graph rendering looks like this -<br/> <br/> protected override void OnRender(DrawingContext drawingContext)<br/> ...<br/>             using (StreamGeometryContext ctx = geo.Open())<br/>             {<br/>                 ctx.BeginFigure(new Point(0, MidY), true, false);<br/>                 List&lt;Point&gt; pts = new List&lt;Point&gt;(__EnPoints());  /// &lt;------- here I see that number of points are &quot;same enough&quot;<br/>                 ctx.PolyLineTo(pts, true, false); <br/> <br/>             }<br/>             geo.Freeze();<br/>             drawingContext.DrawGeometry(null, pen, geo);<br/> <br/> I tried this also -  <br/>             //PathFigure pf = new PathFigure(new Point(0, MidY), __EnSegs(), false);<br/>             //pg.Figures.Add(pf);            <br/> <br/>             //drawingContext.DrawGeometry(null, pen, pg);            <br/> But here's no effect.<br/> <br/> The number of points is about 700-900.<br/> Help pls :')Thu, 26 Nov 2009 23:00:30 Z2009-11-26T23:00:31Zhttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/1370c235-44ae-42d3-9281-481d40e7e17fhttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/1370c235-44ae-42d3-9281-481d40e7e17falejandr000http://social.expression.microsoft.com/Profile/en-US/?user=alejandr000Programmatically adding buttons - Problem with subscription to a mouse eventIm adding a list of buttons in code and also subscribing to their mouseleave event. For each button i subcribe to the event with an anonymous function, the problem is that when I run the app they are all subscribed to the last anonymous function. Here is the code, I hope I explained myself.<br/> <br/> <pre lang="x-c#">var modules = ModulesSC.GetAllMoudules(); var imageSet = ModulesSC.GetModuleImageSet(); foreach (var module in modules) { var btn = new Button(); btn.SetResourceReference(Control.TemplateProperty, &quot;SideMenuButton&quot;); btn.Content = module.Title; btn.MouseEnter += (s, e) =&gt; { ShowInfo(module.Description); }; btn.MouseLeave += (s, e) =&gt; { HideInfo(); }; ModuleButtons.Children.Add(btn); } protected void HideInfo() { DescriptionLabel.Visibility = Visibility.Collapsed; DescriptionText.Text = string.Empty; } protected void ShowInfo(string description) { DescriptionLabel.Visibility = Visibility.Visible; DescriptionText.Text = description; }</pre> When i run the app the all call showInfo with the las &quot;module.Description&quot;<br/> <br/> Thanks<br/> -Alejandro<br/>Thu, 26 Nov 2009 22:01:59 Z2009-11-26T22:53:30Zhttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/c4cb16aa-182a-43e6-a08b-78776501eb1ehttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/c4cb16aa-182a-43e6-a08b-78776501eb1eGraeme.Rhttp://social.expression.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-26T22:55:09Zhttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/57d1d1da-9d6a-4899-8906-03f2e3895710http://social.expression.microsoft.com/Forums/en-US/wpf/thread/57d1d1da-9d6a-4899-8906-03f2e3895710j_hidenhttp://social.expression.microsoft.com/Profile/en-US/?user=j_hidenHaving problems displaying image resources through visual basic codeHi all, im having trouble displaying image resources in my class wpf library.<br/><br/>I add the images no problem (set them to resource), and can change them at design using xaml but i want to be able to change an image at run time using vb code.<br/><br/>I'm creating a custom message dialog, and want to change the image depending on the type of message. here a bit  of code:<br/> <div style="background-color:white;color:black"> <pre><span style="color:blue">Select</span> <span style="color:blue">Case</span> DisplayType <span style="color:blue">Case</span> DisplayTypeOptions.ThoughtDisplay <span style="color:blue">Case</span> DisplayTypeOptions.CautionDisplay <span style="color:blue">Case</span> DisplayTypeOptions.ErrorDisplay pic_display.Source = <span style="color:blue">New</span> BitmapImage(<span style="color:blue">New</span> Uri(<span style="color:#a31515">&quot;pack://application:,,,/Resources/Images/Exclamation64x64.png&quot;</span>)) lbl_dialog_title.Foreground = <span style="color:blue">New</span> SolidColorBrush(Colours.ErrorRed) <span style="color:blue">Case</span> DisplayTypeOptions.InformationDisplay <span style="color:blue">Case</span> DisplayTypeOptions.QuestionDisplay <span style="color:blue">End</span> <span style="color:blue">Select</span> </pre> </div> The path displayed in the code is where the images are in the library project. The error i get is:<br/>'Cannot locate resource 'resources/images/exclamation64x64.png'.'<br/><br/>I had a look round for solutions and tried a few things but none seem to work. Any help would be fantastic!Thu, 26 Nov 2009 00:17:36 Z2009-11-26T22:22:59Zhttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/89307788-a294-47db-b49a-1f45ef3a8602http://social.expression.microsoft.com/Forums/en-US/wpf/thread/89307788-a294-47db-b49a-1f45ef3a8602MauroGvhttp://social.expression.microsoft.com/Profile/en-US/?user=MauroGvcode-behind is not updated changing control name in designerHi,<br/>new question about WPF designer.<br/>In WindowsForms when you change the control name, the code is automatically updated.<br/><br/>Now I've changed the control name in WPF but in code-behind the control remains unchanged.<br/>No tip appears down the control in the Designer to rename the rest of the code.<br/>Compiling the code naturally I receive the errors for the old control name.<br/>The same situation happens renaming the event handler.<br/>Is there any trick?<br/><br/>Best regards,<br/>Mauro<hr class="sig">MauroThu, 26 Nov 2009 21:45:56 Z2009-11-26T21:52:33Zhttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/8e42f6a4-864c-47a9-ac73-9245b87db68ahttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/8e42f6a4-864c-47a9-ac73-9245b87db68aTheEnglishPatienthttp://social.expression.microsoft.com/Profile/en-US/?user=TheEnglishPatientLost in WPF databindingCan someone please help with a quick mockup of the databinding required in the folowing scenario:<br/>I have a datastructure with three tables: tblIndicators with columns Index, Name, Description; tblLights with columns Index,Name, Description; and a third table tblStates that links the indices, i.e. with columns IndexIndicator, IndexLights.<br/><br/>Overall idea here is that you have a number of Indicators that can display several of pre-defined states.<br/><br/>Now, what I want is a window that has two dataviews: a) a plain vanilla view of all columns in tblIndicators so the user can make a list of the available Indicators, and b) a view of tblStates, but <br/>b) should only show anything if the user selects a row in a);<br/>b) should then display only the rows from tblStates which apply to the selected item<br/>b) should also not display the IndexLights, but use this to lookup the appropriate Name in tblLights; and<br/>finally, the user should be able to edit/add/delete in b) with the allowed values from tblLights.<br/><br/>I previously did solve this in a forms application with datagridview and comboboxcolumns, but it needed a lot of code and eventhandling. Being new to WPF, is there a simpler and clever view of doing this with all the new binding architecture?<br/><br/>Thanks for any help.Tue, 10 Nov 2009 12:35:59 Z2009-11-26T21:45:23Zhttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/af1863a1-c637-4022-af45-28fcd95b945ehttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/af1863a1-c637-4022-af45-28fcd95b945eGTrzhttp://social.expression.microsoft.com/Profile/en-US/?user=GTrzWhen will “Visual Studio.NET” slowliness come to an end? I posted it as a bug for Visual Studio .net, have a look.<br/><a href="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=514849">https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=514849</a><br/>Thu, 26 Nov 2009 16:26:00 Z2009-11-26T21:06:06Zhttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/7821cf1a-e5d3-4209-8c71-4a8f5f8092b6http://social.expression.microsoft.com/Forums/en-US/wpf/thread/7821cf1a-e5d3-4209-8c71-4a8f5f8092b6YAreAllTheDisplayNamesTakenhttp://social.expression.microsoft.com/Profile/en-US/?user=YAreAllTheDisplayNamesTakenVertical Tickbar?Hey<br/> <br/> Is there an easy way to get a vertical tickbar?<br/> <br/> I'd like to put a custom tickbar beneath my slider because I don't want to display as many ticks in my slider as I am snapping to.<br/> <br/> I saw some code here: http://www.rhizohm.net/irhetoric/blog/80/default.aspx that does this (see the comment). I'm using Orientation=&quot;Horizontal&quot; in my slider, but have no such luck for the Tickbar.<br/> <br/> And to top it off there isn't a control template for TickBar. Have I overlooked something simple, or do I really have to build one myself?Thu, 26 Nov 2009 17:44:31 Z2009-11-26T18:46:17Zhttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/e30e5402-6535-43d7-ba3f-4a645341b279http://social.expression.microsoft.com/Forums/en-US/wpf/thread/e30e5402-6535-43d7-ba3f-4a645341b279greenboihttp://social.expression.microsoft.com/Profile/en-US/?user=greenboiGetting a derivative of Control to paint its BackgroundHello, I am programming a simple Tower Defense game in WPF with C#. I'm doing this with Visual Studio 2010 Beta 2 and ReSharper.<br/> The Map derives from Canvas:<br/> <div style="color:Black;background-color:White"><br/> public class Map : Canvas <br/> { <br/>   private Field[,] fields; <br/>   //... <br/> }<br/>  <br/></div> The class Field derives from Control:<br/> <br/> public  class Field : Control <br/> { <br/>   private int column;<br/>   private int row; <br/>   //... <br/> }<br/> <br/> <br/> The Map class reads the details about each Field in its Field[,] from an XML-type file and then places them in Map.Children, using Fields[x,y].SetValue(...) to set the Top and Left properties of the Canvas. The problem being, the fields are invisible. They return an actualHeight and actualWidth of 0.<br/> On the other hand, if I derive Field from Image, the whole thing works and I end up with my Map shown on the screen.<br/> So, what did I forget?<br/> <br/> Thanks for your help!Thu, 26 Nov 2009 18:37:34 Z2009-11-26T18:37:34Zhttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/2d5949aa-358f-4fe5-b760-16ea3e3f9035http://social.expression.microsoft.com/Forums/en-US/wpf/thread/2d5949aa-358f-4fe5-b760-16ea3e3f9035Jasterhttp://social.expression.microsoft.com/Profile/en-US/?user=JasterDeriving windows / changing application entry pointHi everybody,<br/><br/>i am currenty developing a huge wpf application. I've been working with winforms for quite a while. Now i try to use some of the typical structures in wpf, but i leak some practice here. maybe someone could help :)<br/><br/>first question:<br/>In winforms there used to be an Application.run(Form f) to start the app using a specific Form. I was able to use any form form any Assembly. In wpf i got app.xaml as entry point. there is also a codebehind file (app.g.cs) that contains a partial declaration of the entry class. is there a way to place the startup window inside another assembly?<br/><br/>second question:<br/>i tried to create a base window/control inside assembly a. now i create a control inside assembly b and derive it. assembly c creates an instance of b adding it to a window. the application compiles, but it crashes with an error saying that the ressource compnent/a.xaml was not found in assembly c.<br/>what's my mistake?<br/><br/>im am using vsts 2008.sp1. i can provide some sample code if required ;)<br/><br/>Thanks.<br/><br/>Regards<br/>JasterThu, 26 Nov 2009 17:50:16 Z2009-11-26T18:32:46Zhttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/44f8ac8a-7026-4bc8-81a7-6817562c6bf1http://social.expression.microsoft.com/Forums/en-US/wpf/thread/44f8ac8a-7026-4bc8-81a7-6817562c6bf1MauroGvhttp://social.expression.microsoft.com/Profile/en-US/?user=MauroGvThe simplest textbox custom control not show the TextHi,<br/>I'm trying to use Custom Control instead of User Control.<br/>I derived from the TextBox to create a new one.<br/>MyTextBox is equal to the base class but not show the text.<br/><br/>Code-behind:<br/> <pre lang="x-c#">namespace WpfApplication1 { public class MyTextBox : TextBox { static MyTextBox() { DefaultStyleKeyProperty.OverrideMetadata(typeof(MyTextBox), new FrameworkPropertyMetadata(typeof(MyTextBox))); } } }</pre> .xaml code:<br/> <pre lang=x-xml>&lt;Window x:Class=&quot;WpfApplication1.Window1&quot; xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot; xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot; xmlns:MyNameSpace=&quot;clr-namespace:WpfApplication1&quot; Title=&quot;Window1&quot; Height=&quot;300&quot; Width=&quot;300&quot;&gt; &lt;Grid&gt; &lt;MyNameSpace:MyTextBox Margin=&quot;47,102,116,0&quot; Height=&quot;22&quot; VerticalAlignment=&quot;Top&quot; Text=&quot;Hello&quot;&gt; &lt;/MyNameSpace:MyTextBox&gt; &lt;/Grid&gt; &lt;/Window&gt;</pre> <br/>It seems so easy...<br/>Thanks,<br/>Mauro<hr class="sig">MauroFri, 20 Nov 2009 11:02:28 Z2009-11-26T18:30:41Zhttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/28d5fb54-5904-45e9-9534-7fc9b090ff29http://social.expression.microsoft.com/Forums/en-US/wpf/thread/28d5fb54-5904-45e9-9534-7fc9b090ff29dcyahttp://social.expression.microsoft.com/Profile/en-US/?user=dcyaHow to remove Icon from window titlebar1. I try to set Icon = null.<br/> <br/> 2. I try to use this code.<br/> http://www.danrigsby.com/blog/index.php/2008/05/26/remove-icon-from-wpf-window/<br/> <br/> But his code is nor working if we install application with setap at system.<br/> <br/> And his code is not working for Xp<br/> <br/> 3.<br/> <br/> I try <br/> <br/> SendMessage(hwnd, WM_SET<span class=searchterm3>ICON</span> , IntPtr.Zero, IntPtr.Zero) can <span class=searchterm2>remove</span> the <span class=searchterm3>Icon</span> <span class=searchterm4>from</span> XP<br/> <br/> But if my program install at system using .msi it not works.<br/>Thu, 26 Nov 2009 18:17:34 Z2009-11-26T18:17:34Zhttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/14466080-5fcd-496d-a285-394b6f787dd7http://social.expression.microsoft.com/Forums/en-US/wpf/thread/14466080-5fcd-496d-a285-394b6f787dd7Kofoedhttp://social.expression.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-26T18:02:48Zhttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/94b2daa3-8802-40d2-ba44-03ec00158814http://social.expression.microsoft.com/Forums/en-US/wpf/thread/94b2daa3-8802-40d2-ba44-03ec00158814tomer70http://social.expression.microsoft.com/Profile/en-US/?user=tomer70Separating presentation from domain model with XAML<p class=MsoNormal style="margin:0in 0in 0pt"> <p class=MsoNormal style="margin:0in 0in 0pt"><span style=""></span></p> <span style="font-family:Calibri;font-size:small">Hi,</span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-family:Calibri;font-size:small"> </span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-family:Calibri;font-size:small">I have a domain model representing an electrical circuit with resistors; the domain model is ignorant of WPF, and is serialized as following</span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-family:Calibri;font-size:small"> </span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-family:Calibri;font-size:small">?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;</span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-family:Calibri;font-size:small">&lt;Circuit&gt;</span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:small"><span style="font-family:Calibri"><span style="">  </span>&lt;Resistor id=&quot;{67CD73DC-0CD7-4381-6504-H7774310D963}&quot; value=&quot;50&quot;&gt;</span></span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:small"><span style="font-family:Calibri"><span style="">      </span>&lt;Associations&gt;</span></span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:small"><span style="font-family:Calibri"><span style="">          </span>&lt;Resistor id=&quot;{67CD73DC-0CD7-2345-9604-F1C143104444}” value=&quot;75&quot;&gt;</span></span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:small"><span style="font-family:Calibri"><span style="">          </span>&lt;Resistor id=&quot;{67CD73DC-0CD7-1987-9604-G1C132323232}” value=&quot;25&quot;&gt;</span></span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:small"><span style="font-family:Calibri"><span style="">      </span>&lt;Associations&gt;</span></span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:small"><span style="font-family:Calibri"><span style="">   </span>&lt;/Resistor&gt;</span></span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-family:Calibri;font-size:small">&lt;/Circuit&gt;</span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-family:Calibri;font-size:small"> </span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-family:Calibri;font-size:small">Note that a resistor is </span><span style="font-family:'Arial','sans-serif';color:#000099;font-size:9pt">apathetic</span><span style="font-size:small"><span style="font-family:Calibri"> to its place in space</span></span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-family:Calibri;font-size:small"> </span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-family:Calibri;font-size:small">My goal is to display the circuit with WPF without introducing new properties(x, y) to my domain model</span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-family:Calibri;font-size:small"> </span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-family:Calibri;font-size:small">For that I have also a xml(should be xaml) document describing the layout for the circuit,</span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-family:Calibri;font-size:small">The ID attribute is a  foreign key to the a resistor in the previous document<br/><br/></span><span style="font-family:Calibri;font-size:small">&lt;Layout&gt;</span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-family:Calibri;font-size:small">&lt;Position X=&quot;0.5&quot; Y=&quot;1&quot; ID=&quot;67CD73DC-0CD7-4381-6504-H7774310D963&quot;&gt;</span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:small"><span style="font-family:Calibri"><span style="">                </span>&lt;Subordinates&gt;</span></span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:small"><span style="font-family:Calibri"><span style="">                </span>&lt;Position X=&quot;1.5&quot; Y=&quot;2&quot; ID=&quot;67CD73DC-0CD7-2345-9604-F1C143104444&quot;&gt;</span></span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:small"><span style="font-family:Calibri"><span style="">                </span>&lt;Position X=&quot;1.5&quot; Y=&quot;2&quot; ID=&quot;67CD73DC-0CD7-2345-9604-F1C143104444&quot;&gt;</span></span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:small"><span style="font-family:Calibri"><span style="">               </span>&lt;Subordinates&gt;</span></span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-family:Calibri;font-size:small">&lt;/Position&gt;</span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-family:Calibri;font-size:small">&lt;/Layout&gt;</span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style=""><span style="font-family:Calibri;font-size:small">     </span></span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-family:Calibri;font-size:small"> </span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-family:Calibri;font-size:small">The result should be a drawing of the circuit with the value of the circuit(taken from the first xml document) displayed on each resistor</span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-family:Calibri;font-size:small"> </span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-family:Calibri;font-size:small">(The layout xml can be converted to XAML and used templates,it just a simple example)<br/></span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-family:Calibri;font-size:small"><br/>Is is possible to do it with XAML only?<br/><br/>Thanks in advance </span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-family:Calibri;font-size:small"> </span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-family:Calibri;font-size:small"> </span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-family:Calibri;font-size:small"> </span></p>Wed, 25 Nov 2009 10:20:44 Z2009-11-26T18:00:08Zhttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/75620805-344a-41cc-a323-83b440f29565http://social.expression.microsoft.com/Forums/en-US/wpf/thread/75620805-344a-41cc-a323-83b440f29565Kent.zhouhttp://social.expression.microsoft.com/Profile/en-US/?user=Kent.zhouIs there any way to operate WPF controls from common CS file(non code-behind)Hello Everyone,<br/><br/>Do you know there's any way to operate WPF controls from common CS files, not code-behind? For einstance, one backend thread. If exisits, could you please provide some code snippet to show how to do?<br/><br/>Thanks,<br/>KentWed, 23 Sep 2009 10:45:53 Z2009-11-26T17:50:29Zhttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/26b991ef-f61d-4c08-8e44-43885a83040bhttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/26b991ef-f61d-4c08-8e44-43885a83040brodolfo petizhttp://social.expression.microsoft.com/Profile/en-US/?user=rodolfo%20petizHow to scroll items in wrappanelhi,<br/> <br/> <strong>I want to have a listview with two columns and vertical scroll.<br/> </strong> <br/> The solution i've found is to do this with a wrappanel and scrollview. however, when i scroll the items they don't scroll one by one. <br/> I think i need to redefine the scrollbar.<br/> <br/> considering this, do you think this is the best solution?<br/> if so, how can i implement this?<br/> <br/> Thanks for any help,<br/> <br/> RodolfoFri, 30 Oct 2009 23:22:37 Z2009-11-26T17:24:17Zhttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/ce5faad9-dd7a-4226-a634-5a3b306ba0ebhttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/ce5faad9-dd7a-4226-a634-5a3b306ba0ebUlysses31http://social.expression.microsoft.com/Profile/en-US/?user=Ulysses31underline a string in c#Hi, I was wondering how do i underline a string in the c# codebehind of a xaml page?Thu, 29 Oct 2009 16:50:52 Z2009-11-26T17:21:41Zhttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/862744f5-f859-4ffd-8394-ac4301c12105http://social.expression.microsoft.com/Forums/en-US/wpf/thread/862744f5-f859-4ffd-8394-ac4301c12105Charles O. Brownhttp://social.expression.microsoft.com/Profile/en-US/?user=Charles%20O.%20Brownpack uri - using it to extract an image from resources in a WPF projectWPF Application named TestWPF<br/>I do not know why the following syntax is not working (Tried many permutations)<br/><span style="color:#008000;font-size:x-small"><span style="color:#008000;font-size:x-small"><br/>1. Dim bmpimg As New BitmapImage(New Uri(&quot;pack://application:,,,/TestWPF;component/Resources/bw4.jpg&quot;, UriKind.RelativeOrAbsolute))</span></span><span style="font-size:x-small"><font size=2> <p> </p> </font></span> <p><span style="color:#008000;font-size:x-small"><span style="color:#008000;font-size:x-small">2. Dim bmpimg As New BitmapImage(New Uri(&quot;pack://application:,,,/bw4.jpg&quot;))</span></span></p> <span style="font-size:x-small"><font size=2> <p> </p> </font></span> <p><span style="color:#008000;font-size:x-small"><span style="color:#008000;font-size:x-small">3. 'Dim bmpimg As New BitmapImage(New Uri(&quot;pack://application:,,,/TestWPF;component/Images/bw4.jpg&quot;, UriKind.RelativeOrAbsolute))<br/><br/>The exception is always the same - can not locate resource &quot;x&quot; - where &quot;x&quot; is anything following<br/>application:,,,/ or TestWPF;component/ - is sems as if the Namespace;component is not needed<br/>since it never complains when it is left out of the syntax and never includes it as part of &quot;x&quot;.<br/>Searching other comments I have seen that the following syntax is supposed to work:<br/>pack://application:,,,/filename.extension<br/><br/>All of my resources were added using Visual Studio 2008 under the resources section of My Project, and were added under images, and in the project they are in a folder called Resources (automatically created by VS).<br/><br/>I have tried &quot;x&quot; as: (thinking that maybe these are created folders in the application assembly)<br/>bw4.jpg<br/>Resources/bw4.jpg<br/>Images/bw4.jpg<br/>Resources/Images/bw4.jpg</span></span></p>Sun, 01 Nov 2009 15:55:29 Z2009-11-26T17:17:47Zhttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/a459e4e6-df3c-4d64-8d5b-b889dbe79647http://social.expression.microsoft.com/Forums/en-US/wpf/thread/a459e4e6-df3c-4d64-8d5b-b889dbe79647C F D Ghttp://social.expression.microsoft.com/Profile/en-US/?user=C%20%20F%20%20D%20%20GWindow propertiesHello everyone, <div><br/></div> <div>Here is some code I have for a custom Window:</div> <div><br/></div> <div> <div>Private Sub AboutButton_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles AboutButton.Click</div> <div>        Dim AboutUserControlWindow As New Window</div> <div>        AboutUserControlWindow.Content = New UserControl1</div> <div>        AboutUserControlWindow.Owner = Me</div> <div>        AboutUserControlWindow.Topmost = True</div> <div>        AboutUserControlWindow.SizeToContent = Windows.SizeToContent.WidthAndHeight</div> <div>        AboutUserControlWindow.ResizeMode = Windows.ResizeMode.NoResize</div> <div>        AboutUserControlWindow.Title = &quot;About&quot;</div> <div>        AboutUserControlWindow.WindowStartupLocation = Windows.WindowStartupLocation.CenterOwner</div> <div>        AboutUserControlWindow.Show()</div> <div>    End Sub</div> <div><br/></div> <div><br/></div> <div>This all works fine and all, but I would like to set the window icon as the &quot;?&quot; help icon, from an API call, of which I have no idea how to make.</div> <div><br/></div> <div>I would also like to make it to where the user must close out of it before any other part of the project can be accessed, like an alert or message box. The way MsgBox works with its focus.</div> <div><br/></div> <div>How could these things be done?</div> <div><br/></div> <div><br/></div> <div>Thanks in advance,</div> <div><br/></div> <div>- Jake M.</div> </div>Thu, 12 Nov 2009 03:16:53 Z2009-11-26T17:14:17Zhttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/4a8b1254-9d0a-409d-8ef9-00863c10ef4bhttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/4a8b1254-9d0a-409d-8ef9-00863c10ef4bsa123http://social.expression.microsoft.com/Profile/en-US/?user=sa123wpf eventtrigger not triggeringHi,<br/><br/>I have a window which has ellipses and i need to animate it.<br/><br/>see the code.<br/><br/><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff"><font size=2 color="#0000ff"><font size=2 color="#0000ff"> <p>&lt;</p> </font></font></span><font size=2 color="#0000ff"> <p> </p> </font></span> <p><span style="font-size:x-small;color:#a31515"><span style="font-size:x-small;color:#a31515">Window</span></span><span style="font-size:x-small;color:#ff0000"><span style="font-size:x-small;color:#ff0000"> x</span></span><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">:</span></span><span style="font-size:x-small;color:#ff0000"><span style="font-size:x-small;color:#ff0000">Class</span></span><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">=&quot;TM.Kiosk.Client.ProgressDialog&quot;</span></span></p> <span style="font-size:x-small"><font size=2> <p> </p> </font></span> <p><span style="font-size:x-small;color:#ff0000"><span style="font-size:x-small;color:#ff0000">xmlns</span></span><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;</span></span></p> <span style="font-size:x-small"><font size=2> <p> </p> </font></span> <p><span style="font-size:x-small;color:#ff0000"><span style="font-size:x-small;color:#ff0000">xmlns</span></span><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">:</span></span><span style="font-size:x-small;color:#ff0000"><span style="font-size:x-small;color:#ff0000">x</span></span><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;</span></span></p> <span style="font-size:x-small"><font size=2> <p> </p> </font></span> <p><span style="font-size:x-small;color:#ff0000"><span style="font-size:x-small;color:#ff0000">Width</span></span><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">=&quot;300&quot;</span></span><span style="font-size:x-small;color:#ff0000"><span style="font-size:x-small;color:#ff0000"> Height</span></span><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">=&quot;100&quot;</span></span><span style="font-size:x-small;color:#ff0000"><span style="font-size:x-small;color:#ff0000"> WindowStartupLocation</span></span><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">=&quot;CenterScreen&quot;</span></span><span style="font-size:x-small;color:#ff0000"><span style="font-size:x-small;color:#ff0000"> WindowStyle</span></span><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">=&quot;None&quot;&gt;</span></span></p> <span style="font-size:x-small;color:#a31515"><span style="font-size:x-small;color:#a31515"><font size=2 color="#a31515"><font size=2 color="#a31515"> <p> </p> </font></font></span><font size=2 color="#a31515"> <p> </p> </font></span> <p><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">&lt;</span></span><span style="font-size:x-small;color:#a31515"><span style="font-size:x-small;color:#a31515">Border</span></span><span style="font-size:x-small;color:#ff0000"><span style="font-size:x-small;color:#ff0000"> BorderBrush</span></span><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">=&quot;Black&quot;</span></span><span style="font-size:x-small;color:#ff0000"><span style="font-size:x-small;color:#ff0000"> BorderThickness</span></span><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">=&quot;2&quot;</span></span><span style="font-size:x-small;color:#ff0000"><span style="font-size:x-small;color:#ff0000"> Background</span></span><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">=&quot;LightGray&quot;&gt;</span></span></p> <span style="font-size:x-small;color:#a31515"><span style="font-size:x-small;color:#a31515"><font size=2 color="#a31515"><font size=2 color="#a31515"> <p> </p> </font></font></span><font size=2 color="#a31515"> <p> </p> </font></span> <p><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">&lt;</span></span><span style="font-size:x-small;color:#a31515"><span style="font-size:x-small;color:#a31515">Canvas</span></span><span style="font-size:x-small;color:#ff0000"><span style="font-size:x-small;color:#ff0000"> Background</span></span><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">=&quot;LightGray&quot;&gt;</span></span></p> <span style="font-size:x-small;color:#a31515"><span style="font-size:x-small;color:#a31515"><font size=2 color="#a31515"><font size=2 color="#a31515"> <p> </p> </font></font></span><font size=2 color="#a31515"> <p> </p> </font></span> <p><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">&lt;</span></span><span style="font-size:x-small;color:#a31515"><span style="font-size:x-small;color:#a31515">Canvas.Resources</span></span><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">&gt;</span></span></p> <span style="font-size:x-small;color:#a31515"><span style="font-size:x-small;color:#a31515"><font size=2 color="#a31515"><font size=2 color="#a31515"> <p> </p> </font></font></span><font size=2 color="#a31515"> <p> </p> </font></span> <p><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">&lt;</span></span><span style="font-size:x-small;color:#a31515"><span style="font-size:x-small;color:#a31515">ParallelTimeline</span></span><span style="font-size:x-small;color:#ff0000"><span style="font-size:x-small;color:#ff0000"> x</span></span><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">:</span></span><span style="font-size:x-small;color:#ff0000"><span style="font-size:x-small;color:#ff0000">Key</span></span><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">=&quot;fade&quot;&gt;</span></span></p> <span style="font-size:x-small;color:#a31515"><span style="font-size:x-small;color:#a31515"><font size=2 color="#a31515"><font size=2 color="#a31515"> <p> </p> </font></font></span><font size=2 color="#a31515"> <p> </p> </font></span> <p><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">&lt;</span></span><span style="font-size:x-small;color:#a31515"><span style="font-size:x-small;color:#a31515">DoubleAnimation</span></span><span style="font-size:x-small;color:#ff0000"><span style="font-size:x-small;color:#ff0000"> Storyboard.TargetProperty</span></span><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">=&quot;(Ellipse.Opacity)&quot;</span></span><span style="font-size:x-small;color:#ff0000"><span style="font-size:x-small;color:#ff0000"> From</span></span><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">=&quot;1&quot;</span></span><span style="font-size:x-small;color:#ff0000"><span style="font-size:x-small;color:#ff0000"> To</span></span><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">=&quot;0&quot;</span></span><span style="font-size:x-small"> <font size=2> <p> </p> </font></span></p> <p><span style="font-size:x-small;color:#ff0000"><span style="font-size:x-small;color:#ff0000">Duration</span></span><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">=&quot;0:0:0.1&quot;</span></span><span style="font-size:x-small;color:#ff0000"><span style="font-size:x-small;color:#ff0000"> AutoReverse</span></span><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">=&quot;True&quot;/&gt;</span></span></p> <span style="font-size:x-small;color:#a31515"><span style="font-size:x-small;color:#a31515"><font size=2 color="#a31515"><font size=2 color="#a31515"> <p> </p> </font></font></span><font size=2 color="#a31515"> <p> </p> </font></span> <p><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">&lt;/</span></span><span style="font-size:x-small;color:#a31515"><span style="font-size:x-small;color:#a31515">ParallelTimeline</span></span><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">&gt;</span></span></p> <span style="font-size:x-small;color:#a31515"><span style="font-size:x-small;color:#a31515"><font size=2 color="#a31515"><font size=2 color="#a31515"> <p> </p> </font></font></span><font size=2 color="#a31515"> <p> </p> </font></span> <p><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">&lt;</span></span><span style="font-size:x-small;color:#a31515"><span style="font-size:x-small;color:#a31515">Style</span></span><span style="font-size:x-small;color:#ff0000"><span style="font-size:x-small;color:#ff0000"> TargetType</span></span><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">=&quot;{</span></span><span style="font-size:x-small;color:#a31515"><span style="font-size:x-small;color:#a31515">x</span></span><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">:</span></span><span style="font-size:x-small;color:#a31515"><span style="font-size:x-small;color:#a31515">Type</span></span><span style="font-size:x-small;color:#ff0000"><span style="font-size:x-small;color:#ff0000"> Ellipse</span></span><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">}&quot;&gt;</span></span></p> <span style="font-size:x-small;color:#a31515"><span style="font-size:x-small;color:#a31515"><font size=2 color="#a31515"><font size=2 color="#a31515"> <p> </p> </font></font></span><font size=2 color="#a31515"> <p> </p> </font></span> <p><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">&lt;</span></span><span style="font-size:x-small;color:#a31515"><span style="font-size:x-small;color:#a31515">Setter</span></span><span style="font-size:x-small;color:#ff0000"><span style="font-size:x-small;color:#ff0000"> Property</span></span><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">=&quot;Ellipse.Width&quot;</span></span><span style="font-size:x-small;color:#ff0000"><span style="font-size:x-small;color:#ff0000"> Value</span></span><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">=&quot;3&quot; /&gt;</span></span></p> <span style="font-size:x-small;color:#a31515"><span style="font-size:x-small;color:#a31515"><font size=2 color="#a31515"><font size=2 color="#a31515"> <p> </p> </font></font></span><font size=2 color="#a31515"> <p> </p> </font></span> <p><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">&lt;</span></span><span style="font-size:x-small;color:#a31515"><span style="font-size:x-small;color:#a31515">Setter</span></span><span style="font-size:x-small;color:#ff0000"><span style="font-size:x-small;color:#ff0000"> Property</span></span><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">=&quot;Ellipse.Height&quot;</span></span><span style="font-size:x-small;color:#ff0000"><span style="font-size:x-small;color:#ff0000"> Value</span></span><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">=&quot;3&quot; /&gt;</span></span></p> <span style="font-size:x-small;color:#a31515"><span style="font-size:x-small;color:#a31515"><font size=2 color="#a31515"><font size=2 color="#a31515"> <p> </p> </font></font></span><font size=2 color="#a31515"> <p> </p> </font></span> <p><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">&lt;</span></span><span style="font-size:x-small;color:#a31515"><span style="font-size:x-small;color:#a31515">Setter</span></span><span style="font-size:x-small;color:#ff0000"><span style="font-size:x-small;color:#ff0000"> Property</span></span><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">=&quot;Fill&quot;</span></span><span style="font-size:x-small;color:#ff0000"><span style="font-size:x-small;color:#ff0000"> Value</span></span><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">=&quot;Black&quot;/&gt;</span></span></p> <span style="font-size:x-small;color:#a31515"><span style="font-size:x-small;color:#a31515"><font size=2 color="#a31515"><font size=2 color="#a31515"> <p> </p> </font></font></span><font size=2 color="#a31515"> <p> </p> </font></span> <p><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">&lt;/</span></span><span style="font-size:x-small;color:#a31515"><span style="font-size:x-small;color:#a31515">Style</span></span><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">&gt;</span></span></p> <span style="font-size:x-small;color:#a31515"><span style="font-size:x-small;color:#a31515"><font size=2 color="#a31515"><font size=2 color="#a31515"> <p> </p> </font></font></span><font size=2 color="#a31515"> <p> </p> </font></span> <p><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">&lt;/</span></span><span style="font-size:x-small;color:#a31515"><span style="font-size:x-small;color:#a31515">Canvas.Resources</span></span><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">&gt;</span></span></p> <span style="font-size:x-small;color:#a31515"><span style="font-size:x-small;color:#a31515"><font size=2 color="#a31515"><font size=2 color="#a31515"> <p> </p> </font></font></span><font size=2 color="#a31515"> <p> </p> </font></span> <p><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">&lt;</span></span><span style="font-size:x-small;color:#a31515"><span style="font-size:x-small;color:#a31515">Canvas.Triggers</span></span><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">&gt;</span></span></p> <span style="font-size:x-small;color:#a31515"><span style="font-size:x-small;color:#a31515"><font size=2 color="#a31515"><font size=2 color="#a31515"> <p> </p> </font></font></span><font size=2 color="#a31515"> <p> </p> </font></span> <p><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">&lt;</span></span><span style="font-size:x-small;color:#a31515"><span style="font-size:x-small;color:#a31515">EventTrigger</span></span><span style="font-size:x-small;color:#ff0000"><span style="font-size:x-small;color:#ff0000"> RoutedEvent</span></span><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">=&quot;FrameworkElement.Loaded&quot;&gt;</span></span></p> <span style="font-size:x-small;color:#a31515"><span style="font-size:x-small;color:#a31515"><font size=2 color="#a31515"><font size=2 color="#a31515"> <p> </p> </font></font></span><font size=2 color="#a31515"> <p> </p> </font></span> <p><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">&lt;</span></span><span style="font-size:x-small;color:#a31515"><span style="font-size:x-small;color:#a31515">EventTrigger.Actions</span></span><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">&gt;</span></span></p> <span style="font-size:x-small;color:#a31515"><span style="font-size:x-small;color:#a31515"><font size=2 color="#a31515"><font size=2 color="#a31515"> <p> </p> </font></font></span><font size=2 color="#a31515"> <p> </p> </font></span> <p><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">&lt;</span></span><span style="font-size:x-small;color:#a31515"><span style="font-size:x-small;color:#a31515">BeginStoryboard</span></span><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">&gt;</span></span></p> <span style="font-size:x-small;color:#a31515"><span style="font-size:x-small;color:#a31515"><font size=2 color="#a31515"><font size=2 color="#a31515"> <p> </p> </font></font></span><font size=2 color="#a31515"> <p> </p> </font></span> <p><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">&lt;</span></span><span style="font-size:x-small;color:#a31515"><span style="font-size:x-small;color:#a31515">Storyboard</span></span><span style="font-size:x-small;color:#ff0000"><span style="font-size:x-small;color:#ff0000"> Duration</span></span><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">=&quot;0:0:1.2&quot;</span></span><span style="font-size:x-small;color:#ff0000"><span style="font-size:x-small;color:#ff0000"> RepeatBehavior</span></span><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">=&quot;Forever&quot;&gt;</span></span></p> <span style="font-size:x-small;color:#a31515"><span style="font-size:x-small;color:#a31515"><font size=2 color="#a31515"><font size=2 color="#a31515"> <p> </p> </font></font></span><font size=2 color="#a31515"> <p> </p> </font></span> <p><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">&lt;</span></span><span style="font-size:x-small;color:#a31515"><span style="font-size:x-small;color:#a31515">Storyboard</span></span><span style="font-size:x-small;color:#ff0000"><span style="font-size:x-small;color:#ff0000"> TargetName</span></span><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">=&quot;ellip1&quot;</span></span><span style="font-size:x-small;color:#ff0000"><span style="font-size:x-small;color:#ff0000"> BeginTime</span></span><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">=&quot;0:0:0.0&quot;&gt;</span></span></p> <span style="font-size:x-small;color:#a31515"><span style="font-size:x-small;color:#a31515"><font size=2 color="#a31515"><font size=2 color="#a31515"> <p> </p> </font></font></span><font size=2 color="#a31515"> <p> </p> </font></span> <p><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">&lt;</span></span><span style="font-size:x-small;color:#a31515"><span style="font-size:x-small;color:#a31515">StaticResource</span></span><span style="font-size:x-small;color:#ff0000"><span style="font-size:x-small;color:#ff0000"> ResourceKey</span></span><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">=&quot;fade&quot; /&gt;</span></span></p> <span style="font-size:x-small;color:#a31515"><span style="font-size:x-small;color:#a31515"><font size=2 color="#a31515"><font size=2 color="#a31515"> <p> </p> </font></font></span><font size=2 color="#a31515"> <p> </p> </font></span> <p><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">&lt;/</span></span><span style="font-size:x-small;color:#a31515"><span style="font-size:x-small;color:#a31515">Storyboard</span></span><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff">&gt;<br/><br/>when i run this window directly it is working fine.but when i show this window from some other window(click of a button on another window) the ellipses are not moving.<br/><br/>i think it is not trigerring the event.is there any way to trigger this from code behind?</span></span></p>Wed, 04 Nov 2009 11:49:01 Z2009-11-26T17:05:31Zhttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/9f59216b-2782-4673-8acf-eae8ee843784http://social.expression.microsoft.com/Forums/en-US/wpf/thread/9f59216b-2782-4673-8acf-eae8ee843784parth.shahhttp://social.expression.microsoft.com/Profile/en-US/?user=parth.shahIs there any event available in our WPF combobox Like SelectionChangedCommited event in Windows comboboxHi All,<br/><br/>I am using WPF combobox and I am unable to find an event analogous to &quot;SelectionChangedCommited&quot; in Windows combobox.<br/>Is there any event available in WPF combobox that is similar to &quot;SelectionChangedCommited&quot; in Windows combobox.<br/>If yes, then please let me know....<br/>If no, then is there any other way to handle this please let me know....Fri, 20 Nov 2009 08:43:21 Z2009-11-26T17:04:54Zhttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/c580b5b3-373a-4e98-9960-1cd5d5246b3bhttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/c580b5b3-373a-4e98-9960-1cd5d5246b3bwiyosayahttp://social.expression.microsoft.com/Profile/en-US/?user=wiyosayaHow to select a listview celltemplate based on the column?I want to provide a column template in a GridView contained in a ListView based on the column and the data type. So, I have implemented a cell template selector, however, I do not see a way of getting any kind of an identifier that will tell me what column is calling &quot;SelectTemplate&quot;.<br/><br/>What I do see is that the DependencyObject sent is a ContentPresenter that has a parent of type GridViewRowPresenter. I do not see anything that would get me something that I can use to identify the column that sent the event. I do see a &quot;SelectTemplate&quot; call. The GridViewRowPresenter has a &quot;columns&quot; collection, however, I do not see a currentcolumn property or anything like this.<br/><br/>So, is there a way to do this, or am I going about this in the wrong way?<br/><br/>Thanks.Thu, 19 Nov 2009 22:53:10 Z2009-11-26T16:50:14Zhttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/4b3eb877-4cc5-478a-b34b-213829f1ce4bhttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/4b3eb877-4cc5-478a-b34b-213829f1ce4bJohnAbrahamhttp://social.expression.microsoft.com/Profile/en-US/?user=JohnAbrahamValidation on button click<p>Hi.</p> <p>I have a WPF dialog with a couple of textboxes on it. Textboxes are bound to my business object and have WPF validation rules attached.</p> <p>The problem is that user can perfectly click 'OK' button and close the dialog, without actually entering the data into textboxes. Validation rules never fire, since user didn't even attempt entering the information into textboxes.</p> <p>Is it possible to force validation checks and determine if some validation rules are broken?</p> <p>I would be able to do it when user tries to close the dialog and prohibit him from doing it if any validation rules are broken.</p> <p>Data should be saved only all validation has done.<br/><br/>Thanks<br/>John</p>Wed, 25 Nov 2009 13:59:37 Z2009-11-26T16:40:00Zhttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/2c394879-c9bd-47d8-b30f-3352bf2117d4http://social.expression.microsoft.com/Forums/en-US/wpf/thread/2c394879-c9bd-47d8-b30f-3352bf2117d4xl3khttp://social.expression.microsoft.com/Profile/en-US/?user=xl3kListview with expanderI am trying to create a table where a set of rows could be expanded/collapsed. I believe I should be using the ListView control (gridview mode) and the Expander control. A step by step guide on how to do it would be extremely helpful.<br/><br/>Things I am particularly stuck at are:<br/>1. How to add the expander control to the listview<br/>2. How to handle the expand/collapse messages<br/>3. How to do thigs in the code as I expect rows to be dynamically added/removed from the table.<br/><br/>Thanks in advance!Tue, 24 Nov 2009 04:36:09 Z2009-11-26T15:50:45Zhttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/8a6a55a3-edc3-4445-aaee-bd04b4dac881http://social.expression.microsoft.com/Forums/en-US/wpf/thread/8a6a55a3-edc3-4445-aaee-bd04b4dac881YAreAllTheDisplayNamesTakenhttp://social.expression.microsoft.com/Profile/en-US/?user=YAreAllTheDisplayNamesTakenAnimation skipping keyframes... normal?Hey<br/> <br/> I have an animation whose target is a dependency property. I listen to changes to the dependency property using a PropertyChangedCallback. Every time the PropertyChangedCallback fires I increment a count. <br/> <br/> It turns out the the higher I set the speed ratio (SetSpeedRatio), the more keyframes are dropped (i.e. the PropertyChangedCallback does not fire for every keyframe).<br/> <br/> Is there a way to stop this skipping behaviour? Or at least isolate which keyframes are being dropped (with little overhead) so that I can intervene?<br/> <br/> Any help is much appreciated.<br/> <br/>Thu, 26 Nov 2009 13:42:19 Z2009-11-26T15:08:13Zhttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/b8987d4e-88d8-40f0-a852-05ef74439ddfhttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/b8987d4e-88d8-40f0-a852-05ef74439ddfOlaf Rabbachinhttp://social.expression.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-26T14:51:20Zhttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/6076dfec-a9a9-45c0-8faa-911f1c45e1c9http://social.expression.microsoft.com/Forums/en-US/wpf/thread/6076dfec-a9a9-45c0-8faa-911f1c45e1c9niaohttp://social.expression.microsoft.com/Profile/en-US/?user=niaoAdd grid column dynamically in xamlIs there any way I can add grid column dynamically in xaml (e.g. using trigger/datatrigger)?<br/>The case is that I want to add/remove grid column depending on the Visibility property that is binded to that grid.Wed, 25 Nov 2009 12:28:23 Z2009-11-26T14:41:04Zhttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/1610f679-c671-4114-b5bb-c587b6d9525dhttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/1610f679-c671-4114-b5bb-c587b6d9525dicubehttp://social.expression.microsoft.com/Profile/en-US/?user=icubeBinding Collection to another Collection with different type<p>ok, i need some help on binding a collection to another collection with different type<br/><br/>i have a data class(a class with just public get/set properties with notifypropertychange)<br/>i have a master collection that stores this data object<br/>i have another collection(lets call it collection A), however this collection is a collection of a property inside the data class<br/><br/>how can i bind collection A to the master collection. the master collection will be used for reordering and modifying the data classes' properties.<br/><br/>do i use a converter to do that? or is there something else?<br/><br/>Regards</p>Thu, 19 Nov 2009 16:58:00 Z2009-11-26T14:36:25Zhttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/11a19986-faae-42ad-9eae-45ebe9799cd7http://social.expression.microsoft.com/Forums/en-US/wpf/thread/11a19986-faae-42ad-9eae-45ebe9799cd7John Guilberthttp://social.expression.microsoft.com/Profile/en-US/?user=John%20GuilbertWhy is WPF Browser App so far removed from ASP.NET 3.5Hi,<br/><br/>I am a Sharepoint Project Manager and currently helping out with ASP.NET 3.5 Web Development. I thought it would be so good to use WPF (xaml) etc and at last be able to do something sexy with code. Reason I am complaining is all I wanted to do was bind a GridView(ListView) to my dataset I created in a Class Library (Data Access Layer). Can you answer the following questions:<br/><br/>Can you bind a GridView(Listview) to a DataSet - if yes or no can someone give me a link to a simple example and/or BEST practice?<br/><br/>Your help would be appreciated.<br/><br/>Thanks.<br/><br/>John. <br/><br/>P.S. If you are; French, have descended from France, have a T-shirt saying 'Vive La France', have Tierry as a first name or Henry as a last you know where the door is!Thu, 19 Nov 2009 19:19:50 Z2009-11-26T13:36:27Zhttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/363e58ea-2940-49a3-848d-e0660da911dchttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/363e58ea-2940-49a3-848d-e0660da911dcLudwigNewbiehttp://social.expression.microsoft.com/Profile/en-US/?user=LudwigNewbieEdit row in typed dataset and write it to xmlI have the folowing code:<br/><br/><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small"><font size=2 color="#0000ff"><font size=2 color="#0000ff"> <p>public</p> </font></font></span><font size=2 color="#0000ff"> <p> </p> </font></span> <p><span style="font-size:x-small"> </span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">void</span></span><span style="font-size:x-small"> UpdateConnection(</span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">string</span></span><span style="font-size:x-small"> sConn, </span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">string</span></span><span style="font-size:x-small"> cName, </span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">string</span></span><span style="font-size:x-small"> svrNamw, </span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">string</span></span><span style="font-size:x-small"> dbName, <font size=2> <p> </p> </font></span></p> <p><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">string</span></span><span style="font-size:x-small"> dbUser, </span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">string</span></span><span style="font-size:x-small"> dbPwd) <p>{</p> <font size=2> <p> </p> </font></span></p> <p><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">try</span></span></p> <span style="font-size:x-small"> <p>{</p> <font size=2> <p>connDs.ReadXml(filePath +</p> </font></span> <p><span style="color:#a31515;font-size:x-small"><span style="color:#a31515;font-size:x-small">&quot;\\conn.xml&quot;</span></span><span style="font-size:x-small">);<font size=2> <p> </p> </font></span></p> <p><span style="color:#2b91af;font-size:x-small"><span style="color:#2b91af;font-size:x-small">DataTable</span></span><span style="font-size:x-small"> connDt = connDs.Tables[</span><span style="color:#a31515;font-size:x-small"><span style="color:#a31515;font-size:x-small">&quot;connDataTable&quot;</span></span><span style="font-size:x-small">];<font size=2> <p> </p> </font></span></p> <p><span style="color:#2b91af;font-size:x-small"><span style="color:#2b91af;font-size:x-small">MessageBox</span></span><span style="font-size:x-small">.Show(connDs.Tables[</span><span style="color:#a31515;font-size:x-small"><span style="color:#a31515;font-size:x-small">&quot;connDataTable&quot;</span></span><span style="font-size:x-small">].Rows.Count.ToString());<font size=2> <p> </p> </font></span></p> <p><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">for</span></span><span style="font-size:x-small"> (</span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">int</span></span><span style="font-size:x-small"> i = 0; i &lt; connDs.connDataTable.Rows.Count; i++) <p>{</p> <font size=2> <p> </p> </font></span></p> <p><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">if</span></span><span style="font-size:x-small"> (connDs.connDataTable[i].connNameDataColumn.ToString() == sConn) <p>{</p> <p>connDs.connDataTable[i].connNameDataColumn = cName;</p> <p>connDs.connDataTable[i].serverNameDataColumn = svrNamw;</p> <p>connDs.connDataTable[i].databaseDataColumn = dbName;</p> <p>connDs.connDataTable[i].dbUserDataColumn = dbUser;</p> <p>connDs.connDataTable[i].dbPasswordDataColumn = dbPwd;</p> <font size=2> <p>connDs.WriteXml(filePath +</p> </font></span></p> <p><span style="color:#a31515;font-size:x-small"><span style="color:#a31515;font-size:x-small">&quot;\\conn.xml&quot;</span></span><span style="font-size:x-small">);<font size=2> <p> </p> </font></span></p> <p><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">break</span></span><span style="font-size:x-small">; <p>}</p> <font size=2> <p> </p> </font></span></p> <p><span style="color:#2b91af;font-size:x-small"><span style="color:#2b91af;font-size:x-small">MessageBox</span></span><span style="font-size:x-small">.Show(connDs.Tables[</span><span style="color:#a31515;font-size:x-small"><span style="color:#a31515;font-size:x-small">&quot;connDataTable&quot;</span></span><span style="font-size:x-small">].Rows.Count.ToString()); <p> </p> <p>}</p> <p>connDs.Clone();</p> <p>}</p> <font size=2> <p> </p> </font></span></p> <p><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">catch</span></span><span style="font-size:x-small"> (</span><span style="color:#2b91af;font-size:x-small"><span style="color:#2b91af;font-size:x-small">Exception</span></span><span style="font-size:x-small"> ex) <p>{</p> <font size=2> <p> </p> </font></span></p> <p><span style="color:#2b91af;font-size:x-small"><span style="color:#2b91af;font-size:x-small">MessageBox</span></span><span style="font-size:x-small">.Show(ex.Message, </span><span style="color:#a31515;font-size:x-small"><span style="color:#a31515;font-size:x-small">&quot;Error occurred while trying update the connection details.&quot;</span></span><span style="font-size:x-small">, </span><span style="color:#2b91af;font-size:x-small"><span style="color:#2b91af;font-size:x-small">MessageBoxButton</span></span><span style="font-size:x-small">.OK, </span><span style="color:#2b91af;font-size:x-small"><span style="color:#2b91af;font-size:x-small">MessageBoxImage</span></span><span style="font-size:x-small">.Error); <p>}</p> <p>}<br/>I use this to make changes to a xml file where I store  connection details.<br/>I want to be able to edit a particular row.<br/>What happens with my code is a row is added instead of the one selected being updted.<br/>How do I update a row in the dataset and then write this back to the xml file?</p> </span></p>Thu, 26 Nov 2009 13:05:31 Z2009-11-26T13:05:31Zhttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/ca6f60ad-ce38-4cf3-b8d1-fd1afb525d72http://social.expression.microsoft.com/Forums/en-US/wpf/thread/ca6f60ad-ce38-4cf3-b8d1-fd1afb525d72TheEnglishPatienthttp://social.expression.microsoft.com/Profile/en-US/?user=TheEnglishPatientDatatrigger from constructor parameterI am struggling with the whole concept of the templates and triggers: In simple terms, I want to have a class constructor for a UserControl with a parameter string ('layout'), that will add alternative elements to the UserControl. For example, a layout 'r' might add a rectangle, a layout 'e' might add an ellipse, etc. I can do this in code with a switch, but to separate graphics and functionality how do I do this in XAML?Thu, 26 Nov 2009 11:13:40 Z2009-11-26T12:48:22Zhttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/f7e52d09-8459-40a9-8ceb-eae63a450719http://social.expression.microsoft.com/Forums/en-US/wpf/thread/f7e52d09-8459-40a9-8ceb-eae63a450719pymWPFhttp://social.expression.microsoft.com/Profile/en-US/?user=pymWPFGrid Rows/Columns simple questionHi,<br/> <br/> If I want to create a Grid with 50 rows/columns, for example, in XAML, do I have to do the following:<br/> <br/> <div style="color:Black;background-color:White"> <pre> &lt;Grid&gt;<br/> &lt;Grid.RowDefinitions&gt;<br/> &lt;RowDefinition/&gt;<br/> &lt;RowDefinition/&gt;<br/> &lt;RowDefinition/&gt;<br/> &lt;RowDefinition/&gt;<br/> &lt;RowDefinition/&gt;<br/> &lt;RowDefinition/&gt;<br/> &lt;RowDefinition/&gt;<br/> &lt;RowDefinition/&gt;<br/> ... UNTIL 50????<br/> &lt;/Grid.RowDefinitions&gt;<br/> &lt;/Grid&gt; </pre> </div> <br/> Thanks!Thu, 26 Nov 2009 11:49:11 Z2009-11-26T15:03:54Zhttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/dd2f81cf-cc7e-419e-92fa-fa7fd25371c2http://social.expression.microsoft.com/Forums/en-US/wpf/thread/dd2f81cf-cc7e-419e-92fa-fa7fd25371c2GovindKaverihttp://social.expression.microsoft.com/Profile/en-US/?user=GovindKaveriScreen resolution & memory footprintI have a WPF application that typically runs on a monitor of 1920 X 1200 resolution. The main window is put in a viewbox so that the application can be run in smaller resolution monitor as well. When we run the application in lower resolution monitor, the memory footprint drops significantly. <br/>Anyone has an idea what could be causing the drop in the footprint? <br/>I am basically facing a problem of very high memory footprint (~950MB). I am looking out for ways to reduce the footprint. Is there any setting in display driver that can help reduce the memory footprint?<br/>Any other options to reduce the footprint?Wed, 21 Oct 2009 08:26:25 Z2009-11-26T11:57:16Zhttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/7fb79aa2-84d2-4b02-bcbe-b2e8845fceb9http://social.expression.microsoft.com/Forums/en-US/wpf/thread/7fb79aa2-84d2-4b02-bcbe-b2e8845fceb9gnanamhttp://social.expression.microsoft.com/Profile/en-US/?user=gnanamApplication thows errorHello,<br/> <br/>   My application is getting crash with this error after long time running.<br/> <br/> Please help me.<br/> <br/> <br/>    at System.Windows.Media.Imaging.BitmapSource.set_WicSourceHandle(BitmapSourceSafeMILHandle value)<br/>    at System.Windows.Media.Imaging.UnmanagedBitmapWrapper..ctor(BitmapSourceSafeMILHandle bitmapSource)<br/>    at System.Windows.Media.Effects.BitmapEffect.GetOutput(SafeHandle unmanagedEffect, Int32 index, BitmapEffectRenderContext context)<br/>    at System.Windows.Media.Effects.BitmapEffect.GetOutput(BitmapEffectInput input)<br/>    at System.Windows.Media.Effects.BitmapEffectState.GetEffectOutput(Visual visual, RenderTargetBitmap&amp; renderBitmap, Matrix worldTransform, Rect windowClip, Matrix&amp; finalTransform)<br/>    at System.Windows.Media.Effects.BitmapEffectVisualState.RenderBitmapEffect(Visual visual, Channel channel)<br/>    at System.Windows.Media.Effects.BitmapEffectContent.ExecuteRealizationsUpdate()<br/>    at System.Windows.Media.RealizationContext.RealizationUpdateSchedule.Execute()<br/>    at System.Windows.Media.MediaContext.Render(ICompositionTarget resizedCompositionTarget)<br/>    at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)<br/>    at System.Windows.Media.MediaContext.AnimatedRenderMessageHandler(Object resizedCompositionTarget)<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.DispatcherOperation.InvokeImpl()<br/>    at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)<br/>    at System.Threading.ExecutionContext.runTryCode(Object userData)<br/>    at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)<br/>    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)<br/>    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)<br/>    at System.Windows.Threading.DispatcherOperation.Invoke()<br/>    at System.Windows.Threading.Dispatcher.ProcessQueue()<br/>    at System.Windows.Threading.Dispatcher.WndProcHook(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 iGuide.App.Main() in C:\Users\Administrator\Desktop\Memory Test\Game\iGuide\iGuide\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()Thu, 26 Nov 2009 11:52:49 Z2009-11-26T11:52:49Zhttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/e10b9df6-bab4-4ae1-bce3-3d43257edc17http://social.expression.microsoft.com/Forums/en-US/wpf/thread/e10b9df6-bab4-4ae1-bce3-3d43257edc17Willie007http://social.expression.microsoft.com/Profile/en-US/?user=Willie007Using RoutedCommand does not fire CanExecuteChangedEventHi,<br/><br/>I created a usercontrol which must be enabled/disabled based on a command which is used from a main program.<br/>However the CanExecuteChangedEvent is not fired. What am I doing wrong here???<br/>The Command1ChangedCallback is fired (i checked), but it seems that the addhandler does not work for some reason??<br/><br/> <div style="background-color:white;color:black"> <pre><span style="color:blue">Public</span> <span style="color:blue">Class</span> Usercontrol1 <span style="color:blue">Dim</span> MyCommand <span style="color:blue">As</span> Windows.Input.RoutedCommand = <span style="color:blue">Nothing</span> <span style="color:blue">Friend</span> <span style="color:blue">Shared</span> Command1Property <span style="color:blue">As</span> DependencyProperty = DependencyProperty.RegisterAttached(<span style="color:#a31515">&quot;Command&quot;</span>, <span style="color:blue">GetType</span>(RoutedCommand), <span style="color:blue">GetType</span>(Usercontrol1), <span style="color:blue">New</span> PropertyMetadata(<span style="color:blue">AddressOf</span> Command1ChangedCallback)) <span style="color:blue">Private</span> <span style="color:blue">Shared</span> <span style="color:blue">Sub</span> Command1ChangedCallback(<span style="color:blue">ByVal</span> d <span style="color:blue">As</span> DependencyObject, <span style="color:blue">ByVal</span> e <span style="color:blue">As</span> DependencyPropertyChangedEventArgs) <span style="color:blue">On</span> <span style="color:blue">Error</span> <span style="color:blue">Resume</span> <span style="color:blue">Next</span> <span style="color:blue">If</span> <span style="color:blue">Not</span> <span style="color:blue">CType</span>(d, Usercontrol1).MyCommand <span style="color:blue">Is</span> <span style="color:blue">Nothing</span> <span style="color:blue">Then</span> <span style="color:blue">RemoveHandler</span> <span style="color:blue">CType</span>(d, Usercontrol1).MyCommand.CanExecuteChanged, <span style="color:blue">AddressOf</span> <span style="color:blue">CType</span>(d, Usercontrol1).CanExecuteChangedEvent <span style="color:blue">CType</span>(d, Usercontrol1).MyCommand = <span style="color:blue">Nothing</span> <span style="color:blue">End</span> <span style="color:blue">If</span> <span style="color:blue">If</span> <span style="color:blue">Not</span> e.NewValue <span style="color:blue">Is</span> <span style="color:blue">Nothing</span> <span style="color:blue">Then</span> <span style="color:blue">CType</span>(d, Usercontrol1).MyCommand = e.NewValue <span style="color:blue">AddHandler</span> <span style="color:blue">CType</span>(d, Usercontrol1).MyCommand.CanExecuteChanged, <span style="color:blue">AddressOf</span> <span style="color:blue">CType</span>(d, Usercontrol1).CanExecuteChangedEvent <span style="color:blue">End</span> <span style="color:blue">If</span> <span style="color:blue">End</span> <span style="color:blue">Sub</span> <span style="color:blue">Public</span> <span style="color:blue">Property</span> Command() <span style="color:blue">As</span> RoutedCommand <span style="color:blue">Get</span> <span style="color:blue">On</span> <span style="color:blue">Error</span> <span style="color:blue">Resume</span> <span style="color:blue">Next</span> <span style="color:blue">Return</span> GetValue(Command1Property) <span style="color:blue">End</span> <span style="color:blue">Get</span> <span style="color:blue">Set</span>(<span style="color:blue">ByVal</span> value <span style="color:blue">As</span> RoutedCommand) <span style="color:blue">On</span> <span style="color:blue">Error</span> <span style="color:blue">Resume</span> <span style="color:blue">Next</span> SetValue(Command1Property, value) <span style="color:blue">End</span> <span style="color:blue">Set</span> <span style="color:blue">End</span> <span style="color:blue">Property</span> <span style="color:blue">Private</span> <span style="color:blue">Sub</span> CanExecuteChangedEvent(<span style="color:blue">ByVal</span> sender <span style="color:blue">As</span> <span style="color:blue">Object</span>, <span style="color:blue">ByVal</span> e <span style="color:blue">As</span> System.EventArgs) <span style="color:blue">On</span> <span style="color:blue">Error</span> <span style="color:blue">Resume</span> <span style="color:blue">Next</span> <span style="color:blue">If</span> MyCommand.CanExecute(<span style="color:blue">Nothing</span>, <span style="color:blue">Me</span>) <span style="color:blue">Then</span> <span style="color:blue">Me</span>.IsEnabled = <span style="color:blue">True</span> <span style="color:blue">Else</span> <span style="color:blue">Me</span>.IsEnabled = <span style="color:blue">False</span> <span style="color:blue">End</span> <span style="color:blue">If</span> <span style="color:blue">End</span> <span style="color:blue">Sub</span> <span style="color:blue">End</span> <span style="color:blue">Class</span> </pre> </div>Thu, 26 Nov 2009 10:17:31 Z2009-11-26T12:56:46Zhttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/fb0a2246-90f5-43b1-9d20-51fd3f30f2cehttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/fb0a2246-90f5-43b1-9d20-51fd3f30f2cem0nkeymafiahttp://social.expression.microsoft.com/Profile/en-US/?user=m0nkeymafiaDisable selection on treeviewHello<br/> <br/> I have a treeview with 3 levels.<br/> I want only the last level to be selectable and preferably, if someone attempts to select any of it's parent elements it will automatically select the first selectable item in the treeview - I guess this could be done with intercepting some mouse events and coding though.  <br/> <br/> I.e.<br/> User clicks a parent node which is not selectable, selection then defaults to its first selectable child.<br/> <br/> What I most would like is for someone to tell me how to disable the selection of certain levels of the treeview.<br/> I have tried using IsHitTestVisible=&quot;False&quot; on the data templates for those specific levels but this didnt work.  I think tried applying that to the entire TreeView and enabling only the levels I want to.  This didnt work either.<br/> <br/> Any help with this would be greatly appreciated, thanks<br/> <br/> Chris<hr class="sig">I am Tyler DurdenThu, 26 Nov 2009 11:15:14 Z2009-11-26T11:15:15Zhttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/09303968-3973-4a8f-9af5-d71985d2e2d5http://social.expression.microsoft.com/Forums/en-US/wpf/thread/09303968-3973-4a8f-9af5-d71985d2e2d5eugzlhttp://social.expression.microsoft.com/Profile/en-US/?user=eugzlcase statment problemHi All<br/>When I try open form and field DayOff is NULL I'm getting error message: &quot;Operator '=' is not defined for type 'DBNull' and string &quot;AA&quot;. How to fix that problem?<br/><br/><span style="font-size:x-small"><span style="color:#0000ff"><span style="color:#0000ff">Select</span></span> <span style="color:#0000ff"><span style="color:#0000ff">Case</span></span> (<span style="color:#0000ff"><span style="color:#0000ff">Me</span></span>.cvCallIn.CurrentItem(<span style="color:#a31515"><span style="color:#a31515">&quot;DayOff&quot;</span></span>))<br/><span style="color:#0000ff"><span style="color:#0000ff">   Case</span></span> </span><span style="font-size:x-small"><span style="color:#a31515"><span style="color:#a31515">&quot;AA&quot;<br/></span></span><span style="color:#0000ff"><span style="color:#0000ff">        Me</span></span>.RadioButton1.IsChecked = </span><span style="font-size:x-small"><span style="color:#0000ff"><span style="color:#0000ff">True<br/></span></span><span style="color:#0000ff"><span style="color:#0000ff">   Case</span></span> </span><span style="font-size:x-small"><span style="color:#a31515"><span style="color:#a31515">&quot;BB&quot;<br/></span></span><span style="color:#0000ff"><span style="color:#0000ff">        Me</span></span>.RadioButton2.IsChecked = </span><span style="font-size:x-small"><span style="color:#0000ff"><span style="color:#0000ff">True<br/></span></span><span style="color:#0000ff"><span style="color:#0000ff">   Case</span></span> </span><span style="font-size:x-small"><span style="color:#0000ff"><span style="color:#0000ff">Else<br/></span></span><span style="color:#0000ff"><span style="color:#0000ff">       Me</span></span>.RadioButton3.IsChecked = </span><span style="font-size:x-small"><span style="color:#0000ff"><span style="color:#0000ff">True<br/></span></span><span style="color:#0000ff"><span style="color:#0000ff">End</span></span> </span><span style="color:#0000ff"><span style="color:#0000ff;font-size:x-small">Select<br/><span style="color:#000000"><br/>Thanks.</span></span></span>Wed, 25 Nov 2009 22:02:50 Z2009-11-26T15:07:13Zhttp://social.expression.microsoft.com/Forums/en-US/wpf/thread/0844f82e-1d62-4303-8839-99108191f5b5http://social.expression.microsoft.com/Forums/en-US/wpf/thread/0844f82e-1d62-4303-8839-99108191f5b5Vineeth Paliathhttp://social.expression.microsoft.com/Profile/en-US/?user=Vineeth%20PaliathUndo Redo for Grouping UielementsHi,<br/> <br/> i have a problem with undoredo of grouping and ungrouping, that is when i try to group two or more uielements in canvas by removing uielements from originalcanvas and place it into another groupcanvas and set the groupcanvas intoa viewbox child then place it into originalcanvas, and ungroup it will remove from groupcanvas and place into original canvas, it works well , now i need to know a simple method to implement undo redo for this.<br/> <br/> Thanks<hr class="sig">VineethTue, 17 Nov 2009 09:28:30 Z2009-11-26T11:07:34Z