首页 \ 问答 \ XamPropertyGrid自定义编辑器(绑定)不起作用(XamPropertyGrid Custom Editor (Binding) not working)

XamPropertyGrid自定义编辑器(绑定)不起作用(XamPropertyGrid Custom Editor (Binding) not working)

我在C#WPF中使用Infragistics的“XamPropertyGrid”,我创建了两个类如下:

public class ClassA
{
    public ClassB B { get; set; }
}

public class ClassB
{
    public bool C { get; set; }
}

目标是为PropertyGrid创建一个自定义编辑器,其中包含一个Checkbox控件并设置ClassA实例的Property BC

这是我的xaml代码:

<ig:XamPropertyGrid x:Name="pGrid">
        <ig:XamPropertyGrid.EditorDefinitions>
            <ig:PropertyGridEditorDefinition>
                <ig:PropertyGridEditorDefinition.TargetProperties>
                    <system:String>B</system:String>
                </ig:PropertyGridEditorDefinition.TargetProperties>
                <ig:PropertyGridEditorDefinition.EditTemplate>
                    <DataTemplate>
                        <CheckBox Content="XYC" IsChecked="{Binding Value.C}"></CheckBox>
                    </DataTemplate>
                </ig:PropertyGridEditorDefinition.EditTemplate>
            </ig:PropertyGridEditorDefinition>
        </ig:XamPropertyGrid.EditorDefinitions>
    </ig:XamPropertyGrid>

首先,我为PropertyGrid设置所选对象,如下所示:

public MainWindow()
    {
        InitializeComponent();

        ClassA a = new ClassA();
        a.B = new ClassB();

        pGrid.SelectedObject = a;

    }

但是当我检查Checkbox时,Property C不会改变。 至于我调试了编辑器DataTemplate中的Value属性为null。 (我在Binding中放了一个转换器来检查它。)

先谢谢你。


I am using Infragistics' "XamPropertyGrid" in C# WPF, I have created two classes as follow:

public class ClassA
{
    public ClassB B { get; set; }
}

public class ClassB
{
    public bool C { get; set; }
}

The Goal is to create a Custom Editor for PropertyGrid that contains a Checkbox Control and sets Property B.C of an instance of ClassA

Here is my xaml code:

<ig:XamPropertyGrid x:Name="pGrid">
        <ig:XamPropertyGrid.EditorDefinitions>
            <ig:PropertyGridEditorDefinition>
                <ig:PropertyGridEditorDefinition.TargetProperties>
                    <system:String>B</system:String>
                </ig:PropertyGridEditorDefinition.TargetProperties>
                <ig:PropertyGridEditorDefinition.EditTemplate>
                    <DataTemplate>
                        <CheckBox Content="XYC" IsChecked="{Binding Value.C}"></CheckBox>
                    </DataTemplate>
                </ig:PropertyGridEditorDefinition.EditTemplate>
            </ig:PropertyGridEditorDefinition>
        </ig:XamPropertyGrid.EditorDefinitions>
    </ig:XamPropertyGrid>

At the start, I set the selected object for PropertyGrid like this:

public MainWindow()
    {
        InitializeComponent();

        ClassA a = new ClassA();
        a.B = new ClassB();

        pGrid.SelectedObject = a;

    }

But when I check the Checkbox, Property C won't change. As far as I debugged the Value property inside Editor DataTemplate is null. (I put a converter inside Binding to check that.)

Thank you in Advance.


原文:https://stackoverflow.com/questions/34245580
更新时间:2023-06-10 19:06

最满意答案

这工作:

perl -p -i -e 's/(<langSet xml.lang=....>)\s*<tig>(.*?)<\/tig>\s*<tig>/\1<tig>\2<\/tig>\1<tig>/g while m/(<langSet xml.lang=....>)\s*<tig>(.*?)<\/tig>\s*<tig>/gi' iate.dsl

This worked:

perl -p -i -e 's/(<langSet xml.lang=....>)\s*<tig>(.*?)<\/tig>\s*<tig>/\1<tig>\2<\/tig>\1<tig>/g while m/(<langSet xml.lang=....>)\s*<tig>(.*?)<\/tig>\s*<tig>/gi' iate.dsl

