itemscontrol

How to create a custom MultiSelector / ItemsControl in WPF / C#

I'm trying to create a diagramming application in C# / WPF. What I going for is somewhat similar to Microsoft Visio although I'm not trying to clone it. I kind of wrote this question as I was coding and just put all the issues I had into it in case someone will find it useful. Maybe I've been thinking too hard but I feel like I could thr...

Show items in an itemscontrol in two columns (WPF)

I have an items control that is bound to a collection of objects. The object has two properties (name, value) that i display in a textblock and textbox respectively. The list is quite long and I would like to show it in two columns. So my question is, is there any way I can get an Itemscontrol to show its items in two columns? P.S: The ...

Bind to ItemsControl's DataContext from inside an ItemTemplate

I have an ItemsControl whose for the ItemTemplate DataTemplate contains a Button. I want the Command on the button to bind to a Command on the DataContext of the ItemsControl, not the ItemTemplate. I think the solution has to do with using RelativeSource, but my attempts so far have failed: <ItemsControl ItemsSource="{Binding Games}"> ...

Can I have a Treeview without the tree structure?

Hi all, Can someone tell me how I can template a treeview control so that it doesn't look like a tree? Basically, I want to remove the indents at various levels as well as the +/- that allow for expansion and collapse. The actual requirement is that I have a hierarchical data template that is bound to an object collection that is rec...

WPF items not visible when grouping is applied

Hi, I'm having this strange issue with my ItemsControl grouping. I have the following setup: <ItemsControl Margin="3" ItemsSource="{Binding Communications.View}" > <ItemsControl.GroupStyle> <GroupStyle> <GroupStyle.ContainerStyle> <Style TargetType="{x:Type GroupItem}"> <Sette...

How do I get WPF GridSplitter controls working inside an ItemsControl?

Hi all, Could anyone possibly explain to me why the following simple example works: <ItemsControl x:Class="UserControl1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt; <ItemsControl.ItemsPanel> <ItemsPanelTemplate> ...

WPF - styling a lookless control: How to access dependecy properties of control from second level of ControlTemplates?

Hello, I am extending the ItemsControl (class EnhancedItemsControl : ItemsControl), because I want to add several dependecy properties to it - like AlternativeContent which will be displayed when there are no items in collection (think of 'enter a search terms and hit search' label in a itemscontrol for results of search). I have subcla...

ItemsControl, VirtualizingStackPanel and ScrollViewer height

I want to display a important list of items using an ItemsControl. The reason why I'm using an ItemsControl is that the DataTemplate is much more complex in the application I'm working on: The sample code provided only reflects the sizing problem I have. I would like : the ItemsControl to be virtualized because there is many items to...

[WPF]ItemsControl not completely loaded @Loaded event

Hi everyone I have a propably simple problem, that i just can't seem to figure out: I've made an ItemsControl which has its datacontext set and shows the data as pairs of Checkboxes and TextBlocs: <ItemsControl Name="listTaskTypes" Grid.Row="1" Grid.Column="2" Grid.RowSpan="2" ItemsSource="{Binding}" Margin="10,0,0,0" VerticalAlignmen...

WPF: Can't drop dragged data onto an ItemsControl

I have the following XAML: <DockPanel x:Name="OverViewContainer" AllowDrop="True"> <StackPanel Orientation="Horizontal" DockPanel.Dock="Bottom" HorizontalAlignment="Right"> <uicommon:Toolbar DataContext="{Binding Commands}" /> </StackPanel> <ItemsControl ItemsSource="{Binding DocumentE...

WPF: Scroll into view a new item in a ItemsControl

I have an ItemsControl that is databound to a ObservableCollection. I have this method in the code behind which adds a new model to the list. I would then like to scroll the new item (at the bottom of the list) into view. I think the size of the ItemsControl is not yet updated when I am querying the size, since the ActualHeight before a...

getting a reference to a MediaElement inside an ItemsControl (WPF)

Hi , this is a known issue with ItemsControl although I couldn't find a solution :( . XAML <ItemsControl x:Name="myItemsControl" ItemsSource ="{Binding videos}" Grid.ColumnSpan="2"> <ItemsControl.Resources> <DataTemplate x:Name="myDataTemplate" DataType="{x:Type sys:String}"> <Grid x:Name="sp" ...

Prism's ItemsControl seems to have a xaml parse error. Why?

I am at a loss as to why my Shell.xaml's ItemsControl is causing a parse error. I know the syntax is correct because I copied the Silvelright project files from a working project. Right now my only guess is that ItemsControl is dependent on something else. Here is the relevant xaml line for ItemsControl. <ItemsControl x:Name="Region" ...

WPF itemscontrol binding to collection of controls

Hi, I'm trying to bind to a collection of controls I generate dynamically: <ItemsControl ItemsSource="{Binding CustomFields}"> And the code: public ObservableCollection<Control> CustomFields { get { return GetCustomFields(); } } The Getcustomfields just generates some controls like a...

How to get a List<string> collection of values from app.config in WPF?

The following example fills the ItemsControl with a List of BackupDirectories which I get from code. How can I change this so that I get the same information from the app.config file? XAML: <Window x:Class="TestReadMultipler2343.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas....

Silverlight ItemsControl

Hello, I am trying to use an ItemsControl to display a DataTemplate. I have this simple example: <navigation:Page.Resources> <DataTemplate x:Key="PictureResultsTemplate"> <!--<Grid/> --> <TextBlock Text="Nick Was Here"></TextBlock> </DataTemplate> </navigation:Page.Resources> <Grid x:Name="LayoutRoot"> <Grid Margin="0,0...

WPF ItemsControl binding and the item order

I have ItemsControl in a WPF application, which is bind to an array of objects. And I am using ItemTemplate to render the list. I want to display for each item in the list the item order, like for example Customer 1 Name : xxxxx Age: 9999 Customer 2 Name : yyyy Age: 8888 Any idea how to do it Thanks ...

Bind ItemsControl with ItemsSource to the array index

Hi I want to bind an ItemsControl to an array of object, using ItemsSource and DataTemplate. And I want to show the index of each item. Like Customer 1: Name: xxxx Age:888 Customer 2: Name: yyy Age: 7777 ...

WPF Show data from multiple DataContexts in ToolTip of ItemsControl

Hi, I am trying to display a tooltip for an item generated by an ItemsControl that needs to pull data from conceptually unrelated sources. For example, say I have an Item class as follows: public class Item { public string ItemDescription { get; set; } public string ItemName { get; set; } } I can display the Item within an It...

WPF ItemsPanelTemplate not working

I'm trying to get an ItemsPanelTemplate working for a ListBox. The ListBox is used in a DataTemplate, and none of my implicit ListBox styles override the default visual style. For some reason, the ItemsPanelTemplate I'm specifiying for the control (a WrapPanel) is being ignored and a StackPanel is used instead. This is the entire templa...