小编Blu*_*ron的帖子

在一个影响另一个对象的对象上创建一个简单的wpf触发器

这是我最接近创建一个简单的触发器.我只想要datagrid的IsMouseOver == true来显示按钮.问题是Setter的TargetName说:属性'TargetName'不代表'Setter'的有效目标,因为找不到名为'ButtonExpand'的元素.确保在使用目标的任何Setter,Triggers或Conditions之前声明目标.我究竟做错了什么?

<UserControl.Resources>
    <Style TargetType="DataGrid">
        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter TargetName="ButtonExpand" Property="Visibility" Value="Visible" />
            </Trigger>
        </Style.Triggers>
    </Style>
</UserControl.Resources>
<Grid>



    <DataGrid Name="MainDataGrid" ItemsSource="{Binding Programs}" IsReadOnly="True" AutoGenerateColumns="false" >
        <DataGrid.Columns>
            <DataGridTextColumn Header="Name" Binding="{Binding Name}"/>
            <DataGridTextColumn Header="Version" Binding="{Binding Version}"/>
            <DataGridTextColumn Header="Publisher" Binding="{Binding Publisher}"/>
        </DataGrid.Columns>
    </DataGrid>

    <Button Name="ButtonExpand" Height="25" Width="25" HorizontalAlignment="Right" VerticalAlignment="Bottom" Visibility="Hidden">+</Button>
</Grid>
Run Code Online (Sandbox Code Playgroud)

.net c# wpf .net-4.0 wpf-4.0

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

提升现在简单的人类可读日期时间

任何人都知道如何从当前时间的提升到本地系统获得简单的日期格式?

boost::posix_time::ptime now = boost::posix_time::second_clock::universal_time();
boost::posix_time::time_facet *facet = new boost::posix_time::time_facet("%d-%m-%Y %H:%M:%S");
Run Code Online (Sandbox Code Playgroud)

我见过使用cout.imbue的例子,但我只想要一个简单的字符串.

c++ boost

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

grep 环视匹配项不起作用

我听说 grep 有环视支持。我试图在答案中排除带有 grep 的行,因为显然它通常会在那里。我只是想检查我的 mysqld 服务器是否基本启动。

我正在尝试的正则表达式:

^(?!.*grep)(?=.*mysql).*
Run Code Online (Sandbox Code Playgroud)

命令行。我试图匹配的顶线,我试图排除的底线。

root:~# ps aux | grep mysqld_safe
root     28012  0.0  0.1   4408   712 pts/0    S    18:00   0:00 /bin/sh /usr/bin/mysqld_safe
root     29167  0.0  0.1   9392   900 pts/1    S+   20:51   0:00 grep --color=auto mysqld_safe
Run Code Online (Sandbox Code Playgroud)

这是我的查询:

http://regex101.com/r/qK3cI5

# ps aux | grep '^(?!.*grep)(?=.*mysql).*'
(nothing)
Run Code Online (Sandbox Code Playgroud)

regex grep

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

名称为“recaptchaReactive”的表单控件没有值访问器

从这个例子开始工作https://stackblitz.com/edit/ng-recaptcha-example?file=src%2Fapp%2Fapp.component.ts

可能与:Angular4 - 没有用于表单控制的值访问器

在我的表格中,我有以下内容。

<form [formGroup]="loginForm" (ngSubmit)="onSubmit()">
    <mat-form-field class="example-full-width">
       <input matInput placeholder="{{'Email' | translate}}" formControlName="email"                                        [errorStateMatcher]="matcher">

        <mat-error *ngIf="loginForm.controls['email'].hasError('email') || loginForm.controls['email'].hasError('required')">
             {{"Enter a valid email address" | translate}}
        </mat-error>
    </mat-form-field>
    <re-captcha formControlName="recaptchaReactive"></re-captcha>
</form>
Run Code Online (Sandbox Code Playgroud)

电子邮件字段(以及我省略的密码)可以使用。在组件中,我有以下内容。

loginForm = new FormGroup({
    email: new FormControl('', [
        Validators.email,
        Validators.required
    ]),
    password: new FormControl('', [
        Validators.required,
        Validators.minLength(8)
    ]),
    recaptchaReactive: new FormControl(null, Validators.required)
});
Run Code Online (Sandbox Code Playgroud)

angular

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

将int32存储在字节数组中

如何将int32存储在字节数组中的特定位置?

据我所知,我需要使用BitConverter.GetBytes(value); 得到字节[4].

然后我有一个byte [whatever_size]和offset.

public void SetInt32(byte[] message, int offset, Int32 value)
{
var value_bytes = BitConverter.GetBytes(value);
message[offset] = value_bytes;
}
Run Code Online (Sandbox Code Playgroud)

c#

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

持久的UAC提升

有什么方法可以使程序UAC提升永久性地跨越新实例.我有一个在UAC提升模式下运行的程序,需要在UAC提升模式下启动进程,但用户不会每次都在计算机上进行授权.也许在安装期间...但不是每次都安装.

c# uac

-1
推荐指数
1
解决办法
291
查看次数

标签 统计

c# ×3

.net ×1

.net-4.0 ×1

angular ×1

boost ×1

c++ ×1

grep ×1

regex ×1

uac ×1

wpf ×1

wpf-4.0 ×1