Alert chain

2 posts, 0 answers
  1. Simon
    Simon avatar
    159 posts
    Member since:
    Sep 2010

    Posted 28 Feb 2011 Link to this post

    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

  2. Simon
    Simon avatar
    159 posts
    Member since:
    Sep 2010

    Posted 01 Mar 2011 Link to this post

    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
  3. DevCraft banner
Back to Top