添加数据绑定时按钮被禁用

时间:2019-06-06 14:31:17

标签: wpf data-binding

当我在com中向其添加数据绑定时,我的按钮将被禁用

var dt1 = dt.Copy();
dt.Columns.Remove("<columnsToRemove>")

但我已经在NavigationCommands类中定义了此

<Button Style="{DynamicResource MaterialDesignFlatButton}" Margin="0 2 8 2" Command="{x:Static local:NavigationCommands.RefreshCommand}">
    <StackPanel Orientation="Horizontal">
        <materialDesign:PackIcon Kind="Refresh" />
        <TextBlock Margin="4 0 0 0" VerticalAlignment="Center">REFRESH</TextBlock>
    </StackPanel>
</Button>

我也在我的viewmodel类中定义了它

using System.Windows.Input;

namespace myapp
{
    public static class NavigationCommands
    {
        public static RoutedCommand RefreshCommand= new RoutedCommand();
    }
}

enter image description here

0 个答案:

没有答案