I cannot get it to fail...
I created a simple WPF application that has a ComboBox and a Button. The constructor of the Window sets the IsDropDownOpen property to true. And then the Button will do the same.
You left out the details of what criteria you use to determine if that is true or not, but you should be able to specify it there, or you can use triggers within the XAML.
The following code shows my demo application:
XAML (some elided for brevity)
<ComboBox x:Name="MyComboBox" Margin="5 0 5 0" Grid.Column="0"
ItemsSource="{Binding Path=.}">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=.}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<Button Grid.Column="2" Margin="0 0 5 0"
Content="Open DropDown"
Click="Button_Click" />
Code-behind (some elided for brevity)
readonly List<string> items = new List<string>() { "One", "Two", "Three" };
public MainWindow()
{
InitializeComponent();
DataContext = items;
MyComboBox.IsDropDownOpen = true;
}
private void Button_Click(object sender, RoutedEventArgs e)
{
MyComboBox.IsDropDownOpen = true;
}</string></string>