Closed yaunchen closed 8 months ago
<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"; }
前台代码如下
逻辑代码如下
我在点击按钮时候更新Text,但是UI未更新。