Skip to content
闫驚鏵(Jinhua Yan) edited this page Aug 2, 2023 · 2 revisions

1)Xaml

<Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <ToggleButton
                x:Name="MyBadgeToggleButton"
                Margin="10"
                HorizontalAlignment="Center"
                Content="显示Badge" />
            <StackPanel
                Grid.Row="1"
                HorizontalAlignment="Center"
                Orientation="Horizontal">
                <Button
                    wd:Badge.IsShow="{Binding ElementName=MyBadgeToggleButton, Path=IsChecked}"
                    wd:Badge.Text="new"
                    wd:Badge.HorizontalOffset="-20"
                    wd:Badge.VerticalOffset="8"
                    Content="Default"
                    Style="{DynamicResource WD.PrimaryButton}" />
                <Button
                    Margin="40,0"
                    wd:Badge.FontSize="12"
                    wd:Badge.IsShow="{Binding ElementName=MyBadgeToggleButton, Path=IsChecked}"
                    wd:Badge.Text="3"
                    Content="Success"
                    Style="{DynamicResource WD.SuccessDefaultButton}" />
                <Button
                    wd:Badge.FontSize="12"
                    wd:Badge.IsShow="{Binding ElementName=MyBadgeToggleButton, Path=IsChecked}"
                    wd:Badge.Text="10+"
                    Content="Warning"
                    Style="{DynamicResource WD.WarningDefaultButton}" />
                <Button
                    Margin="40,0"
                    wd:Badge.IsShow="{Binding ElementName=MyBadgeToggleButton, Path=IsChecked}"
                    wd:Badge.Text="NEW"
                    Content="Danger"
                    Style="{DynamicResource WD.DangerDefaultButton}" />
                <Rectangle
                    Width="100"
                    Height="100"
                    wd:Badge.IsShow="{Binding ElementName=MyBadgeToggleButton, Path=IsChecked}"
                    Fill="Aqua" />
            </StackPanel>
        </Grid>
Clone this wiki locally