申请主机网站,wordpress可视化界面,wordpress zp,最全的游戏网站在前面分享的几篇中咱已经玩耍了Popup、ListBox多选、Grid动态分、RadioButton模板、控件的拖放效果、控件的置顶和置底、控件的锁定、自定义Window样式、动画效果、Expander控件;今天趁着空闲时间接着去摸索基于ListBox的折叠列表的效果,最终实现的效果如下图:先来看看布局吧:… 在前面分享的几篇中咱已经玩耍了Popup、ListBox多选、Grid动态分、RadioButton模板、控件的拖放效果、控件的置顶和置底、控件的锁定、自定义Window样式、动画效果、Expander控件;今天趁着空闲时间接着去摸索基于ListBox的折叠列表的效果,最终实现的效果如下图:先来看看布局吧:前台的布局代码:外面ListBox的子项模板:ListBox.ItemTemplateDataTemplate!--这里绑定ListBoxItem的IsSelected可以控制只展开一项--!--去掉绑定的话可以展开多项--!--IsExpanded{Binding $parent[ListBoxItem].IsSelected}--Expander Header{Binding Name} Cores:AttachedDependencyHelper.ExpanderHeaderImg{Binding HeaderImg} ForegroundWhite Width{Binding $parent[ListBox].Width}HorizontalContentAlignmentStretch VerticalContentAlignmentStretchListBox Items{Binding ChildData} Width260ItemTemplate{StaticResource LisBoxItemTemplate}ListBox.StylesStyle SelectorListBoxItem /template/ Border#OutBorderSetter PropertyBackground Value#1C3466//Style!--鼠标pointerover的颜色--Style SelectorListBoxItem:pointerover /template/ Border#OutBorderSetter PropertyBackground Value#cc075c9f//Style!--鼠标selected的颜色--Style SelectorListBoxItem:selected /template/ Border#OutBorderSetter PropertyBackground Value#075C9F//Style/ListBox.Styles/ListBox/Expander/DataTemplate
/ListBox.ItemTemplate里面的ListBox的子项模板:DataTemplate x:KeyLisBoxItemTemplateGrid Width{Binding $parent[ListBox].Width}WrapPanel OrientationHorizontal Margin30,0,0,0 VerticalAlignmentCenterImage Source{Binding ManagerType,Converter{StaticResource ManagerTypeEnumToImageConverter}} Height20 StretchUniform/TextBlock Margin10,0,0,0 HorizontalAlignmentCenter Text{Binding PathName,StringFormat{}我是{0}} ForegroundWhite//WrapPanelButton ClassesRemoveItemButton Tag{Binding} IsVisible{Binding $parent[ListBoxItem].IsSelected} CommandParameter{Binding .}Command{Binding DataContext.RemoveItemCommand,RelativeSource{RelativeSource AncestorType{x:Type ListBox} AncestorLevel2}}//Grid
/DataTemplate最终简单的效果先这样吧;回头可以基于玩耍一下联系人的效果;以后有时间的话,可以再去摸索一下更复杂的效果;编程不息、Bug不止、无Bug、无生活;改bug的冷静、编码的激情、完成后的喜悦、挖坑的激动 、填坑的兴奋;这也许就是屌丝程序员的乐趣吧;今天就到这里吧;希望自己有动力一步一步坚持下去;生命不息,代码不止;大家抽空可以看看今天分享的效果,有好的意见和想法,可以在留言板随意留言;我看到后会第一时间回复大家,多谢大家的一直默默的关注和支持!如果觉得不错,那就伸出您的小手点个赞并关注一下,多谢您的支持