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

在官方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>

posted @   贝壳笨  阅读(492)  评论(0编辑  收藏  举报
编辑推荐:
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
阅读排行:
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
· 周边上新:园子的第一款马克杯温暖上架
点击右上角即可分享
微信分享提示