WPF绑定到混淆对象无法找到该属性

时间:2013-01-11 16:11:39

标签: wpf binding spreadsheetgear

我正在尝试将ComboBox绑定到SpreadsheetGear工作表的指定单元格。

SpreadsheetGear是一个混淆的程序集,所以我是我的第一个猜测。

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

并且视图模型属于

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>(); }
}

我在“输出”窗口中收到以下错误

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')

我已经尝试直接返回Worksheet.Names,它不会从Enumerable继承而是提供GetEnumerator()。这产生了同样的错误。

有什么想法吗?

1 个答案:

答案 0 :(得分:1)

没有更多代码,很难说,但我会随机猜测:IName是内部接口吗?大多数代码混淆器只会破坏internal / private / protected类/枚举/接口......

相关问题