相关问答

更多
  • Sass语法主要基于缩进和换行,所以在Sass中确实是六行(每个规则两个,不包括空行): .apple background-image: url('apple.png') .orange background-image: url('orange.png') .pear background-image: url('pear.png') 据我所见,你无法将这些人凝聚到萨斯的单线队员身上。 Sass syntax is principally based on indentat ...
  • perl -pe's/\D*(\d+).*/$1/' 要么 perl -nE'/\d+/&&say$&' 要么 perl -nE'say/(\d+)/' 要么 perl -ple's/\D//g' 或者可能 perl -nE'$,=" ";say/\d+/g' perl -pe's/\D*(\d+).*/$1/' or perl -nE'/\d+/&&say$&' or perl -nE'say/(\d+)/' or perl -ple's/\D//g' or may be perl -n ...
  • backtick语法调用一个shell,并在被调用时,shell假定它应该插入传递的字符串。 一个更清晰的语法可能是: system('perl -pli -e "s/\s*$//" tape.txt'); 由于您没有捕获命令的输出,因此使用反引号或qx代替system不是问题。 另外,添加-l开关可以自动读取每一行,然后添加一个换行符 - 可能是您想要的。 The backtick syntax invokes a shell and when invoked, the shell assumes it ...
  • /e开关将replace表达式转换为常规perl表达式。 你需要引用' MB'并使用连接( . )。 's#(\d+)(\s+SELECT)#$1/(1024*1024*2) . q[ MB] . $2#e 应该管用。 The /e switch turns the replace expression into a regular perl expression. You need to quote the ' MB' and use concatenation (.) . 's#(\d+)(\s+SE ...
  • 不要使用glob rename 。 使用标量。 尝试在替换之前将文件名分配给新变量,并将旧名称重命名为修改后的名称,如下所示: perl -e'while(<*.JPG>) { ($new = $_) =~ s/JPG$/jpg/; rename $_, $new }' 用ls -1检查输出: IMG_0178.jpg ...
  • sum()调用不需要加倍 total = sum(v.amount for ob in self.oblist for v in ob.anotherob) No need to double up on the sum() calls total = sum(v.amount for ob in self.oblist for v in ob.anotherob)
  • 可以Encode做你想要的吗? 然后,您可能必须在脚本中使用encode()和decode() ,因此它可能不会短于: perl -nE 'BEGIN {binmode STDIN, ":encoding(utf16)" } ; ...' 有一个PERL_UNICODE环境变量,但它是相当有限的:它只是模仿-C如果我记得正确。 我曾经试图找出为什么不存在用于“流行”形式的UTF的-C开关,并且它似乎归结为它们是否经常被使用; 是或不是很好理解(endianness有时数 - 谁知道?); 是 - ...
  • 嗯,简单的解决方案是将所有换行符和管道转换为选项卡。 这听起来有点疯狂,但乍一看,它听起来像你想要的: perl -pwe 'tr/\n|/\t\t/' yourfile.txt 但是有一些东西与你的问题描述不符。 你说: 我有一个包含成对行的文件 这意味着您的文件实际上看起来像这样: FIRST PIECE OF INFO PIECE 2 | PIECE 3 | PIECE 4 | ... SECOND PIECE OF INFO PIECE 2a | PIECE 3b | PIECE 4b | ... ...
  • 这工作: perl -p -i -e 's/()\s*(.*?)<\/tig>\s*/\1\2<\/tig>\1/g while m/()\s*(.*?)<\/tig>\s*/gi' iate.dsl This worked: perl -p -i -e 's/()\s*(.*?)<\/tig>\s* ...
  • 你已经用^锚定了替换。 由于Vim如何进行替换,它将从最后一场比赛结束时寻找下一场比赛。 改为使用后视: :%s/\v(^\s*)@<= {4}/\t/g 有关更多帮助请参阅: :h /\@<= You have anchored you substitution with ^. Because of how Vim does substitution's it will look for the next match from the end of the last match. Use a look ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。