小编Nar*_*ani的帖子

以编程方式设置x:Uid的值

我在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.

c# xaml windows-mobile winrt-xaml uwp

5
推荐指数
1
解决办法
1334
查看次数

接受除5个连续零之外的所有数字:Javascript

我想验证一个不应该是00000的5位数字.允许除00000之外的所有数字.

示例:01201,00001,21436,45645是有效数字,1,12,123,1234,00000是无效数字.

我试过^([0-9]{5}[^(0){5}])$但是没用.

任何有关这方面的帮助将非常感激.

谢谢.

javascript regex

3
推荐指数
3
解决办法
2119
查看次数

将按钮XAML更改为C#

我有一个选项卡控件,我在其中以编程方式添加选项卡项.我希望每个标签项都有一个关闭按钮.在谷歌搜索我发现下面的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这样的属性.对此有任何帮助非常感谢.谢谢 !

c# wpf xaml tabitem

2
推荐指数
1
解决办法
79
查看次数

在RDLC报告中更新数据

我正在使用SQL视图将数据传递给RDLC报告.现在,如果我向SQL视图添加一列,如何在RDLC报告中获取此新添加的列.

目前,我必须删除RDLC数据集并每次创建一个新的数据集,这根本不可行.希望有人有更好的方法来做到这一点.

report rdlc reporting-services

0
推荐指数
1
解决办法
370
查看次数

密封类和私有类有什么区别?

我知道你不能从一个类继承一次sealed被使用,但我很困惑这两者之间有什么区别:privatesealed

private如果我们不想继承它们而不是整个类,我们不能使基类成员吗?使用的意义sealed class何在?

.net c# oop class sealed

0
推荐指数
1
解决办法
1万
查看次数