align-toparrow-leftarrow-rightbackbellblockcalendarcamerachatcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-crosscrosseditfacebookglobegoogleimagesinstagramlocation-pinmagnifying-glassmailmoremuplabelShape 3 + Rectangle 1outlookpersonplusImported LayersImported LayersImported Layersshieldstartwitteryahoo

WPF popup positioning/alignments

From: Alec B.
Sent on: Friday, November 23, 2007 5:55 PM
Guys,
 
I'm using Popup.Placement="Bottom" According to the MSDN docs, the popup should align itself with the bottom left corner of the target control. However, it's aligning with the bottom right corner.
 
Any ideas?
 
 

<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">

<Grid>

<StackPanel>

<TextBlock Name="ttt"></TextBlock>

<TextBox Name="txtCity" GotFocus="TextBox_GotFocus" LostFocus="TextBox_LostFocus"></TextBox>

<TextBox></TextBox>

</StackPanel>

<Popup Name="popupLink" AllowsTransparency="True" HorizontalAlignment="Left" PopupAnimation="Fade" Placement="Bottom" PlacementTarget="{Binding ElementName = txtCity}">

<Border BorderBrush="Beige" BorderThickness="2" Background="White">

<Grid>

<TextBlock>This is the popup. </TextBlock>

</Grid>

</Border>

</Popup>

</Grid>

</Window>

 

 

private void TextBox_GotFocus(object sender, RoutedEventArgs e)

{

popupLink.IsOpen = true;

}

private void TextBox_LostFocus(object sender, RoutedEventArgs e)

{

popupLink.IsOpen = false;

}

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy