Fórum Windows Presentation Foundation (WPF)How to use Windows Presentation Foundation (WPF) productively to create visually appealing and differentiating applications and to improve user experience.© 2009 Microsoft Corporation. Všechna práva vyhrazena.Sat, 28 Nov 2009 17:33:11 Z43e1b4ad-eb8d-427f-90a9-161e7af74457http://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/8add70a3-6c43-417c-8e85-9d3be36057cehttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/8add70a3-6c43-417c-8e85-9d3be36057cek0065126http://social.msdn.microsoft.com/Profile/cs-CZ/?user=k0065126Trying to find an alternative to VBs InputBox<span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small"> <p>If I was using Visual Basic I would write :-</p> <p>string message = &quot;Choose one option&quot;;<br/>if (option1) message = message + &quot;1 This is one option&quot;;<br/>if (option2) message = message + &quot;2 Another option&quot;;<br/>...<br/>if (option5) message = message + &quot;5 Last option&quot;;</p> <p>int choice = InputBox(message);</p> <p>switch (choice)<br/>   case 1<br/>      code for case 1;<br/>  ...<br/>  case 5<br/>      code for case 5;<br/>end of switch statements</p> <p>This does not seem to be possible in WPF or C#.  I did wonder if using a pop-up form would be possible but could not work out if the form could pass a parameter back to the originating method.</p> <p>I am now trying to use a list box but cannot work out how to add an event handler at run time.<br/>What I have in XAML is :-</p> <p>&lt;ListBox Height=&quot;85&quot; Margin=&quot;663,0,700,350&quot; Name=&quot;listBox1&quot; VerticalAlignment=&quot;Bottom&quot; FontSize=&quot;14&quot; Visibility=&quot;Hidden&quot;&gt;</p> <p>&lt;ListBoxItem Selected=&quot;ListBoxItem_Selected&quot;&gt;The options are :-&lt;/ListBoxItem&gt;</p> <p>&lt;/ListBox&gt; <br/> </p> <p>And in my code I have :-</p> <p>if (option1)<br/> {<br/> listBox1.Items.Add(&quot;text for option 1&quot;);</p> <p> listBox1.SelectedItem +=</p> <p> new EventHandler(void (ListBoxItem1_Selected) ); // this causes an error <br/> }<br/>...<br/>if (option5)<br/> {<br/> listBox1.Items.Add(&quot;text for option 5&quot;);</p> <p> listBox1.SelectedItem +=</p> <p> new EventHandler((ListBoxItem5_Selected) ); //  nor does this <br/>  <br/> }</p> <p>I am trying to find out how to add an event handler which will be callled if the item in the list is selected.<br/>Although I could hard code the list items and hide those which are not relevant this does not look very good, and the list items will probably be different each time I call the code.</p> <p>I hope that someone can help, and that I have explained myself clearly,</p> <p>Viv</p> </span></span>Fri, 27 Nov 2009 19:50:14 Z2009-11-28T17:33:11Zhttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/98e39986-a100-449a-8f3e-c2553f299a4chttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/98e39986-a100-449a-8f3e-c2553f299a4ctomasz.82http://social.msdn.microsoft.com/Profile/cs-CZ/?user=tomasz.82drag n drop from thunderbird 3Hi,<br/> I develope c# application with drag &amp; drop functionality. In thunderbird 2 evertything works fine but in new rc version I can not drag an attachment to my application. The function :<br/>  MemoryStream ms = (MemoryStream)e.Data.GetData(&quot;FileContents&quot;, true);<br/> allways retunrs null. Is there any way to drag attachments from thunderbird 3?Sat, 28 Nov 2009 17:05:35 Z2009-11-28T17:05:35Zhttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/a80153f8-dcf7-4b18-a8b9-5aa328c9d339http://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/a80153f8-dcf7-4b18-a8b9-5aa328c9d339JRichTXhttp://social.msdn.microsoft.com/Profile/cs-CZ/?user=JRichTXListView ItemsPresenter Scrolling with GroupStyle specified<p>I have implemented Grouping with a ListView in which I wrap the ItemsPresenter in an Expander like follows<br/><br/>&lt;ListView.GroupStyle&gt;<br/>                    &lt;GroupStyle&gt;<br/>                        &lt;GroupStyle.ContainerStyle&gt;<br/>                            &lt;Style TargetType=&quot;{x:Type GroupItem}&quot;&gt;<br/>                                &lt;Setter Property=&quot;Margin&quot; Value=&quot;0,0,0,5&quot;/&gt;<br/>                                &lt;Setter Property=&quot;Template&quot;&gt;<br/>                                    &lt;Setter.Value&gt;<br/>                                        &lt;ControlTemplate TargetType=&quot;{x:Type GroupItem}&quot;&gt;<br/>                                            &lt;Expander IsExpanded=&quot;True&quot; <br/>                                                      BorderBrush=&quot;Black&quot; <br/>                                                      BorderThickness=&quot;0,0,0,1&quot; <br/>                                                      Expanded=&quot;Expander_Expanded&quot; <br/>                                                      Collapsed=&quot;Expander_Collapsed&quot; <br/>                                                      ScrollViewer.CanContentScroll=&quot;True&quot; &gt;<br/>                                                &lt;Expander.Header&gt;<br/>                                                    &lt;TextBlock Text=&quot;{Binding Path=Name}&quot; Style=&quot;{DynamicResource gvHeaderStyle}&quot; /&gt;<br/>                                                &lt;/Expander.Header&gt;<br/>                                                &lt;Expander.Content&gt;<br/>                                                    &lt;Border Background=&quot;White&quot; Margin=&quot;2&quot; CornerRadius=&quot;3&quot;&gt;<br/>                                                        &lt;ItemsPresenter/&gt;<br/>                                                    &lt;/Border&gt;<br/>                                                &lt;/Expander.Content&gt;<br/>                                            &lt;/Expander&gt;<br/>                                        &lt;/ControlTemplate&gt;<br/>                                    &lt;/Setter.Value&gt;<br/>                                &lt;/Setter&gt;<br/>                            &lt;/Style&gt;<br/>                        &lt;/GroupStyle.ContainerStyle&gt;<br/>                    &lt;/GroupStyle&gt;<br/>                &lt;/ListView.GroupStyle&gt;<br/><br/>This code works fine with one problem. The contents of the ItemsPresenter are not scrollable. I have tried everything I can think of to make the ItemsContent scroll, but no luck. Is there a way to make the contents of the expander scrollable in this case?</p>Sat, 28 Nov 2009 16:51:27 Z2009-11-28T16:51:28Zhttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/966fa1f5-b818-45d7-b2f3-0ebd75de7d8ahttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/966fa1f5-b818-45d7-b2f3-0ebd75de7d8aMarkReynhttp://social.msdn.microsoft.com/Profile/cs-CZ/?user=MarkReynDataGridView auto resize cell as user typesI'm using a DataGridView with a column that will be used to capture text. I have the column that will be used to capture text and I have the Column's Cell Style Wrap Mode set to True and the DataGridView's AutoSizeRowsMode set to AllCells. Right now, the grid only resizes the height of the row when the user finishes editing and leaves the cell. I need the row height to automatically resize as the user enters text. <div><br/></div> <div>Any suggestions? Samples? Are there other grids that provide this behavior?</div> <div><br/></div> <div>thanks for the help</div>Sat, 28 Nov 2009 16:08:30 Z2009-11-28T16:08:31Zhttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/4327ed0e-eb94-4346-a103-a9de7b00d543http://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/4327ed0e-eb94-4346-a103-a9de7b00d543t sswhttp://social.msdn.microsoft.com/Profile/cs-CZ/?user=t%20sswRe-use Cell Template in ListViewI have attempted to re-use a cell template similar to this post (http://social.msdn.microsoft.com/forums/en-US/wpf/thread/7f09f268-2920-423b-ae41-aaf46a13920e/).  However, it does not seem to work for non-string types.  E.g. when the data type is a bool, I get nothing in the cell.  I would like to continue to use this approach as the DataTemplates are quite complicated (code below simplified to show the problem).   Here is a snippet:<br/> <br/> <pre lang=x-xml> &lt;UserControl.Resources&gt;<br/> &lt;DataTemplate x:Key=&quot;ListViewSimpleTemplate&quot;&gt;<br/> &lt;Border Margin=&quot;0,0,-6,0&quot; BorderThickness=&quot;0,0,1,0&quot; BorderBrush=&quot;LightGray&quot; RenderOptions.EdgeMode=&quot;Aliased&quot;&gt;<br/> &lt;TextBlock Text=&quot;{TemplateBinding Content}&quot; VerticalAlignment=&quot;Center&quot; Margin=&quot;0,0,6,0&quot;/&gt;<br/> &lt;/Border&gt;<br/> &lt;/DataTemplate&gt;<br/> &lt;/UserControl.Resources&gt;<br/> <br/> <br/> &lt;ListView Name=&quot;MyList&quot; ItemsSource=&quot;{Binding Path=ViewModelList}&quot; SelectionMode=&quot;Single&quot; Grid.Row=&quot;0&quot; Grid.Column=&quot;0&quot; AlternationCount=&quot;2&quot;<br/> SelectedItem=&quot;{Binding Path=SelectedItem, Mode=TwoWay}&quot; IsSynchronizedWithCurrentItem=&quot;True&quot;&gt;<br/> &lt;ListView.ItemContainerStyle&gt;<br/> &lt;Style TargetType=&quot;ListViewItem&quot; BasedOn=&quot;{StaticResource ListViewItemBaseStyle}&quot;&gt;<br/> &lt;Setter Property=&quot;HorizontalContentAlignment&quot; Value=&quot;Stretch&quot; /&gt;<br/> &lt;Setter Property=&quot;VerticalContentAlignment&quot; Value=&quot;Stretch&quot; /&gt;<br/> &lt;/Style&gt;<br/> &lt;/ListView.ItemContainerStyle&gt;<br/> &lt;ListView.View&gt;<br/> &lt;GridView&gt;<br/> &lt;GridViewColumn Header=&quot;My Bool&quot;&gt;<br/> &lt;GridViewColumn.CellTemplate&gt;<br/> &lt;DataTemplate&gt;<br/> &lt;ContentControl Content=&quot;{Binding Path=MyBool}&quot; ContentTemplate=&quot;{StaticResource ListViewSimpleTemplate}&quot; /&gt;<br/> &lt;/DataTemplate&gt;<br/> &lt;/GridViewColumn.CellTemplate&gt;<br/> &lt;/GridViewColumn&gt;<br/> &lt;GridViewColumn Header=&quot;Note&quot;&gt;<br/> &lt;GridViewColumn.CellTemplate&gt;<br/> &lt;DataTemplate&gt;<br/> &lt;ContentControl Content=&quot;{Binding Path=Note}&quot; ContentTemplate=&quot;{StaticResource ListViewSimpleTemplate}&quot; /&gt;<br/> &lt;/DataTemplate&gt;<br/> &lt;/GridViewColumn.CellTemplate&gt;<br/> &lt;/GridViewColumn&gt;<br/> </pre>Sat, 28 Nov 2009 07:05:29 Z2009-11-28T14:16:56Zhttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/d6da1f1e-9b46-41d8-83e3-d61c9c74491dhttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/d6da1f1e-9b46-41d8-83e3-d61c9c74491dengnounahttp://social.msdn.microsoft.com/Profile/cs-CZ/?user=engnounaHighLight a specific cell in DataGridHi<br/><br/>I have 3 DataGrid bound to the same datatable but each DataGrid displays different columns,When the user selects a row in any datagrid, I want to select this row in the other datagrids.In other words,if Grid1.SelectedIndex is 5, then Grid2.selectedIndex should be = 5 and Grid3.selectedIndex should be = 5,I tried Grid2.selectedIndex = Grid1.SelectedIndex but I noticed that the row in Grid2 is not selected<br/><br/>Any tips?<br/><br/>thanksSat, 28 Nov 2009 11:13:36 Z2009-11-28T13:51:26Zhttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/53ca5ffe-b50b-46fd-b019-47a42970375bhttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/53ca5ffe-b50b-46fd-b019-47a42970375btomer70http://social.msdn.microsoft.com/Profile/cs-CZ/?user=tomer70mvvm-aggregating ViewModels?<p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Times New Roman;font-size:small"><br/> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas">Hi,</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas"><br/>Is it common to aggregate ViewModels into a new ViewModel?</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas"> </span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas">Suppose I have two ViewModels:</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas"> </span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas">1.ImageViewModel</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas"> </span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas">2.PositionViewModel</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas"> </span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas">The ImageViewModel containing a description ,a URL to an image, and a key</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas"> </span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas">The PositionViewModel containing a key (identifying an image) and a Point.</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas"> </span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas">The result should be displaying images based on a position</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas"> </span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas">The connection between the Position and the Image is made using the key.</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas"> </span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas">1. Is aggregating both ViewModel into <strong>ImageAndPositionViewModel</strong> is a good idea in general?</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas"> </span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas">2. <span style=""> </span>Do I really need the ImageViewModel and PositionViewModel at all?</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas"><span style="">    </span>Isn’t enough to create an ImageAndPositionViewModel assuming I always only want display the image based on its position?</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas"> </span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas">3. In general Should a ViewModel communicate with other Models using the other   model's ViewModel? </span><span style="font-family:Consolas"><span style="">for example  </span>Should ImageViewModel use <span style=""> </span>PositionViewModel or can directly use Position?</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas"> </span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas"> Thanks in advance.<br/></span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:Consolas"><br/> </span></p> <font face="Times New Roman" size=3> <p class=MsoNormal style="margin:0cm 0cm 0pt"> </p> </font></span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"> </p>Sat, 28 Nov 2009 12:40:38 Z2009-11-28T13:54:27Zhttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/f96fa37c-aa1b-43af-9695-69c518950582http://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/f96fa37c-aa1b-43af-9695-69c518950582Failurehttp://social.msdn.microsoft.com/Profile/cs-CZ/?user=FailureCannot recover from ArgumentOutOfRangeException - but why?When I set the Indices property of a <strong>Glyphs</strong> object to an invalid value, I get an ArgumentOutOfRangeException.<br/>That's fair enough. But if I do that in a try block and handle the exception in its catch-clause, <strong>why is it that I am <em>not</em> allowed to handle that exception but my program gets shot down anyway?</strong> (If I use the debugger I can see that my program never even reaches the catch clause - the program gets just shot down in what I consider a rather unfriendly manner.)<br/><br/>Also: <strong>Is there a way that I can figure out which indices are valid for a given font / Glyphs.Index by inspecting the Glyphs object programmatically</strong> before even attempting to set its Indices property?<br/><br/>Thanks in advance for any ideas,<br/>FailureFri, 27 Nov 2009 20:44:53 Z2009-11-28T11:50:30Zhttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/0fd10bc3-89d5-419f-8a8b-cf7a39799e65http://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/0fd10bc3-89d5-419f-8a8b-cf7a39799e65NoNameNoOnehttp://social.msdn.microsoft.com/Profile/cs-CZ/?user=NoNameNoOneHow to retrieve image path from mysql and display it?hi guys, i'm new in WPF C#.<br/> I'm wondering how to retrieve image by image path from mysql database and display on screen?<br/> <br/> Thanks for helping...<br/>Sat, 28 Nov 2009 11:40:07 Z2009-11-28T11:40:07Zhttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/29b4cd22-b60f-4980-bb8f-1092a12b7823http://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/29b4cd22-b60f-4980-bb8f-1092a12b7823Jetsunhttp://social.msdn.microsoft.com/Profile/cs-CZ/?user=JetsunWhy the IsEnabled for the style of ComboBoxItem does not work unless the dropdown list is showed?Following is the XAML and data, the IsEnabled property of ComboboxItem is binding to the value in the data.<br/> The disabled item still can be selected when user roll the mouse wheel in the textbox of ComboBox.<br/> But after the dropdown list is showed, then the disabled items will not be able to selected by scroll the mouse wheel in the textbox of combobox.<br/> <br/> There is another problem, the disabled item can be selected if the combobox is Editable, and user input the disabled item.<br/> <br/> <pre lang=x-xml> &lt;Window.Resources&gt; &lt;ResourceDictionary&gt; &lt;Style TargetType=&quot;{x:Type ComboBoxItem}&quot;&gt; &lt;Setter Property=&quot;IsEnabled&quot; Value=&quot;{Binding Path =[1]}&quot;/&gt; &lt;/Style&gt; &lt;/ResourceDictionary&gt; &lt;/Window.Resources&gt; &lt;Grid&gt; &lt;ComboBox Margin=&quot;46,72,31,0&quot; Name=&quot;ComboBox1&quot; Height=&quot;28&quot; VerticalAlignment=&quot;Top&quot; IsEditable=&quot;True&quot; TextSearch.TextPath=&quot;[0]&quot; DisplayMemberPath=&quot;[0]&quot; SelectedValuePath=&quot;[0]&quot; &gt; &lt;/ComboBox&gt;</pre> <pre lang=x-vbnet> Private Sub Window_Loaded(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Dim combList As New List(Of String()) combList.Add(New String() {&quot;1 Item1&quot;, &quot;True&quot;}) combList.Add(New String() {&quot;2 Item2&quot;, &quot;False&quot;}) combList.Add(New String() {&quot;3 Item3&quot;, &quot;True&quot;}) combList.Add(New String() {&quot;4 Item4&quot;, &quot;False&quot;}) combList.Add(New String() {&quot;5 Item5&quot;, &quot;True&quot;}) Me.ComboBox1.ItemsSource = combList End Sub</pre>Tue, 24 Nov 2009 03:51:24 Z2009-11-28T11:38:03Zhttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/3ed11dbe-7b30-46ff-8ce4-4d1096eb5628http://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/3ed11dbe-7b30-46ff-8ce4-4d1096eb5628wg1989johnhttp://social.msdn.microsoft.com/Profile/cs-CZ/?user=wg1989johnCannot input Chinese in the Textbox of PopupHi<br/>I'm a college student in China.The teacher ask us to program with the WPF.<br/>Now,I use the a popup in a window,I have successfully created a textbox. I can input English and get them.<br/>But,I can not change the input method so that I cannot input Chinese.<br/><br/>And,I try creating a textbox just in a window,not in a popup.<br/>I can change the input method and input Chinese in the textbox just in a window.<br/><br/>I don't konw where the problem is ?  Is there anyone can help me? Thanks a lot.Sat, 28 Nov 2009 10:50:33 Z2009-11-28T10:50:34Zhttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/c351f7f6-6968-422c-9e92-5bb9f3525e67http://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/c351f7f6-6968-422c-9e92-5bb9f3525e67hermitOCYhttp://social.msdn.microsoft.com/Profile/cs-CZ/?user=hermitOCYCompilation Error Related to FIPS EncryptionHi,<br/> <br/> I am new to Silverlight development. When I was compiling a Silverlight application via Visual Web Developer, I was greeted with the following compilation errors which I have no idea how to resolve it. I tried to compile a &quot;blank&quot; Silverlight application which nothing was created, but still this error occurs. My machine is running .NET framework 3.5 sp1 and FIPS validated cryptographic algorithms has already been activated via machine policy.<br/> <br/> Any help is very much appreciated. Many thanks :)<br/> <br/> <br/> <br/> Error    1    This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms.    F:\NET Projects\SilverlightApplication3\SilverlightApplication3\App.xaml    1    1    SilverlightApplication3<br/> <br/> Error    2    This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms.    F:\NET Projects\SilverlightApplication3\SilverlightApplication3\Page.xaml    1    1    SilverlightApplication3<br/> <br/>Fri, 27 Nov 2009 11:00:41 Z2009-11-28T10:37:41Zhttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/b8786341-379c-44f9-b7a8-3a315343ad73http://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/b8786341-379c-44f9-b7a8-3a315343ad73suchit_geekhttp://social.msdn.microsoft.com/Profile/cs-CZ/?user=suchit_geekHow to add EventAggregator Support in MVVMHi,<br/><br/>I am using MVVM approach in Prism framework, how can I attach my view model to my view in Prism??? Whenever I try to use unityContainer.RegisterType&lt;&gt;() I don't see the viewmodel getting attached to my view and hence I don't get any eventAggregator instance coming in my VM too :-( <br/><br/>Could anyone guide me....<br/><br/>Thanks <hr class="sig">Computer GeekSat, 28 Nov 2009 03:37:20 Z2009-11-28T10:25:45Zhttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/de75cebe-3681-43cb-8c85-266ac7bced62http://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/de75cebe-3681-43cb-8c85-266ac7bced62bhagyesh joshihttp://social.msdn.microsoft.com/Profile/cs-CZ/?user=bhagyesh%20joshiBinding with own class propertyHello friends,<br/>         I am facing a trouble. I want to attach my textbox with a String property of the same class. For an example in my Window.xaml there is a textbox named txtUserName and in its code behind file Window.xaml.cs there's property named UserName(type of string). I want to bind this property with the textbox's Text property. So is it possible..?<br/> <br/> Thnx in advanced.<br/> <br/><hr class="sig">destinySat, 28 Nov 2009 09:01:30 Z2009-11-28T09:57:57Zhttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/8f1c30ae-eec3-4d59-9c24-b178533db2a7http://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/8f1c30ae-eec3-4d59-9c24-b178533db2a7marck68http://social.msdn.microsoft.com/Profile/cs-CZ/?user=marck68which are the forbidden characters in xaml codewhere can I find the list of forbidden characters in xaml code??Fri, 27 Nov 2009 14:38:42 Z2009-11-28T09:36:59Zhttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/ac969dfb-acab-4932-b456-6276d536cff0http://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/ac969dfb-acab-4932-b456-6276d536cff0Alexwpfhttp://social.msdn.microsoft.com/Profile/cs-CZ/?user=AlexwpfInkCanvas set/get ZIndexHello,<br/> <br/> I would like to change ZIndex to force display overlaps InkCanvas child elements on top.<br/> I can not find any method to set/get this property for InkCanvas? <br/> <br/> Best regards,<br/>Thu, 26 Nov 2009 03:30:27 Z2009-11-28T09:20:36Zhttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/f125c86f-41a9-48a0-97a3-f577ff1391b5http://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/f125c86f-41a9-48a0-97a3-f577ff1391b5Zach_Shinehttp://social.msdn.microsoft.com/Profile/cs-CZ/?user=Zach_ShineHow to reduce unnecessary elements in the Visual Tree? (Calendar contains over 480 elements!)Hi, <br/><br/>I just use Snoop to have a look at my simple WPF app. The surprising thing is that here are over 3000 elements in the Visual Tree!<br/>- I use the Calendar control in the WPF toolkit. One instance of it contains over 480 elements!<br/>- I use a ListBox and a DataTemplate for each item. There are about 10 levels in the Visual Tree between the ListBox to the root element of the DataTemplate. The path : ListBox-&gt;Border-&gt;ScrollViewer-&gt;Grid-&gt;ScrollContentPresenter-&gt;ItemsPresenter-&gt;ListBoxItem-&gt;Border-&gt;ContentPresenter-&gt;Grid(The root of the DataTemplate)<br/>- TextBox control creates many elements depending on the lines of your text!<br/><br/><br/>Maybe it's why WPF is so slow and uses so many memory?<br/>How can I reduce those unnecessary elements in the Visual Tree, such as those borders and presenters?<br/><br/>Best regards,<br/>Zach_ShineFri, 27 Nov 2009 09:47:58 Z2009-11-28T09:15:11Zhttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/00b13b61-8e54-4078-94e8-1825d5954005http://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/00b13b61-8e54-4078-94e8-1825d5954005handsomecelestehttp://social.msdn.microsoft.com/Profile/cs-CZ/?user=handsomecelesteHow to recognize the flick direction via StylusSystemGesture?<p>Hi all, I'm using the Windows7.Multitouch.Manipulation to handler the gesture, to zoom, translate, ro rotate the picture, it works well, but I also want the flick gesture, code like this:<br/><br/>StylusSystemGesture += new StylusSystemGestureEventHandler(Window1_StylusSystemGesture);</p> <p>        void Window1_StylusSystemGesture(object sender, StylusSystemGestureEventArgs e)<br/>        {  <br/>            switch (e.SystemGesture)<br/>            {<br/>                case SystemGesture.Flick<br/>                    // Do something.<br/>                    break;<br/>            }</p> <p>        }<br/><br/>in the SystemGesture have a enum value 'Flick', but no direction for it, so how can I know it to implement the 'Back' or 'Forward' ?</p>Sat, 28 Nov 2009 08:10:10 Z2009-11-28T11:00:14Zhttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/fc9fd709-34f5-482f-931b-ab5e7e99ba03http://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/fc9fd709-34f5-482f-931b-ab5e7e99ba03B. Clay Shannonhttp://social.msdn.microsoft.com/Profile/cs-CZ/?user=B.%20Clay%20ShannonTutorial on using the DataGrid with queries?<p>Can somebody point me to a tutorial on how to use a DataGrid to display the results of dynamic queries? I did find the following code (which uses a bogus (dynamically created, populated with constants) table example), but I don't know if I should modify this to accommodate the queries I want to create and execute, or go in an entirely different direction - any suggestions?<br/><br/>IOW, how would this need to be different for dynamic queries?<br/><br/>xaml:</p> <p><strong>        &lt;StackPanel&gt;<br/> . . .<br/>            &lt;DataGrid<br/>            ItemsSource=&quot;{Binding Path=.}&quot;    <br/>                         Margin=&quot;10&quot;  <br/>                         x:Name=&quot;_dataGrid&quot;    <br/>                         ColumnHeaderHeight=&quot;30&quot; AutoGenerateColumns=&quot;True&quot;    <br/>                             AlternatingRowBackground=&quot;Cyan&quot; CanUserSortColumns=&quot;False&quot;&gt;<br/>            &lt;/DataGrid&gt;<br/>        &lt;/StackPanel&gt;</strong></p> <p>code-behind:</p> <p><strong>private DataSet _ds;</strong></p> <p><strong>. . .</strong></p> <p><strong>protected override void OnInitialized( EventArgs e )<br/>    {<br/>      base.OnInitialized(e);<br/>      _ds = new DataSet();<br/>      DataTable table = new DataTable();<br/>      _ds.Tables.Add(table);</strong></p> <p><strong>      DataColumn col = new DataColumn(&quot;Name&quot;, typeof(string));<br/>      col.MaxLength = 100;<br/>      table.Columns.Add(col);</strong></p> <p><strong>      col = new DataColumn(&quot;City&quot;, typeof(string));<br/>      col.MaxLength = 100;<br/>      table.Columns.Add(col);</strong></p> <p><strong>      DataRow row = table.NewRow();<br/>      table.Rows.Add(row);<br/>      row[&quot;Name&quot;] = &quot;Norbert&quot;;<br/>      row[&quot;City&quot;] = &quot;Cologne&quot;;</strong></p> <p><strong>      row = table.NewRow();<br/>      table.Rows.Add(row);<br/>      row[&quot;Name&quot;] = &quot;Bob&quot;;<br/>      row[&quot;City&quot;] = &quot;London&quot;;</strong></p> <p><strong>      _dataGrid.DataContext = _ds.Tables[0];<br/>    }</strong>   <br/><br/></p><hr class="sig">Writer / Photographer: www.lulu.com/blackbirdcraven, www.bclayshannon.photoshop.comFri, 27 Nov 2009 20:52:32 Z2009-11-28T07:27:54Zhttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/2691406e-c1ed-40af-b364-89fd9e76c824http://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/2691406e-c1ed-40af-b364-89fd9e76c824B. Clay Shannonhttp://social.msdn.microsoft.com/Profile/cs-CZ/?user=B.%20Clay%20ShannonWhy is the designer blank?My project runs, and it shows its face at runtime, but at design time, it's blank (no GUI). Why is that? Here is my xaml:<br/><br/><span style="font-family:Consolas;color:#0000ff;font-size:small"><span style="font-family:Consolas;color:#0000ff;font-size:small"><span style="font-family:Consolas;color:#0000ff;font-size:small"><font face=Consolas size=3 color="#0000ff"><font face=Consolas size=3 color="#0000ff"><font face=Consolas size=3 color="#0000ff"> <p>&lt;Window x:Class=&quot;MC_Proctor.MainWindow&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/>        Title=&quot;MC Proctor&quot; Height=&quot;350&quot; Width=&quot;525&quot;&gt;<br/>    &lt;Grid&gt;<br/>        &lt;StackPanel&gt;<br/>            &lt;Expander Margin=&quot;5&quot; Padding=&quot;5&quot; Header=&quot;Received Messages&quot; &gt;<br/>                &lt;ScrollViewer Height=&quot;50&quot; &gt;<br/>                    &lt;ListView Name=&quot;lvMsgs&quot; &gt;<br/>                    &lt;/ListView&gt;<br/>                &lt;/ScrollViewer&gt;<br/>            &lt;/Expander&gt;<br/>            &lt;DataGrid<br/>            ItemsSource=&quot;{Binding Path=.}&quot;    <br/>                         Margin=&quot;10&quot;  <br/>                         x:Name=&quot;_dataGrid&quot;    <br/>                         ColumnHeaderHeight=&quot;30&quot; AutoGenerateColumns=&quot;True&quot;    <br/>                             AlternatingRowBackground=&quot;Cyan&quot; CanUserSortColumns=&quot;False&quot;&gt;<br/>            &lt;/DataGrid&gt;<br/>            &lt;Button&gt;Show Highest Scores&lt;/Button&gt;<br/>        &lt;/StackPanel&gt;<br/>    &lt;/Grid&gt;<br/>&lt;/Window&gt;</p> </font></font></font></span><font face=Consolas size=3 color="#0000ff"><font face=Consolas size=3 color="#0000ff"> <p> </p> </font></font></span><font face=Consolas size=3 color="#0000ff"> <p> </p> </font></span> <p><span style="font-family:Consolas;color:#0000ff;font-size:small"><span style="font-family:Consolas;color:#0000ff;font-size:small"></span></span></p><hr class="sig">Writer / Photographer: www.lulu.com/blackbirdcraven, www.bclayshannon.photoshop.comFri, 27 Nov 2009 21:28:02 Z2009-11-28T07:19:19Zhttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/9d8eceb3-122a-4367-ba21-03ee9ceacac5http://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/9d8eceb3-122a-4367-ba21-03ee9ceacac5Nolan G.http://social.msdn.microsoft.com/Profile/cs-CZ/?user=Nolan%20G.Data Binding Dynamic List to Radio ButtonsI'm following the example here (<a href="http://forums.msdn.microsoft.com/en-US/wpf/thread/a2988ae8-e7b8-4a62-a34f-b851aaf13886#radiobuttonlist">http://forums.msdn.microsoft.com/en-US/wpf/thread/a2988ae8-e7b8-4a62-a34f-b851aaf13886#radiobuttonlist</a> ) to implement a list of radio buttons. My goal is have the number of radio buttons to be editable at runtime. I have modified the example to include a ComboBox used to select the number of radio buttons. I have also added a ViewModel for the window to hold the list that represents the radio buttons.<br/> <br/> This works fine if I use the ComboBox to decrease the number of radio buttons but if I add more radio buttons, the added radio buttons are not mutually exclusive (e.g. in my code below I start with four radio buttons and selection is mutually exclusive, if I change the ComboBox to eight, only the first five radio buttons are mutually exclusive, the remaining three radio buttons are not mutually exclusive)<br/> <br/> Any suggestions to why this is happening and how to fix it would be very helpful. <br/> <br/> XAML Code: <br/> <br/> <pre lang=x-xml>&lt;Window x:Class=&quot;ScratchWpf.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:s=&quot;clr-namespace:System;assembly=mscorlib&quot; Title=&quot;Window1&quot; Height=&quot;300&quot; Width=&quot;300&quot;&gt; &lt;StackPanel&gt; &lt;ListBox ItemsSource=&quot;{Binding Choices}&quot; IsSynchronizedWithCurrentItem=&quot;True&quot;&gt; &lt;ListBox.ItemContainerStyle&gt; &lt;Style TargetType=&quot;{x:Type ListBoxItem}&quot;&gt; &lt;Setter Property=&quot;Template&quot;&gt; &lt;Setter.Value&gt; &lt;ControlTemplate TargetType=&quot;{x:Type ListBoxItem}&quot;&gt; &lt;RadioButton IsChecked=&quot;{Binding Path=IsSelected, RelativeSource={RelativeSource TemplatedParent}}&quot; Content=&quot;{TemplateBinding Content}&quot;/&gt; &lt;/ControlTemplate&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Style&gt; &lt;/ListBox.ItemContainerStyle&gt; &lt;/ListBox&gt; &lt;ComboBox ItemsSource=&quot;{Binding NumberOfChoices}&quot; SelectedValue=&quot;{Binding ChoiceCount}&quot;/&gt; &lt;/StackPanel&gt; &lt;/Window&gt;</pre> <br/> C# View Model:<br/> <br/> <pre lang="x-c#"> class WindowViewModel { private static readonly int MaxNumberOfChoices = 26; private ObservableCollection&lt;string&gt; _choices; private List&lt;int&gt; _numberOfChoices = null; private int _choiceCount = 4; public ObservableCollection&lt;string&gt; Choices { get { if (this._choices == null) { this._choices = new ObservableCollection&lt;string&gt;() { { &quot;One&quot; }, { &quot;Two&quot; }, { &quot;Three&quot; }, { &quot;Four&quot; } }; } return this._choices; } } public List&lt;int&gt; NumberOfChoices { get { if (this._numberOfChoices == null) { this._numberOfChoices = new List&lt;int&gt;(WindowViewModel.MaxNumberOfChoices); for (int i = 1; i &lt;= WindowViewModel.MaxNumberOfChoices; i++) { this._numberOfChoices.Add(i); } } return this._numberOfChoices; } } public int ChoiceCount { get { return this._choiceCount; } set { this._choiceCount = value; this.ChangeChoiceCount(value); } } public void ChangeChoiceCount(int count) { if (count &lt; this._choices.Count) { for (int i = (this._choices.Count - 1); i &gt;= count; i--) { this._choices.RemoveAt(i); } } else { for (int i = this._choices.Count; i &lt; count; i++) { this._choices.Add(&quot;&quot;); } } } }</pre> <br/> <br/> <br/> <br/> <br/> <br/> <br/>Fri, 27 Nov 2009 23:56:02 Z2009-11-28T07:07:04Zhttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/7cac7203-d703-483f-8145-464739cd7cd3http://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/7cac7203-d703-483f-8145-464739cd7cd3mailzyokhttp://social.msdn.microsoft.com/Profile/cs-CZ/?user=mailzyokWPF application build by VS2008 C# (.Net 3.5), but the target framework is .Net 3.0 by configure the project property<p>I have build an APP using VS2008 c# (requires .Net 3.5 SP1), but the target .net framework is set to .Net3.0 in the project property. When run the app, there will be crash always, and after check the log, the Main window is initialized successfully, but crash before displayed<br/><br/>Environment:<br/><br/>1. XP SP2<br/>2. .Net 3.0<br/><br/><br/>App.xaml<br/><br/>&lt;Application x:Class=&quot;MyApp.App&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:System=&quot;clr-namespace:System;assembly=mscorlib&quot; <br/>    xmlns:x=&quot;<a href="http://schemas.microsoft.com/winfx/2006/xaml">http://schemas.microsoft.com/winfx/2006/xaml</a>&quot;<br/>    StartupUri=&quot;MainWindow.xaml&quot;&gt;<br/><br/>...<br/><br/>Add log in the construct fuction in MainWindow.xaml.cs<br/><br/> public MainWindow()<br/> {<br/><br/>InitializeComponent();<br/>//log<br/>}<br/><br/>the log is printed out, which means  initializeComponent() is successful, but the our applications crash.<br/><br/>EventType : clr20r3     P1 : bcs.exe     P2 : 2.0.0.0     P3 : 4b0f87b0     <br/>P4 : presentationframework     P5 : 3.0.0.0     P6 : 45398c20     P7 : 6496<br/>P8 : be     P9 : system.windows.markup.xamlparse<br/><br/><br/>Pls help. Thanks in advance.</p>Fri, 27 Nov 2009 09:18:15 Z2009-11-28T05:14:42Zhttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/fb0745f0-6c26-4a9e-b792-3f7e8484b243http://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/fb0745f0-6c26-4a9e-b792-3f7e8484b243alainkkkhttp://social.msdn.microsoft.com/Profile/cs-CZ/?user=alainkkkallow only number in textbox<font face=Arial size=2> <p>hi .. how do i allow only user to key in number in the textbox.. </p> <p align=left>when they try to key in character.. they cant..  how i do that</p> <p align=left>thanks</p></font>Tue, 19 Feb 2008 13:15:11 Z2009-11-28T04:09:01Zhttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/b0f77818-dcd9-4922-b525-77ccaf333181http://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/b0f77818-dcd9-4922-b525-77ccaf333181StevenIBhttp://social.msdn.microsoft.com/Profile/cs-CZ/?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-28T02:58:17Zhttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/3991f75d-a062-46ec-bcf7-fd3306b2c32chttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/3991f75d-a062-46ec-bcf7-fd3306b2c32cNumber Sevenhttp://social.msdn.microsoft.com/Profile/cs-CZ/?user=Number%20SevenRelative resize on listbox items&lt;rant&gt;<br/> Okay, so, WPF is the new Microsoft thing and all and everyone is hyped about it. However, I've found it a pain to work with, coming from a Windows Form and ASPX perspective, because it's like mixing both and messes with your head a lot.<br/> <br/> I'm having a problem here which I posted in a thread where I got no answers (http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/c8f6b2ab-7650-450e-9ac2-ccc631802604). Maybe it's because nobody likes to look at code or it's too much code or whatever, but I've been trying to figure this out for a couple weekends now and it's becoming so stupidly hard I'm thinking to leave WPF until it becomes more intuitive for a developer.<br/> &lt;/rant&gt;<br/> <br/> Anyways, I have a windows form with a 3-row grid layout as shown in thie screenshot <strong>-&gt; <a href="http://omploader.org/vMnU1ag/screen.png">here</a> </strong> <strong>&lt;-</strong> , along with a styled listbox in the 2nd row of the grid. However, the app must be resolution-independent so it doesn't matter if you have a 1920x1200 HDTV or a 640x480 CRT monitor, you should be able to see that the items have the same height.<br/> <br/> In a common resolution, the app should look like <strong>-&gt; <a href="http://omploader.org/vMnZlbg/01.jpg">this</a> </strong> <strong>&lt;-</strong> , but when you resize it to a lower resolution, watch what happens <strong>-&gt; <a href="http://omploader.org/vMnZlbw/02.jpg">here</a> </strong> <strong>&lt;-</strong> . It isn't pretty at all.<br/> <br/> So instead of asking for code (which I didn't anyways, but for those who think I'm just asking for code...) I'm asking what can I do to archieve the same &quot;aspect ratio resizing&quot;, to say it that way. <strong>The problem isn't resizing the listbox (I think) but its items height-wise. If you have widescreen you could look at more items wide but its height should stay relative to the listbox's height.<br/> </strong> <br/> I've tried binding the image's height to the listbox Height or ActualHeight without success. I've tried to put the listbox inside a viewbox which is inside the 2nd grid row with no success, I've tried to use dockpanels, I've tried to put the grid inside a viewbox, etc etc etc. And nothing has helped, so it would be <strong>great</strong> if, you know, somebody replied here or in the other thread... a bit of help would come in handy y'know.<br/> <br/> If you wanna see code, it's in the other thread. I don't wanna repeat it to not to scare readers...<br/> <br/> Anyways, thanks in advance to whoever replies :D.<br/> <br/> - N7<br/>Sat, 28 Nov 2009 00:30:17 Z2009-11-28T02:37:28Zhttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/dad0bdbf-ca15-45a0-bbb9-63273120d867http://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/dad0bdbf-ca15-45a0-bbb9-63273120d867Gehlanhttp://social.msdn.microsoft.com/Profile/cs-CZ/?user=GehlanXmlnsDefinition with CiderI have a custom control library which has a XmlnsDefinition defined in its own AssemblyInfo so i can use all the controls, tools etc in my projects by including this definition.<br/> This works fine in Blend but de Visual Studio Designer (Cider) doesn't  seem te work. It gives the following error:<br/> <br/> Invalid XmlnsDeclaration occurs in assembly '&lt;assembly&gt;'. XmlnsDeclaration references a namespace '&lt;namespace&gt;' that is not in the assembly. <br/> <br/> Like I said, overall it works fine, the program works and designing in Blend works. Only Cider doesn't cooperate.<br/> I've searched for this problem but couldn't find a solution. Is this a known problem and are there any workarounds? (except including all namespaces separately)<br/>Wed, 25 Nov 2009 08:06:07 Z2009-11-28T01:50:49Zhttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/ecf0e10d-3de2-472e-af1d-55299bc66cc3http://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/ecf0e10d-3de2-472e-af1d-55299bc66cc3Mark Macumberhttp://social.msdn.microsoft.com/Profile/cs-CZ/?user=Mark%20MacumberFlickering on some of my modelsIm using WPF and some pretty basic 3D spheres floating around in 3D space. And for some reason, they flicker. But only on the deployment machine, not the Dev machine.<br/> <br/> Can anyone please help me out with how to debug this type of thing?<br/> <br/> It must be something to do with the actual machine, correct? I.e. Video Card?<br/> <br/> Cheers,<br/> MarkFri, 27 Nov 2009 05:26:12 Z2009-11-28T01:41:45Zhttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/23a932c4-4c21-4384-97c4-de2db6806a2dhttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/23a932c4-4c21-4384-97c4-de2db6806a2dGhassanhttp://social.msdn.microsoft.com/Profile/cs-CZ/?user=GhassanShowing a page that runs VBScriptI want to show a web page inside wpf application.<br/> The web page has VBScript which run with the body onload.<br/> I tried to use WPF webBrowser, but the script was not running.<br/> I tried to invoke the script by code using _webbrowser.InvokeScript<br/> but it didn't work as well<br/> Any idea?<br/>Fri, 27 Nov 2009 23:57:39 Z2009-11-28T01:02:25Zhttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/d0de4015-867a-438c-9ff4-9caeadac17ebhttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/d0de4015-867a-438c-9ff4-9caeadac17ebkukushkohttp://social.msdn.microsoft.com/Profile/cs-CZ/?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-27T22:41:05Zhttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/5d88cdf1-e992-4ad4-8f56-b5dbf92dcf1chttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/5d88cdf1-e992-4ad4-8f56-b5dbf92dcf1cHimar1http://social.msdn.microsoft.com/Profile/cs-CZ/?user=Himar1Possible WriteableBitmap Memory Leak? Hi,<br><br>   perhaps someone could help with this issue. Using WriteableBitmap (3.5 SP1) in a WPF app running on Windows XP SP3 and unreferencing it seems to cause a memory leak. <br><br>I wrote a little test application to isolate the problem. It is a simple WPF application with a single window. With the default XAML that VS2005 creates and adding this code behind: <br> <p> </p> <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">    </font><font style="color:blue">public</font><font style="font-size:11px"> partial </font><font style="color:blue">class</font><font style="font-size:11px"> Window1 : System.Windows.Window  </font></td></tr> <tr> <td style="background-color:#f7f7f7">    {  </td></tr> <tr> <td>        </font><font style="color:blue">public</font><font style="font-size:11px"> Window1()  </font></td></tr> <tr> <td style="background-color:#f7f7f7">        {  </td></tr> <tr> <td>            InitializeComponent();  </td></tr> <tr> <td style="background-color:#f7f7f7"> </td></tr> <tr> <td>            Image m = </font><font style="color:blue">new</font><font style="font-size:11px"> Image();  </font></td></tr> <tr> <td style="background-color:#f7f7f7">            m.Stretch = Stretch.Fill;  </td></tr> <tr> <td>            </font><font style="color:blue">this</font><font style="font-size:11px">.Content = m;  </font></td></tr> <tr> <td style="background-color:#f7f7f7"> </td></tr> <tr> <td>            </font><font style="color:blue">this</font><font style="font-size:11px">.SizeChanged+=</font><font style="color:blue">new</font><font style="font-size:11px"> SizeChangedEventHandler(OnSizeChanged);  </font></td></tr> <tr> <td style="background-color:#f7f7f7">        }  </td></tr> <tr> <td> </td></tr> <tr> <td style="background-color:#f7f7f7">        </font><font style="color:blue">private</font><font style="font-size:11px"> </font><font style="color:blue">void</font><font style="font-size:11px"> OnSizeChanged(</font><font style="color:blue">object</font><font style="font-size:11px"> sender, SizeChangedEventArgs args)  </font></td></tr> <tr> <td>        {  </td></tr> <tr> <td style="background-color:#f7f7f7">            WriteableBitmap bm = </font><font style="color:blue">new</font><font style="font-size:11px"> WriteableBitmap((</font><font style="color:blue">int</font><font style="font-size:11px">)args.NewSize.Width, (</font><font style="color:blue">int</font><font style="font-size:11px">)args.NewSize.Height, 96, 96, PixelFormats.Bgr32, </font><font style="color:blue">null</font><font style="font-size:11px">);  </font></td></tr> <tr> <td>            ((Image)</font><font style="color:blue">this</font><font style="font-size:11px">.Content).Source = bm;  </font></td></tr> <tr> <td style="background-color:#f7f7f7">        }  </td></tr> <tr> <td> </td></tr> <tr> <td style="background-color:#f7f7f7">    } </td></tr></tbody></table></div> <p><br>The window has an Image as its content, and the source of the image is an instance of WriteableBitmap. What i want to achieve is to have the WriteableBitmap with the same size as the Window, therefore the window handles its SizeChanged event. <br><br>Running this app on Windows XP (SP3) and resizing the window, and the app starts eating a lot of memory (simply looking at the Process Explorer). During the resize operation the memory consumption increments rapidly and the memory is never freed. This seems to be ocurring only on Windows XP and not in Vista. <br><br>As WriteableBitmap isn't IDisposable, i can't release it. <br><br>Does anyone has any solution or workaround for this problem? Do i miss anything?<br><br>Thanks in advance,<br>Himar.</p>Mon, 03 Nov 2008 23:46:28 Z2009-11-27T22:24:18Zhttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/a4e7ed36-9a8a-48ce-a5d5-00a49376669bhttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/a4e7ed36-9a8a-48ce-a5d5-00a49376669bVadim Dorogininhttp://social.msdn.microsoft.com/Profile/cs-CZ/?user=Vadim%20DorogininXAML binding won't set if the property is initialized in the constructor<div>Hello, everybody!</div> <div><br/></div> <div>I've run into a problem with data-binding inside control template while the property is initialized inside the constructor.</div> <div><br/></div> <div>Here is the show-case (you can also download <a title="sample solution" href="http://www.filehosting.org/file/details/75794/WpfApplication5.zip">sample solution</a>):</div> <div><br/></div> <div>CustomControl1.cs</div> <div><br/></div> <div> <pre lang="x-c#"> public class CustomControl1 : ContentControl { static CustomControl1() { DefaultStyleKeyProperty.OverrideMetadata( typeof(CustomControl1), new FrameworkPropertyMetadata(typeof(CustomControl1))); } public CustomControl1() { Content = &quot;Initial&quot;; // comment this line out and everything // will start working just great } }</pre> <br/></div> <div><br/></div> <div>CustomControl1 style:</div> <div><br/></div> <div> <pre lang=x-xml> &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;Border Background=&quot;{TemplateBinding Background}&quot; BorderBrush=&quot;{TemplateBinding BorderBrush}&quot; BorderThickness=&quot;{TemplateBinding BorderThickness}&quot;&gt; &lt;ContentPresenter /&gt; &lt;/Border&gt; &lt;/ControlTemplate&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Style&gt;</pre> <br/></div> <div><br/></div> <div><br/></div> <div>CustomControl2.cs:</div> <div><br/></div> <div> <pre lang="x-c#"> public class CustomControl2 : ContentControl { static CustomControl2() { DefaultStyleKeyProperty.OverrideMetadata( typeof(CustomControl2), new FrameworkPropertyMetadata(typeof(CustomControl2))); } }</pre> <br/></div> <div><br/></div> <div>CustomControl2 style:</div> <div><br/></div> <div> <pre lang=x-xml> &lt;Style TargetType=&quot;{x:Type local:CustomControl2}&quot;&gt; &lt;Setter Property=&quot;Template&quot;&gt; &lt;Setter.Value&gt; &lt;ControlTemplate TargetType=&quot;{x:Type local:CustomControl2}&quot;&gt; &lt;Border Background=&quot;{TemplateBinding Background}&quot; BorderBrush=&quot;{TemplateBinding BorderBrush}&quot; BorderThickness=&quot;{TemplateBinding BorderThickness}&quot;&gt; &lt;local:CustomControl1 Content=&quot;{Binding Content, RelativeSource={RelativeSource AncestorType=local:CustomControl2}}&quot; /&gt; &lt;/Border&gt; &lt;/ControlTemplate&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Style&gt;</pre> <br/></div> <div><br/></div> <div>Window1.xaml:</div> <div><br/></div> <div> <pre lang=x-xml> &lt;Window x:Class=&quot;WpfApplication5.Window1&quot; xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot; xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot; Title=&quot;Window1&quot; Height=&quot;300&quot; Width=&quot;300&quot; xmlns:local=&quot;clr-namespace:WpfApplication5&quot;&gt; &lt;Grid&gt; &lt;local:CustomControl2 Content=&quot;Some content&quot; /&gt; &lt;/Grid&gt; &lt;/Window&gt;</pre> <br/></div> <div><br/></div> <div><br/></div> <div><br/></div> <div><strong>So, the problem is</strong>: when you launch the app, the content of CustomControl1 appears to be &quot;Initial&quot; which is set by constructor, not the &quot;Some content&quot; string, which is supposed to be set by binding.</div> <div><br/></div> <div>When we remove the initialization from the constructor, the binding starts working.</div> <div><br/></div> <div>First of all, let me predict the answer: &quot;you should set the initial value of a dependency property inside its metadata: either at the moment of registration or by means of metadata overriding capabilities&quot;. Yeap, you right, but the problem with this method of initialization is that the property is of collection type, so if I'll provide `new MyCustomCollection()` as a default value of the property, then every instance of `CustomControl1` will share the same instance of that collection and that's obviously not the idea.</div> <div><br/></div> <div>I've done some debugging on the problem, here are the results:</div> <div><br/></div> <div>  - Binding instance is created, when we put it in element-like syntax and assign `x:Name` to it, then it's accessible through `Template.FindName(&quot;PART_Binding&quot;, this)` inside `OnApplyTemplate`.</div> <div>  - Binding simply isn't set on the property: inside the same `OnApplyTemplate` the code `this.GetBindingExpression(ContentProperty)` return `null`.</div> <div>  - There is nothing wrong with the binding itself: inside `OnApplyTemplate` we can look it up and then we can simply set it on the property like this: `this.SetBinding(ContentProperty, myBinding)` - everything will work fine.</div> <div><br/></div> <div><strong>Can anyone explain how and why that happens?</strong></div> <div><br/></div> <div><strong>Does anyone have a solution for setting non-shared initial value for a dependency property, so the binding wouldn't break?</strong></div> <div><br/></div> <div>The most weird thing is that debug output with highest trace-level is the same for both cases: either when the binding doesn't occur or if it does.</div> <div><br/></div> <div>Here it goes:</div> <div><br/></div> <div> <pre> System.Windows.Data Warning: 52 : Created BindingExpression (hash=18961937) for Binding (hash=44419000) System.Windows.Data Warning: 54 : Path: 'Content' System.Windows.Data Warning: 56 : BindingExpression (hash=18961937): Default mode resolved to OneWay System.Windows.Data Warning: 57 : BindingExpression (hash=18961937): Default update trigger resolved to PropertyChanged System.Windows.Data Warning: 58 : BindingExpression (hash=18961937): Attach to WpfApplication5.CustomControl1.Content (hash=47980820) System.Windows.Data Warning: 62 : BindingExpression (hash=18961937): RelativeSource (FindAncestor) requires tree context System.Windows.Data Warning: 61 : BindingExpression (hash=18961937): Resolve source deferred System.Windows.Data Warning: 63 : BindingExpression (hash=18961937): Resolving source System.Windows.Data Warning: 66 : BindingExpression (hash=18961937): Found data context element: &lt;null&gt; (OK) System.Windows.Data Warning: 69 : Lookup ancestor of type CustomControl2: queried Border (hash=11653293) System.Windows.Data Warning: 69 : Lookup ancestor of type CustomControl2: queried CustomControl2 (hash=54636159) System.Windows.Data Warning: 68 : RelativeSource.FindAncestor found CustomControl2 (hash=54636159) System.Windows.Data Warning: 74 : BindingExpression (hash=18961937): Activate with root item CustomControl2 (hash=54636159) System.Windows.Data Warning: 104 : BindingExpression (hash=18961937): At level 0 - for CustomControl2.Content found accessor DependencyProperty(Content) System.Windows.Data Warning: 100 : BindingExpression (hash=18961937): Replace item at level 0 with CustomControl2 (hash=54636159), using accessor DependencyProperty(Content) System.Windows.Data Warning: 97 : BindingExpression (hash=18961937): GetValue at level 0 from CustomControl2 (hash=54636159) using DependencyProperty(Content): 'Some content' System.Windows.Data Warning: 76 : BindingExpression (hash=18961937): TransferValue - got raw value 'Some content' System.Windows.Data Warning: 85 : BindingExpression (hash=18961937): TransferValue - using final value 'Some content'</pre> <br/></div> <div><br/></div> <div> <div>Thanks in advance!</div> </div>Fri, 27 Nov 2009 20:32:32 Z2009-11-27T20:32:33Zhttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/3bc78717-b2a2-4c26-8f17-796cecd63024http://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/3bc78717-b2a2-4c26-8f17-796cecd63024sjb500http://social.msdn.microsoft.com/Profile/cs-CZ/?user=sjb500Help with MVVM design<p>Hi<br/><br/>I'm pretty new to WPF but have already done much reading - esp <a href="http://blogs.msdn.com/vinsibal/archive/2009/04/10/launching-a-custom-dialog-to-edit-items-in-a-datagrid-with-mvvm.aspx">http://blogs.msdn.com/vinsibal/archive/2009/04/10/launching-a-custom-dialog-to-edit-items-in-a-datagrid-with-mvvm.aspx</a> - on the MVVM pattern and I have started a fairly simple application. There is one screen in the app where the user can choose to double click a row in a DataGrid to open up a separate Dialog window - the user can then update the associated data and close the window. My issue is how do I then refresh the calling parent window (using MVVM principles) which happens to contain a couple of related DataGrids. The last line in my code that executes appears to be that within the ICommand method of the ItemViewModel, namely<br/><br/>Item=dlg.Result.Item;<br/><br/>Has anyone got an example of this type of behaviour or otherwise can help?<br/><br/>Thanks</p>Fri, 27 Nov 2009 18:00:51 Z2009-11-27T19:45:09Zhttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/e06ea580-7d33-43ea-b0fc-80749c6bbb45http://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/e06ea580-7d33-43ea-b0fc-80749c6bbb45Jomar Saleshttp://social.msdn.microsoft.com/Profile/cs-CZ/?user=Jomar%20SalesWPF and Windows Form - ProblemHi,<br/><br/>I´m a .net brazilian developer and i´m starting in WPF. My aplication WPF have windows forms and when i try to call them the aparence change to windows classic. That .net aparece is lose, i don´t know why. Samebory help me?<br/><br/>thank´s.<br/><br/>Jomar Sales<br/>Objetiva Soluções<br/>Linhares-ES - BrazilWed, 25 Nov 2009 10:17:45 Z2009-11-27T19:32:40Zhttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/28a8c8b8-35ca-43e2-af13-e0322c0f3542http://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/28a8c8b8-35ca-43e2-af13-e0322c0f3542assassin316http://social.msdn.microsoft.com/Profile/cs-CZ/?user=assassin316What kind of limitation is this ???I am in shock that such a limitation exists in an architecture as advanced in WPF, let me explain.... <div><br /></div> <div>SCENARIO:</div> <div><br /></div> <div>I've created a UseControl, which is actually an INHERITED Border control. Once done, I used this new control in a window and started placing my Labels, TextBoxes, ComboBoxes, etc...</div> <div><br /></div> <div>So far so good. Once that was done, I went back to these input controls and gave them Names with x:Name, so for example my Label control would be called lblTitle, and so on.</div> <div><br /></div> <div>PROBLEM:</div> <div><br /></div> <div>When I compiled, I got the following error:</div> <div><br /></div> <div>"<span style="font-family: consolas, 'bitstream vera sans mono', monaco, 'lucida console', 'courier new', courier, serif, monospace; font-size: 12px; color: #666666;">Cannot set Name attribute value 'lblTitle' on element 'Label'. 'Label' is under the scope of element 'CustomBorder', which already had a name registered when it was defined in another scope.<span style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px;">"</span></span></div> <div><br /></div> <div>So at this point, I thought I did something wrong, but then I came across this article...</div> <div><br /></div> <div><a href="http://blog.bluecog.co.nz/archives/2007/08/27/wpf-cannot-set-name-attribute/">http://blog.bluecog.co.nz/archives/2007/08/27/wpf-cannot-set-name-attribute/</a></div> <div><br /></div> <div><br /></div> <div><br /></div> <div>Can someone please explain why this limitation exists? I am currently believing that maybe this is a bug in WPF?</div> <div><br /></div>Fri, 09 Oct 2009 15:47:23 Z2009-11-27T19:28:26Zhttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/ad0f8a6a-1f2e-4b72-adeb-9a7da20e8f97http://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/ad0f8a6a-1f2e-4b72-adeb-9a7da20e8f97Igor Kondrasovashttp://social.msdn.microsoft.com/Profile/cs-CZ/?user=Igor%20KondrasovasDataGrid RowEditEnding with MessageBox ProblemHello,<br/><br/>I have a list of business objects (the list is derived from an ObserveableCollection) bound to a WPFDataGrid.<br/><br/>When the RowEditEnding event is fired, I make some verifications and in some situations I must show a message box to the user. <br/><br/>The problem is that when the user clicks &quot;ok&quot; in the MessageBox, the RowEditEnding event is fired again, show the message again, and it repeates all over continuously !!<br/><br/>I have tried using the e.Cancel property, but with no efect.<br/><br/>If I don´t display the MessageBox the problem does not occcurs.<br/><br/>How can I workaround this?<br/><br/>Kindly Regards,<br/><br/>Igor.<hr class="sig">Project Manager at INOVATIVA Tecnologia www.inovativatec.comFri, 27 Nov 2009 19:07:31 Z2009-11-28T10:01:43Zhttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/64ed823d-ec02-46fd-899f-50ee48966217http://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/64ed823d-ec02-46fd-899f-50ee48966217MauroGvhttp://social.msdn.microsoft.com/Profile/cs-CZ/?user=MauroGvoverride metadata in Custom ControlHi all,<br/>I create a customControl TextBox that inherits from TextBox.<br/>I want add in the TextProperty the event handler OnTextChanged and put new code in the Text set accessory.<br/>I tried in this way:<br/><br/> <pre lang=x-xml>public class ValidateFileNameTextBox : TextBox { public new string Text { get { return (string)base.GetValue(TextProperty); } set { if (value.IndexOfAny(System.IO.Path.GetInvalidFileNameChars(), 0) &gt; -1) return; base.SetValue(TextProperty, value); } } private static void OnTextChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) { ValidateFileNameTextBox validateFileNameTextBox = ((ValidateFileNameTextBox)sender); validateFileNameTextBox.IsValidFileName = validateFileNameTextBox.Text.Length == 0 ? false : true; } public bool isValidFileName; static ValidateFileNameTextBox() { DefaultStyleKeyProperty.OverrideMetadata(typeof(ValidateFileNameTextBox), new FrameworkPropertyMetadata(typeof(ValidateFileNameTextBox))); TextProperty.OverrideMetadata(typeof(string), new PropertyMetadata(new PropertyChangedCallback(OnTextChanged))); } protected override void OnPreviewTextInput(TextCompositionEventArgs e) { if ((Array.IndexOf(System.IO.Path.GetInvalidFileNameChars(), (char)e.Text.ToCharArray()[0]) &gt;= 0)) { e.Handled = true; } base.OnPreviewTextInput(e); } } </pre> <br/><br/><br/>The code is not running,<br/>I get this error in designer:<br/>Could not create an instance of type ValidateFileNameTextBox.<br/><br/>I added in the static default constructor the OverrideMetadata for the TextProperty and I thougth it was enough, but it's wrong.<br/>My Second problem is manage code in Set Text.<br/>Is correct using the new keyword to hide the base property??<br/><br/>Best Regards,<br/>Mauro<br/><hr class="sig">MauroFri, 27 Nov 2009 14:19:15 Z2009-11-27T17:03:27Zhttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/76a88021-3701-4d39-99cb-5c1472da03cahttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/76a88021-3701-4d39-99cb-5c1472da03caTMLinchttp://social.msdn.microsoft.com/Profile/cs-CZ/?user=TMLincTabControl > TabItem.Header > Image Source with IsSelected PropertyHi,<br/> <br/> How do I change an image source within my TabControl &gt; TabItem &gt; TabItem.Header using triggers?  Here's what I have so far:<br/> <br/> <pre lang=x-xml> &lt;TabControl Name=&quot;tabctlMainTab&quot; Style=&quot;{StaticResource PrimaryTabControl}&quot; SelectionChanged=&quot;MainTab_SelectionChanged&quot; Background=&quot;Transparent&quot;&gt; &lt;TabItem IsSelected=&quot;True&quot;&gt; &lt;TabItem.Header&gt; &lt;Image Name=&quot;imgProjectCreate&quot; Style=&quot;{StaticResource PrimaryTabItemImage}&quot; Source=&quot;/PROJECT.Desktop;component/Images/PrimaryTabs/tab_left_create_project_on.png&quot; /&gt; &lt;/TabItem.Header&gt; &lt;TabItem.Style&gt; &lt;Style BasedOn=&quot;{StaticResource PrimaryTabItem}&quot; TargetType=&quot;{x:Type TabItem}&quot;&gt; &lt;Setter Property=&quot;Template&quot;&gt; &lt;Setter.Value&gt; &lt;ControlTemplate TargetType=&quot;{x:Type TabItem}&quot;&gt; &lt;ControlTemplate.Triggers&gt; &lt;Trigger Property=&quot;IsSelected&quot; Value=&quot;True&quot;&gt; &lt;Setter TargetName=&quot;imgProjectCreate&quot; Property=&quot;Source&quot; Value=&quot;/PROJECT.Desktop;component/Images/PrimaryTabs/tab_left_create_project_on.png&quot; /&gt; &lt;/Trigger&gt; &lt;/ControlTemplate.Triggers&gt; &lt;/ControlTemplate&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Style&gt; &lt;/TabItem.Style&gt; &lt;/TabItem&gt; &lt;TabItem Style=&quot;{StaticResource PrimaryTabItem}&quot;&gt; &lt;TabItem.Header&gt; &lt;Image Style=&quot;{StaticResource PrimaryTabItemImage}&quot; Source=&quot;/PROJECT.Desktop;component/Images/PrimaryTabs/tab_left_modify_project_off.png&quot; /&gt; &lt;/TabItem.Header&gt; &lt;/TabItem&gt; &lt;/TabControl&gt; <br/> </pre> <br/> But, I get this error:<br/> <br/> <strong>Cannot find the Trigger target 'imgProjectCreate'.  (The target must appear before any Setters, Triggers, or Conditions that use it.)</strong> <br/> <br/> <br/> I'm completely new to WPF and XAML so any help would be greatly appreciated.<br/> <br/> Thanks!Fri, 27 Nov 2009 16:34:19 Z2009-11-27T16:34:19Zhttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/2d5949aa-358f-4fe5-b760-16ea3e3f9035http://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/2d5949aa-358f-4fe5-b760-16ea3e3f9035Jasterhttp://social.msdn.microsoft.com/Profile/cs-CZ/?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-27T16:30:05Zhttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/9c810072-5ed7-4eac-bbc2-8893e81825bbhttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/9c810072-5ed7-4eac-bbc2-8893e81825bbMichaelLeipzighttp://social.msdn.microsoft.com/Profile/cs-CZ/?user=MichaelLeipzigAutomatic loading ResourceDictionaries in a referenced dllHello,<br/> <br/> I've created a project in VS2008 with some ResourceDictionaries for colors, default styles and images. Now I want to use these resources in another project by referencing this project output dll. At the moment I have to add following code to the projects App.xaml's resources:<br/> <br/> &lt;Application.Resources&gt;<br/>   &lt;ResourceDictionary Source=&quot;pack://application:,,,Resources.dll;component/Resources.xaml&quot; /&gt;<br/> &lt;/Application.Resources&gt;<br/> <br/> I there any way to enable my application to use these Resources automatically? I've tried to create a Folder in my resource project called &quot;Themes&quot;, created a generic.xaml and put my Resources.xaml in it, but it doesn't work.Fri, 27 Nov 2009 10:03:09 Z2009-11-27T15:42:47Zhttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/a7226806-d218-40fc-b8bd-aed2cc66a93ahttp://social.msdn.microsoft.com/Forums/cs-CZ/wpf/thread/a7226806-d218-40fc-b8bd-aed2cc66a93aAlekshttp://social.msdn.microsoft.com/Profile/cs-CZ/?user=AleksComposite Application Library : How to have a dedicated config file per module ?Hi there,<br/><br/>I'm using Composite Application Library to build a WPF application.<br/>I'd like to have a configuration file (app.config) for every modules. So, this configuration file should be loaded on demand and accessed only by the module itself.<br/><br/>Does someone have gone threw this type of problematic and get a solution ?<br/><br/>Thank you!<hr class="sig">www.Dotnet-Project.comFri, 27 Nov 2009 15:37:05 Z2009-11-27T15:37:06Z