Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

How to place autocomplete box near textbox where multiple textbox are children of stackpanel in WPF Application

$
0
0

Hi

I have five textbox in my application. All the textbox are children of stack panel. It's name is rootStackPanel. For autocomplete box, I have added textblocks to a stackpanel. its name is autoCompleteTextBox.

When a user clicks in a textbox, I want to show autocompletebox below it. So I planned to use translate tranform to move the autocompletebox below the focused textbox. 

Following are my code:

Point pos=targetTextBox.PointToScreen(new Point(0d, 0d));
autoCompleteBox.RenderTransform= new TranslateTransform(pos.X, pos.Y);

This is not giving desired result. I also tried following code:

Point pos = targetTextBox.TranslatePoint(new Point(0, 0),this);
autoCompleteBox.RenderTransform= new TranslateTransform(pos.X, pos.Y);

This is also not giving desired result. 

In both cases, it is placing the autocomplete box far from the focused textbox. 

There must be more efficient way to achieve the result. Please guide me. Thanks in Advance. 


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>