다음을 통해 공유


FlowDocumentScrollViewer.Selection 속성

정의

FlowDocumentScrollViewer의 선택된 내용을 가져옵니다.

public:
 property System::Windows::Documents::TextSelection ^ Selection { System::Windows::Documents::TextSelection ^ get(); };
public System.Windows.Documents.TextSelection Selection { get; }
member this.Selection : System.Windows.Documents.TextSelection
Public ReadOnly Property Selection As TextSelection

속성 값

TextSelection

FlowDocumentScrollViewer의 선택된 내용입니다.

예제

다음 예제에서는 사용자가 선택한 FlowDocumentScrollViewer텍스트를 가져오는 방법을 보여줍니다.

<StackPanel>
    <Button Content="Show Selection" Click="ShowSelection_Click"/>
    <FlowDocumentScrollViewer Name="flowdocScrollViewer1" 
                              Margin="10" 
                              BorderBrush="Black"
                              BorderThickness="1"
                              Height="300">
        <FlowDocument ColumnWidth="400" 
                      IsOptimalParagraphEnabled="True" 
                      IsHyphenationEnabled="True">
            <Section FontSize="12">
                <Paragraph>
                    <Bold>Neptune</Bold> (planet), major planet in the solar system, eighth planet
                    from the Sun and fourth largest in diameter.  Neptune maintains an almost constant
                    distance, about 4,490 million km (about 2,790 million mi), from the Sun.  Neptune
                    revolves outside the orbit of Uranus and for most of its orbit moves inside the
                    elliptical path of the outermost planet Pluto (see Solar System). Every 248 years,
                    Pluto’s elliptical orbit brings the planet inside Neptune’s nearly circular orbit
                    for about 20 years, temporarily making Neptune the farthest planet from the Sun.
                    The last time Pluto’s orbit brought it inside Neptune’s orbit was in 1979. In
                    1999 Pluto’s orbit carried it back outside Neptune’s orbit.
                </Paragraph>
                <Paragraph>
                    Astronomers believe Neptune has an inner rocky core that is surrounded by a vast
                    ocean of water mixed with rocky material. From the inner core, this ocean extends
                    upward until it meets a gaseous atmosphere of hydrogen, helium, and trace amounts
                    of methane. Neptune has four rings and 11 known moons. Even though Neptune's volume
                    is 72 times Earth’s volume, its mass is only 17.15 times Earth’s mass. Because of
                    its size, scientists classify Neptune—along with Jupiter, Saturn, and Uranus—as
                    one of the giant or Jovian planets (so-called because they resemble Jupiter).
                </Paragraph>
                <Paragraph>
                    Mathematical theories of astronomy led to the discovery of Neptune. To account for
                    wobbles in the orbit of the planet Uranus, British astronomer John Couch Adams and
                    French astronomer Urbain Jean Joseph Leverrier independently calculated the existence
                    and position of a new planet in 1845 and 1846, respectively. They theorized that the
                    gravitational attraction of this planet for Uranus was causing the wobbles in Uranus’s
                    orbit. Using information from Leverrier, German astronomer Johann Gottfried Galle first
                    observed the planet in 1846.
                </Paragraph>
            </Section>
        </FlowDocument>
    </FlowDocumentScrollViewer>
</StackPanel>
private void ShowSelection_Click(object sender, RoutedEventArgs e)
{
    MessageBox.Show(flowdocScrollViewer1.Selection.Text);
}
Private Sub ShowSelection_Click(ByVal sender As System.Object, _
                                ByVal e As System.Windows.RoutedEventArgs)

    MessageBox.Show(flowdocScrollViewer1.Selection.Text)

End Sub

설명

Selection .NET Framework 버전 3.5에서에서 도입 되었습니다. 자세한 내용은 버전 및 종속성을 참조하세요.

적용 대상