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>