我在XAML视图的代码隐藏文件中创建一个AppBarButton.目前,我在XAML中定义了AppBarButton,如下所示:
<AppBarButton x:Name="SelectVisitAppBarButton" x:Uid="AppBar_TransferVisit" Margin="0,0,12,0" Icon="Bullets" Style="{StaticResource TransferAppBarButtonStyle}" IsEnabled="{Binding ScheduleViewVm.IsVisitSelectionEnable}" Click="SelectVisit_Click" />
Run Code Online (Sandbox Code Playgroud)
我想将此XAML转换为C#代码.以下是我到目前为止的代码.
AppBarButton SelectVisitAppBarButton = new AppBarButton();
SelectVisitAppBarButton.Margin = new Thickness(0, 0, 12, 0);
SymbolIcon bulletSymbol = new SymbolIcon();
bulletSymbol.Symbol = Symbol.Bullets;
SelectVisitAppBarButton.Icon = bulletSymbol;
SelectVisitAppBarButton.Style = App.Current.Resources["TransferAppBarButtonStyle"] as Style;
SelectVisitAppBarButton.Click += SelectVisit_Click;
Binding b = new Binding();
b.Source = _viewModel.ScheduleViewVm.IsVisitSelectionEnable;
SelectVisitAppBarButton.SetBinding(Control.IsEnabledProperty, b);
Appbar.Children.Add(SelectVisitAppBarButton);
Run Code Online (Sandbox Code Playgroud)
我唯一想要的是将x:Uid ="AppBar_TransferVisit"转换为其等效的C#代码.对此的任何帮助都非常感谢.
谢谢,Naresh Ravlani.
我想验证一个不应该是00000的5位数字.允许除00000之外的所有数字.
示例:01201,00001,21436,45645是有效数字,1,12,123,1234,00000是无效数字.
我试过^([0-9]{5}[^(0){5}])$但是没用.
任何有关这方面的帮助将非常感激.
谢谢.
我有一个选项卡控件,我在其中以编程方式添加选项卡项.我希望每个标签项都有一个关闭按钮.在谷歌搜索我发现下面的XAML代码:
<Button Content="X" Cursor="Hand" DockPanel.Dock="Right"
Focusable="False" FontFamily="Courier" FontSize="9"
FontWeight="Bold" Margin="5,0,0,0" Width="16" Height="16" />
Run Code Online (Sandbox Code Playgroud)
现在,我正在将此代码转换为等效的C#代码并与一些属性进行斗争.下面给出的是我到现在为止的代码.
var CloseButton = new Button()
{
Content = "X",
Focusable = false,
FontFamily = FontFamily = new System.Windows.Media.FontFamily("Courier"),
FontSize = 9,
Margin = new Thickness(5, 0, 0, 0),
Width = 16,
Height = 16
};
Run Code Online (Sandbox Code Playgroud)
我想要帮助像Cursor,DockPanel.Dock这样的属性.对此有任何帮助非常感谢.谢谢 !
我正在使用SQL视图将数据传递给RDLC报告.现在,如果我向SQL视图添加一列,如何在RDLC报告中获取此新添加的列.
目前,我必须删除RDLC数据集并每次创建一个新的数据集,这根本不可行.希望有人有更好的方法来做到这一点.
我知道你不能从一个类继承一次sealed被使用,但我很困惑这两者之间有什么区别:private和sealed?
private如果我们不想继承它们而不是整个类,我们不能使基类成员吗?使用的意义sealed class何在?