在显示的代码中
XAML:
import qualified Data.Vector.Unboxed.Mutable as M
import Data.Vector.Unboxed
import Control.Monad.ST
import Control.Monad
createCustomeInitializedArray :: ST s (Vector Int)
createCustomeInitializedArray = do
arr <- M.new 10
-- ...
iarr <- freeze arr
return iarr
C#:
<Window x:Class="ScrollBarFocus.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ScrollBarFocus"
mc:Ignorable="d"
ResizeMode="CanMinimize"
SizeToContent="WidthAndHeight"
Title="MainWindow">
<Grid HorizontalAlignment="Center" VerticalAlignment="Center">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Button Grid.Row="0" Click="Button_Click" Content="Click me to focus on the ScrollBar"/>
<ScrollBar x:Name="TheScrollBar" Grid.Row="1" Maximum="99" Orientation="Horizontal" SmallChange="1"/>
<TextBox BorderBrush="Black" Grid.Row="2" IsReadOnly="True" Text="{Binding ElementName=TheScrollBar, Path=Value, StringFormat={}{0:####0}}" TextAlignment="Center"/>
<Label x:Name="TheStatus" Grid.Row="3" Height="40" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Width="400"/>
<x:Code>
<![CDATA[
void Button_Click(object sender, RoutedEventArgs e) {
TheStatus.Content = "TheScrollBar.Focus() == " + TheScrollBar.Focus().ToString();
}
]]>
</x:Code>
</Grid>
</Window>
我显然在这里遗漏了一些东西。 UIElement.Focus不接受焦点吗?
答案 0 :(得分:1)
简单回答:滚动条不接受焦点:)。
答案 1 :(得分:0)