首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >组合框打开时从ObjectDataProvider获取数据

组合框打开时从ObjectDataProvider获取数据
EN

Stack Overflow用户
提问于 2009-06-17 14:23:30
回答 1查看 794关注 0票数 0

如何让ObjectDataProvider在组合框每次展开时都被触发,而不是只触发一次?

代码语言:javascript
复制
<UserControl.Resources>
    <ObjectDataProvider x:Key="possibleExpressionValues"
                MethodName="GetWatchVariableNames" 
                ObjectType="{x:Type mu:UserInterfaceHelper}" IsInitialLoadEnabled="False">
    </ObjectDataProvider>
</UserControl.Resources>

<Grid>
    <ComboBox IsEditable="True" Text="{Binding ID}" ItemsSource="{Binding Source={StaticResource possibleExpressionValues}}" VerticalAlignment="Top" />
</Grid>

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2009-06-17 18:12:24

使用ObjectDataProvider get触发,您的意思是希望创建一个新的UserInterfaceHelper对象?

在这种情况下,将组合框的DropDownOpened事件连接到以下方法。

代码语言:javascript
复制
private void ComboBox_DropDownOpened(object sender, EventArgs e)
{
  ObjectDataProvider odp = Resources["possibleExpressionValues"] as ObjectDataProvider;
  odp.ObjectType = null;
  odp.ObjectInstance = new UserInterfaceHelper();
}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/1007357

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档