等效于XAML代码的C# [英] C# equivalent of XAML code

查看:86
本文介绍了等效于XAML代码的C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<dxe:TextEdit Name="txtCompanyName" my:FilterGrid.Obj ="{Binding ElementName=dXCustomers}"

                     my:FilterGrid.ConditionValue="{Binding RelativeSource={RelativeSource Self}, Path=Text, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"

                     my:FilterGrid.ColumnName="CompanyName"

                     my:FilterGrid.Operator="Like"  />

推荐答案

看起来那里有一些自定义名称空间,但是TextEdit似乎包含FilterGrid,因此您可以直接在该对象上设置这些属性.

此处 [
Looks like you have some custom namespaces there, but TextEdit appears to contain the FilterGrid, so you can set those properties directly on that object.

Here[^] is an example of setting a binding with code, I found it with google.


您遇到哪部分麻烦?我认为是绑定,所以也许像这样
Which part are you having trouble with? I assume the bindings, so maybe something like this
TextEdit textedit = ...;

Binding binding = new Binding();
binding.ElementName = "dXCustomers";
textedit.SetBinding([somedependencyproperty], binding);

binding = new Binding("Text");
binding.RelativeSource = new RelativeSource(RelativeSourceMode.Self);
binding.Mode = BindingMode.TwoWay;
binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
textedit.SetBinding([somedependencyproperty], binding);


这篇关于等效于XAML代码的C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