gpt4 book ai didi

c# - 从列表中填充 WrapPanel

转载 作者:行者123 更新时间:2023-11-30 14:19:42 26 4
gpt4 key购买 nike

有没有办法将列表按钮动态绑定(bind)到 WrapPanel 及其事件?

最佳答案

我不太确定这对你想做的事情是否正确,但听起来很相似:

来自上面链接的 XAML 如下:

<ItemsControl x:Name="activitiesControl" Margin="10">
<ItemsControl.Template>
<ControlTemplate>
<WrapPanel Width="{TemplateBinding Width}" Height="{TemplateBinding Height}"
FlowDirection="LeftToRight" IsItemsHost="true">
</WrapPanel>
</ControlTemplate>
</ItemsControl.Template>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button Style="{DynamicResource ActionButton}" HorizontalAlignment="Right" Margin="5"
Content="{Binding Value}" Width="200"
Command="{Binding Path=ViewModel.ActionTypeCommand,
RelativeSource={RelativeSource Mode=FindAncestor,
AncestorType=local:CustomerEditView}}" CommandParameter="{Binding Key}"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>

关于c# - 从列表中填充 WrapPanel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2354516/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com