Skip to content

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

Closed
@ChenYuan516

Description

@ChenYuan516
  • 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

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingenhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions