Line Number TextBox WPF

Post a Comment
Chào mọi người, bài viết này mình sẽ hướng dẫn mọi người một thủ thuật khi viết một chương trình WPF - Windows Presentation Foundation.
Line Number TextBox WPF

Chúng ta bắt đầu nhé.

1. References -> Manage NuGet Packages -> Install AvalonEditor vào Project
2. Quay lại MainWindow.xaml, thêm.
xmlns:Avalon="http://icsharpcode.net/sharpdevelop/avalonedit"

trong thẻ Window 3. Trong thẻ Grid, thêm.
<ScrollViewer VerticalScrollBarVisibility="Visible">
    <Avalon:TextEditor ShowLineNumbers="True"
        Text="">
    </Avalon:TextEditor>
</ScrollViewer>

MainWindow.xaml
<Window x:Class="WpfApp1.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:WpfApp1"
        xmlns:Avalon="http://icsharpcode.net/sharpdevelop/avalonedit"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <Grid>
        <ScrollViewer VerticalScrollBarVisibility="Visible">
            <Avalon:TextEditor ShowLineNumbers="True"
                Text="">
            </Avalon:TextEditor>
        </ScrollViewer>
    </Grid>
</Window>

Như vậy đã hoàn thành, chúc mọi người thành công.

Lê Hùng
Lê Hùng
Chia sẽ kiến thức và tư duy sáng tạo của bản thân mỗi ngày cho cộng đồng internet Việt Nam và thế giới

Post a Comment

@Partner

Chúng tôi sẽ gỡ liên kết đối với những blog/website vi phạm chính sách & quy định chung về liên kết.