[英]ListBox in Popup WP7
我正在嘗試為Windows Phone 7應用程序的搜索建議/歷史記錄創建自定義彈出窗口,但是遇到了一些無法解決的問題。
我在彈出窗口中使用列表框來顯示結果,但是,
a)我的物品顯示不正確,它列出了從-1位置開始的物品??? 在列表框中,但是當它們被選擇時,它們給出下面的值。
b)在我的頁面中,我有一個顯示搜索結果的列表框,並且我的彈出式建議顯示在該列表框上(以下為“文本框”),並且當我滾動/選擇建議時,下面的列表框會滾動並選擇項目。
有誰知道解決方法或修復?
這是我的(簡化)代碼:
<Popup Name="AutoCompleteList">
<Border Background="White" BorderThickness="1" BorderBrush="Black" HorizontalAlignment="Center">
<ListBox x:Name="ListItems" HorizontalAlignment="Left" Height="Auto">
<ListBoxItem>
<TextBlock Text="Test1" Foreground="Black" />
</ListBoxItem>
<ListBoxItem>
<TextBlock Text="Test2" Foreground="Black" />
</ListBoxItem>
<ListBoxItem>
<TextBlock Text="Test3" Foreground="Black" />
</ListBoxItem>
<ListBoxItem>
<TextBlock Text="Test4" Foreground="Black" />
</ListBoxItem>
<ListBoxItem>
<TextBlock Text="Test5" Foreground="Black" />
</ListBoxItem>
<ListBoxItem>
<TextBlock Text="Test6" Foreground="Black" />
</ListBoxItem>
<ListBoxItem>
<TextBlock Text="Test7" Foreground="Black" />
</ListBoxItem>
<ListBoxItem>
<TextBlock Text="Test8" Foreground="Black" />
</ListBoxItem>
<ListBoxItem>
<TextBlock Text="Test9" Foreground="Black" />
</ListBoxItem>
<ListBoxItem>
<TextBlock Text="Test10" Foreground="Black" />
</ListBoxItem>
</ListBox>
</Border>
</Popup>
謝謝。
a) ListBox
初始SelectedIndex
始終為-1
b)聽起來像預期的行為。 沒有剩下的代碼就不可能說。
但是,如果要使用AutoCompleteBox,則應使用Silverlight Toolkit中的AutoCompleteBox
。 你可以在這里讀到一些
我發現了問題。
a)我在宿主UserControl的頁面中使用wp7工具包的旋轉旋轉效果進行精美的導航,這影響了Popup中ListBox的外觀:
<toolkit:TransitionService.NavigationInTransition>
<toolkit:NavigationInTransition>
<toolkit:NavigationInTransition.Backward>
<toolkit:TurnstileTransition Mode="BackwardIn"/>
</toolkit:NavigationInTransition.Backward>
<toolkit:NavigationInTransition.Forward>
<toolkit:TurnstileTransition Mode="ForwardIn"/>
</toolkit:NavigationInTransition.Forward>
</toolkit:NavigationInTransition>
</toolkit:TransitionService.NavigationInTransition>
<toolkit:TransitionService.NavigationOutTransition>
<toolkit:NavigationOutTransition>
<toolkit:NavigationOutTransition.Backward>
<toolkit:TurnstileTransition Mode="BackwardOut"/>
</toolkit:NavigationOutTransition.Backward>
<toolkit:NavigationOutTransition.Forward>
<toolkit:TurnstileTransition Mode="ForwardOut"/>
</toolkit:NavigationOutTransition.Forward>
</toolkit:NavigationOutTransition>
</toolkit:TransitionService.NavigationOutTransition>
b)我再次使用工具包:LongListSelector作為搜索結果的列表框,並且該控件從浮動於其上方的彈出窗口中竊取了鼠標操作,但使用標准的ListBox控件的效果很好。
h!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.