datatemplateselector

Explicitly refresh DataTemplate from a DataTemplateSelector?

Hello. I set up a ContentControl.DataTemplateSelector to my desired one. I want that according to a command or whatever, call the ContentControl to reselect the template from the selector by either xaml or code. Thank ...

WPF - How to properly reference a class from XAML

OK, this is a super super noob question, one that I'm almost embarrassed to ask... I want to reference a class in my XAML file. It's a DataTemplateSelector for selecting the right edit template for a DataGrid column. Anyway, I've written the class into my code behind, added the local namespace to the top of top of the XAML, but when I ...

WPF - Getting the value of one a DataGridCell from within DataTemplateSelector

Hi, I'm using DataTemplateSelector with the WPFToolkit DataGrid. I want to select the editing template for one cell based on the value of another cell on the same row. The DataTemplateSelector's SelectTemplate method takes two arguments: one is the data item displayed by the grid row, the other is the grid cell. What I want to know is...

How to specify unique container styles for heterogenous hierarchies using SL3 and TreeView control

Hello, Just look for strategies that have been successful in rendering hierarchies that represent inheritance structures using SL3/4 TreeViews. I need to render certain nodes differently than others, depending upon what kind of container they are (a choice between things, or simply a list of related things, etc.) So far, I've been ver...

WPF DataGrid Binding to datatable

This is driving me nuts. I am creating a DataGrid in code and then binding it to a datatable. This is dynamic and the rows and columns will be different everytime the grid is created. Basically I loop through my datatable and create DataGrid columns for each column, like this: private static void CreateDataGridColumns(DataGrid datagr...

.NET4 WPF Datagrid - Responding to different datatypes

I'm a novice programmer and I've been doing it more as a hobby then a career. As such I'm putting together an application for generating invoices for company I work for. I have the invoicing stuff working which takes in data feeds from our suppliers and matches up customers, products and rates etc. and produces the invoices. I'm now tryi...

WPF: Reapply DataTemplateSelector when a certain value changes

So here is the XAML that I have: <ItemsControl ItemsSource="{Binding Path=Groups}" ItemTemplateSelector="{Binding RelativeSource={RelativeSource AncestorType=Window}, Path=ListTemplateSelector}"/> Here is my ListTemplateSelector class: public class ListTemplateSelector : DataTemplateSelector { public DataTemplate GroupTemplate { get;...

How do I apply a DataTemplate in a Dynamic Grid?

Hello, I have a Grid. The grid's columns are auto-generated at run-time based on the user's selection. I need the cells in the grid to be red if the content is a negative number. I have created a DataTemplateSelector. The DataTemplateSelector get's correctly called and returns my template if the cell is negative. Since my columns...

WPF ComboBox Key Index not working when using data template selector

Hi all, I have a problem regarding WPF combobox when using data template selector. Basically, WPF combobox has a standard behaviour which will take you directly to the item that starts from a character if you type that character using keyboard. I don't know the official name for this functionality and will temporarily call it "Key Inde...

DataTemplateSelector to refresh on button click...

Hi, I have a DataTemplateSelector which I have attached to a cell in my list view. There is a button on each of the rows in the list view. When the user clicks on the button or double clicks on the row, I need to check for errors and update the row's appearance accordingly. How can I invoke my DataTemplateSelector based in the button cli...