itemspresenter

Is it possible to override the ItemsPresenter to use a Virtualizing StackPanel instead of a regular stack panel?

。_饼干妹妹 提交于 2021-02-08 06:15:56
问题 Background I have a custom control that inherits from a TreeView and is modified to display in a data grid style. The problem I am seeing is with performance when expanding the tree. This is common from my research with Tree Views. Upon inspection with the WPF Performance tools I noticed that the ItemsPresenter class is using a regular Stack Panel instead of a Virtualizing Stack Panel. Here is the section of code where the ScrollContentPresenter is used (showing in image).

WrapPanel as ItemPanel for ItemsControl

烂漫一生 提交于 2019-12-17 07:24:54
问题 Still fooling around with WPF and learning as I go. Trying now to build a dynamic grouping of controls (mostly Buttons but might include CheckBoxes and others). I had no idea what was the best way to do this so I tried creating a ItemsControl style and then add the items into a ItemsPresenter inside a WrapPanel. Soon realized the items wouldn't wrap because they effectively weren't inside the WrapPanel unless I put it as ItemsHost. Like this: <Style x:Key="ButtonPanelGroup" TargetType="{x

Using a Grid as an ItemsHost

佐手、 提交于 2019-12-06 10:31:20
问题 I would like to use a Grid as an ItemsHost but none of the items appear in their bound (column, row) positions. How can I make this work? As a simple example: XAML <ItemsControl ItemsSource="{Binding DataSet}"> <ItemsControl.ItemTemplate> <DataTemplate> <TextBlock Grid.Column="{Binding Col}" Grid.Row="{Binding Row}" Text="{Binding Text}" /> </DataTemplate> </ItemsControl.ItemTemplate> <ItemsControl.Style> <Style TargetType="{x:Type ItemsControl}"> <Setter Property="Template"> <Setter.Value>

Using a Grid as an ItemsHost

孤街醉人 提交于 2019-12-04 16:22:55
I would like to use a Grid as an ItemsHost but none of the items appear in their bound (column, row) positions. How can I make this work? As a simple example: XAML <ItemsControl ItemsSource="{Binding DataSet}"> <ItemsControl.ItemTemplate> <DataTemplate> <TextBlock Grid.Column="{Binding Col}" Grid.Row="{Binding Row}" Text="{Binding Text}" /> </DataTemplate> </ItemsControl.ItemTemplate> <ItemsControl.Style> <Style TargetType="{x:Type ItemsControl}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ItemsControl}"> <Grid HorizontalAlignment="Stretch" IsItemsHost=

ItemsControl, ItemsPanel and ItemsPresenter (Silverlight, XAML)

随声附和 提交于 2019-12-03 11:06:47
问题 I'm utterly confused by these 3 terms, when to use which? What's the relationship and they are children of which controls? Is it correct to say this is the tree: ItemsControl > ItemsPresenter > ItemsPanel 回答1: ItemsControl is conceptually a control that houses items. Try to simply think of this control as a holder for zero or more objects. ItemsPresenter is a bit tougher to explain, but this is part of the ItemsControl template that will define where the items are placed within it. Your

WrapPanel as ItemPanel for ItemsControl

℡╲_俬逩灬. 提交于 2019-11-27 04:13:06
Still fooling around with WPF and learning as I go. Trying now to build a dynamic grouping of controls (mostly Buttons but might include CheckBoxes and others). I had no idea what was the best way to do this so I tried creating a ItemsControl style and then add the items into a ItemsPresenter inside a WrapPanel. Soon realized the items wouldn't wrap because they effectively weren't inside the WrapPanel unless I put it as ItemsHost. Like this: <Style x:Key="ButtonPanelGroup" TargetType="{x:Type ItemsControl}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type