类似于360点击三角按钮,下拉显示更多按钮.这里用到Popup

<Button x:Name="menu"  HorizontalAlignment="Right" Height="24" VerticalAlignment="Top" Width="39.75" Margin="0,1,79.8,0" Click="menu_Click" />
        <Popup x:Name="menuPop1" StaysOpen="False" Margin="0" PlacementTarget="{Binding ElementName=menu}" AllowsTransparency="True">
            <Grid Height="78" Width="100" HorizontalAlignment="Left">
                <Border BorderThickness="0" CornerRadius="3" Background="White" Margin="3">
                    <Border.Effect>
                        <DropShadowEffect ShadowDepth="0" Color="#FFB6B6B6"/>
                    </Border.Effect>
                    <StackPanel Margin="0">
                        <TextBlock Text="hello"></TextBlock>
                        <MenuItem Header="设置" FontSize="12"  Height="23.5" FontFamily="Microsoft YaHei"/>
                        <MenuItem Header="关于" FontSize="12"Height="23.5" FontFamily="Microsoft YaHei"/>
                        <MenuItem Header="退出" FontSize="12" Height="23.5" FontFamily="Microsoft YaHei" Background="#00000000"/>
                    </StackPanel>
                </Border>
            </Grid>
       </Popup>

上面popup中的  PlacementTarget="{Binding ElementName=menu}"

是关联控件的意思
private void menu_Click(object sender, RoutedEventArgs e)
{
      menuPop1.IsOpen = true;
}

 





相关文章:

  • 2022-12-23
  • 2021-11-05
  • 2022-12-23
  • 2021-11-19
  • 2022-12-23
  • 2021-12-03
  • 2022-12-23
猜你喜欢
  • 2021-10-09
  • 2022-12-23
  • 2021-07-30
  • 2022-12-23
  • 2021-11-01
  • 2022-12-23
相关资源
相似解决方案