Radwindow appearing behind child window

8 posts, 0 answers
  1. lakshmi jeeva
    lakshmi jeeva avatar
    20 posts
    Member since:
    Jul 2012

    Posted 24 Nov 2011 Link to this post

    HI,

        In silverlight main page i am having button.If i click button it will open a radwindow. It is opening properly.In that radwindow i am having an image. If user single clicks or double clicks a image it has open a another radwindow.

       In imageMouseLeftButton_Down event i have written code like this

      

    Private

     

     

    Sub moPART_AnswerImage_MouseLeftButtonDown(ByVal sender As Object, ByVal e As System.Windows.Input.MouseButtonEventArgs) Handles moPART_AnswerImage.MouseLeftButtonDown

     

         Dim oImageViewer As New Radwindow2
         oImageViewer.ShowDialog()

     


    End
    Sub

    Find below is the xaml for Radwindow2

     

    <tkNavigation:RadWindow  

       x:Class="RAMWare.Controls.dlg_PhotoViewer"

      xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation

      xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml

      xmlns:msControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"

      xmlns:tkNavigation="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation"

      xmlns:tkControls="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"

      Height="Auto"

      Width="Auto"

      WindowStartupLocation="CenterScreen"

      HorizontalAlignment="Center"

      VerticalAlignment="Center">

      

    <Grid x:Name="LayoutRoot" Margin="1">
    <Grid.RowDefinitions>

       <RowDefinition Height="Auto" /> 
      <RowDefinition Height="Auto" />

     </Grid.RowDefinitions>

     <StackPanel Orientation="Vertical">
             <Image x:Name="imgPhoto" Height="Auto" Width="Auto" Stretch="Uniform" />
    <StackPanel Orientation="Vertical" VerticalAlignment="Bottom">
     <StackPanel Width="Auto" Orientation="Horizontal" HorizontalAlignment="Center" Grid.Row="1">

     <Button  

    x:Name="cmdRotateCounterClockwise"
    Content="RotateCounterClockwise"
    Width="Auto"
    Height="23"
    HorizontalAlignment="Left" />

     <Button
        x:Name="cmdOK" 

        Content="OK"

            Width="75"

            Height="23"

            HorizontalAlignment="Center" />

     <Button

     x:Name="cmdRotateClockwise"

     Content="RotateClockwise"

     Width="Auto"

     Height="23"

     HorizontalAlignment="Right" />

     </StackPanel>
    <TextBlock

     x:Name="tblError"></TextBlock>

     </StackPanel>

     </StackPanel>

     </Grid> </tkNavigation:RadWindow>

     
    If user single click a image present in Radwindow1 it has to open Radwindow2.If user double cliks of a image present in Radwindow1 also opens a Radwindow2.But user double clicks a image, radwindow2 is opening behind Radwindow1 that is parent window.
    How to solve the problem?

  2. Manuel
    Manuel avatar
    61 posts
    Member since:
    Oct 2011

    Posted 21 Dec 2011 Link to this post

    Hi,

    I´ve the same problem. When I try open a second window this window is showed behind the first one. Maybe the problem is the MouseLeftButton_Down even.

    Any help?
  3. DevCraft banner
  4. Rosi
    Admin
    Rosi avatar
    2527 posts

    Posted 21 Dec 2011 Link to this post

    Hello all,

    I suggest you try opening the window by using  a Dispatcher when the code in the event handler of MouseLeftButton_Down event.

    Dispatcher.BeginInvoke( () => window.Show());

















    Kind regards,
    Rosi
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
  5. Manuel
    Manuel avatar
    61 posts
    Member since:
    Oct 2011

    Posted 21 Dec 2011 Link to this post

    Hi Rosi,

    Thanks, your tip solve the problem.
    Thanks
  6. lakshmi jeeva
    lakshmi jeeva avatar
    20 posts
    Member since:
    Jul 2012

    Posted 01 Feb 2012 Link to this post

    Hi,

     

        I have used nested dispatcher to show the dialog.But still sometimes radwindow is going behind the parent window? I have followed below website.

         http://www.telerik.com/community/forums/silverlight/window/sl4-upgrade-problems-again-with-windows-newly-opened-window-appearing-behind-previously-opened-window.aspx

       Even i have tried to open a window using timer also. But still problem exists. It is very urgent work.I am using sl4.How to proceed further?

  7. Boyan
    Admin
    Boyan avatar
    758 posts

    Posted 06 Feb 2012 Link to this post

    Hi lakshmi jeeva,

    There is an easy way to ensure that the RadWindow is always on top. You have to set the IsTopmost property to true. However setting this to a predefined dialog is a little bit more tricky. If you use a predefined dialog like Confirm or Alert. You have to apply a WindowStyle in order to set IsTopmost. Your code should look something like this:
    var dialogParams = new DialogParameters();
    Style radAlertStyle = this.Resources["RadAlertStyle1"] as Style;
    dialogParams.WindowStyle = radAlertStyle;
    RadWindow.Alert(dialogParams);
    And the style which is placed in the XAML is the following:
    <UserControl.Resources>
        <Style x:Key="RadAlertStyle1" TargetType="telerik:RadWindow">
            <Setter Property="IsTopmost" Value="true"/>
        </Style>
    </UserControl.Resources>

    Hope this helps. Let us know if you are still having problems.


    Regards,
    Boyan
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  8. lakshmi jeeva
    lakshmi jeeva avatar
    20 posts
    Member since:
    Jul 2012

    Posted 07 Feb 2012 Link to this post

    Hi,
       I have used IsTopMost property. But i am getting error Property 'IsTopMost' is not exist in Telerik.windows.controls.navigation. I am using telerik version 2010.1.422.1030. I have used dispatcher to show the dialog like below

    Dispatcher.BeginInvoke( () => window.Show());

    But it was not working.SO i have tried nested Dispatcher.It is not working sometimes.If i single click a image the new dialog is opening.If i double a image two window is opening .One window is showing infront of parent window.Another window is going behind a parent window.

     

    I have opened the dialog in Image1_MouseLeftButtonDown event. In mouse left button down event i have opened the dialog like below

      

     

    moImageViewer =

     

    New dlg_PhotoViewer

     

     

     

    moImageViewer.ShowDialog()

    How to show the dialog when user double cliks as well as single a image without going behind the parent window?

     

  9. Boyan
    Admin
    Boyan avatar
    758 posts

    Posted 10 Feb 2012 Link to this post

    Hi,

    You are using a rather old version and IsTopMost property is not existing in this version. It will be best to upgrade to a more recent version. The problem comes form the fact that if the RadWindow shows slower (if it has complex content in it), the background is not disabled until the RadWindow is shown, so in the time before it shows you can make another Click and open another Window. You can attach to the click event and disable another clicks, before the RadWindow is closed.

    Regards,
    Boyan
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Back to Top
DevCraft banner