Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1160
How do I populate a ComboEditorTool combobox programmatically?
posted

I tried the following and get "Object reference not set to an instance of an object." when I try to add the first item (a string) to the combobox (there is a value in s at the time).  What's the correct way to do this:

XAML snippet:

 <igRibbon:RibbonTabItem Header="Skins">

<igRibbon:RibbonGroup Id="skins" Caption="Skins" >

<igRibbon:ComboEditorTool

Id="cetSkins"

x:Name="cetSkins"

DropDownResizeMode="VerticalOnly"

IsEditable="False"

SelectedItemChanged="cetSkins_SelectedItemChanged"/>

</igRibbon:RibbonGroup>

 Code:

 public Window1()

{

InitializeComponent();

string[ f = Directory.GetFiles("skins", "skin*.xaml");

foreach (string s in f)

this.cetSkins.ComboBox.Items.Add(s);

I've also tried putting my code in as separate Window_Loaded event but that fails the same way.

 

Thanks!

 Glenn L