Preventing a text to be deleted in a Wpf RichTextBoxPreventing a Certain Text to be Deleted or Change in a RichTextBoxCould not load type 'System.Windows.Controls.Primitives.MultiSelector' from assembly PresentationFrameworkwpf theme changed my aligmnentText orientationHow do I make the Extended WPF Toolkit ColorPicker work?Change color text in paragraph using OpenXMLEnhance my RegEx for proofreadingGrab random sequence of words from a string?multiphrase method with two phrases - Elastic SearchCut the string in c#Find those lines which contains text

What is the hex versus octal timeline?

Can pay be witheld for hours cleaning up after closing time?

In what ways can a Non-paladin access Paladin spells?

How do I make distance between concentric circles equal?

In an emergency, how do I find and share my position?

How to draw a square on cylinder?

Is refusing to concede in the face of an unstoppable Nexus combo punishable?

Why does my house heat up, even when it's cool outside?

Descent a representation over finite field

Why we don't have vaccination against all diseases which are caused by microbes?

Vacuum collapse -- why do strong metals implode but glass doesn't?

Is a butterfly one or two animals?

(Why) May a Beit Din refuse to bury a body in order to coerce a man into giving a divorce?

The teacher logged me in as administrator for doing a short task, is the whole system now compromised?

Get info from plist file

Avoiding racist tropes in fantasy

Is the "Find Greater Steed" Spell affected by Barovian Magic Alterations?

Why don't electrons take the shorter path in coils

Check in to 2 hotels at same location

Justifying the use of directed energy weapons

How to avoid using System.String with Rfc2898DeriveBytes in C#

Why is Boris Johnson visiting only Paris & Berlin if every member of the EU needs to agree on a withdrawal deal?

IndexOptimize - Configuration

How to write triplets in 4/4 time without using a 3 on top of the notes all the time



Preventing a text to be deleted in a Wpf RichTextBox


Preventing a Certain Text to be Deleted or Change in a RichTextBoxCould not load type 'System.Windows.Controls.Primitives.MultiSelector' from assembly PresentationFrameworkwpf theme changed my aligmnentText orientationHow do I make the Extended WPF Toolkit ColorPicker work?Change color text in paragraph using OpenXMLEnhance my RegEx for proofreadingGrab random sequence of words from a string?multiphrase method with two phrases - Elastic SearchCut the string in c#Find those lines which contains text






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















Copy and paste following code into MainWindow.xaml file.



<Window x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<RichTextBox>
<FlowDocument>
<Paragraph>
<Run Text="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book."/>
</Paragraph>
</FlowDocument>
</RichTextBox>
</Grid>
</Window>


Run this code and see that you are able to delete that text.



I want you are not able to delete that text.



There is a solution for WinForm as you can see in the following link because WinForm RichTextBox has selection protected property.



Preventing a Certain Text to be Deleted or Change in a RichTextBox



WPF RichTextBox has no selection protected property. So how can I solve this issue for WPF?










share|improve this question
























  • <RichTextBox IsReadOnly="True">?

    – fhnaseer
    Mar 27 at 15:52

















1















Copy and paste following code into MainWindow.xaml file.



<Window x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<RichTextBox>
<FlowDocument>
<Paragraph>
<Run Text="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book."/>
</Paragraph>
</FlowDocument>
</RichTextBox>
</Grid>
</Window>


Run this code and see that you are able to delete that text.



I want you are not able to delete that text.



There is a solution for WinForm as you can see in the following link because WinForm RichTextBox has selection protected property.



Preventing a Certain Text to be Deleted or Change in a RichTextBox



WPF RichTextBox has no selection protected property. So how can I solve this issue for WPF?










share|improve this question
























  • <RichTextBox IsReadOnly="True">?

    – fhnaseer
    Mar 27 at 15:52













1












1








1








Copy and paste following code into MainWindow.xaml file.



<Window x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<RichTextBox>
<FlowDocument>
<Paragraph>
<Run Text="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book."/>
</Paragraph>
</FlowDocument>
</RichTextBox>
</Grid>
</Window>


Run this code and see that you are able to delete that text.



I want you are not able to delete that text.



There is a solution for WinForm as you can see in the following link because WinForm RichTextBox has selection protected property.



Preventing a Certain Text to be Deleted or Change in a RichTextBox



WPF RichTextBox has no selection protected property. So how can I solve this issue for WPF?










share|improve this question














Copy and paste following code into MainWindow.xaml file.



<Window x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<RichTextBox>
<FlowDocument>
<Paragraph>
<Run Text="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book."/>
</Paragraph>
</FlowDocument>
</RichTextBox>
</Grid>
</Window>


Run this code and see that you are able to delete that text.



I want you are not able to delete that text.



There is a solution for WinForm as you can see in the following link because WinForm RichTextBox has selection protected property.



Preventing a Certain Text to be Deleted or Change in a RichTextBox



WPF RichTextBox has no selection protected property. So how can I solve this issue for WPF?







c# wpf vb.net






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 27 at 15:48







user10702813






















  • <RichTextBox IsReadOnly="True">?

    – fhnaseer
    Mar 27 at 15:52

















  • <RichTextBox IsReadOnly="True">?

    – fhnaseer
    Mar 27 at 15:52
















<RichTextBox IsReadOnly="True">?

– fhnaseer
Mar 27 at 15:52





<RichTextBox IsReadOnly="True">?

– fhnaseer
Mar 27 at 15:52












1 Answer
1






active

oldest

votes


















0













Try this.



<RichTextBox IsReadOnly="True">


Or if you want no selection at all.



<RichTextBox IsEnabled="false">





share|improve this answer
























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55381346%2fpreventing-a-text-to-be-deleted-in-a-wpf-richtextbox%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown
























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0













    Try this.



    <RichTextBox IsReadOnly="True">


    Or if you want no selection at all.



    <RichTextBox IsEnabled="false">





    share|improve this answer





























      0













      Try this.



      <RichTextBox IsReadOnly="True">


      Or if you want no selection at all.



      <RichTextBox IsEnabled="false">





      share|improve this answer



























        0












        0








        0







        Try this.



        <RichTextBox IsReadOnly="True">


        Or if you want no selection at all.



        <RichTextBox IsEnabled="false">





        share|improve this answer













        Try this.



        <RichTextBox IsReadOnly="True">


        Or if you want no selection at all.



        <RichTextBox IsEnabled="false">






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 27 at 15:57









        fhnaseerfhnaseer

        4,08611 gold badges45 silver badges93 bronze badges




        4,08611 gold badges45 silver badges93 bronze badges





















            Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







            Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55381346%2fpreventing-a-text-to-be-deleted-in-a-wpf-richtextbox%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

            용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

            155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해