今天测试报了一个BUG 在TD上面, BUG的内容很奇怪
“客户端除了实时浏览的已展开设备列表结构不会因切换tab窗口而变化外,其它窗口都会因切换窗口后其已展开的设备列表还原为初始状态”
我们的客户端界面左侧是有一个树的设备列表的,后面看了代码后也不明所以,为什么切换tag展开过的 树的结构会还原呢?
后面对比了一下实时浏览的treeview 发现了问题的所在。
这是实时浏览的treeview
<TreeView x:Name="DeviceTree"
Grid.Row="2"
Grid.Column="0"
BorderThickness="0"
AllowDrop="True"
Focusable="False"
SelectedItemChanged="DeviceTree_SelectedItemChanged"
MouseDoubleClick="DeviceTree_MouseDoubleClick"
Background="{DynamicResource LeftBGBrush}">
<TreeViewItem x:Name="RootItem"
ItemTemplate="{StaticResource deviceTreeItemTemplate}"
IsExpanded="True"
ItemContainerStyle="{StaticResource deviceTreeViewItemStyle}"
PreviewMouseLeftButtonDown="RootItem_PreviewMouseLeftButtonDown"
PreviewMouseMove="RootItem_PreviewMouseMove">
<TreeViewItem.Header>
<Grid x:Name="root">
<TextBlock x:Name="text_root" Text="{x:Static lang:Strings.E_WaitingText}" Margin="5,0,0,0" VerticalAlignment="Center" FontFamily="宋体" Foreground="#FF666666"/>
</Grid>
</TreeViewItem.Header>
</TreeViewItem>
</TreeView>
这是其他tag页里面的treeview
<TreeView x:Name="DeviceTree"
Grid.Row="3"
Grid.Column="0"
BorderThickness="0"
AllowDrop="True"
Focusable="False"
Background="{DynamicResource LeftBGBrush}">
<TreeViewItem x:Name="RootItem"
ItemTemplate="{StaticResource treeItemTemplate}"
ItemsSource="{Binding DeviceList}"
IsExpanded="True"
ItemContainerStyle="{StaticResource deviceTreeViewItemStyle}"
PreviewMouseMove="RootItem_PreviewMouseMove">
<TreeViewItem.Header>
<StackPanel x:Name="root" Orientation="Horizontal">
<TextBlock x:Name="text_root" Text="root" Margin="5,0,0,0" VerticalAlignment="Center" FontFamily="宋体" Foreground="#FF666666"/>
</StackPanel>
</TreeViewItem.Header>
</TreeViewItem>
</TreeView>
</Grid>
相信大家都看出来区别了 就是这句“
ItemsSource="{Binding DeviceList}"
实时浏览页面treeview 的itemsource 是在后台赋值的,所以如果在前台Binding的童鞋要注意了,页面每次出现都会重新加载update一次。