检索"模板" ItemsControl的项目

时间:2016-04-16 10:32:02

标签: wpf xaml win-universal-app itemscontrol contentcontrol

我目前在UWP中做自定义面板。

我有以下xaml:

<ItemsControl Name="itemsControl" ItemsSource="{Binding ForTest}"  
    SizeChanged="OnFluidPaneSizeChanged" >
    <ItemsControl.ItemsPanel >
        <ItemsPanelTemplate>
            <wpfSpark:FluidWrapPanel>
                <wpfSpark:FluidWrapPanel.ElementEasing>
                    <BackEase EasingMode="EaseOut" Amplitude="0.35"></BackEase>
                </wpfSpark:FluidWrapPanel.ElementEasing>
                <wpfSpark:FluidWrapPanel.DragEasing>
                    <BackEase EasingMode="EaseOut" Amplitude="0.65"></BackEase>
                </wpfSpark:FluidWrapPanel.DragEasing>
            </wpfSpark:FluidWrapPanel>
        </ItemsPanelTemplate>
    </ItemsControl.ItemsPanel>
    <ItemsControl.ItemTemplate>
        <DataTemplate >
        <Button Margin="10" MinHeight="50" MinWidth="40" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                SomeButton
            </Button>
        </DataTemplate>
    </ItemsControl.ItemTemplate>
</ItemsControl>

我正在聆听SizeChanged,我设法得到了我的小组:

FluidWrapPanel fwPanel = itemsControl.ItemsPanelRoot as FluidWrapPanel;

我也可以获得这些物品:

fwPanel.FluidItems

但是那些是ContentControl

我要更改生成的每件商品的WidthHeight,那么如何通过将此尺寸设置为每个按钮来结束呢?

0 个答案:

没有答案