English 中文(简体)
标 标 标 数
原标题:passing listbox item index as parameter to objectdataprovider

目前,我试图利用目标数据提供者来回我作为每个清单箱项目的背景而希望使用的颜色,其肤色取决于该清单箱项目指数。

基本上,发给标的参数是原始颜色和单箱项目指数,它将根据......此处的代码,即目前用于目标数据提供者的代码,以更轻的颜色:

    <ObjectDataProvider ObjectType="{x:Type local:cUserProfiles}"
              MethodName="GetRankColour" x:Key="RankColour">
        <ObjectDataProvider.MethodParameters>
            <Color> {ORIGINAL_COLOUR}<Color/>
            <system:Int16>{LISTBOXITEM INDEX}</system:Int16>
        </ObjectDataProvider.MethodParameters>
    </ObjectDataProvider>

我知道,你不能直接约束,因为它不是一个依赖物,不符合具有约束力的规则,你必须直接确定......。 然而,我不敢肯定,在我的名单上的Xaml中,我本应受到约束。

此外,在长期寻求答案后,我只找到一些例子,说明人们只根据诸如有人使用这种方法进入一个文本箱的内容而改变参数:

{Binding Source={StaticResource RankColour},   
                 Path=MethodParameters[1],  
                 BindsDirectlyToSource=True,  
                 UpdateSourceTrigger=PropertyChanged}

我希望它受名单框索引的约束,因此无法确定把什么财产列入。

Second question: The listbox item does have a label who s content is bound to the listbox item index, however, how can I use the above binding source technique to bind the content, when i always want to bind it to the index?

感谢您的帮助!

问题回答

这似乎令人sil笑皆是,但你是否认为,使用后面的法典间接地将这一问题联系起来? 这就是利用一系列变量和选定案例确定你想要的特性。 我知道,数据约束能够成为真正的主人——如果能够以另一种方式抵消通常相同的最终结果,我就避免了。

我确实需要更详细地了解你的最终目标(尽管我的咖啡 has足以让我理解英语,但 lo)。 你们是否使用数据库? 每位用户的排名如何?





相关问题
WPF convert 2d mouse click into 3d space

I have several geometry meshes in my Viewport3D, these have bounds of (w:1800, h:500, d:25). When a user clicks in the middle of the mesh, I want the Point3D of (900, 500, 25)... How can I achieve ...

Editing a xaml icons or images

Is it possible to edit a xaml icons or images in the expression design or using other tools? Is it possible to import a xaml images (that e.g you have exported) in the expression designer for editing?...

WPF: writing smoke tests using ViewModels

I am considering to write smoke tests for our WPF application. The question that I am faced is: should we use UI automation( or some other technology that creates a UI script), or is it good enough to ...

WPF - MVVM - NHibernate Validation

Im facing a bit of an issue when trying to validate a decimal property on domain object which is bound to a textbox on the view through the viewmodel. I am using NHibernate to decorate my property on ...

How do WPF Markup Extensions raise compile errors?

Certain markup extensions raise compile errors. For example StaticExtension (x:Static) raises a compile error if the referenced class cannot be found. Anyone know the mechanism for this? Is it baked ...

WPF design-time context menu

I am trying to create a custom wpf control, I m wondering how I can add some design-time features. I ve googled and can t seem to get to my goal. So here s my simple question, how can I add an entry ...

How to combine DataTrigger and EventTrigger?

NOTE I have asked the related question (with an accepted answer): How to combine DataTrigger and Trigger? I think I need to combine an EventTrigger and a DataTrigger to achieve what I m after: when ...

热门标签