Advertisement
Guest User

Untitled

a guest
Apr 19th, 2014
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. <Window x:Class="WpfApplication1.MainWindow"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Height="100" Width="300">
  4. <Grid>
  5. <ComboBox VerticalAlignment="Top" HorizontalAlignment="Left"
  6. Width="100" IsSynchronizedWithCurrentItem="True" >
  7. <ComboBoxItem Content="item 1"/>
  8. <ComboBoxItem Content="item 2"/>
  9. <ComboBoxItem Content="item 3"/>
  10. </ComboBox>
  11. <Button Content="Test" VerticalAlignment="Bottom" HorizontalAlignment="Right"
  12. Width="100" Click="Button_Click" />
  13. </Grid>
  14. </Window>
  15.  
  16. private void Button_Click(object sender, RoutedEventArgs e)
  17. {
  18. MessageBox.Show("Button clicked");
  19. }
  20.  
  21. MyComboBox.AddHandler(
  22. UIElement.MouseLeftButtonDownEvent,
  23. new MouseButtonEventHandler(
  24. (sender, e) =>
  25. {
  26. MyButton.Command.Execute(null);
  27. }),
  28. handledEventsToo: true
  29. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement