I have many items inside a list control. I want each item to have a different item template depending on the type of the item. So the first item in the list is a ObjectA type and so I want it to be rendered with ItemTemplateA. Second item is a ObjectB type and so I want it to have ItemTemplateB for rendering. At the moment I can only use...
Hi,
I have a listbox, and I have the following ItemTemplate for it:
<DataTemplate x:Key="ScenarioItemTemplate">
<Border
Margin="5,0,5,0"
Background="#FF3C3B3B"
BorderBrush="#FF797878"
BorderThickness="2"
CornerRadius="5">
<DockPanel>
<DockPanel DockPanel.Dock="Top" Margin="0,2,0,0">
...
I'm using an asp.net repeater to create a bunch of images. The image markup is all the same so the standard <ItemTemplate> is fine.
However, I want to wrap K images in a div. Lets say I bind 25+ images to the repeater and I want 5 images per div. How do I go about conditionally creating the start and close tags for the div?
Is this a...
I have a tabControl that is bound to an observable collection.
In the headerTemplate, I would like to bind to a string property, and in the contentTemplate I have placed a user-control.
Here's the code for the MainWindow.xaml:
<Grid>
<Grid.Resources>
<DataTemplate x:Key="contentTemplate">
<local...
Hello all,
Sorry if this is a basic question, but how can I take an ItemTemplate that I have for a ListBox, and put it in the resources for the window so that more than one ListBox can use it.
Here's some XAML:
<Window x:Class="Example">
<Window.Resources>
<DataTemplate x:Key="dtExample">
<ListBox.ItemTemplate>...
My tree definition is:
<TreeView Name="tree" ItemsSource="{Binding Children}" >
<TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Children}">
<CheckBox Name="foo"></CheckBox>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
Having a TreeViewItem element, I try t...
I have a UserControl which I'm using to display a list of UIElements. The control consists of a single ItemsControl with it's ItemPanelTemplate switched for a horizontal StackPanel, its ItemsSource bound to a DependencyProperty exposed by the UserControl and its ItemTemplate set in the UserControl.Resources.
Everything works fine exc...
I'm fairly new to WPF and trying to understand how best to extend the ListBox control. As a learning experience, I wanted to build a ListBox whose ListBoxItems display a CheckBox instead of just text. I got that working in a basic fashion using the ListBox.ItemTemplate, explicitly setting the names of the properties I wanted to databind ...
I'm working on a project which will pull data from two different tables, Events and Travel Times. I'm displaying it in a DataList using ItemTemplate. Almost all of the information displayed in the DataList will be from Events and will always be displayed. The data from Travel Times will only be shown if it falls within a certain range of...
Hi All,
I have a Datalist. Following is the structure of the ItemTemplate:
<ItemTemplate>
<div id="driversGrid" runat="server" style="width:3500px;" >
<table cellpadding="0" cellspacing="0" border="0" width="3500px">
<tr>
<td id="Td1" runat="server" style="visibility:hidden;"...
Hi,
I try to create a ItemTemplate for my Repeater with a tree of child controls inside an ItemTemplate. The problem is I can't find a way to persist all my controls. Each time that there is a postback, my controls are lost. I tried many things but I didn't find a way. Is anybody can help me? Here is the code that I use :
Here where ...
I am unable to edit Gender lookup field. I am having problem with post back edits. Every time I edit, the row YourGender keeps getting repeated. I am getting null values for GenderLookup value field. What is the right way to populate dynamically this look up in detailsview control. How does the get request and post back request with this...
So, lets say I have a ComboBox with a custom data template. One of the items in the data template is a button:
<ComboBox Width="150" ItemsSource="{Binding MyItems}">
<ComboBox.ItemTemplate>
<DataTemplate>
<Button Content="ClickMe" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
The problem...
I have a custom control that is derived from TabItem, and I want to databind that custom TabItem to a stock TabControl. I would rather avoid creating a new TabControl just for this rare case.
This is what I have and I'm not having any luck getting the correct control to be loaded. In this case I want to use my ClosableTabItem control in...
I'm using a TabControl as my main workspace in an application, and I'd like to add a "Window" menu item that lists the headers of open tabs. The active (i.e. - focused) tab should be checked.
I've tried using an ItemsTemplate as follows:
<MenuItem Header="_Window" ItemsSource="{Binding ElementName=ux_workspace, Path=Items}...
In the following code, I tell the ComboBox to use the DataTemplate called CustomerTemplate by assigning its ItemTemplate attribute.
StackPanel, however, doesn't have an ItemTemplate attribute.
How can I get the StackPanel to also use CustomerTemplate?
<Window.Resources>
<DataTemplate x:Key="CustomerTemplate">
<StackPanel O...
I've been working on a SplitButton control for WPF and its basically done, but I'm trying to go through all the possible properties that can be set on it and make sure they are actually implemented. I mostly have only two properties left to implement which is the ItemTemplate and ItemTemplateSelector (and AlternationCount, okay so 3 prop...
This is a XAML code sample taken from the MSDN library article for the ItemsControl.ItemTemplate property:
<ListBox Width="400" Margin="10" ItemsSource="{Binding Source={StaticResource myTodoList}}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding Path=TaskName}" />
<TextBlock Text="{Binding Path=Descripti...
I have a ListBox with an ItemTemplate consisting of a TextBlock and a ComboBox. The problem is that the width of the text inside the TextBlock is not the same for each item and the ComboBox controls are not aligned.
How can I set the TextBlock in the template so all items are the same width, that is the one of the widest?
Here is my xam...
I'm adding TreeViewItems manually in code behind and would like to use a DataTemplate to display them but can't figure out how to. I'm hoping to do something like this but the items are displayed as empty headers. What am I doing wrong?
XAML
<Window x:Class="TreeTest.WindowTree"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/p...