This is a migrated thread and some comments may be shown as answers.

Alert chain

1 Answer 60 Views
Window
This is a migrated thread and some comments may be shown as answers.
Simon
Top achievements
Rank 1
Simon asked on 28 Feb 2011, 05:55 PM
Hello,

I'm trying to create an alert / prompt chain (Ask a question, then ask an other question or result depending on the user input).  Everything works as expected in a plain application (like the demo example) but I couldn't figure how to use this within a RadWindow.

After the first alert, the activated event of the window is raised, then this window is bringed to front hidding any existing modal alert.

This was described in 2009 in this post but no real solution was suggested for my problem.

Here's a sample code of my issue:

<telerik:RadWindow 
    xmlns:FrameworkClient="http://schemas.simonbesner.com/FrameworkClient"
    xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" xmlns:System="clr-namespace:System;assembly=mscorlib" x:Class="SardoClient.XWindow"
    mc:Ignorable="d"
    telerik:StyleManager.Theme="Office_Silver"
    d:DesignHeight="231" d:DesignWidth="576" Header="XWindow" IsRestricted="True" WindowStartupLocation="CenterScreen" Width="453" Height="229" CanClose="True" CanMove="True" ResizeMode="CanResize" ModalBackground="White">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="50"/>
        </Grid.RowDefinitions>
  
        <telerik:RadButton Grid.Row="0"  Content="Button1" Height="54" Name="RadButton1" Width="100" />
    </Grid>
      
</telerik:RadWindow>

Partial Public Class XWindow
    Inherits Telerik.Windows.Controls.RadWindow
  
    Private Sub RadButton1_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles RadButton1.Click
        Dim eventHandler As New System.EventHandler(Of Telerik.Windows.Controls.WindowClosedEventArgs)(AddressOf OnClosed1)
  
        Telerik.Windows.Controls.RadWindow.Alert("Alert #1", eventHandler)
    End Sub
  
    Private Sub OnClosed1(ByVal sender As Object, ByVal e As Telerik.Windows.Controls.WindowClosedEventArgs)
        Dim eventHandler As New System.EventHandler(Of Telerik.Windows.Controls.WindowClosedEventArgs)(AddressOf OnClosed2)
  
        Telerik.Windows.Controls.RadWindow.Alert("Alert #2", eventHandler)
    End Sub
  
    Private Sub OnClosed2(ByVal sender As Object, ByVal e As Telerik.Windows.Controls.WindowClosedEventArgs)
        System.Windows.MessageBox.Show("Done")
    End Sub
  
End Class

Best regards,

Simon

1 Answer, 1 is accepted

Sort by
0
Simon
Top achievements
Rank 1
answered on 01 Mar 2011, 04:40 PM

Ok, I've found a simple workaround...

I did create my own dialog window with a RadWindow and I added those 2 magic functions to fix all my problems.

Public Shadows Sub ShowDialog()
    Me.Dispatcher.BeginInvoke(AddressOf MyBaseShowDialog)
End Sub
Private Sub MyBaseShowDialog()
    MyBase.ShowDialog()
End Sub
Tags
Window
Asked by
Simon
Top achievements
Rank 1
Answers by
Simon
Top achievements
Rank 1
Share this question
or