dotancohen
dotancohen

Reputation: 31471

Overflow `Label`

Is there any way to make a Label overflow? I am overlaying a Label over a Combobox to simulate default text, but the Label prevents the Combobox from getting focus when clicked. I would like to therefore set the Label width as 1 and overflow it.

By the way, I have seen the "watermark" workaround to the Combobox default text issue, but it is not viable in my use case so there is no need to suggest it. Thanks.

Upvotes: 0

Views: 214

Answers (2)

David
David

Reputation: 6114

to do what you want to do, you should just do:

MyLabel.IsHitTestVisible = false;

http://msdn.microsoft.com/fr-fr/library/system.windows.uielement.ishittestvisible%28v=vs.95%29.aspx

this way you do not have to worry about overlapping.

Upvotes: 1

Phil
Phil

Reputation: 42991

Use <Label IsHitTestVisible="false" Focusable="false" /> then the label won't intercept mouse clicks or receive the focus.

Upvotes: 1

Related Questions