itemscontrol

WPF: Scroll Itemcontrol Content Fixed Header

ⅰ亾dé卋堺 提交于 2019-11-28 19:23:16
问题 Is it possible to do something like this with WPF's ItemsControl: Demo I am trying to freeze the GroupedItems rather than the GridView Columns. Resources: <Window.Resources> <CollectionViewSource x:Key="data" Source="{Binding}"> <CollectionViewSource.GroupDescriptions> <PropertyGroupDescription PropertyName="Date"/> </CollectionViewSource.GroupDescriptions> </CollectionViewSource> </Window.Resources> ListView: <ListView Grid.Column="0" ItemsSource="{Binding Source={StaticResource data}}">

How to draw line of ten thousands of points with WPF within 0.5 second?

a 夏天 提交于 2019-11-28 15:14:54
问题 I am writing WPF code to show a real-time plot which is a connected line containing about 10,000 points. It takes about 5 seconds to show a picture in my computer. Does anyone have an idea to make it quicker and within 0.5 second? class eee : FrameworkElement { public eee() { _children = new VisualCollection(this); Random rand = new Random(); DrawingVisual dv = new DrawingVisual(); using (DrawingContext dx = dv.RenderOpen()) { Pen drawingPen = new Pen(Brushes.Black, 1); double x=rand.Next(300

WPF TabStop / TabIndex in ItemsControl

前提是你 提交于 2019-11-28 13:12:21
I'm dynamically adding WPF ComboBox-es and I want to be able to select the added ComboBoxes with the 'TAB' key . (Dynamically generate TabIndex or something) As it actually is: What I want: How would you do that? This is the code: <ItemsControl ItemsSource="{Binding}" Name="myItemsControl"> <ItemsControl.ItemTemplate> <DataTemplate> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="3*"/> <ColumnDefinition Width="*"/> <ColumnDefinition Width="Auto"/> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> </Grid.RowDefinitions> <ComboBox Grid.Column="0" ItemsSource

How to highlight selected item in ItemsControl?

a 夏天 提交于 2019-11-28 11:07:16
I have the following XAML. How can i highlight the selected item in the ItemsControl ? I can override the selected item template for ListView but how to achieve the same for ItemsControl? Is there any alternative control that can display a collection of images ? <Window x:Class="ImageScrollDemo.View.MoviePosterView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:ImageScrollDemo" xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" Title="MoviePosterView"

How to convert X/Y position to Canvas Left/Top properties when using ItemsControl

孤街醉人 提交于 2019-11-28 09:30:55
I am trying to use a Canvas to display objects that have "world" location (rather than "screen" location). The canvas is defined like this: <Canvas Background="AliceBlue"> <ItemsControl Name="myItemsControl" ItemsSource="{Binding MyItems}"> <Image x:Name="myMapImage" Panel.ZIndex="-1" /> <ItemsControl.ItemTemplate> <DataTemplate> <Canvas> <TextBlock Canvas.Left="{Binding WorldX}" Canvas.Top="{Binding WorldY}" Text="{Binding Text}" Width="Auto" Height="Auto" Foreground="Red" /> </Canvas> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> </Canvas> MyItem is defined like this: public

Bind to DataContext Property inside inline Array Declaration

*爱你&永不变心* 提交于 2019-11-28 06:02:37
问题 We have some XAML which may seem odd but apparently is needed for defining a couple of buttons inside a third party's ribbon gallery control. The gallery has a ItemsControl.ItemsSource which the XAML is populating with two Array items, these array items are a custom type which has a bitmap property and a ICommand property. Everything looks fine but I cannot get the array item property to bind to anything to do with the window's data context. I have tried every trick i know, RelativeSource,

How to use AlternationIndex in ItemsControls?

核能气质少年 提交于 2019-11-28 04:58:16
I have seen some articles that show how to use AlternationIndex with ListBox es or ListView s, but I had spent a few hours trying to get alternating background colors on the base ItemsControl class and nothing seems to work. All ListBox samples I saw use ListBoxItem as the target type for the style that sets the background based on AlternationIndex - like this one from MSDN : <Grid> <Grid.Resources> <Style x:Key="alternatingWithTriggers" TargetType="{x:Type ListBoxItem}"> <Setter Property="Background" Value="Blue"/> <Setter Property="Foreground" Value="White"/> <Style.Triggers> <Trigger

Modify ZIndex of an Items in an ItemsControl

拥有回忆 提交于 2019-11-28 03:55:48
问题 Here is the code of my ItemsControl that zooms on items when the mouse goes over. I don't manage to increase the ZIndex of the current zoomed item to put it over the others. <ItemsControl ItemsSource="{Binding Path=Value}"> <ItemsControl.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding Path=Name}" RenderTransformOrigin="0.5 0.5"> <TextBlock.Style> <Style TargetType="{x:Type TextBlock}"> <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="RenderTransform">

WPF: Alternating colors on a ItemsControl?

本秂侑毒 提交于 2019-11-27 23:25:58
How do I get alternating colors on a ItemsControl? I have AlternationCount set to 2, but the ItemsControl.AlternationIndex property always returns 0. <ItemsControl ItemsSource="{Binding}" AlternationCount="2"> <ItemsControl.Resources> <Style x:Key="FooBar" TargetType="Grid"> <Style.Triggers> <Trigger Property="ItemsControl.AlternationIndex" Value="0"> <Setter Property="Background" Value="Blue"/> </Trigger> <Trigger Property="ItemsControl.AlternationIndex" Value="1"> <Setter Property="Background" Value="Red"/> </Trigger> </Style.Triggers> </Style> </ItemsControl.Resources> <ItemsControl

WPF - Best way to remove an item from the ItemsSource

老子叫甜甜 提交于 2019-11-27 22:33:28
问题 I'm writing a custom ItemsControl (a tabbed document container), where each item (tab) can remove itself from the UI when the user closes it. However, I can't remove it directly from the ItemsControl.Items collection, because the items can be databound. So I have to remove it from the ItemsSource , which can be anything ( ICollection , DataTable , DataSourceProvider ...). In the context of my application, I know what the actual type of the ItemsSource will be, but I want that control to be