Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Silverlight MVVM PRISM
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;
                       this.RefreshAllEvents(context);
                   }
               }
               );
       }
 

 
In ChildWindow XAML.cs-
 
internal Confirmation ViewModel
     {
         get { return (Confirmation)this.DataContext; }
         set { this.DataContext = value; }
     }
 
   public ApprovePersonnelChildWindow()
   {
     InitializeComponent();
     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">
       <Grid.RowDefinitions>
           <RowDefinition Height="150"/>
           <RowDefinition Height="367*"/>
           <RowDefinition Height="Auto" />
       </Grid.RowDefinitions>
       <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" />
               </ScrollViewer>
           <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>
           <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>
       </StackPanel>
       <Grid Margin="8,19,8,10" Grid.Row="1">
           <Grid.RowDefinitions>
               <RowDefinition Height="Auto"/>
               <RowDefinition/>
           </Grid.RowDefinitions>
           <TextBox  x:Name="InputTextApprovePersonnel"   TextWrapping="Wrap" AcceptsReturn="True"  Text="{Binding MergedEntity,Mode=TwoWay}"  Margin="10,20,10,9" Grid.RowSpan="2" />
       </Grid>
       <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:Interaction.Triggers>
                   <i:EventTrigger EventName="Click">
                       <ei:CallMethodAction TargetObject="{Binding ElementName=ApprovePersonnelWindow}" MethodName="Close"/>
                   </i:EventTrigger>
               </i:Interaction.Triggers>
           </Button>
       </StackPanel>
   </Grid>
Posted 9-Apr-13 2:53am

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

  Print Answers RSS
0 OriginalGriff 5,170
1 DamithSL 4,357
2 Maciej Los 3,750
3 Kornfeld Eliyahu Peter 3,470
4 Sergey Alexandrovich Kryukov 2,851


Advertise | Privacy | Mobile
Web04 | 2.8.141216.1 | Last Updated 9 Apr 2013
Copyright © CodeProject, 1999-2014
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