上一篇文章已經提前預告了今天要分享的效果,今天接著上一篇的效果接著去實現,還是先來看最終實現的效果:
1、關于簡單的布局設計:
總結:①③是Expander②④⑤⑥是ListBox
2、把上一篇的②這一塊用ListBox替換:
<Expander Grid.Column="1" ExpandDirection="Left" Header="控制卡" VerticalAlignment="Bottom" HorizontalAlignment="Right"Style="{DynamicResource LeftExpanderStyle}" Background="Transparent"><ListBox Style="{StaticResource SignalCardListBox}" ItemsSource="{Binding VideoCard.SignalDistributionCards}"/>
</Expander>
3、然后就是最愛的ItemContainerStyle:
<Style x:Key="SignalCardListBoxItemStyle" TargetType="{x:Type ListBoxItem}"><Setter Property="SnapsToDevicePixels" Value="True"/><Setter Property="Padding" Value="0"/><Setter Property="Background" Value="Transparent"/><Setter Property="BorderBrush" Value="#282BFF"/><Setter Property="BorderThickness" Value="1"/><Setter Property="Margin" Value="4,4,4,0"/><Setter Property="FocusVisualStyle" Value="{x:Null}"/><Setter Property="Template"><Setter.Value><ControlTemplate TargetType="{x:Type ListBoxItem}"><Expander Header="信號分配卡" Style="{DynamicResource ExpanderStyle}" VerticalAlignment="Bottom" Padding="0"><ListBox Style="{StaticResource BoxBodyListListBox}" ItemsSource="{Binding BoxBodys}"/></Expander></ControlTemplate></Setter.Value></Setter>
</Style>
4、ListBox的ItemsPanel:
<ItemsPanelTemplate x:Key="SignalCardItemsPanelTemplate"><VirtualizingStackPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
5、至于⑤⑥的ListBox就沒什么可說的了:
最終簡單的效果先這樣吧;以后有時間的話,可以再去摸索一下更復雜的效果
;編程不息、Bug不止、無Bug、無生活
;改bug的冷靜、編碼的激情、完成后的喜悅、挖坑的激動 、填坑的興奮;這也許就是屌絲程序員的樂趣吧;今天就到這里吧;希望自己有動力一步一步堅持下去;生命不息,代碼不止;大家抽空可以看看今天分享的效果,有好的意見和想法,可以在留言板隨意留言;我看到后會第一時間回復大家,多謝大家的一直默默的關注和支持!如果覺得不錯,那就伸出您的小手點個贊并關注一下,多謝您的支持!