Reputation: 9394
I have a usercontrol with a grid whith just one row and one column. To this column I add a combobox which fills the whole space of the column. Now I want to put a canvas-element over the combobox in the left corner. Until here everything works fine.
The code:
<Grid>
<ComboBox Style="{StaticResource Flat}" SelectionChanged="ColorSelectionChanged" BorderThickness="0" ItemsSource="{Binding ItemCol, UpdateSourceTrigger}"\>
<Canvas Margin="5,5,0,5" Width="25" HorizontalAlignment="Left" Background="{Binding SelectedColor, UpdateSourceTrigger=PropertyChanged}"/>
</Grid>
If I move the mouse over this conrtrol I only get the selection of the combobox if I'm not over the canvas. How can I route the mouse-events from the canvas to the combobox?
Upvotes: 0
Views: 297
Reputation: 14930
If the canvas is just for show, you can turn off hit testing IsHitTestVisible="false"
on the canvas
http://msdn.microsoft.com/en-us/library/system.windows.uielement.ishittestvisible.aspx
Upvotes: 1