Select to view content in your preferred language

Move Active Draggable Window to top of other windows.

1057
2
02-07-2013 06:51 AM
DavidAshton
Frequent Contributor
I have an application and I'm using Draggable Windows. 

For example take these two draggable windows (My address locator Search window and Candidate/Results window)

<!-- Address Finder Search Window  -Locator -->

        <userControls:DraggableWindow x:Name="AddressFinder" Title="Search For An Address" IsOpen="False" VerticalAlignment="Top" 
            HorizontalAlignment="Right" Margin="0,85,10,0"
                                      Effect="{StaticResource dropShadow}" 
                                      >

            <Grid HorizontalAlignment="Right" VerticalAlignment="Top" >
                <Border Effect="{StaticResource miniDropShadow}" Style="{StaticResource RibbonElementBorder}" >


                  <StackPanel Orientation="Vertical" HorizontalAlignment="Center" Margin="30,20,30,30">
                        <TextBlock Text="Enter Address Information" FontWeight="Bold" Foreground="White" HorizontalAlignment="Center" Margin="0,0,0,10" />


                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" >
                            <TextBlock Text="Address: " Width="80" Foreground="White" TextAlignment="Right" />
                            <TextBox x:Name="InputAddress" Text="456 N Main St" Width="125"/>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" >
                            <TextBlock Text="City: " Foreground="White" Width="80" TextAlignment="Right" />
                            <TextBox x:Name="City" Text="Santa Barbara" Width="125"/>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" >
                            <TextBlock Text="State: " Foreground="White" Width="80" TextAlignment="Right"/>
                            <TextBox x:Name="State" Text="CA" Width="125"/>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" >
                            <TextBlock Text="Zip: " Width="80" Foreground="White" TextAlignment="Right"/>
                            <TextBox x:Name="Zip" Text="93101" Width="125"/>
                        </StackPanel>
                        <Button x:Name="FindAddressButton" Content="Find" Width="100" HorizontalAlignment="Center"
                       Margin="0,10,0,0"  Click="FindAddressButton_Click" />
                    </StackPanel>
                  
                </Border>
            </Grid>
        </userControls:DraggableWindow>

        <!--End Address Finder  -Locator -->
        
        <!-- Address Candidate WIndow -->
        <userControls:DraggableWindow x:Name="AddressCandidates" Title="Address Search Results" IsOpen="False" VerticalAlignment="Top" 
            HorizontalAlignment="Right" Margin="0,385,10,0"
                                      Effect="{StaticResource dropShadow}" 
                                      Background="Black">
            <Grid x:Name="CandidatePanelGrid" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,10,15" Visibility="Collapsed">

                <Border Background="{StaticResource CommonPanelBorderBackgroundBrush}" BorderBrush="{StaticResource CommonBorderBrush}" BorderThickness="1" CornerRadius="6" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">


                    <StackPanel Orientation="Vertical" HorizontalAlignment="Center" Margin="0">
                        <TextBlock HorizontalAlignment="Left" Text="Address Candidates" Margin="2,0,0,5" />
                        <ScrollViewer x:Name="CandidateScrollViewer" Width="300" MaxHeight="150" BorderThickness="0"
                              HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" >
                            <ListBox x:Name="CandidateListBox" VerticalAlignment="Top" BorderThickness="0" 
                             SelectionChanged="_candidateListBox_SelectionChanged" />
                        </ScrollViewer>
                    </StackPanel>
                </Border>

            </Grid>
        </userControls:DraggableWindow>

        <!-- End  Address Candidate WIndow -->





How I have it set up in the XAML the Search window is below the Candidate/Results window.  Below might be the wrong term but I hope you know what I mean.  If the two windows overlap the Candidate/Results window is always on tap and covers the Search Window. 

How can I make the active window move to front.  So if a users click on the window to interact with it (Drag it, Populate a drop box/text box, etc.) it jumps in the for front and displays on top of the other windows open.

Thanks
D.
0 Kudos
2 Replies
DavidAshton
Frequent Contributor
I'm still hoping someone can help me answer this question...any ideas?
0 Kudos
DaveTimmins
Deactivated User
How about setting the z-index ?

You could set up a visual state to do it purely in XAML.

Cheers,
0 Kudos