c# - Can I set text-wrapping mode for a long-text mesage to transfer the text to the next line in Prism 6.2. modal dialog? -


sometimes text of notification message modal dialog long can see on figure below.enter image description herethis not custom modal dialog simple notification modal dialog has long text mesage. exception error-message produced modbus protocol library use in application. sql server exceptions can have such long text messages errors. default, prism 6.2 modal notification dialod displays none-wrapped text. result of it, modal dialog long , not of text of error-message placed , displayed in dialog. below xaml markup modal dialog:

<prism:interactionrequesttrigger sourceobject="{binding notificationrequest, mode=oneway}">     <prism:popupwindowaction ismodal="true" centeroverassociatedobject="true"/> </prism:interactionrequesttrigger> 

and below view model c#-code dialog:

public interactionrequest<inotification> notificationrequest { get; private set; }  public string notificationstatus {     { return this._notificationstatus; }     set { setproperty(ref this._notificationstatus, value); } } 

the folowing line of code view modal constructor:

this.notificationrequest = new interactionrequest<inotification>(); 

and following method displaying modal notification dialog:

private void raisenotification(string message, string caption) {     this.notificationrequest.raise(            new notification { content = message, title = caption },            n => { this.notificationstatus = "the user notified."; }); } 

can set text-wrapping mode long-text mesage (in xaml or in view model) transfer text next lines in prism 6.2. modal dialog?

you can show view want inside popupwindowaction, add content popupwindowaction:

<prism:interactionrequesttrigger sourceobject="{binding notificationrequest, mode=oneway}">     <prism:popupwindowaction ismodal="true" centeroverassociatedobject="true">          <prism:popupwindowaction.windowcontent>             <views:myfancyerrorpopup/>         </prism:popupwindowaction.windowcontent>              </prism:popupwindowaction> </prism:interactionrequesttrigger>   

now myfancyerrorpopup can show error message multi-line textbox or whatever like...

edit:

<usercontrol x:class="clientmodule.views.myfancyerrorpopup"      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"       xmlns:d="http://schemas.microsoft.com/expression/blend/2008"       xmlns:prism="http://prismlibrary.com/"      prism:viewmodellocator.autowireviewmodel="true"      mc:ignorable="d"       d:designheight="300" d:designwidth="300">     <stackpanel orientation="vertical">         <textblock text={binding message}" textwrapping="wrap"/>         <button content="ok" command="{binding okcommand}"/>     </stackpanel> </usercontrol>   class myfancyerrorpopupviewmodel : bindablebase, iinteractionrequestaware {     public myfancyerrorpopupviewmodel()     {         okcommand = new delegatecommand( onok );     }      public delegatecommand okcommand     {         get;     }      public string message     {         { return (_notification?.content string) ?? "null"; }     }      #region iinteractionrequestaware     public inotification notification     {         { return _notification; }         set         {             setproperty( ref _notification, value notification );             onpropertychanged( () => message );         }     }      public action finishinteraction     {         get;         set;     }     #endregion      #region private     private notification _notification;      private void onok()     {         finishinteraction();     }     #endregion } 

Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -