Search code examples
c#urhosharpurho3d

Urho3D Sharp DropDownList Popup issue


I am trying to create a DropDownList in Urho3D Sharp. For some reason unknown to me I cannot get the popup to appear from the DropDownList. Does anyone have any tips for creating drop downs in Urho3D Sharp?

I have tried calling ShowPopup when the dropdown list has been pressed, however this yielded no effect.

DropDownList ddl = new DropDownList();
ddl.SetMinSize(200, 30);
ddl.SetPosition(200, 81);
ddl.SetStyleAuto();
ddl.Popup.SetStyleAuto();
ddl.ItemSelected += args =>
{
   System.Console.WriteLine(args);
};
ddl.AddItem(t1);//Text Object
ddl.AddItem(t2);//Text Object
UI.Root.AddChild(ddl);

Solution

  • I found the answer. When you call SetStyleAuto you should pass in a style XmlFile.

    XmlFile style = ResourceCache.GetXmlFile("UI/DefaultStyle.xml");
    ddl.SetStyleAuto(style);