datatemplates

How to get DataTemplate.DataTrigger to check for greater than or less than?

The following DataTemplate.DataTrigger makes the age display red if it is equal to 30. How do I make the age display red if it is greater than 30? <DataTemplate DataType="{x:Type local:Customer}"> <Grid x:Name="MainGrid" Style="{StaticResource customerGridMainStyle}"> <Grid.ColumnDefinitions> <ColumnDefinition W...

In MVVM are DataTemplates considered Views as UserControls are Views?

In MVVM, every View has a ViewModel. A View I understand to be a Window, Page or UserControl to which you can attach a ViewModel from which the view gets its data. But a DataTemplate can also render a ViewModel's data. So I understand a DataTemplate to be another "View", but there seem to be differences, e.g. Windows, Pages, and UserCo...

Dynamic Datatemplate in WPF

Hi, I have a requirement that based on the User who logged in to my application I need to show a different view. How can I achieve this using datatemplates? Thanks, Jithu ...

Converting WPF Datatemplates using x:Type to Silverlight

Hi. I have a WPF app that uses x:type when working with datatemplates. This doesn't work in Silverlight out of the box, but I can remember that I saw something some time ago in a googlegroup where they where talking about Silverlight Extensions and how that could be used. If anyone knows what I am talking about or knows how I can reuse...

WPF TabControl and DataTemplates

I've got a set of ViewModels that I'm binding to the ItemsSource property of a TabControl. Let's call those ViewModels AViewModel, BViewModel, and CViewModel. Each one of those needs to have a different ItemTemplate (for the header; because they each need to show a different icon) and a different ContentTemplate (because they have very d...

Custom controls in a row of a list view

I want a list view control (or any list like control) in which each row (item), not only has text, but also some other controls. For example, each row (item) in my list view is composed of a checkbox, button, a slider, a image and a label. I tried the corresponding renderer classes (CheckBox renderer) in the owner drawn event, but i am n...

How to use DataTemplates in Prism

I have been using Prism for a while now and enjoy how much easier it is to decouple my modules. This works especially great for views and view models since you can inject the view models via interfaces and the views via the region manager. Unfortunately this only works when my views are full blown user controls unless I'm missing somet...

Data Binding, DataTemaplates and DataSets... Data Bound TextBox not Updating Underlying Source?

Hi Guys In my WPF App I've got a ListBox. This ListBox is bound to a Dataset(i used the Click-Drag Method onto the Window). The Listbox has a DataTemplate, and the Elements(TextBox's) of this DataTemplate is Bound to the Columns of the Dataset. All works well, the ListBox displays the information correctly. The Problem i'm having is w...

Binding Items inside a DataTemplate with Items from another DataTemplate

Hi Everyone, I have two Data Template (one for drawing[draw] and another for Input Data[data]) Also I have the two ContentControls which uses the above DataTemplates. I want the both DataTemplate's elements to be binded so that when the user fills in a field in the data form DateTemplate it automatically updates the draw Template as well...

Content generated from ContentTemplate does not have DataContext of Silverlight ContentControl set

In my Silverlight 4 application, I have a ContentControl with its ContentTemplate property bound to a property in the data context. That works fine. However, the content of the template once rendered has its DataContext set to null. I would like the content to inherit the same DataContext as set for the ContentControl. Is there a way...

Are recursive DataTemplates possible?

I have a class something like: public class Section { private IEnumerable<Section> sections; private IEnumerable<KeyValuePair<string, string>> attributes public string Name {get;set;} public IEnumerable<Section> Sections { get {return sections;} } public IEnumerable<KeyValuePair<string, string>> Attr...

Filtering a hierarchical object displayed with nested xaml data templates

I'm having trouble filtering hierarchical data that's being displayed in nested xaml templates. I've got a ObservableCollection<Foo> Foos, that I'm displaying in XAML. Lets say Foo looks like: class Foo { public ObservableCollection<Bar> Bars; } class Bar { public ObservableCollection<Qux> Quxes; } I'm displaying Foos with ...

How do I bind a generic window to an arbitrary view model at runtime, using DataTemplates?

I have a large number of ViewModel classes. For each of these classes, there is a corresponding .xaml file which is a 'UserControl'. In my App.xaml, I have them registered as DataTemplates, like so: <DataTemplate DataType="{x:Type viewModel:MainMenuViewModel}"> <view:MainMenuView/> </DataTemplate> With the idea being that WPF w...