对话框在wpf弹出窗口后面打开

时间:2014-05-21 07:47:10

标签: c# wpf

您好我已经在Wpf中创建了应用程序。我在这里面临的问题是,当我打开弹出窗口时,我已经放置了文件上载文件上传,当我点击上传文件的浏览按钮时,对话框在弹出窗口后面打开。但它应该在弹出窗口打开如果有人知道请帮助我。提前谢谢。

我的弹出窗口是这样的:

                                                                                                                                                                                                                                                                                             

                    <Button  Grid.Column="0" Grid.Row="0" x:Name="btnaddactivity" Width="140" Height="40" FontSize="12" Content="Save Project" Foreground="White" Background="#FFF3800C" Margin="631,425,99,-58"  />


                    <Expander x:Name="expander" HorizontalAlignment="Right" FlowDirection="RightToLeft"     Foreground="White" FontFamily="segoe_uilight" Height="200"  Width="326" Canvas.Right="20" Canvas.Left="1000"  BorderBrush="#FF0A0909" BorderThickness="1,1,1,2" Background="#FFF3800C" Margin="0,188,73,19" Loaded="expander_Loaded"  >
                        <Expander.Header>
                            <StackPanel Orientation="Horizontal" Width="243">

                                <Canvas Height="22" Width="145" VerticalAlignment="Bottom">

                                    <Image x:Name="imagebind1" Height="30" Width="45" RenderTransformOrigin="2.75,0.8" Canvas.Left="250" Canvas.Top="3" />
                                </Canvas>
                            </StackPanel>
                        </Expander.Header>
                        <Grid HorizontalAlignment="Left" Width="261" >
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="39*"/>
                                <ColumnDefinition Width="64*"/>
                            </Grid.ColumnDefinitions>
                            <ListBox  ScrollViewer.HorizontalScrollBarVisibility="Disabled"  BorderBrush="#FFF3800C" Name="icTodoList2" Background="#FFF3800C" Margin="23,10,-47,0" Grid.ColumnSpan="2"  HorizontalAlignment="Left" Width="285" MouseUp="icTodoList2_MouseUp">
                                <ListBoxItem>
                                    <Canvas Margin="20,20,20,20" Height="30" Width="30" ClipToBounds="True" Background="#F39437" >
                                        <StackPanel  Orientation="Vertical">
                                            <Image  Source="img/icons/1.png"  Height="30" Width="30" HorizontalAlignment="Center"  />

                                        </StackPanel>
                                    </Canvas>
                                </ListBoxItem>
                                <ListBoxItem>
                                    <Canvas Margin="20,20,20,20" Height="30" Width="30" ClipToBounds="True" Background="#F39437" >
                                        <StackPanel  Orientation="Vertical">
                                            <Image  Source="img/icons/2.png"  Height="30" Width="30" HorizontalAlignment="Center"  />

                                        </StackPanel>
                                    </Canvas>
                                </ListBoxItem>
                                <ListBoxItem>
                                    <Canvas Margin="20,20,20,20" Height="30" Width="30" ClipToBounds="True" Background="#F39437" >
                                        <StackPanel  Orientation="Vertical">
                                            <Image  Source="img/icons/3.png"  Height="30" Width="30" HorizontalAlignment="Center"  Tag="-1"/>

                                        </StackPanel>
                                    </Canvas>
                                </ListBoxItem>
                                <ListBoxItem>
                                    <Canvas Margin="20,20,20,20" Height="30" Width="30" ClipToBounds="True" Background="#F39437" >
                                        <StackPanel  Orientation="Vertical">
                                            <Image  Source="img/icons/4.png"  Height="30" Width="30" HorizontalAlignment="Center"  />

                                        </StackPanel>
                                    </Canvas>
                                </ListBoxItem>
                                <ListBoxItem>
                                    <Canvas Margin="20,20,20,20" Height="30" Width="30" ClipToBounds="True" Background="#F39437" >
                                        <StackPanel  Orientation="Vertical">
                                            <Image  Source="img/icons/6.png"  Height="30" Width="30" HorizontalAlignment="Center"  />

                                        </StackPanel>
                                    </Canvas>
                                </ListBoxItem>
                                <ListBoxItem>
                                    <Canvas Margin="20,20,20,20" Height="30" Width="30" ClipToBounds="True" Background="#F39437" >
                                        <StackPanel  Orientation="Vertical">
                                            <Image  Source="img/icons/7.png"  Height="30" Width="30" HorizontalAlignment="Center"  />

                                        </StackPanel>
                                    </Canvas>
                                </ListBoxItem>
                                <ListBoxItem>
                                    <Canvas Margin="20,20,20,20" Height="30" Width="30" ClipToBounds="True" Background="#F39437" >
                                        <StackPanel  Orientation="Vertical">
                                            <Image  Source="img/icons/8.png"  Height="30" Width="30" HorizontalAlignment="Center"  />

                                        </StackPanel>
                                    </Canvas>
                                </ListBoxItem>
                                <ListBoxItem>
                                    <Canvas Margin="20,20,20,20" Height="30" Width="30" ClipToBounds="True" Background="#F39437" >
                                        <StackPanel  Orientation="Vertical">
                                            <Image  Source="img/icons/9.png"  Height="30" Width="30" HorizontalAlignment="Center"  />

                                        </StackPanel>
                                    </Canvas>
                                </ListBoxItem>
                                <ListBox.ItemsPanel>
                                    <ItemsPanelTemplate>
                                        <WrapPanel IsItemsHost="True" Orientation="Horizontal"  />
                                    </ItemsPanelTemplate>
                                </ListBox.ItemsPanel>
                            </ListBox>
                        </Grid>
                    </Expander>

                </Grid>

            </Canvas>
        </Border>
    </Popup>

1 个答案:

答案 0 :(得分:0)

你看过这个,它和你的问题类似。

Popup always stays on top

在这里,他们使用user32.dll

创建自定义弹出窗口