itemtemplate

How do I get current ListViewItem with a control in ItemTemplate, WPF

I have the following code: <ListView.ItemTemplate> <DataTemplate> <StackPanelName="stackPanel" Orientation="Horizontal"> <TextBoxName="textBoxOrg" Background="Transparent" BorderThickness="0" TextWrapping="Wrap" Text="{BindingOrgText}" IsReadOnly="True"/> <TextBoxName="textBoxNew" ...

WPF ComboBox get displayed text

I'm having a problem with my combo box and trying to get the text that is displayed in the box. I have the ItemsSource bound to a SqlDataReader, and I'm trying to populate another combo box based on what item is selected in the first combo box. In the first combobox's selection changed event, I'm running a query based on what's selected...

Why Does ItemsControl Not Use My ItemTemplate?

I am able to use an ItemTemplate within an ItemsControl to render items in a specific format. However, if one of the items within the ItemsControl happens to be, say, a TextBox, that TextBox is rendered rather than an instance of the ItemsTemplate. From what I can tell, this is true for any FrameworkElement. Is this intended behavior ...

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...

two itemtemplates for one listbox

Hello everyone, I've got the problem with displaying wpf listbox items. I give abstract example. I hope it's going to be ok. I've got a class FruitViewModel - it describes viewmodels for listboxitems. And I've got class BananaViewModel : FruitViewModel and class AppleViewModel : FruitViewModel So, collection Fruits contains Bana...

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...