WPF TextBox and Scroll behavior

后端 未结 3 936
失恋的感觉
失恋的感觉 2020-11-27 06:33

I have a problem. I need to host grid with controls in ScrollViewer to prevent textbox from being either truncated or collapsed to zero-with at the UI. Also I want the with

3条回答
  •  余生分开走
    2020-11-27 07:08

    Overriding TextBox.MeasureOverride like so worked for me:

    protected override Size MeasureOverride(Size constraint)
    {
        Size origSize = base.MeasureOverride(constraint);
        origSize.Width = MinWidth;
        return origSize;
    }
    

提交回复
热议问题