簡體   English   中英

在WPF documentViewer中設置光標

[英]Setting the cursor in a WPF documentViewer

我正在創建一個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>

但是,當光標位於頁面上方時,我似乎無法從其文本光標的默認設置更改它。

您可以嘗試以下語句:

Cursor="Arrow"  ForceCursor="True"

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM