itemspaneltemplate

Modifying an ItemsPanel's Grid RowDefinitionCollection

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-02 17:26:44
问题 This is a followup for ItemsControl has no children during MainWindow's constructor Based on the answer to SO question "WPF: arranging collection items in a grid", I have the following: <ItemsControl Name="itemsControl1" ItemsSource="{Binding MyItems}"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <Grid Name="theGrid" ShowGridLines="True" /> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemContainerStyle> <Style TargetType="{x:Type FrameworkElement}"> <Setter Property=

How to set ItemsPanelTemplate to a dynamically created Grid in code behind

送分小仙女□ 提交于 2019-12-01 17:24:12
I've got this UserControl defined in XAML and would like to set the ItemsPanelTemplate dynamically in my code behind class (not in the XAML like in the example): <UserControl> <ItemsControl x:Name="Items"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <Grid> <!-- I want to add this Grid definition in code behind --> <Grid.ColumnDefinitions> <ColumnDefinition /> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition /> </Grid.RowDefinitions> </Grid> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> </ItemsControl> </UserControl> I tried something like this.Items.ItemsPanel.Template =

Setting the GroupStyle.Panel of a ListView on Windows Phone

心不动则不痛 提交于 2019-12-01 04:58:10
I'm trying to create a ListView with grouping where the elements in each group are shown horizontally (as a scrollable content). No matter what I tried with the GroupStyle.Panel of the ListView it doesn't seem to have any effect on the list. Here is how my XAML looks: <ListView x:Name="itemListView" Padding="10" SelectionMode="None" IsSwipeEnabled="False" IsItemClickEnabled="True" ItemTemplate="{StaticResource listItemTemplate}"> <ListView.GroupStyle> <GroupStyle> <GroupStyle.Panel> <ItemsPanelTemplate> <ItemsWrapGrid ItemWidth="144" Orientation="Horizontal" /> </ItemsPanelTemplate> <

ListBox with Grid as ItemsPanelTemplate produces weird binding errors

て烟熏妆下的殇ゞ 提交于 2019-11-27 17:50:50
I've got a ListBox control and I'm presenting a fixed number of ListBoxItem objects in a grid layout. So I've set my ItemsPanelTemplate to be a Grid. I'm accessing the Grid from code behind to configure the RowDefinitions and ColumnDefinitions. So far it's all working as I expect. I've got some custom IValueConverter implementations for returning the Grid.Row and Grid.Column that each ListBoxItem should appear in. However I get weird binding errors sometimes, and I can't figure out exactly why they're happening, or even if they're in my code. Here's the error I get: System.Windows.Data Error:

ListBox with Grid as ItemsPanelTemplate produces weird binding errors

▼魔方 西西 提交于 2019-11-26 22:36:32
问题 I've got a ListBox control and I'm presenting a fixed number of ListBoxItem objects in a grid layout. So I've set my ItemsPanelTemplate to be a Grid. I'm accessing the Grid from code behind to configure the RowDefinitions and ColumnDefinitions. So far it's all working as I expect. I've got some custom IValueConverter implementations for returning the Grid.Row and Grid.Column that each ListBoxItem should appear in. However I get weird binding errors sometimes, and I can't figure out exactly