richtextbox dans mon application qui n'affiche qu'un seul caractère par ligne

GSr 1 Reputation point
2020-05-05T08:30:50.073+00:00

Bonjour,

Il m'arrive quelque chose de curieux.

J'ai un richtextbox dans mon application qui n'affiche qu'un seul caractère par ligne. Je n'arrive pas à voir pourquoi.

Je vous remercie de m'éclairer.

Cordialement

<Grid Height="600">
<Grid.RowDefinitions>
<RowDefinition Height="35"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.Resources>
<Style TargetType="{x:Type Button}" x:Key="formatTextStyle">
<Setter Property="FontFamily" Value="Palatino Linotype"/>
<Setter Property="Width" Value="30"/>
<Setter Property="FontSize" Value="14"/>

                      &lt;Setter Property=&#34;CommandTarget&#34; Value=&#34;{Binding ElementName=mainRTB}&#34;/&gt; 
                        &lt;/Style&gt;
                        &lt;Style TargetType=&#34;{x:Type Button}&#34; x:Key=&#34;formatImageStyle&#34;&gt;
                            &lt;Setter Property=&#34;Width&#34; Value=&#34;30&#34;/&gt;  
                            &lt;Setter Property=&#34;BorderBrush&#34; Value=&#34;Gray&#34;/&gt;
                            &lt;Setter Property=&#34;CommandTarget&#34; Value=&#34;{Binding ElementName=mainRTB}&#34;/&gt;
                        &lt;/Style&gt;
                    &lt;/Grid.Resources&gt;
                    &lt;DockPanel Name=&#34;mainPanel&#34; Grid.Row=&#34;0&#34;&gt;
                        &lt;!-- ce toolbar conytient tous les boutons d&#39;édition--&gt;
                        &lt;ToolBar Name=&#34;mainToolBar&#34; DockPanel.Dock=&#34;Top&#34; Height=&#34;40&#34; Background=&#34;White&#34;&gt;
                            &lt;Button x:Name=&#34;buttMainRTBOuvrir&#34; Style=&#34;{StaticResource formatImageStyle}&#34; Click=&#34;buttMainRTBOuvrir_Click&#34; ToolTip=&#34;Onvrir&#34; &gt;
                                    &lt;Image Source=&#34;C:\VendiStrat\VendittoreStratego\VendittoreStratego\VendittoreStratego\Images\EditTexte\2020FileOpen.png&#34;&gt;&lt;/Image&gt;
                            &lt;/Button&gt;
                            &lt;Button x:Name=&#34;buttMainRTBEnreg&#34; Style=&#34;{StaticResource formatImageStyle}&#34; Click=&#34;buttMainRTBEnreg_Click&#34; ToolTip=&#34;Enregistrer&#34;&gt;
                                   &lt;Image Source=&#34;C:\VendiStrat\VendittoreStratego\VendittoreStratego\VendittoreStratego\Images\EditTexte\2020FileSave.png&#34;/&gt;
                            &lt;/Button&gt;
                            &lt;Button x:Name=&#34;buttMainRTBImprim&#34; Style=&#34;{StaticResource formatImageStyle}&#34; Click=&#34;buttMainRTBimprim_Click&#34; ToolTip=&#34;Imprimer&#34;&gt;
                                &lt;Image Source=&#34;C:\VendiStrat\VendittoreStratego\VendittoreStratego\VendittoreStratego\Images\EditTexte\2020Imprimante.png&#34;/&gt;
                            &lt;/Button&gt;
                            &lt;Separator /&gt;
                            &lt;Button Style=&#34;{StaticResource formatImageStyle}&#34; Command=&#34;ApplicationCommands.Cut&#34; ToolTip=&#34;Couper&#34;&gt;
                                &lt;Image Source=&#34;C:\VendiStrat\VendittoreStratego\VendittoreStratego\VendittoreStratego\Images\EditTexte\2020CCPCut.png&#34;/&gt;
                            &lt;/Button&gt;
                            &lt;Button Style=&#34;{StaticResource formatImageStyle}&#34; Command=&#34;ApplicationCommands.Copy&#34; ToolTip=&#34;Copier&#34;&gt;
                                &lt;Image Source=&#34;C:\VendiStrat\VendittoreStratego\VendittoreStratego\VendittoreStratego\Images\EditTexte\2020CCPCopy.png&#34;/&gt;
                            &lt;/Button&gt;
                             &lt;Button Style=&#34;{StaticResource formatImageStyle}&#34; Command=&#34;ApplicationCommands.Paste&#34; ToolTip=&#34;Coller&#34;&gt;
                                    &lt;Image Source=&#34;C:\VendiStrat\VendittoreStratego\VendittoreStratego\VendittoreStratego\Images\EditTexte\2020CCPPaste.png&#34;/&gt;
                            &lt;/Button&gt;
                            &lt;Button Style=&#34;{StaticResource formatImageStyle}&#34; Command=&#34;ApplicationCommands.Undo&#34; ToolTip=&#34;Annuler&#34;&gt;
                                &lt;Image Source=&#34;C:\VendiStrat\VendittoreStratego\VendittoreStratego\VendittoreStratego\Images\EditTexte\2020CorrectUndo.png&#34;/&gt;
                            &lt;/Button&gt;
                            &lt;Button Style=&#34;{StaticResource formatImageStyle}&#34; Command=&#34;ApplicationCommands.Redo&#34; ToolTip=&#34;Refaire&#34;&gt;
                                &lt;Image Source=&#34;C:\VendiStrat\VendittoreStratego\VendittoreStratego\VendittoreStratego\Images\EditTexte\2020CorrectRedo.png&#34;/&gt;
                            &lt;/Button&gt;
                            &lt;Button Style=&#34;{StaticResource formatImageStyle}&#34; Command=&#34;EditingCommands.ToggleBold&#34; ToolTip=&#34;Gras&#34;&gt;
                                &lt;Image Source=&#34;C:\VendiStrat\VendittoreStratego\VendittoreStratego\VendittoreStratego\Images\EditTexte\2020FontBold.png&#34;/&gt;
                            &lt;/Button&gt;
                            &lt;Button Style=&#34;{StaticResource formatImageStyle}&#34; Command=&#34;EditingCommands.ToggleItalic&#34; ToolTip=&#34;Italique&#34;&gt;
                                &lt;Image Source=&#34;C:\VendiStrat\VendittoreStratego\VendittoreStratego\VendittoreStratego\Images\EditTexte\2020FontItalic.png&#34;/&gt;
                            &lt;/Button&gt;
                            &lt;Button Style=&#34;{StaticResource formatImageStyle}&#34; Command=&#34;EditingCommands.ToggleUnderline&#34; ToolTip=&#34;Souligné&#34;&gt;
                                &lt;Image Source=&#34;C:\VendiStrat\VendittoreStratego\VendittoreStratego\VendittoreStratego\Images\EditTexte\2020FontUnderline.png&#34;/&gt;
                            &lt;/Button&gt;
                            &lt;Button Style=&#34;{StaticResource formatImageStyle}&#34; Command=&#34;EditingCommands.IncreaseFontSize&#34; ToolTip=&#34;Agrandir&#34;&gt;
                                &lt;Image Source=&#34;C:\VendiStrat\VendittoreStratego\VendittoreStratego\VendittoreStratego\Images\EditTexte\2020FontGrowfont.png&#34;/&gt;
                            &lt;/Button&gt;
                            &lt;Button Style=&#34;{StaticResource formatImageStyle}&#34; Command=&#34;EditingCommands.DecreaseFontSize&#34; ToolTip=&#34;Retrécir&#34;&gt;
                                &lt;Image Source=&#34;C:\VendiStrat\VendittoreStratego\VendittoreStratego\VendittoreStratego\Images\EditTexte\2020FontShrinkfont.png&#34;/&gt;
                            &lt;/Button&gt; 
                            &lt;Button Style=&#34;{StaticResource formatImageStyle}&#34; Command=&#34;EditingCommands.ToggleBullets&#34; ToolTip=&#34;Puces&#34;&gt;
                                &lt;Image Source=&#34;C:\VendiStrat\VendittoreStratego\VendittoreStratego\VendittoreStratego\Images\EditTexte\2020NumBullets.png&#34;/&gt;
                            &lt;/Button&gt;
                            &lt;Button Style=&#34;{StaticResource formatImageStyle}&#34; Command=&#34;EditingCommands.ToggleNumbering&#34; ToolTip=&#34;Numérotation&#34;&gt;
                                &lt;Image Source=&#34;C:\VendiStrat\VendittoreStratego\VendittoreStratego\VendittoreStratego\Images\EditTexte\2020NumNum.png&#34;/&gt;
                            &lt;/Button&gt;
                            &lt;Separator/&gt;
                            &lt;Button Style=&#34;{StaticResource formatImageStyle}&#34; Command=&#34;EditingCommands.AlignLeft&#34; ToolTip=&#34;Aligner à gauche&#34;&gt;
                                &lt;Image Source=&#34;C:\VendiStrat\VendittoreStratego\VendittoreStratego\VendittoreStratego\Images\EditTexte\2020JustifyLeft.png&#34;/&gt;
                            &lt;/Button&gt;                     
                            &lt;Button Style=&#34;{StaticResource formatImageStyle}&#34; Command=&#34;EditingCommands.AlignCenter&#34; ToolTip=&#34;Aligner au centre&#34;&gt;
                                &lt;Image Source=&#34;C:\VendiStrat\VendittoreStratego\VendittoreStratego\VendittoreStratego\Images\EditTexte\2020JustifyCenter.png&#34;/&gt;
                            &lt;/Button&gt;                                   
                            &lt;Button Style=&#34;{StaticResource formatImageStyle}&#34; Command=&#34;EditingCommands.AlignRight&#34; ToolTip=&#34;Aligner à droite&#34;&gt;
                                &lt;Image Source=&#34;C:\VendiStrat\VendittoreStratego\VendittoreStratego\VendittoreStratego\Images\EditTexte\2020JustifyRight.png&#34;/&gt;
                            &lt;/Button&gt;                                
                             &lt;Button Style=&#34;{StaticResource formatImageStyle}&#34; Command=&#34;EditingCommands.AlignJustify&#34; ToolTip=&#34;Justifier&#34;&gt;
                                &lt;Image Source=&#34;C:\VendiStrat\VendittoreStratego\VendittoreStratego\VendittoreStratego\Images\EditTexte\2020JustifyFully.png&#34;/&gt;
                            &lt;/Button&gt;
                            &lt;Separator/&gt;
                            &lt;Button Style=&#34;{StaticResource formatImageStyle}&#34; Command=&#34;EditingCommands.IncreaseIndentation&#34; ToolTip=&#34;Augmenter l&#39;indentation&#34;&gt;
                                &lt;Image Source=&#34;C:\VendiStrat\VendittoreStratego\VendittoreStratego\VendittoreStratego\Images\EditTexte\2020IndentationIncrease.png&#34;/&gt;
                            &lt;/Button&gt;
                             &lt;Button Style=&#34;{StaticResource formatImageStyle}&#34; Command=&#34;EditingCommands.DecreaseIndentation&#34; ToolTip=&#34;Diminuer l&#39;indentation&#34;&gt;
                                &lt;Image Source=&#34;C:\VendiStrat\VendittoreStratego\VendittoreStratego\VendittoreStratego\Images\EditTexte\2020IndentationDecrease.png&#34;/&gt;
                            &lt;/Button&gt;    

                            &lt;Separator /&gt;

                            &lt;ComboBox Name=&#34;cmbFontFamily&#34; Width=&#34;150&#34; SelectionChanged=&#34;cmbFontFamily_SelectionChanged&#34; BorderBrush=&#34;Gray&#34; ToolTip=&#34;Police&#34;/&gt;

                            &lt;ComboBox Name=&#34;cmbFontSize&#34; Width=&#34;50&#34;  SelectionChanged=&#34;cmbFontSize_SelectionChanged&#34; BorderBrush=&#34;Gray&#34; Margin=&#34;2&#34; ToolTip=&#34;Taille&#34;/&gt;

                        &lt;/ToolBar&gt;
                    &lt;/DockPanel&gt;
                    &lt;RichTextBox Name=&#34;mainRTB&#34;  Margin=&#34;10&#34; Grid.Row=&#34;1&#34; Width=&#34;auto&#34;&gt;

                    &lt;/RichTextBox&gt;
                &lt;/Grid&gt;


            &lt;/TabItem&gt;
            &lt;TabItem Name=&#34;tITel&#34; Header=&#34;Téléphone&#34; Style=&#34;{StaticResource TabItemApp}&#34;  Width=&#34;Auto&#34; Height=&#34;22&#34;&gt;
                &lt;DataGrid x:Name=&#34;dtgTelephone&#34;&gt;

                &lt;/DataGrid&gt;
            &lt;/TabItem&gt;

            &lt;TabItem  Name=&#34;tIMail&#34; Header=&#34;Mail&#34; Style=&#34;{StaticResource TabItemApp}&#34;  Width=&#34;Auto&#34; Height=&#34;22&#34;&gt;
                &lt;DataGrid x:Name=&#34;dtgMail&#34;&gt;

                &lt;/DataGrid&gt;
            &lt;/TabItem&gt;
            &lt;TabItem Name=&#34;tICourrier&#34;  Header=&#34;Courrier&#34; Style=&#34;{StaticResource TabItemApp}&#34;  Width=&#34;Auto&#34; Height=&#34;22&#34;&gt;
                &lt;DataGrid x:Name=&#34;dtgCourrier&#34;&gt;

                &lt;/DataGrid&gt;
            &lt;/TabItem&gt;
            &lt;TabItem Name=&#34;tIProposition&#34; Header=&#34;Propositions&#34; Style=&#34;{StaticResource TabItemApp}&#34;  Width=&#34;Auto&#34; Height=&#34;22&#34;&gt;

            &lt;/TabItem&gt;
            &lt;TabItem Name=&#34;tICR&#34; Header=&#34;Compte-rendu&#34; Style=&#34;{StaticResource TabItemApp}&#34;  Width=&#34;Auto&#34; Height=&#34;22&#34;&gt;
                &lt;DataGrid x:Name=&#34;dtgCRs&#34;&gt;

                &lt;/DataGrid&gt;
            &lt;/TabItem&gt;
            &lt;TabItem Name=&#34;tIAction&#34; Header=&#34;Action&#34; Style=&#34;{StaticResource TabItemApp}&#34;  Width=&#34;Auto&#34; Height=&#34;22&#34;&gt;
                &lt;DataGrid x:Name=&#34;dtgActions&#34;&gt;

                &lt;/DataGrid&gt;
            &lt;/TabItem&gt;
            &lt;TabItem Name=&#34;tIDemande&#34; Header=&#34;Demandes&#34; Style=&#34;{StaticResource TabItemApp}&#34;  Width=&#34;Auto&#34; Height=&#34;22&#34;&gt;
                &lt;DataGrid x:Name=&#34;dtgDemandes&#34;&gt;

                &lt;/DataGrid&gt;
            &lt;/TabItem&gt;
            &lt;TabItem Name=&#34;tIRV&#34; Header=&#34;Rendez-vous&#34; Style=&#34;{StaticResource TabItemApp}&#34;  Width=&#34;Auto&#34; Height=&#34;22&#34;&gt;
                &lt;DataGrid x:Name=&#34;dtgRV&#34;&gt;

                &lt;/DataGrid&gt;
            &lt;/TabItem&gt;
        &lt;/TabControl&gt;
    &lt;/GroupBox&gt;
    &lt;GroupBox Grid.Row=&#34;4&#34; Grid.Column=&#34;0&#34; Grid.ColumnSpan=&#34;4&#34; Header=&#34;Messages&#34;&gt;

    &lt;/GroupBox&gt;
&lt;/Grid&gt;
Not Monitored
Not Monitored
Tag not monitored by Microsoft.
23,914 questions
No comments
{count} votes