문제

콤보 상자가 한 번 대신 확장 될 때마다 객체 dataprovider를 트리거하도록하는 방법은 무엇입니까?

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

도움이 되었습니까?

해결책

ObjectDataprovider가 트리거되면 신선한 userinterfaceHelper 개체를 만들고 싶습니까?

이 경우 Combobox의 Dropdownoped 이벤트를 다음 방법에 연결하십시오.

private void ComboBox_DropDownOpened(object sender, EventArgs e)
{
  ObjectDataProvider odp = Resources["possibleExpressionValues"] as ObjectDataProvider;
  odp.ObjectType = null;
  odp.ObjectInstance = new UserInterfaceHelper();
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top