解决windows phone 7 toolkit中Expanderview点击未展开的可展开列表项题目下边缘空白出现响应的问题
2012-01-11 23:02
357 查看
出现这个问题,是跟Expanderview中带年纪Header和点击Item程序响应鼠标点击消息两次有关系,即不仅Header接收到了Tap消息,响应之后又讲此Tap消息传递给Item进行了处理,所以出现了,点击空白区域,程序先交给Header处理点击消息,进行了相应处理,然后又交给Item进行消息处理,就会出现意想不到的结果,具体要根据项目中处理鼠标消息写在了Listbox中还是写在Header中还是Item中,或者其中某几项中,根据自己的项目程序如下,和后台代码也有关联,不多赘述了。
如代码PTA项目中的Pivot中的一项:
图片中,点击每一项都会有子菜单,有+号的可以展开,代码中第二行 VerticalAlignment="Top"加上之后可以让程序正常运行,未展开时,点击最后一项的下面附近区域,程序不会有相应,如果不加,项目会进入点击最后一项之后的列表项其中一项的状态,
具体效果见本项目PTA的1月10号之前的版本。和1月11号以后的做对比。
如代码PTA项目中的Pivot中的一项:
<controls:PivotItem Name="Pivot_Phrase" Header="Phrase Book"> <ListBox Name="PhraseList" ItemsSource="{Binding}" VerticalAlignment="Top" Margin="12,0,0,0"> <!--<ListBox.ItemContainerStyle> <Style TargetType="ListBoxItem"> <Setter Property="HorizontalContentAlignment" Value="Stretch"/> </Style> </ListBox.ItemContainerStyle>--> <ListBox.ItemTemplate> <DataTemplate> <toolkit:ExpanderView Margin="0,0,0,8" Header="{Binding}" ItemsSource="{Binding}" NonExpandableHeader="{Binding}" IsNonExpandable="{Binding HasSingleMessage}" Tap="ExpanderView_Tap" > <!-- The HeaderTemplate describes the header for an expandable item. In the sample, it's the TextBlock for "Anne Wallace".--> <toolkit:ExpanderView.HeaderTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <TextBlock Name="Node" Text="{Binding Title}" Width="300" Foreground="{StaticResource PhoneForegroundBrush}" FontSize="{StaticResource PhoneFontSizeExtraLarge}" FontFamily="{StaticResource PhoneFontFamilySemiLight}"/> <Image Source="{Binding Arrow}"></Image> </StackPanel> </DataTemplate> </toolkit:ExpanderView.HeaderTemplate> <toolkit:ExpanderView.ItemTemplate > <DataTemplate> <ListBoxItem toolkit:TiltEffect.IsTiltEnabled="True"> <StackPanel> <TextBlock Text="{Binding Sender}" TextWrapping="Wrap" Margin="0,8,0,-4" Tap="PhraseList_Tap" Foreground="{StaticResource PhoneForegroundBrush}" FontSize="27" Width="400" FontFamily="{StaticResource PhoneFontFamilySemiLight}"/> </StackPanel> </ListBoxItem> </DataTemplate> </toolkit:ExpanderView.ItemTemplate> <toolkit:ExpanderView.NonExpandableHeaderTemplate> <DataTemplate> <StackPanel Orientation="Horizontal" toolkit:TiltEffect.IsTiltEnabled="True"> <TextBlock Text="{Binding Title}" Width="300" Foreground="{StaticResource PhoneForegroundBrush}" FontSize="{StaticResource PhoneFontSizeExtraLarge}" FontFamily="{StaticResource PhoneFontFamilySemiLight}"/> </StackPanel> </DataTemplate> </toolkit:ExpanderView.NonExpandableHeaderTemplate> </toolkit:ExpanderView> </DataTemplate> </ListBox.ItemTemplate> </ListBox> </controls:PivotItem>
图片中,点击每一项都会有子菜单,有+号的可以展开,代码中第二行 VerticalAlignment="Top"加上之后可以让程序正常运行,未展开时,点击最后一项的下面附近区域,程序不会有相应,如果不加,项目会进入点击最后一项之后的列表项其中一项的状态,
具体效果见本项目PTA的1月10号之前的版本。和1月11号以后的做对比。
相关文章推荐
- Android开发之如何在WebView中点击链接使用自身打开(解决出现的选择使用第三方应用的问题)
- TextView按钮点击第二次才有响应的问题解决
- android用webview加载H5页面出现点击事件失效的问题解决
- TextView设置文本部分可点击时出现文本不显示的问题分析与解决
- 解决ViewPager嵌套Fragment内部点击事件无响应问题
- Android WebView加载出现空白页面问题解决
- 解决ViewPager嵌套Fragment内部点击事件无响应问题
- 当点击onBackpress方法或者onKeyDown方法时出现不能响应的问题解决办法
- 解决StoryBoard上cell上定义的view的背景点击后不显示的问题(其中用uiview 当作线的时候最多遇到,会不显示线 而出现不流畅问题)
- 解决CCScrollView中菜单条目在不可见时仍响应点击事件的问题
- 解决 点击ListView空白处事件不响应问题
- android Webview中注入js,用于解决第三方页中出现返回事件window.history.go(-1),无法响应问题
- 安卓二级列表的适配器 带优化的 解决二级列表里添加了自定义view以后不能点击展开的问题
- 解决CCScrollView中菜单条目在不可见时仍响应点击事件的问题
- 解决listview item Textview加超链接 超链接以外部分不响应listview item点击事件问题
- 解决通过UIAlertView按钮点击事件pop回上级页面键盘会响应问题
- 当点击onBackpress方法或者onKeyDown方法时出现不能响应的问题解决办法
- 解决界面有搜索栏时,点击TableView的空白界面,键盘不消失的问题
- 解决 点击ListView空白处事件不响应问题
- 解决Fragment中使用ViewPager时,ViewPager里的Fragment错位和空白问题