Live Chat Icon For mobile
Live Chat Icon

How can I specify a Custom Popup Position ?

Platform: WPF| Category: Popup

You can specify a custom pop-up location by setting the Placement property to Custom. This can be done with the following code snippets.


<Popup Name="myCustomPopup" 
        PlacementTarget ="{Binding ElementName=myGridLayout}"
  <TextBlock Height="50" Width="150"
             TextWrapping="Wrap">Custom popup position demo</TextBlock>
public CustomPopupPlacement[] placementForPopup(Size popupSize,
                                           Size targetSize,
                                           Point offset)
    CustomPopupPlacement customPlacement1 =
       new CustomPopupPlacement(new Point(-40, 90), PopupPrimaryAxis.Vertical);
    CustomPopupPlacement customPlacement2 =
        new CustomPopupPlacement(new Point(20, 30), PopupPrimaryAxis.Horizontal);
    CustomPopupPlacement[] customPlacements =
            new CustomPopupPlacement[] { customPlacement1 , customPlacement2  };
    return customPlacements ;
myCustomPopup.CustomPopupPlacementCallback =
    new CustomPopupPlacementCallback(placementForPopup);

Reference link:

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.