none
Popup positioning RRS feed

  • Question

  • Hi,

     

        Im having a stackpanel with a button and a grid. Within my  grid there are  2 buttons, In the mouse enter event of the button within the stackpanel i want to replace the 1st button in the grid with a popup. But instead of replacing the button  with the popup, the popup is placed at the end of the grid.

     

     

    <StackPanel Name="grr">

     

    <Button Width="168" Height="40"  MouseEnter="menter">

    <StackPanel Name="aStackPanel">

    <TextBlock>Create Popup</TextBlock>

    </StackPanel>

    </Button>

     

    <Grid Name="stc">

    <Grid.RowDefinitions>

    <RowDefinition/>

    </Grid.RowDefinitions>

    <Grid.ColumnDefinitions>

    <ColumnDefinition/>

    <ColumnDefinition/>

    </Grid.ColumnDefinitions>

    <Button Name="Resetbtn" Grid.Row="0" Grid.Column="0">Reset</Button>

    <Button Name="Finishbtn" Grid.Row="0" Grid.Column="1">Finish</Button>

    </Grid>

     

    </StackPanel>

     

     

    The mouse enter event..

    private void menter(object sender, System.Windows.Input.MouseEventArgs e)

    {

     

    Popup codePopup = new Popup();

    TextBlock popupText = new TextBlock();

    popupText.Text = "Popup Text";

    popupText.Background = Brushes.LightBlue;

    popupText.Foreground = Brushes.Blue;

    codePopup.Child = popupText;

    stc.Children.Add(codePopup);

    Grid.SetRow(codePopup, 0);

    Grid.SetColumn(codePopup, 0);

    codePopup.IsOpen = true;

    }

    can anyone please help me in this to place the popup over the button.

    Friday, June 29, 2007 1:18 PM

Answers