我有一个WPF应用程序需要支持屏幕阅读器(尤其是JAWS).问题是,当列表视图项已更改(添加,删除)时,JAWS不会发布任何内容.盲人用户完全不知道发生了什么.我有什么方法强制屏幕阅读器宣布一些文本,当尝试从列表视图控件添加/删除项目?我该怎么办?
我有一个跟随xaml的窗口:
<Window x:Class="TestDemoApp.TreeViewWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="TreeViewWindow" Height="300" Width="300">
<Window.Resources>
<Style TargetType="Control" x:Key="FocusedStyle">
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle StrokeThickness="1"
Stroke="Red"
StrokeDashArray="1 2 3 4"
SnapsToDevicePixels="true"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="TreeViewItem">
<Setter Property="IsTabStop" Value="True"/>
<Setter Property="Focusable" Value="True"/>
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusedStyle}"/>
<Setter Property="KeyboardNavigation.TabNavigation" Value="Continue"/>
</Style>
<Style TargetType="ListViewItem">
<Setter Property="IsTabStop" Value="True"/>
<Setter Property="Focusable" Value="True"/>
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusedStyle}"/>
<Setter Property="KeyboardNavigation.TabNavigation" Value="Continue"/>
</Style>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<ListView TabIndex="1" BorderThickness="5" Focusable="True" IsTabStop="True" KeyboardNavigation.TabNavigation="Continue" FocusVisualStyle="{StaticResource FocusedStyle}">
<ListViewItem TabIndex="2" Content="List Item …Run Code Online (Sandbox Code Playgroud) 我有一个名为Users的表(例如),它有3列(Id、Name和IsDeleted),IsDeleted表示用户被删除,还是不被删除?
当我运行下面的 select 语句(select * from users)时,是否可以自动过滤掉 IsDeleted 等于 1 的记录?我有一个仅设计为软删除的数据库,因此有很多带有此 IsDeleted 列的表。当查询数据库时,我们必须添加where子句来过滤掉这些记录,这非常烦人,尤其是在查询/连接多个表时。我想在这里问,是否有一些功能(如默认过滤器?)可以做到这一点。因此,只有在禁用表默认过滤器的情况下,才能查询已删除的记录。
private void Window_Loaded(object sender, RoutedEventArgs e)
{
try
{
RichTextBox myRTB = new RichTextBox();
ListViewItem lvi1 = new ListViewItem();
ListViewItem lvi2 = new ListViewItem();
lvi1.Content = myRTB;
lvi2.Content = myRTB;
this.lstView1.Items.Add(lvi1);
this.lstView2.Items.Add(lvi2);
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
Run Code Online (Sandbox Code Playgroud)
两台机器:
机器1:安装了Windows 7 32位,.net4.0
机器2:安装了Windows 8 64位,.net4.0/4.5
上面的代码总是在机器1上崩溃,除了"指定的元素已经是另一个元素的逻辑子元素,首先断开它.
但是,它适用于机器2.(lvi2的内容实际上是空的)
有人可以详细解释,为什么会发生?(注意:测试应用程序是使用VS2010,.net 4.0构建的)
补充:以下代码有相同的问题(在机器2上工作,而不是机器1)
try
{
RichTextBox myRTB = new RichTextBox();
ListViewItem lvi1 = new ListViewItem();
lvi1.Content = myRTB;
this.lstView1.Items.Add(lvi1);
this.lstView1.Items.Remove(lvi1);
ListViewItem lvi2 = new ListViewItem();
lvi2.Content = myRTB;
this.lstView2.Items.Add(lvi2);
}
catch (Exception …Run Code Online (Sandbox Code Playgroud)