I have a list containing objects that follow this structure. This is not the real classes I am working with, but should explain the concept.
CLASSES
public class BaseType{}
public class TypeA : BaseType{}
public class TypeB: BaseType
{
public List<TypeA> TypeAList { get; private set; }
}
The List that the ItemsControl binds to is...
I want to have an ItemsControl in which the items are displayed horizontally.
However, no matter if I use StackPanel with Orientation="Horizontal" or WrapPanel, they still stack up.
How can I get items in an ItemsControl to be horizontally?
XAML:
<Window x:Class="TestItemsControl2938.Window1"
xmlns="http://schemas.microsoft.com...
When I have background colors on the items in an ItemsControl, and set the margins to 0, WPF leaves hairlines between the items as if the ItemsControl wrapper plumbing is taking up a minute amount of space. I checked the visual tree with Snoop and all margins are set to 0,0,0,0.
What are causing these lines and how can I avoid them?
...
I have some data that I want to present in a FlowDocument. This will basically be a view that explains the data in a friendly way, with section headers, paragraphs of text, etc., and which I will display in a FlowDocumentScrollViewer.
To this end, I would like to create a bulleted list (<List>) out of the contents of an ObservableCollec...
I'm trying to databind to this ItemsControl:
<ItemsControl ItemsSource="{Binding Path=Nodes, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<Canvas />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
By using this DataTemplate, I'm ...
I have a FlowDocument that varies in height due to an ItemsControl in a BlockUIContainer. In some cases, the ItemsControl extends beyond the page height. Is there a way to scale the FlowDocument to fit a page (8.5" X 11") right before printing if needed?
As of right now, the FlowDocument is named 'doc' and the method for printing I am u...
I am attempting to write a simple WPF learning project which creates a set of buttons inside a resizeable main window. There is to be one Button per entry in a collection, and the contents of that collection may vary during run-time. I want the buttons to fill the entire window (e.g. 1 button @ 100% width, 2 buttons @ 50% width, 3 butt...
I have 2 ItemsControls parallel to each other. The first is a set of TextBlocks with Property names and the second is a set of TextBoxes with Property values.
Property1 Value1
Property2 Value2
Property3 Value3
" "
The list goes on very long in some cases.
Is there a way to possibly break the columns at a certain poin...
I've got an ItemsControl (in a DockPanel with other stuff) which has a ControlTemplate to provide a ScrollViewer because the items won't fit on the screen. With the given config, I get a strange double-border top and bottom. It looks like a grey line above the top line and another below the bottom line. The sides are unaffected. I ge...
Hey guys
I have an observable collection of items, where each item has a name and a "group name" (both strings).
The tricky part is, in XAML, I need to style this collection such that all items with the same group name are listed next to each other, and the group name is shown at the top.
I have designed user controls for the layout o...
Hi,
I've got a list of strings I'm binding to an items control.
The strings are displayed in textblocks I've declared in the itemscontrol template. I've rotated the textblocks 270 so that the text is on its side - I've also translated the textblocks down by their width so that they are at the top of the page.
My issue is they are now...
Is there a XAML only way to automatically sort the bound items (list of ViewModel object) ItemsControl based on one of the properties of the items. The ItemsControl is part of a DataTemplate. I thought CollectionViewSource would do the trick, but how do I bind the CollectionViewSource to the ItemsControl. The follwoing code dispays nothi...
Hi,
This might be a crazy question.
Suppose a collection that has a a few entries, some of them are just empty string. Is it possible to write the ItemsControl to use different DateTempalte if the content is empty string?
Thanks a million times
...
Hello!
First take a look at my code:
<ListBox ItemsSource="{Binding}" SelectionMode="Multiple"
ItemTemplate="{StaticResource ContactTemplate}">
<ListBox.ContextMenu>
<ContextMenu>
<MenuItem Name="mnuEdit" Header="_Edit" Click="MenuItem_Click" />
</ContextMenu>
</ListBox.ContextMenu>
</ListBox>
...
I'm very confused by the MSDN samples. And all the samples I find generally revolve around text items in a StackPanel or something similarly simple.
Given an array of numbers as the ItemsSource -
ItemsSource = { 25 , 50 , 75 }
the ItemsControl should procuce only this:
<PolyLine Points="0,25 1,50 2,75" />
As shown, each item...
I have a WPF ItemsControl who's ItemsSource is bound to an observable collection of view models in MVVM. The ItemTemplate is set to the user control that I want. However, there are instances when I would like another control instead of the one specified in XAML.
How can I easily do this?
...
I'm porting an app (which someone else wrote) from WPF to Silverlight. I have a class which inherits from ItemsControl. In part of the code I access the ItemsControl.Items property (of type ItemCollection). However, some of the methods/properties which exist in WPF are missing in Silverlight:
MoveCurrentToFirst()
CurrentItem
CurrentPos...
This works fine:
<ItemsControl ItemsSource="{Binding Persons}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock ...
Hi,
I'm using M-V-VM and have a command on my ViewModel called 'EntitySelectedCommand'.
I've trying to get all the Items in an ItemsControl to fire this command, however it's not working.
I think it's because each items 'datacontext' is the individual object the item is bound to, rather than the ViewModel?
Can anyone point me in the ...
The subject line says it all really! I have a user control which can be bound successfully to, say, a Fullname object - i.e. it works ok.
I now need to show a list of these and, again, this works ok when the control is in a DataTemplate within ItemsControl.Template.
But, the control has a property (InEditMode) that is not a property ...