Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6177385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:15:55+00:00 2026-05-24T00:15:55+00:00

In my WPF client Application I use GenericIdentity for security: GenericIdentity MyIdentity = new

  • 0

In my WPF client Application I use GenericIdentity for security:

GenericIdentity MyIdentity = new GenericIdentity("Identity");
String[] MyStringArray = { "Admin", "Editor" };
GenericPrincipal MyPrincipal = new GenericPrincipal(MyIdentity, MyStringArray);

Now I want to show/hide WPF objects according to user role.
Iv’e tried several methods such as:

Visibility="{Binding Source=Thread.CurrentPrincipal, Converter={StaticResource RoleToVisibilityConverter}, ConverterParameter=Administrator}"

which make the ‘value’ object in the converter a String of “Thread.CurrentPrincipal”, also tried:

Visibility="{Binding Path=Thread.CurrentPrincipal, Converter={StaticResource RoleToVisibilityConverter}, ConverterParameter=Administrator}" 

And

Visibility="{Binding Source=Thread.CurrentPrincipal, Path=CurrentPrincipal, Converter={StaticResource RoleToVisibilityConverter}, ConverterParameter=Administrator}"

which skip the converter entirely.
This is my first C#/.net program so I don’t really have a lot of knowledge in the area, Would greatly appreciate a solution. thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T00:15:55+00:00Added an answer on May 24, 2026 at 12:15 am

    First, to access static properties, you need to use the x:Static markup extension:

    Visibility="{Binding Source={x:Static Threading:Thread.CurrentPrincipal},
        Converter={StaticResource RoleToVisibilityConverter}, ConverterParameter=Admin}"
    

    This assumes you have

    xmlns:Threading="clr-namespace:System.Threading;assembly=mscorlib"
    

    on the root element of your XAML.

    Second, you don’t show how you set the principal, but you have to do it using AppDomain.SetThreadPrincipal().

    Third, you set the role to Admin, but then check for Administrator.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have N- Tier application Which consist of three parts: 1. Client (WPF) 2.
We are developing a server-client application in c# using wcf services and wpf. We
I have created an application which has a client (WPF) and the Server (WCF),
I'm developing a system using WPF 4. I pretend to use MVC in development.
I'm thinking through the high level architecture of a WPF application. Usually I would
in WPF application I load a list of business objects by WCF to a
Got an application (C# WPF) that needs to call home and get updated stuff
I've got small wpf application deployed using ClickOnce technology. The problem is that when
I'm creating a WPF application, for which all users must be authenticated to an
I have a WPF application that has just one button. When the button is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.