We have a scenario where we want to display a list of items and indicate which is the "current" item (with a little arrow marker or a changed background colour).
ItemsControl is no good to us, because we need the context of "SelectedItem". However, we want to move the selection programattically and not allow the user to change it.
Is t...
I have a list of strings displayed by a Silverlight ItemsControl. The DataTemplate is a Border control with a TextBlock as its child. How can I access the border control corresponding to an item? For example, I might want to do this to change the background color.
...
I have an <ItemsControl> with a custom <DataTemplate> (and also a custom <ItemsPanelTemplate> that is just a WrapPanel), bound via ItemsSource to a simple observable collection of strings.
The DataTemplate consists simply of an instance of a custom UserControl whose properties are bound to the string via {Binding}.
The problem is since...
What WPF book covers ItemsControl.GetContainerForItemOverride and related in detail? Additionally I would like to read about why TreeView overrides it and how IsItemItsOwnContainerOverride is related to it.
...
I have an ItemsControl whose ItemsSource gets bound to an ObservableCollection<Component> at run time. I have defined a data template for type Component which works fine.
Now Component has a ObservableCollection<Control> and I want to add another ItemsControl inside my Component Datatemplate to render all the controls. Control here is ...
I have a DataTamplate for my ItemsControl that merely contains an Image with some other meta data. What I am trying to do is bind to the ItemsControl and have the Images be displayed with the Convas.Left and Canvas.Top that is bound via the data I give.
I have been trying my best to remove any Panels from the control via the ItemsPanel...
I have an ItemsControl bound to an ObservableCollection. When the observable collection changes, I have an event handler that looks at the children of the ItemsControl. Unfortunately, the ItemsControl hasn't yet added a new item at that time (which is understandable). How can I know when an ItemsControl has finished adding new child cont...
I am using an ItemsControl bound to a CollectionViewSource. I set its ItemsPanel to a WrapPanel (with orientation initially set to horizontal) and am using a button to toggle between horizontal and vertical orientation. Basically changing the ItemsPanel to point at different resources, inside the button click handler. This works fine.
...
I have the following (very simple) ItemsControl:
<ItemsControl Name="BlahList" ItemsSource="{Binding Blah}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<CheckBox Name="MyCheckBox" Content="{Binding Text}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
In code, I would like to do the following:
...
I want to verify that the items in my ListBox are displayed correctly in the UI. I figured one way to do this is to go through all of the children of the ListBox in the visual tree, get their text, and then compare that with what I expect the text to be.
The problem with this approach is that internally ListBox uses a VirtualizingStackP...
The stackpanel is not co-operating. We have a fixed width, and a variable number of items to lay out left-to-right inside it.
We have a an items control that lays them out with a stack panel:
<ItemsControl x:Name="testItems"
HorizontalAlignment="Left"
VerticalAlignment="Top">
<ItemsControl.ItemsPanel>
...
I'm looking into creating custom controls for WPF and I've found some reasonably useful blogs and such that vaguely go into enough detail but I'm still struggling a bit.
Basically, what I'm trying to create is something akin to the infamous 'Coda Slider' but i just don't know enough to get started properly. Can anyone either point me i...
I'm creating a UserControl and I just can't remember the name of the attribute which you use to decorate the property which you want to act as the default content property.
To give a concrete example, say i have a property called 'Title' which i can set using property syntax like this -
<local:myControl Title="the title"/>
But the...
I have two ListBoxes, both use Extended SelectionMode. The ItemsSource of the first is a List, and uses a datatemplate. I'm trying to use an aggregation of some property from the first as the itemssource for the second. For example:
public class MultiAppPropertyAggregator : IValueConverter {
public object Convert(object value, T...
I'm just starting learning WPF and I'm trying to use a GridViewRowPresenter inside of an ItemsControl to essentially duplicate the functionality of a simple table in HTML. The ListView is not appropriate since it is interactive (which I don't want). I am binding to a generic List of objects of an unknown quantity.
I have a List of a cus...
I want to databind an ItemsCollection, but instead of rendering the collection items, I want to render sub-objects reached via a property on the collection item.
To be more specific: this will be a 2D map viewer for a game (though in its current state it isn't 2D yet). I databind an ItemsControl to an ObservableCollection<Square>, where...
I have the following XAML for a databound items control to show a list of groups, with a label and button to add a new group appearing first:
<WrapPanel Orientation="Horizontal">
<Label Content="Groups" />
<Button x:Name="btnGroupAdd" Click="btnGroupAdd_Click" Content="+" />
<ItemsControl ItemsSource="{Binding}" x:Name="_groupList" >...
WPF's ItemsControl will display a focus rectangle when it thinks it has focus and the user presses Tab or Alt.
But I recently had an ItemsControl display a focus rectangle even though it did not have focus -- one of its parents did. The ItemsControl was inside a UserControl, which was inside another UserControl that did have focus. Some...
In WPF, you can create a ListBox with a Canvas as an ItemsPanel and position items on that canvas. The code to do that looks something like this:
<ListBox ItemsSource="{Binding}">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=Name}"/>
</DataTemplate>
</ListBox.ItemTemplate>
...