<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Editing Tabular Data in WPF - Building a WPF Grid</title><link>http://blogs.msdn.com/bethmassi/archive/2008/09/15/editing-tabular-data-in-wpf-building-a-wpf-grid.aspx</link><description>In my last post on WPF I showed how you could use a Winforms DataGridView on a WPF form in order to edit data in a tabular style. Today I'll show you how you can customize the WPF ListView in order to edit data without having to use any Winforms controls</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>funny wallpaper &amp;raquo; Editing Tabular Data in WPF - Building a WPF Grid</title><link>http://blogs.msdn.com/bethmassi/archive/2008/09/15/editing-tabular-data-in-wpf-building-a-wpf-grid.aspx#8953367</link><pubDate>Tue, 16 Sep 2008 05:19:07 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8953367</guid><dc:creator>funny wallpaper &amp;raquo; Editing Tabular Data in WPF - Building a WPF Grid</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://housesfunnywallpaper.cn/?p=5855"&gt;http://housesfunnywallpaper.cn/?p=5855&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>re: Editing Tabular Data in WPF - Building a WPF Grid</title><link>http://blogs.msdn.com/bethmassi/archive/2008/09/15/editing-tabular-data-in-wpf-building-a-wpf-grid.aspx#8955422</link><pubDate>Wed, 17 Sep 2008 15:54:06 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8955422</guid><dc:creator>Logan</dc:creator><description>&lt;p&gt;Sorry for the off topic post, but I just noticed that this blog looks very much like WordPress... only difference (and the reason I'm confused now) is that it's not coded in php...&lt;/p&gt;
</description></item><item><title>re: Editing Tabular Data in WPF - Building a WPF Grid</title><link>http://blogs.msdn.com/bethmassi/archive/2008/09/15/editing-tabular-data-in-wpf-building-a-wpf-grid.aspx#8955530</link><pubDate>Wed, 17 Sep 2008 16:59:14 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8955530</guid><dc:creator>Logan</dc:creator><description>&lt;p&gt;Hi Beth,&lt;/p&gt;
&lt;p&gt;Not to be snobbish or mean or anything, but I noticed a typo in this post lol:&lt;/p&gt;
&lt;p&gt;&amp;quot;... focus on the XAML ...&amp;quot;&lt;/p&gt;
&lt;p&gt;Logan&lt;/p&gt;
&lt;p&gt;P.S. Sorry for abusing your blog today :P&lt;/p&gt;
</description></item><item><title>re: Editing Tabular Data in WPF - Building a WPF Grid</title><link>http://blogs.msdn.com/bethmassi/archive/2008/09/15/editing-tabular-data-in-wpf-building-a-wpf-grid.aspx#8955808</link><pubDate>Wed, 17 Sep 2008 19:54:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8955808</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi Logan,&lt;/p&gt;
&lt;p&gt;That's not a typo. XAML is the markup language used in WPF (Windows Presentation Foundation). Start here: &lt;a rel="nofollow" target="_new" href="http://msdn.microsoft.com/en-us/library/ms754130.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms754130.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;HTH,&lt;/p&gt;
&lt;p&gt;-B&lt;/p&gt;
</description></item><item><title>Silverlight Cream for September 17, 2008 -2 -- #371</title><link>http://blogs.msdn.com/bethmassi/archive/2008/09/15/editing-tabular-data-in-wpf-building-a-wpf-grid.aspx#8956037</link><pubDate>Wed, 17 Sep 2008 22:17:58 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8956037</guid><dc:creator>Community Blogs</dc:creator><description>&lt;p&gt;Chris Cavenagh has his YouCube interactive, Jesse Liberty on Custom Controls, Pete Brown with SL TechFest&lt;/p&gt;
</description></item><item><title>re: Editing Tabular Data in WPF - Building a WPF Grid</title><link>http://blogs.msdn.com/bethmassi/archive/2008/09/15/editing-tabular-data-in-wpf-building-a-wpf-grid.aspx#8957090</link><pubDate>Thu, 18 Sep 2008 13:25:51 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8957090</guid><dc:creator>Logan</dc:creator><description>&lt;p&gt;Hi Beth,&lt;/p&gt;
&lt;p&gt;Boy do I feel like a n00b now lol my bad, keep up the awesome blog :-)&lt;/p&gt;
</description></item><item><title>re: Editing Tabular Data in WPF - Building a WPF Grid</title><link>http://blogs.msdn.com/bethmassi/archive/2008/09/15/editing-tabular-data-in-wpf-building-a-wpf-grid.aspx#8957227</link><pubDate>Thu, 18 Sep 2008 15:40:44 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8957227</guid><dc:creator>Logan</dc:creator><description>&lt;p&gt;Hey again Beth,&lt;/p&gt;
&lt;p&gt;Just been having a quick look at the link you gave me (can't really browse much at work) and I can't wait to get into using WPF.&lt;/p&gt;
&lt;p&gt;I just have one worry: I'm still trying to learn vb.NET (I'm only starting to dive into data access and the like). I'm just concerned with the possibility that by the time I've learned what I need to know as a foundation, there's something out that's replaced WPF...&lt;/p&gt;
&lt;p&gt;Any suggestions about the best way you think I should learn would be great.&lt;/p&gt;
&lt;p&gt;Logan&lt;/p&gt;
</description></item><item><title>re: Editing Tabular Data in WPF - Building a WPF Grid</title><link>http://blogs.msdn.com/bethmassi/archive/2008/09/15/editing-tabular-data-in-wpf-building-a-wpf-grid.aspx#8992565</link><pubDate>Thu, 09 Oct 2008 10:57:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8992565</guid><dc:creator>Faliq</dc:creator><description>&lt;p&gt;Hi Beth,&lt;/p&gt;
&lt;p&gt;Im using VS2005. Is it possible to delete row&lt;/p&gt;
&lt;p&gt;in gridview using button?&lt;/p&gt;
&lt;p&gt;How to do that?&lt;/p&gt;
</description></item><item><title>re: Editing Tabular Data in WPF - Building a WPF Grid</title><link>http://blogs.msdn.com/bethmassi/archive/2008/09/15/editing-tabular-data-in-wpf-building-a-wpf-grid.aspx#9193576</link><pubDate>Thu, 11 Dec 2008 03:35:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9193576</guid><dc:creator>Jeff Lewis</dc:creator><description>&lt;p&gt;I don't mean to siss on your parade, but you've hit almost everything that bugs me about WPF in one post.&lt;/p&gt;
&lt;p&gt;&amp;quot;WPF gives us the ultimate flexibility when it comes to designing our UI, it just takes learning what XAML we need to get the job done.&amp;quot; &lt;/p&gt;
&lt;p&gt;Well, technically, other than UI enhancements which come from other assemblies which are (but didn't need to be) designed to work primarily with WPF, there's nothing I can see here that can't be done with WinForms. On the other hand, to use WPF, as you note, it takes learning XAML (which is large, complex, syntax-free and poorly documents) - BUT - also requires knowing traditional .Net anyway. And if you're learning .Net - you'll be learning WinForms except that with WPF, get ready to a LOT of typing just to deal with the basics (ever notice that everyone who demos WPF *types* the XAML in?)Sooo... &lt;/p&gt;
&lt;p&gt;And as for &amp;quot;ultimate flexibility&amp;quot;, this is what class inheritence and the mighty override is for.&lt;/p&gt;
&lt;p&gt;&amp;quot;Unlike the last example that used a Winforms DataGridView, we can't use the designer in Visual Studio 2008 to automatically data bind our data to WPF controls and set up our object instances, so we'll need to set that up manually[...]&amp;quot; Again, we're back into manual mode here. In WinForms, it's a three step process that's braindead easy: create a connection to the database (no coding), create a data source that's bound to the connect (no coding), drag the datasource to the form and voila - it not only creates a form, it adds a navigator to the project and wires most of it for me.&lt;/p&gt;
&lt;p&gt;Even the code that gets generated is simpler and less 'magic' oriented (by which I mean - everything you need is in the same language and is connected obviously - unlike XAML.)&lt;/p&gt;
&lt;p&gt;To me, WPF feels like something invented to make web-designers feel like programmers, which would be fine if they also designed it to make it compatible with existing technologies.&lt;/p&gt;
&lt;p&gt;Was there really a need to come up with an entirely new paradigm just to create flashy UI?&lt;/p&gt;
</description></item><item><title>re: Editing Tabular Data in WPF - Building a WPF Grid</title><link>http://blogs.msdn.com/bethmassi/archive/2008/09/15/editing-tabular-data-in-wpf-building-a-wpf-grid.aspx#9194475</link><pubDate>Thu, 11 Dec 2008 05:55:11 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9194475</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi Jeff,&lt;/p&gt;
&lt;p&gt;Why did we move from DOS entry screens to windows forms? I had the exact same arguments before I started learning WPF as well. And no-one is telling you to move. Of course most line-of-business applications do not need much more than grey forms with black labels. You don't have to move if you don't want to move. And WPF and Winforms do interoperate so you can even use both if you need to.&lt;/p&gt;
&lt;p&gt;And we do know that there is a huge cry for RAD designers for WPF when working with data --- *especially* from me! And that's why they are adding it to the next version of Visual Studio. I actually showed some of the drag-drop WPF data binding in one of my sessions at DevTeach and people were excited and relieved to see the similar type of RAD development we have with Windows Forms today. &lt;/p&gt;
&lt;p&gt;Here's a demo of the feature if you are interested:&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://blogs.msdn.com/bethmassi/archive/2008/11/26/channel-9-interview-wpf-drag-drop-data-binding-in-visual-studio-2010.aspx"&gt;http://blogs.msdn.com/bethmassi/archive/2008/11/26/channel-9-interview-wpf-drag-drop-data-binding-in-visual-studio-2010.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;-B&lt;/p&gt;
</description></item><item><title>re: Editing Tabular Data in WPF - Building a WPF Grid</title><link>http://blogs.msdn.com/bethmassi/archive/2008/09/15/editing-tabular-data-in-wpf-building-a-wpf-grid.aspx#9211988</link><pubDate>Sun, 14 Dec 2008 01:21:53 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9211988</guid><dc:creator>John</dc:creator><description>&lt;p&gt;Beth - thanks! &amp;nbsp;I was trying to figure out how to get the selected row to change when a control within it got focus. &amp;nbsp;I kept trying to capture the Click event, but that always gets handled by the control and stops bubbling. &amp;nbsp;GotFocus makes more sense though, since clicking isn't always how controls get focus!&lt;/p&gt;
</description></item><item><title>re: Editing Tabular Data in WPF - Building a WPF Grid</title><link>http://blogs.msdn.com/bethmassi/archive/2008/09/15/editing-tabular-data-in-wpf-building-a-wpf-grid.aspx#9246117</link><pubDate>Mon, 22 Dec 2008 05:24:04 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9246117</guid><dc:creator>lwin mg soe</dc:creator><description>&lt;p&gt;hello..&lt;/p&gt;
&lt;p&gt;I can't call the method BindingListCollectionView.Addnew&lt;/p&gt;
&lt;p&gt;why?&lt;/p&gt;</description></item><item><title>re: Editing Tabular Data in WPF - Building a WPF Grid</title><link>http://blogs.msdn.com/bethmassi/archive/2008/09/15/editing-tabular-data-in-wpf-building-a-wpf-grid.aspx#9250876</link><pubDate>Wed, 24 Dec 2008 00:00:27 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9250876</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi Iwin,&lt;/p&gt;
&lt;p&gt;Make sure you're using SP1: &lt;a rel="nofollow" target="_new" href="http://msdn.microsoft.com/en-us/vstudio/products/cc533448.aspx"&gt;http://msdn.microsoft.com/en-us/vstudio/products/cc533448.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;HTH,&lt;/p&gt;
&lt;p&gt;-B&lt;/p&gt;
</description></item><item><title>re: Editing Tabular Data in WPF - Building a WPF Grid</title><link>http://blogs.msdn.com/bethmassi/archive/2008/09/15/editing-tabular-data-in-wpf-building-a-wpf-grid.aspx#9286540</link><pubDate>Wed, 07 Jan 2009 03:23:26 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9286540</guid><dc:creator>Ed</dc:creator><description>&lt;p&gt;I've got a question for you. &amp;nbsp;In this example, you have one listview and one click event. &amp;nbsp;What if your form has say 5 listviews? &amp;nbsp;Right now the only way I can get it to work is to replicate this function 5 times referring to each of the 5 listviews. &amp;nbsp;Is there a way you can find the name of the listview of the listviewitem that got clicked? &amp;nbsp;That way you only need to code one event handler for all 5 listviews.&lt;/p&gt;
&lt;p&gt;Private Sub Item_GotFocus(ByVal sender As System.Object, _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ByVal e As System.Windows.RoutedEventArgs)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Dim item = CType(sender, ListViewItem)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Me.ListView1.SelectedItem = item.DataContext&lt;/p&gt;
&lt;p&gt;End Sub&lt;/p&gt;</description></item><item><title>re: Editing Tabular Data in WPF - Building a WPF Grid</title><link>http://blogs.msdn.com/bethmassi/archive/2008/09/15/editing-tabular-data-in-wpf-building-a-wpf-grid.aspx#9300850</link><pubDate>Fri, 09 Jan 2009 02:16:38 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9300850</guid><dc:creator>Ed</dc:creator><description>&lt;p&gt;I found a solution to my previous post.&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://www.codeplex.com/wpf/Wiki/View.aspx?title=Single-Click%20Editing&amp;amp;referringTitle=Tips%20%26%20Tricks"&gt;http://www.codeplex.com/wpf/Wiki/View.aspx?title=Single-Click%20Editing&amp;amp;referringTitle=Tips%20%26%20Tricks&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Add a function to find the parent control using VisualTreeFinder.&lt;/p&gt;
&lt;p&gt;Private Function FindVisualParent(Of T As UIElement)(ByVal element As UIElement) As T&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim parent As UIElement = element&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;While Not parent Is Nothing&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim correctlyTyped As T = TryCast(parent, T)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;If Not correctlyTyped Is Nothing Then&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Return correctlyTyped&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;End If&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;parent = VisualTreeHelper.GetParent(parent)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;End While&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Return Nothing&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;End Function&lt;/p&gt;
&lt;p&gt;then rewrite the eventhandler to use the findvisualparent function&lt;/p&gt;
&lt;p&gt;Private Sub Items_GotFocus(ByVal sender As Object, ByVal e As RoutedEventArgs)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim item As ListViewItem = CType(sender, ListViewItem)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim listview As ListView = FindVisualParent(Of ListView)(item)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;listview.SelectedItem = item.DataContext&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;End Sub&lt;/p&gt;</description></item><item><title>re: Editing Tabular Data in WPF - Building a WPF Grid</title><link>http://blogs.msdn.com/bethmassi/archive/2008/09/15/editing-tabular-data-in-wpf-building-a-wpf-grid.aspx#9300885</link><pubDate>Fri, 09 Jan 2009 02:27:52 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9300885</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi Ed,&lt;/p&gt;
&lt;p&gt;Thanks for posting this back. That's basically what I was fooling around with as well. I was trying to find a cleaner way but in the 20 minutes I spent on it today I didn't see one. Thanks for posting the code!&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;-Beth&lt;/p&gt;
</description></item></channel></rss>