Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

我在使用Badge时更新了Text文本内容,但是Badge UI未能及时更新。请问可能出现这种情况的原因是什么,我该如何解决? #71

Closed
ChenYuan516 opened this issue Dec 2, 2023 · 0 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@ChenYuan516
Copy link

  • Nuget包 :WPFDevelopers -Version 1.1.0.2-preview3
  • .Net 4.5.1

前台代码如下

<Button
                    Width="100"
                    Margin="10,0"
                    wd:Badge.FontSize="12"
                    wd:Badge.IsShow="{Binding ElementName=MyBadgeToggleButton, Path=IsChecked}"
                    wd:Badge.Text="{Binding Text,RelativeSource={RelativeSource AncestorType=UserControl}}"
                    Content="Success"
                    Click="myButton_Click" 
                    Style="{DynamicResource WD.SuccessDefaultButton}" />

逻辑代码如下

  • 我在点击按钮时候更新Text,但是UI未更新。
        public string Text
        {
            get { return (string)GetValue(TextProperty); }
            set { SetValue(TextProperty, value); }
        }

        public static readonly DependencyProperty TextProperty =
            DependencyProperty.Register("Text", typeof(string), typeof(BadgeExample), new PropertyMetadata("3"));

        private void myButton_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            Text = "10";
        }

image

@yanjinhuagood yanjinhuagood self-assigned this Dec 2, 2023
@yanjinhuagood yanjinhuagood added bug Something isn't working enhancement New feature or request labels Dec 2, 2023
yanjinhuagood added a commit that referenced this issue Dec 7, 2023
 Text change does not refresh issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants