<ui:Page
    x:Class="ModernWpf.SampleApp.ControlPages.RichTextBoxPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:ui="http://schemas.modernwpf.com/2019"
    xmlns:sys="clr-namespace:System;assembly=mscorlib"
    xmlns:sc="clr-namespace:SamplesCommon;assembly=SamplesCommon"
    mc:Ignorable="d">

    <ScrollViewer>
        <ui:SimpleStackPanel Style="{StaticResource ControlPageContentPanelStyle}">
            <sc:ControlExample HeaderText="A simple text editor using RichTextBox.">
                <RichTextBox
                    x:Name="richTextBox"
                    ui:ControlHelper.Header="Control header"
                    ui:ControlHelper.PlaceholderText="Placeholder text"
                    SpellCheck.IsEnabled="True" />
            </sc:ControlExample>

            <sc:ControlExample HeaderText="API in action.">
                <RichTextBox
                    x:Name="textBox"
                    Width="296"
                    Height="105"
                    ui:ControlHelper.Header="Control header" />
                <sc:ControlExample.Options>
                    <ui:SimpleStackPanel Style="{StaticResource OptionsPanelStyle}">
                        <CheckBox
                            Content="AcceptsReturn"
                            IsChecked="{Binding ElementName=textBox, Path=AcceptsReturn}" />
                        <CheckBox
                            Content="IsReadOnly"
                            IsChecked="{Binding ElementName=textBox, Path=IsReadOnly}" />
                        <CheckBox
                            Content="IsReadOnlyCaretVisible"
                            IsChecked="{Binding ElementName=textBox, Path=IsReadOnlyCaretVisible}" />
                        <CheckBox
                            Content="IsUndoEnabled"
                            IsChecked="{Binding ElementName=textBox, Path=IsUndoEnabled}" />
                        <CheckBox
                            Content="IsInactiveSelectionHighlightEnabled"
                            IsChecked="{Binding ElementName=textBox, Path=IsInactiveSelectionHighlightEnabled}" />
                        <CheckBox
                            Content="SpellCheck"
                            IsChecked="{Binding ElementName=textBox, Path=(SpellCheck.IsEnabled)}" />
                        <TextBox
                            ui:ControlHelper.Header="Header"
                            Text="{Binding ElementName=textBox, Path=(ui:ControlHelper.Header), UpdateSourceTrigger=PropertyChanged}" />
                        <TextBox
                            ui:ControlHelper.Header="PlaceholderText"
                            Text="{Binding ElementName=textBox, Path=(ui:ControlHelper.PlaceholderText), UpdateSourceTrigger=PropertyChanged}" />
                        <ComboBox
                            ui:ControlHelper.Header="HorizontalScrollBarVisibility"
                            ItemsSource="{Binding Source={x:Type ScrollBarVisibility}, Converter={StaticResource EnumValuesConverter}}"
                            SelectedItem="{Binding ElementName=textBox, Path=HorizontalScrollBarVisibility}" />
                        <ComboBox
                            ui:ControlHelper.Header="VerticalScrollBarVisibility"
                            ItemsSource="{Binding Source={x:Type ScrollBarVisibility}, Converter={StaticResource EnumValuesConverter}}"
                            SelectedItem="{Binding ElementName=textBox, Path=VerticalScrollBarVisibility}" />
                        <ComboBox
                            ui:ControlHelper.Header="SelectionOpacity"
                            SelectedItem="{Binding ElementName=textBox, Path=SelectionOpacity}"
                            IsEditable="True">
                            <sys:Double>0</sys:Double>
                            <sys:Double>0.4</sys:Double>
                            <sys:Double>1</sys:Double>
                        </ComboBox>
                    </ui:SimpleStackPanel>
                </sc:ControlExample.Options>
            </sc:ControlExample>
        </ui:SimpleStackPanel>
    </ScrollViewer>
</ui:Page>
