Click here to Skip to main content
13,142,883 members (52,271 online)
Rate this:
Please Sign up or sign in to vote.
Hi All,

Can any one tell how to show the Validation Messages in Prism Interactive Confirmation box-

When I click on "Ok" button for my Confirmation box , the Validation Messages should persists and the window should not be closed .

Fllowing is my Code -

on Parent Window ViewModel -

private void ExecuteApprovePersonnelSelectedCommand()
           var vm = new ApprovePersonnelChildWindowViewModel()
           this.approvePersonChildRequest.Raise(new Confirmation()
               Content = vm,
               Title = Globalization.ApproveDialogIntroMessage}, (c) =>
                   if (c.Confirmed)
                       var context = ServiceAccess.Shared.AuthenticationService.CurrentContext;

In ChildWindow XAML.cs-

internal Confirmation ViewModel
         get { return (Confirmation)this.DataContext; }
         set { this.DataContext = value; }
   public ApprovePersonnelChildWindow()
     this.DataContext = ViewModel;
   private void OKButton_Click(object sender, RoutedEventArgs e)
       if (this.ViewModel != null)
           this.ViewModel.Confirmed = true;
         this.DialogResult = true;
   private void CancelButton_Click(object sender, RoutedEventArgs e)
     this.DialogResult = false;

My Child Window XAML -

<Grid x:Name="LayoutRoot" Margin="0,2,2,2" DataContext="{Binding Content}" RenderTransformOrigin="0.517,0.285">
           <RowDefinition Height="150"/>
           <RowDefinition Height="367*"/>
           <RowDefinition Height="Auto" />
       <StackPanel Grid.Row="0" Orientation="Vertical" VerticalAlignment="Top" Height="190" Grid.RowSpan="2">
           <TextBlock Text="{Binding Globalization.ApproveDialogIntroMessage, Mode=OneWay}"  VerticalAlignment="Top" Height="5"/>
               <ScrollViewer Height="60">
                   <TextBlock  x:Name="txtValidation" Text="{Binding ValidationMesseges, Mode=OneWay}" Foreground="red"  Height="50" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto" />
           <Grid  Background="#FFFFFFD2" Name="grdInfoText" Margin="20,0" >
               <Image Source=&someimage; HorizontalAlignment="Left"    RenderTransformOrigin="0.688,0.125" Width="30" Height="30"/>
               <TextBlock TextWrapping="Wrap" Style="{StaticResource DialogCaptionStyle}" Text="Enter(or Paste) the list of additional names,email and tier designations.One line per person with commas seperating fields." Height="43" VerticalAlignment="Top" Margin="40,0,21,0"/>
           <Grid Background="LightGray" Margin="20,0" Name="grdExampleText">
               <TextBlock VerticalAlignment="Top" Margin="40,0,19,0" Text="{Binding Globalization.ExampleText, Mode=OneWay}" TextWrapping="Wrap"   Style="{StaticResource InfoBoxStyle}"  Height="75" />
       <Grid Margin="8,19,8,10" Grid.Row="1">
               <RowDefinition Height="Auto"/>
           <TextBox  x:Name="InputTextApprovePersonnel"   TextWrapping="Wrap" AcceptsReturn="True"  Text="{Binding MergedEntity,Mode=TwoWay}"  Margin="10,20,10,9" Grid.RowSpan="2" />
       <StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,8,8" Width="166">
           <TextBlock  Margin="0,0,8,0" Text="{Binding ApprovePersonnelErrorCaption, Mode=OneWay}"/>
           <Button Content="Ok" Width="75" Height="23" VerticalAlignment="Top" Margin="0,0,8,0" Command="{Binding OkClickCommand, Mode=TwoWay}" Click ="OKButton_Click"/>
           <Button Content="Cancel" Width="75" Height="23" VerticalAlignment="Top" Command="{Binding CancelCommand, Mode=OneWay}">
                   <i:EventTrigger EventName="Click">
                       <ei:CallMethodAction TargetObject="{Binding ElementName=ApprovePersonnelWindow}" MethodName="Close"/>
Posted 9-Apr-13 1:53am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.170915.1 | Last Updated 9 Apr 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100