【问题标题】:Setting the cursor in a WPF documentViewer在 WPF documentViewer 中设置光标
【发布时间】:2012-01-24 11:18:09
【问题描述】:

我正在创建一个 WPF 文档查看器,当它被双击时会放大到一个页面。为此,我试图让光标在文档查看器中的页面上变成一只手,而在其他地方则变成一个箭头。

我的 xaml 设置是这样的

<UserControl x:Class="WPFXPSViewerControl.XPSControl"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                     xmlns:UI="clr-namespace:Bluewire.Epro.UI;assembly=EproClientCore"
         xmlns:System="clr-namespace:System;assembly=mscorlib" mc:Ignorable="d"
         Loaded="Window_Loaded"
         Height="1200" MouseDoubleClick="Double_Click">
<Grid Grid.Row="2" Grid.Column="2" Cursor="Hand">
    <Grid.RowDefinitions>
        <RowDefinition Height="*"/>
        <RowDefinition Height="20" Cursor="Arrow"/>
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
        <ColumnDefinition />
        <ColumnDefinition />
    </Grid.ColumnDefinitions>

    <DocumentViewer Name="document" Grid.ColumnSpan="2" Cursor="Arrow">

    </DocumentViewer>
    <Button Width="200" Name="btnZoomIn" Grid.Row="1" Grid.Column="0" Cursor="Hand" Click="btnZoomIn_Click">Zoom In</Button>
    <Button Width="200" Name="btnZoomOut" Grid.Row="1" Grid.Column="1" Cursor="Hand" Click="btnZoomOut_Click">Zoom Out</Button>
</Grid>

</UserControl>

但是,当光标从默认设置的文本光标移到页面上时,我似乎无法更改光标。

【问题讨论】:

    标签: wpf documentviewer


    【解决方案1】:

    您可以尝试以下语句:

    Cursor="Arrow"  ForceCursor="True"
    

    【讨论】:

      猜你喜欢
      • 2010-11-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多