我有以下问题:我必须在 Expander 标题中添加几个额外的按钮(以更改扩展器内容的呈现方案 - 图形或表格)。但问题是,当我按下这些按钮时,Expander 正在折叠或展开(我只想改变内容)。我记得网络开发中的泡沫事件。我为 CancelBubble 找到了以下解决方案: e.Handled = true; 但这无济于事
<Expander x:Name="xpdNumberDevices">
<Expander.Header >
<Border Background="#E5E5E5">
<StackPanel Width="605" Height="40" Orientation="Horizontal" HorizontalAlignment="Center">
<Label Foreground="Black" Content="Number of Devices"
HorizontalAlignment="Center" VerticalAlignment="Center" Margin="10,0,0,0" FontSize="14" />
<Image x:Name="imgGraphNumberDevices" Height="24" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="380,0,0,0"
MouseLeftButtonUp="btnNumDeviceGraph_Click">
<Image.Style>
<Style TargetType="{x:Type Image}">
<Setter Property="Source" Value="/Pictures/graph_button.png"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Source" Value="/Pictures/graph_button_over.png"/>
</Trigger>
</Style.Triggers>
</Style>
</Image.Style>
</Image>
<Image Height="24" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,0,0"
MouseLeftButtonUp="btnNumDeviceTable_Click">
<Image.Style>
<Style TargetType="{x:Type Image}">
<Setter Property="Source" Value="/Pictures/table_button.png"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Source" Value="/Pictures/table_button_over.png"/>
</Trigger>
</Style.Triggers>
</Style>
</Image.Style>
</Image>
</StackPanel>
</Border>
</Expander.Header>
<my:Chart Name="crtDeviceNumberChart" Title="Number of Devices" VerticalAlignment="Top" Margin="20,5,0,0" Height="280" Width="600" BorderBrush="#FFE5E5E5">
<my:BarSeries Title="Devices" DependentValuePath="Key" IndependentValuePath="Value" ItemsSource="{Binding}" IsSelectionEnabled="True" />
</my:Chart>
</Expander>