Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <Window x:Class="WpfApplication1.MainWindow"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Height="100" Width="300">
- <Grid>
- <ComboBox VerticalAlignment="Top" HorizontalAlignment="Left"
- Width="100" IsSynchronizedWithCurrentItem="True" >
- <ComboBoxItem Content="item 1"/>
- <ComboBoxItem Content="item 2"/>
- <ComboBoxItem Content="item 3"/>
- </ComboBox>
- <Button Content="Test" VerticalAlignment="Bottom" HorizontalAlignment="Right"
- Width="100" Click="Button_Click" />
- </Grid>
- </Window>
- private void Button_Click(object sender, RoutedEventArgs e)
- {
- MessageBox.Show("Button clicked");
- }
- MyComboBox.AddHandler(
- UIElement.MouseLeftButtonDownEvent,
- new MouseButtonEventHandler(
- (sender, e) =>
- {
- MyButton.Command.Execute(null);
- }),
- handledEventsToo: true
- );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement