【问题标题】:Setup materialDesign:PackIcon code behind设置materialDesign:PackIcon后面的代码
【发布时间】:2019-03-29 08:48:27
【问题描述】:

我正在尝试分配 materialDesign:PackIcon 代码。这是我的代码。

for (int i = 0; i<PrinterNumber; i++)
{
    Button btn_Restart = new Button();
    btn_Restart.Name = string.Format("PrinterRestartButtton{0}", i);
    btn_Restart.Width = 50;
    btn_Restart.Height = 25;
    btn_Restart.VerticalAlignment = VerticalAlignment.Center;
    btn_Restart.HorizontalAlignment = HorizontalAlignment.Left;
    btn_Restart.Content = "Restart";
    //btn_Restart.Visibility = Visibility.Hidden;
    btn_Restart.Click += Btn_Restart_Click;
    btn_Restart.Style = (Style) Application.Current.TryFindResource("MaterialDesignRaisedDarkButton");
    Grid.SetRow(btn_Restart, i + 2);
    Grid.SetColumn(btn_Restart, 10);
    grd_WorkArea.Children.Add(btn_Restart);
}

如何将 ma​​terialDesign:PackIcon Kind="Restart" 应用于 btn_Restart.Content 属性?

【问题讨论】:

    标签: c# wpf button material-design


    【解决方案1】:

    Content 属性设置为PackIcon

    btn_Restart.Content = new MaterialDesignThemes.Wpf.PackIcon 
        { Kind = MaterialDesignThemes.Wpf.PackIconKind.Restart };
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-03-30
      • 2014-08-08
      • 2016-07-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多