itemscontrol

Silverlight: Datagrid like grouping in ItemsControl

被刻印的时光 ゝ 提交于 2019-12-12 10:37:34
问题 Is it possible to group items in a ItemsControl or Listbox in Silverlight? These controls are bound to a DomainDataSource. Or are there any 3rd party controls that do this? UPDATE: This is the sort of UI I am trying to create. 回答1: You can do this by using nested ItemsControls bound to a PagedCollectionView. Say I have a datasource - MyItems - with fields: Category , Section and Option . I can create a PagedCollectionView from an IEnumerable(of MyItems) and tell it which fields to group by.

Is there an ItemsControl equivalent for text content?

非 Y 不嫁゛ 提交于 2019-12-12 08:06:18
问题 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 ObservableCollection . I know how to do that with ItemsControl , but how do I do it for ListItem elements in a FlowDocument , since they're part of the TextElement class

WPF ItemsControl datacontext sorting

冷暖自知 提交于 2019-12-12 05:27:33
问题 Ok, I have an ItemsControl binded to a List<IComparableObject> , each second the List objects change, so I have to resort them, so each second I call the List.Sort() method. Checking in the Watch panel in VS2008, I can tell the List gets sorted, but the ItemsControl doesn't. How can I make this work? Thanks! 回答1: You have to sort the CollectionView: List<MyObject> myInternalList = new List<MyObject>(); ... ICollectionView colView = CollectionViewSource.GetDefaultView(myInternalList); colView

ItemControl background color

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-12 03:53:09
问题 In a fresh Universal Windows Platform app, I am trying to set the Background of an ItemsControl. But it doesn't seem to do anything. The only changes I've made to the VS template are in MainPage.xaml, which now looks like this: <Page x:Class="UWPPlayground.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:UWPPlayground" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http

WPF add specific button to ItemsControl ItemsPanel

只愿长相守 提交于 2019-12-12 02:59:51
问题 I have an ItemsControl where I display a long list of objects. I display it in a wrappanel so the user does not need to scroll. Now i want to add a Button at the end of the list, so the user can add new objects. What would be the best way to do this? Here is my xaml: <ItemsControl ItemsSource="{Binding Inventory}"> <ItemsControl.ItemTemplate> <DataTemplate> <StackPanel> <Grid Width="300"> <Grid.ColumnDefinitions> <ColumnDefinition Width="200"/> <ColumnDefinition/> <ColumnDefinition Width="30"

Setting rows of ItemPanelTemplate UniformGrid through C#

强颜欢笑 提交于 2019-12-12 02:05:54
问题 Here's what I have: <ItemsControl x:Name="InfoGrid"> <!-- ItemsPanelTemplate --> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <UniformGrid Rows="4" Columns="5" Background="LightGray" /> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <!-- ItemTemplate --> <ItemsControl.ItemTemplate> <DataTemplate> <Border BorderBrush="Black" BorderThickness="{Binding Path=BorderThickness}"> <CheckBox Style="{StaticResource styleCustomCheckBox}" IsChecked="{Binding Path=IsChecked, Mode=TwoWay}"/> </Border>

How can I dynamically lay out list items within an ItemsControl using a Grid?

六月ゝ 毕业季﹏ 提交于 2019-12-11 23:35:52
问题 I have a list of a list of strings which is an adequate stand in for what I need to lay out. I've also read everywhere that in order to accomplish what I need to do, my best bet is an ItemsControl . The problem is that ItemsControl doesn't play nice with Grid out of the box. Fortunately I've found a few articles with code that has helped get me pointed in the right direction. Unfortunately, it's not everything I need. This is the DataContext with which I am working ( and I am pretty certain

WPF Get Item of Itemscontrol in Visualtree

梦想与她 提交于 2019-12-11 22:56:03
问题 I am implementing an DragAndDrop-manager for wpf using attached properties. It works quite nice. But there is only one problem. To grab the dragged item i am using the visualtree. As example I want to have the listboxitem but the originalsource is the border of the listboxitem. So I just use one of my helper methods to search for the parent with the type of ListBoxItem. If I found that I get the data of it and drag that. But I dont want to have my DragAndDrop-manager aviable only while using

Add items to ItemsControl

南楼画角 提交于 2019-12-11 22:16:18
问题 I have an application for telephone call. Each call(line) has its own unique information. Say a colorful icon plus and line number. The numbers are in a queue, I used parallel programming skills to deal these items. When processing the item, the information is shown on the screen. Here I prefer ItemsControl. The expected result likes the image. I want to I borrowed the code for phone icon. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http:/

How to dynamically add UserControl to ItemsControl?

痴心易碎 提交于 2019-12-11 18:58:58
问题 I have a WPF UserControl which is dynamically created at runtime. Depending on user interaction, from 1-5 of these controls is created and should be added to the UI. I have an ObservableCollection<PlayerSpec> PlayerSpecViews in the xaml.cs code-behind. Initially I tried using a Grid and dynamically adding RowDefinitions but that wasn't working. The control would be scaled down in size. Then I tried using an ItemsControl but the binding was not adding the Control but instead the type name. How