0

I am trying to bind a ComboBox to the named cells of a SpreadsheetGear worksheet.

SpreadsheetGear is an obfuscated assembly, so that i my first guess.

<ComboBox Width="200" x:Name="comboBox" IsEditable="True" ItemsSource="{Binding Names, Mode=OneWay}">
    <ComboBox.ItemTemplate>
        <DataTemplate>
            <TextBlock Text="{Binding Name}"/>
        </DataTemplate>
    </ComboBox.ItemTemplate>
</ComboBox>

and the view-model propery is

private IWorksheet worksheet;
public IWorksheet Worksheet
{
    get { return worksheet; }
    private set { SetField(ref worksheet, value, () => Worksheet); OnPropertyChanged(() => Names); }
}
public IEnumerable<IName> Names
{
    get { return Worksheet.Names.Cast<IName>(); }
}

I am getting the following error in my Output window

System.Windows.Data Error: 40 : BindingExpression path error: 'Name' property not found on 'object' ''ᜪ' (HashCode=1500138080)'. BindingExpression:Path=Name; DataItem='ᜪ' (HashCode=1500138080); target element is 'TextBlock' (Name=''); target property is 'Text' (type 'String')

I've tried returning Worksheet.Names directly, which doesn't inherit from Enumerable but DOES provide GetEnumerator(). That yielded the same error.

Any ideas?

Nick Strupat
  • 4,928
  • 4
  • 44
  • 56

1 Answers1

1

Without more code, it's hard to say, but I'll take a random guess: Is IName an internal interface? Most code obfuscators will only mangle internal/private/protected classes/enums/interfaces...

JerKimball
  • 16,584
  • 3
  • 43
  • 55
  • The weird thing is, it's a public interface. Internal implementation, of course. http://www.spreadsheetgear.com/support/help/spreadsheetgear.net.7.0/#SpreadsheetGear2012~SpreadsheetGear.IName.html – Nick Strupat Jan 11 '13 at 16:21
  • @NickStrupat Can you post any more of your view model class or XAML? Like what's your data context, etc. – JerKimball Jan 11 '13 at 16:23