xaml - WPF ListBox in TabItem "Property content set more than once" -
i'm (evidently) new wpf , struggling figure out how put listbox
inside tabitem
. current attempt below results in property 'content' set more once
, answers can't seem relate mine.
<window> <grid> <tabitem> <grid background="red"></grid> <tabitem.header> <dockpanel width="130" horizontalalignment="center"> <textblock text="inventory" foreground="black" fontsize="30" textalignment="center"/> </dockpanel> </tabitem.header> <listbox> <listboxitem>test</listboxitem> </listbox> </tabitem> </grid> </window>
if point me in right direction that'd appreciated.
ok, edited answer works below. indeed, others suggest, removing "<grid background="red"></grid>"
line solves problem. removing following lines:
<listbox> <listboxitem>test</listboxitem> </listbox>
the grid , listbox views both being set content property of tabitem , cause of error.
if wish use both listbox content of our tabitem, need place them both inside stack panel, below:
<window> <grid> <tabitem> <tabitem.header> <dockpanel width="130" horizontalalignment="center"> <textblock text="inventory" foreground="black" fontsize="30" textalignment="center"/> </dockpanel> </tabitem.header> <stackpanel orientation="horizontal"> <grid background="red"></grid> <listbox> <listboxitem>test</listboxitem> </listbox> </stackpanel> </tabitem> </grid> </window>
Comments
Post a Comment