datatemplate

Can you use a CollectionViewSource inside a DataTemplate?

Is it possible to explicitly use a CollectionViewSource inside a data template? Normally we'd put the CollectionViewSource in the resources alongside the template, but our model doesn't allow that because the 'source' of the collectionviewsource is a property of the DataContext at this level in the tree, meaning there needs to be an ins...

WPF - Need an event for when VirtualizingStackPanel creates Items for ListView

Is there any way to tell when the containers are finished being made for a ListView? A detailed explanation of what I've done so far I have a ListView control that has a DataTemplate in one of its columns that contains a CheckBox Control.. I've figured out how to access the CheckBox dynamically using the object that the ListView is bo...

WPF - Binding multiple values to a datagrind

UPDATED : Clean subject, and summarize it. Hi, I've a datable filled, where each cell is a class like this class CValue{ public object Value; public Brush Quality; private int m_quality; public override String toString(){ return Value.toString(); } } My datagrid is bind on the datable, and it's wo...

How to change datatemplate through code

I have ListBox and DataTemplate I need Set GroupBox Heigth = 300 How to do it? <DataTemplate x:Key="data_template"> <GroupBox Header="Категория" Width="300" HorizontalAlignment="Stretch" x:Name="GroupBox"> <DockPanel Tag="{Binding id}"> <Button Click="Button_Click" DockPanel.Dock="Top" > <Button.Content> ...

WPF - CollectionViewSource Filter event in a DataTemplate not working

I'm seeing some really weird behavior where WPF isn't doing what I expect it to do. I've managed to boil the problem down the following bit of code: XAML: <Window x:Class="WpfApplication3.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"...

WPF c# dynamically switch Itemtemplate when object class gets changed

Hello I've got the following scenario: WPF Treeview displaying custom objects, each of them containing a list of children. So the problem is: Each of the custom objects is controlled by a combobox that can change the current object from Class A to Class B/C/D and vice versa. Classes A-D are all subclasses of a superclass. So far so good....

WPF Listbox with usercontrol as ItemTemplate DataTemplate Binding Issue

I have created a simple MVVM wpf project. The basic Idea is to display data about the annual Income of a customer and the loans he has with various Banks. The Model consists of 2 Classes , Financial and FinancialLoans. The ViewModel consists of 2 Classes FinancialVM and FinancialLoanVM Below are the VM Classes: namespace WpfTester.Vie...

Wrap something around each item in an ItemsControl

Let's say I have a collection of objects of different classes. Each class has its UserControl DataTemplated in a resource file. Now I want to use ItemsControl to display the collection, but I want an Border or Expander around each item. I would expect something like this to work: <ItemsControl ItemsSource="{Binding MyObjects}"> <I...

WPF - Weird scrollbars behavior in TabItem

I have following code: <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="145" Width="156"> <Window.Resources> <DataTemplate x:Key="tabTemplate"> <ScrollViewer> <StackPanel Orie...

Focus and Selection Styling listbox items with multiple possible templates

Good afternoon, I have a listbox that consumes a list of items from a model, Addresses and RAddresses (inherited from Addresses) Now, previously I have been creating my item templates in the ItemContainerStyle so that I have only my own focus visuals (i.e. no dotted line, no light grey rectangle, etc). This has worked fine in the past...

How to access the element within the DataTemplate of GridViewColumnHeader?

Hello!! How can I get access to an element (TextBlock) within the DataTemplate of GridViewColumnHeader from the code???? I want to set focus on the column header. ...

Can I access a named fill gradient in a WPF Datatemplate?

I have a DataTemplate with a number of layered text and graphic objects. One of them is a glow effect that comes from the RadialGradientBrush Fill property of a Rectangle. At first, I named the Rectangle and bound to the Fill property and changed it using a DataTrigger. This worked fine, but I have a number of RadialGradientBrush objects...

WPF: TabControl & DataTemplates

I just want to understand the following scenario. Where I am implementing a <TabControl> bound to a ObservableCollection<TabViewModel> No Data Templates When I don't have any DataTemplates, the text WpfApplication1.TabViewModel appears in the Tab Header and Content. Ok I understand this part. Just ItemTemplate When I just have <Ta...