itemscontrol

Scrollviewer logical scrolling with itemscontrol

送分小仙女□ 提交于 2020-01-15 23:25:46
问题 In a WPF app I have a ScrollViewer, in which is an ItemsControl, the items of which are databound to a collection, and I have a template specified for the items. I want the ScrollViewer to use logical scrolling, so I set the ScrollViewer.CanContentScroll="True" flag, and set the ItemsPanel template of the ItemsControl to be a StackPanel. However, the scrolling is still physical rather than logical. What am I doing wrong? Thanks Tom 回答1: Sorry for the late reply... This is something that

PRISM-MVVM, ItemsControl problem with View injection

▼魔方 西西 提交于 2020-01-15 14:13:57
问题 I need to display multiple instances of a basketDetailsView.xaml within a region placed in basketView.xaml, but I'm getting the following errormessage when i debug my code: "An exception occurred while creating a region with name 'basketRegion'. The exception was: System.InvalidOperationException: ItemsControl's ItemsSource property is not empty. This control is being associated with a region, but the control is already bound to something else. If you did not explicitly set the control's

PRISM-MVVM, ItemsControl problem with View injection

爱⌒轻易说出口 提交于 2020-01-15 14:10:18
问题 I need to display multiple instances of a basketDetailsView.xaml within a region placed in basketView.xaml, but I'm getting the following errormessage when i debug my code: "An exception occurred while creating a region with name 'basketRegion'. The exception was: System.InvalidOperationException: ItemsControl's ItemsSource property is not empty. This control is being associated with a region, but the control is already bound to something else. If you did not explicitly set the control's

ListBox Grouping issue

戏子无情 提交于 2020-01-13 08:25:17
问题 I am trying to Group my collection which is based on my following model: public class Person { public string FirstName { get; set; } public string LastName { get; set; } public Role PersonRole { get; set; } } public class Role { public int Id { get; set; } public string RoleName { get; set; } } My PersonCollection, public ObservableCollection<Person> PersonList; The collection is populated with three Person object, two with identical roles. I want to group all my persons as per their RoleName

Item spacing in WPF ItemsControl

*爱你&永不变心* 提交于 2020-01-12 04:30:32
问题 I'm displaying a List<string> collection in an ItemsControl. The problem is that there is no spacing between the list items such as TheyAreAllNextToEachOther . How can I create some spacing between the items? <ItemsControl Grid.Column="2" Grid.ColumnSpan="2" ItemsSource="{Binding Path=ShowTimes}" BorderThickness="0"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <WrapPanel IsItemsHost="True" Orientation="Horizontal"/> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> </ItemsControl> 回答1: I'd

Canvas with Lines and Points

痴心易碎 提交于 2020-01-11 14:01:13
问题 I am migrating an old application and am trying to implement MVVM. The old application has a similar interface to the one described in this post. Although it is slightly simpler. I am not too worried about following MVVM exactly, but I would like to use this as a chance to practice. I have the following class: public class LineViewModel { public ObservableCollection<LinePoint> Points {get;} public Geometry LineGeometry {get;} } In my application view model I have a collection of lines and I

Can i scroll an ItemsControl by dragging row items instead of scrollbar

为君一笑 提交于 2020-01-07 03:51:40
问题 Im wondering how i would go about scrolling a list container like ItemsControl up and down by clicking on an item and dragging your mouse up or down, instead of using dragging on a scrollbar using ScrollViewer? I have googled around but found only results using a scrollbar to scroll up and down a list of items. 回答1: You can use this attached behaviour that someone wrote: http://matthamilton.net/touchscrolling-for-scrollviewer Use as follows: <Window x:Class="WpfApp17.MainWindow" xmlns="http:/

Nested ItemsControl Orientation

一世执手 提交于 2020-01-06 18:43:45
问题 I have a nested ItemsControl. My data structure is an ObservableCollection of Campaigns which consist of a Campaign class and an observableCollection of Data counts (total, assigned, unassigned, closed). What I need is the following: CAMPAIGN.NAME TOTAL UNASSIGNED ASSIGNED CLOSED CAMPAIGN.NAME TOTAL UNASSIGNED ASSIGNED CLOSED I am able to get the first part of this, but for some reason it will not honor the orientation for the second ItemsControl. What am I missing? My XAML is: <ItemsControl

WPF HierarchicalDataTemplate & ItemsControl

徘徊边缘 提交于 2020-01-06 16:54:28
问题 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 a List<BaseType> XAML <ItemsControl> <ItemsControl.Resources> <HierarchicalDataTemplate DataType="{x:Type local:TypeB}" ItemsSource = "{Binding Path=TypeAList}">

WPF Grid.IsSharedSizeScope in ItemsControl and ScrollViewer

和自甴很熟 提交于 2020-01-06 07:08:00
问题 I'm simplyfying this log viewer. It works mostly as expected, but somehow the column lengths don't share the same size. Here is my code: <Window.Resources> <local:IsGreaterThanConverter x:Key="IsGreaterThanConverter" /> <sys:Int32 x:Key="MaxDisplayLineLength">200</sys:Int32> <Style TargetType="ItemsControl" x:Key="LogViewerStyle"> <Setter Property="Template"> <Setter.Value> <ControlTemplate> <ScrollViewer CanContentScroll="True"> <ItemsPresenter/> </ScrollViewer> </ControlTemplate> </Setter