Wpf Button Location
hi everyone.
i am building an application. i have a button on a window. When i click the button, i want
a new window popsup. but new window must open behind button. As another way, when window popsup,button must been shown in front of the window. How can i success that? is that possible? Thanks in advance.
My codes as follows,
private void Topics_Click(object sender, RoutedEventArgs e)
{
TreeView tree = new TreeView();
tree.Top = 250;
tree.Left = 30;
tree.Show();
}
http://www.freeimagehosting.net/image.php?de9869e063.jpg i want it looks like that thanks in advance

Kirtan PatelRank #292 · 8.6K reputationPosted Oct 16, 2009, 12:45 AM EDT
Here is What you want ...
dont forget to mark "do you like this answer" please it will give me some credits :)
Make Back ground and All Transparent in Window 1 So it can have only One Button as you shown in Image
Below is My Result
First of All Set Following Properties in Window1 so that only button will appear in Window 1
Now Write Code in Button 1 in Window1 like below
private void button1_Click(object sender, RoutedEventArgs e)
{
Window2 w2 = new Window2();
w2.Show();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
this.Topmost = true;
}
Window1 XAML Code
-----------------
Window x:Class="WpfApplication1.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300" Topmost="True" WindowStyle="None" OverridesDefaultStyle="False" Loaded="Window_Loaded" AllowsTransparency="True" Background="Transparent"> Grid Visibility="Visible" Height="202" Width="237"> Grid.ColumnDefinitions> ColumnDefinition Width="101*" /> ColumnDefinition Width="177*" /> Grid.ColumnDefinitions> Button Height="27" Margin="12,22,0,0" Name="button1" VerticalAlignment="Top" Click="button1_Click" BorderBrush="SlateBlue" Background="BurlyWood" Grid.ColumnSpan="2" HorizontalAlignment="Left" Width="86">ButtonButton> Grid> Window>busra acar7 reputationPosted Oct 16, 2009, 1:01 AM EDT
Kirtan PatelRank #292 · 8.6K reputationPosted Oct 16, 2009, 1:11 AM EDT
Check My Above post I have updated it :) and download my Project Files
Download Project Files if you want to take a reference
and
Friend ,Dont forget to mark "do you like this answer" please if my answer helped you :)
busra acar7 reputationPosted Oct 16, 2009, 1:15 AM EDT
jingeRank #2,527 · 554 reputationPosted Oct 16, 2009, 1:21 AM EDT
http://chronoswpf.codeplex.com/
Kirtan PatelRank #292 · 8.6K reputationPosted Oct 16, 2009, 1:35 AM EDT
if you want out put as above Image then make propertie opacity = 0.5 in window1 and set back ground color to blue
other thigs will be as it is as above posts :)
jingeRank #2,527 · 554 reputationPosted Oct 16, 2009, 1:48 AM EDT
busra acar7 reputationPosted Oct 16, 2009, 2:29 AM EDT
jingeRank #2,527 · 554 reputationPosted Oct 16, 2009, 4:00 AM EDT
Also have a look at this one.
Kirtan PatelRank #292 · 8.6K reputationPosted Oct 16, 2009, 4:03 AM EDT
Window Inside Window -:)
Friend, Dont forget to check "Do you like answer" if my answer helps you :)
Download Sample