itemscontrol

Virtualizing Panel that doesn't crop items

一世执手 提交于 2019-12-19 08:10:27
问题 So, it looks really silly to have a chrome-less collection if the items are getting cut/cropped at the end of the scroll region. I want to create a virtualizing panel for collections (ItemsControl/ListBox) that only draws whole items, never pieces of items. For example: ______________ | | |______________| ______________ | | |______________| ______________ | | I don't want the 3rd partial container to be displayed unless there is room for the WHOLE item/container to be displayed. In the

Dragable objects in WPF in an ItemsControl?

血红的双手。 提交于 2019-12-19 03:39:55
问题 I want to be able to implement an ItemsControl with dragable items. The reason for the ItemsControl is so I can bind to my ViewModel in the background. I've tried using a Thumb Control in a canvas and it works perfect, except as soon as I stick it in an ItemsControl it stops working. Here is what I tried: <ItemsControl ItemsSource="{Binding MyItems}"> <ItemsControl.ItemTemplate> <DataTemplate> <Thumb Canvas.Left="0" Canvas.Top="0" Width="50" Height="50" DragDelta="MyThumb_DragDelta"/> <

WPF drag and drop from a ListBox that has SelectionMode=Extended

爱⌒轻易说出口 提交于 2019-12-18 03:42:31
问题 I have a ListBox and want the selection-mode to be extended. Also I want have to implement drag and drop functionality. The problem now is, that if the mouse is clicked on a selected item, it will be immediately be selected as single selection instead of waiting to the mouse-up-event for doing this. Due to this behaviour, start dragging multiple items is for the user quasi impossible because always he clicks on the selection to start dragging, the selection changes to the item that is under

When using ItemsControl ItemsControl.ItemsPanel is set to Canvas, ContenPresenter comes in and break my Canvas properties on the children [WPF]

别来无恙 提交于 2019-12-18 03:10:22
问题 I am using an ItemsControl where the ItemsPanel is set to Canvas (see this question for more background information). The ItemsControl is performing as I want, and it works like a charm when adding a child element manually by putting it into ItemsControl.Items: <ItemsControl> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <Canvas IsItemsHost="True" /> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.Items> <Button Canvas.Left="500" Content="Button Text" /> </ItemsControl.Items>

ItemsControl ItemTemplate Binding

霸气de小男生 提交于 2019-12-17 21:02:17
问题 In WPF4.0, I have a class that contains other class types as properties (combining multiple data types for display). Something like: public partial class Owner { public string OwnerName { get; set; } public int OwnerId { get; set; } } partial class ForDisplay { public Owner OwnerData { get; set; } public int Credit { get; set; } } In my window, I have an ItemsControl with the following (clipped for clarity): <ItemsControl ItemsSource={Binding}> <ItemsControl.ItemTemplate> <DataTemplate>

Why Does ItemsControl Not Use My ItemTemplate?

不问归期 提交于 2019-12-17 20:44:05
问题 I am able to use an ItemTemplate within an ItemsControl to render items in a specific format. However, if one of the items within the ItemsControl happens to be, say, a TextBox, that TextBox is rendered rather than an instance of the ItemsTemplate. From what I can tell, this is true for any FrameworkElement. Is this intended behavior for an ItemsControl, or am I doing something incorrectly? An example: <ItemsControl> <ItemsControl.ItemTemplate> <DataTemplate> <Grid Margin="5"> <Rectangle Fill

wpf force to build visual tree

青春壹個敷衍的年華 提交于 2019-12-17 20:38:15
问题 I have ItemsControl with Grid as ItemsPanelTemplate <ItemsControl ItemsSource="{Binding CellCollection}" Name="CellGrid"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <Grid Name="grid" /> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> </ItemsControl> I create some UserControl with this ItemControl inside in code-behind, and then i need to create RowDefinitions and ColumnDefinitons. I use this method to get "grid": private TChildItem FindVisualChild<TChildItem>(DependencyObject obj) where

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

How to dynamically add RowDefinition or ColumnDefinition to a Grid with binding?

自古美人都是妖i 提交于 2019-12-17 02:23:16
问题 I'm trying to create a table with a variable number of rows and columns. I'm doing this with an ItemsControl which has a Grid as its ItemsPanel . And I know I can set Grid.Row and Grid.Column of each item through its ItemContainerStyle . But I don't know how to change the number of rows and columns and their sizes when I can't access the Grid by its name. Question: How can you modify RowDefinitions or ColumnDefinitions of a Grid in run-time without any code-behind using Binding? This is the

Style me an ItemsControl subclass please - stuch with ItemsPresenter

牧云@^-^@ 提交于 2019-12-14 03:57:48
问题 I have an control that is subclassed from ItemsControl , called WorkSheet : public sealed class WorkSheet : ItemsControl { Its elements are forced to be WorkTiles : /// <inheritdoc /> protected override bool IsItemItsOwnContainerOverride(object item) { return (item is WorkTile); } /// <inheritdoc /> protected override DependencyObject GetContainerForItemOverride() { return new WorkTile(); } So far - so good. I want the WorkSheet to use a Canvas for presenting the WorkItems , position being