如何在xaml中绑定到当前riacontext用户

发布于 2024-09-03 00:34:55 字数 847 浏览 1 评论 0原文

我有一个具有“getuserbyguid”方法的数据上下文,我想传入当前登录的user.userid作为参数,但我不知道如何通过xaml绑定到当前登录的用户。我尝试过 {Binding Path=User.UserId} 但没有任何运气。我正在使用内置的 riaservices 身份验证方法,因此用户信息应该在 riacontext 中公开,还是我错了?

例如,我有这个,

<riaControls:DomainDataSource x:Name="FollowingGridData" AutoLoad="True" QueryName="GetUsersFollowedByIDQuery" LoadSize="20">
        <riaControls:DomainDataSource.DomainContext>
            <my:NotesDomainContext />
        </riaControls:DomainDataSource.DomainContext>
        <riaControls:DomainDataSource.QueryParameters>
            <riaControls:Parameter ParameterName="userguid" Value="{Binding Path=User.UserId}" />
        </riaControls:DomainDataSource.QueryParameters>
    </riaControls:DomainDataSource>

但它给了我一个错误,说它不是一个 guid,这意味着它不能正确绑定

I Have a datacontext that has a "getuserbyguid" method, i want to pass in the current logged in user.userid as a parameter, but I don't know how to bind to the current logged in user through xaml. I've tried {Binding Path=User.UserId} but without any luck. I'm using the built in riaservices authentication methods, so the userinfo should be exposed in the riacontext, or am I wrong about this?

I have this for instance

<riaControls:DomainDataSource x:Name="FollowingGridData" AutoLoad="True" QueryName="GetUsersFollowedByIDQuery" LoadSize="20">
        <riaControls:DomainDataSource.DomainContext>
            <my:NotesDomainContext />
        </riaControls:DomainDataSource.DomainContext>
        <riaControls:DomainDataSource.QueryParameters>
            <riaControls:Parameter ParameterName="userguid" Value="{Binding Path=User.UserId}" />
        </riaControls:DomainDataSource.QueryParameters>
    </riaControls:DomainDataSource>

But it gives me an error saying that it's not a guid, meaning that it must not be binding correctly

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浅黛梨妆こ 2024-09-10 00:34:55

正确的绑定是

{绑定源={StaticResource
WebContext},路径=User.DisplayName}

The correct binding was

{Binding Source={StaticResource
WebContext}, Path=User.DisplayName}

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文