WP7 Toolkit AutoCompleteBox 在 Pivot and Panorama无法正常显示的解决方案

博客详细介绍了如何解决Silverlight框架中AutoCompleteBox组件的BUG,并提供了Jeff Wilcox提供的解决方案,包括下载ZIP文件和应用相关代码。文章指导读者复制VisibilityConverter.cs文件到工程,并在XAML中进行配置,实现问题的解决。

在官方Issue Tracker 有人提出这个BUG

http://silverlight.codeplex.com/workitem/7574

主要说了牛人 Jeff Wilcox 提供了解决方案

http://www.jeff.wilcox.name/2011/03/acb-in-pivot/

最好下载:根据代码最好理解了

[ZIP] 31 KB – AutoCompletePivot.zip

http://www.jeff.wilcox.name/wp-content/uploads/2011/03/AutoCompletePivot.zip

 

代码很多就不仔细说了;

复制Converters/VisibilityConverter.cs 到你的工程

然后 在xaml 里  OK 搞定!~

< Grid.Resources >
     < localControls:VisibilityConverter x:Key = "Vis" />
</ Grid.Resources >

 

< ControlTemplate TargetType = "toolkit:AutoCompleteBox" >
     < Grid >
         < Grid.RowDefinitions >
             < RowDefinition Height = "Auto" />
             < RowDefinition />
         </ Grid.RowDefinitions >
         < TextBox
             x:Name = "Text"
             Background = "{TemplateBinding Background}"
             BorderBrush = "{TemplateBinding BorderBrush}"
             BorderThickness = "{TemplateBinding BorderThickness}"
             FontFamily = "{TemplateBinding FontFamily}"
             FontSize = "{TemplateBinding FontSize}"
             FontStyle = "{TemplateBinding FontStyle}"
             FontWeight = "{TemplateBinding FontWeight}"
             Foreground = "{TemplateBinding Foreground}"
             InputScope = "{TemplateBinding InputScope}"
             Opacity = "{TemplateBinding Opacity}"
             Padding = "{TemplateBinding Padding}"
             Style = "{TemplateBinding TextBoxStyle}" />
         < ListBox
             Margin = "12"
             Visibility = "{Binding Path=IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource Vis}}"
             Grid.Row = "1"
             x:Name = "Selector"
             Background = "White"
             FontFamily = "{TemplateBinding FontFamily}"
             FontSize = "{TemplateBinding FontSize}"
             FontStyle = "{TemplateBinding FontStyle}"
             FontWeight = "{TemplateBinding FontWeight}"
             Foreground = "{TemplateBinding Foreground}"
             IsTabStop = "False"
             ItemContainerStyle = "{TemplateBinding ItemContainerStyle}"
             ItemTemplate = "{TemplateBinding ItemTemplate}"
             Opacity = "{TemplateBinding Opacity}"
             BorderBrush = "{StaticResource PhoneTextBoxEditBorderBrush}"
             BorderThickness = "{TemplateBinding BorderThickness}"
             Padding = "0,8" />
     </ Grid >
</ ControlTemplate >

转载于:https://www.cnblogs.com/piaocz/archive/2011/10/23/2221808.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值