How can I β€œclick” a control in WPF?

I have an order entry form that has a ListBox with a list of items. I have a template for my elements, and one of the values ​​is the ComboBox in each of my elements.

Now my form can also create credit memos in addition to purchase orders, but when I create a credit memo, I want to put the words "Credit memo" in the list box, however TextBlock covers ComboBox in two of my positions. I would like to pass my click event through a TextBlock to a ComboBox , but I'm not sure how to do this.

This is what I have (maybe I am in this completely wrong, I kind of like noob with WPF)

 <ListBox SelectionMode="Single" Grid.Row="2" ItemsSource="{Binding Path=LineItems}" HorizontalContentAlignment="Stretch" IsSynchronizedWithCurrentItem="True" Background="#66FFFFFF"> <ListBox.ItemContainerStyle> <Style TargetType="{x:Type ListBoxItem}"> <Setter Property="Background" Value="WhiteSmoke"/> <Setter Property="BorderThickness" Value="1" /> <Style.Triggers> <DataTrigger Binding="{Binding Path=IsPartBackOrder}" Value="True"> <Setter Property="Background" Value="Orange" /> </DataTrigger> </Style.Triggers> </Style> </ListBox.ItemContainerStyle> <ListBox.ItemTemplate> <DataTemplate DataType="{x:Type Entities:SalesOrderLineItem}" > <OrderEntry:SalesOrderLineItemCreate DataContext="{Binding}" DeleteSalesOrderLineItem="DeleteSalesOrderLineItem" Margin="0,3,3,0" > <OrderEntry:SalesOrderLineItemCreate.Resources> <Style TargetType="{x:Type OrderEntry:SalesOrderLineItemCreate}"> <Style.Triggers> <DataTrigger Binding="{Binding RelativeSource= { RelativeSource Mode=FindAncestor, AncestorType={x:Type ListBoxItem} }, Path=IsSelected }" Value="True"> <Setter Property="Background" Value="LightBlue" /> <Setter Property="Foreground" Value="Black" /> </DataTrigger> </Style.Triggers> </Style> </OrderEntry:SalesOrderLineItemCreate.Resources> </OrderEntry:SalesOrderLineItemCreate> </DataTemplate> </ListBox.ItemTemplate> </ListBox> <TextBlock Grid.Row="2" Text="Credit Memo" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="48" Height="Auto" FontStyle="Italic" Foreground="Red" Opacity=".25"> <TextBlock.Style> <Style TargetType="{x:Type TextBlock}"> <Style.Triggers> <DataTrigger Binding="{Binding Path=OrderType}" Value="CR"> <Setter Property="Visibility" Value="Visible" /> </DataTrigger> <DataTrigger Binding="{Binding Path=OrderType}" Value="CU"> <Setter Property="Visibility" Value="Hidden" /> </DataTrigger> </Style.Triggers> </Style> </TextBlock.Style> </TextBlock> 
+54
styles wpf
Jun 12 '09 at 18:36
source share
1 answer
 <TextBlock IsHitTestVisible="False" .../> 
+114
Jun 12 '09 at 18:42
source share



All Articles