As you might expect, using this control was straightforward and it worked just like I wanted. There was one small catch: my List View was hooked up to a data source that changed dynamically (via a Binding on its Items Source property) and I noticed that when the data source was updated, the widths of the columns were not automatically adjusted to fit the new content.
Here's a sample application I wrote for this post - notice how the text in the first List View's "Value" column is truncated because the columns widths have not been updated: This behavior was kind of annoying - and a brief web search showed that I'm hardly the first person to want to change it.
property in WPF is extremely handy, because it is automatically inherited by all children of the element where you assign it; therefore you don’t need to set it again on each element you want to bind.
However, in some cases the is not accessible: it happens for elements that are not part of the visual or logical tree.
To make it work, I started the job in the Content Changed method to be sure the content is rendered once first.
Notice that it’s necessary only when you need to execute a long-running job on the UI-thread.
By day, Michael is a solutions architect at Amerisource Bergen Specialty Group where he delivers high quality enterprise software in . By night, he writes mobile applications in Java for the Andriod platform.:) Okay, so if you're still reading, then your scenario is probably like mine: changes to the data source can occur without the application explicitly knowing about it.That last bit may not make a lot of sense until you realize that it's possible to implement a great deal of an application's functionality entirely in XAML.WPF is really awesome to build reactive applications and data binding is here to push useful information inside of the User Interface.All is done magically and it’s wonderfully simple to create an application without knowledge of the internals of the WPF’s rendering.Specifically, it's quite easy to connect a List View to the Selected Item property of a List Box so that changes to the selected item of the List Box automatically re-populate the data in the List View.