ToolbarSearchField Width

Hi, I’m working on a custom EditorWindow. My editor has a TwoPaneSplitView with some items and a search bar on the left and detail content for the selected item on the right.

image

As you can see in this image, the search bar is wider than the list of items. When I move the divider, the ListView changes its width, but not the ToolbarSearchField.

My UXML looks like this:

<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="False">
    <Style src="project://database/Assets/Ghi3/GameWorld/Editor/GameWorldEditor.uss?fileID=7433441132597879392&amp;guid=b4ace936e0ae6c24284f9393cfc1efa5&amp;type=3#GameWorldEditor" />
    <ui:TwoPaneSplitView>
        <ui:VisualElement name="left-pane">
            <uie:ToolbarSearchField />
            <ui:ListView name="template-master" virtualization-method="DynamicHeight" />
        </ui:VisualElement>
        <ui:VisualElement name="template-detail" />
    </ui:TwoPaneSplitView>
</ui:UXML>

I also have a USS file:

#template-master {
}

TemplateMasterItem {
    padding-left: 10px;
    padding-right: 10px;
    padding-top: 5px;
    padding-bottom: 5px;
}

ToolbarSearchField {
}

#left-pane {
    min-width: 150px;
}

Can anybody help me understand how I can change the ToolbarSearchField to inherit the width of the left container?

Things I’ve tried:

  • Set Shrink from 1 (default) to 0
  • Set Shrink to 0 and Grow to 1
  • Add VisualElement to #left-pane and set Direction to row and Growth to 1

I’m using Unity 2022.3.15f1 with Unity UI 1.0.0.