Click here to Skip to main content
15,905,508 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)

I Need an alternative Scrollbar Style for my whole Application when Touch Displays are attached (then the scrollbar is larger).

I check if there is any touch attached in code behind:

[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
static extern int GetSystemMetrics(int nIndex);

const int SM_MAXIMUMTOUCHES = 95;

static readonly bool isTouchAttached = GetSystemMetrics(SM_MAXIMUMTOUCHES) 
Then I planned to create an attachedproperty in my scrollbarbar style with Inherits but I am not allowed to because of possible Performance issues.

We got a Scrollbar Style in our solution which is appearing in a XAML in a MergedDictionary for all our controls without a code behind.

Any idea how I can use a 2nd aternative style for the General scrollbar style and Switch somehow for using that one?

Are there any best practices or something for a case like this?

Thanks a lot!


1 solution

Is there any way to Switch the scrollbar style if there are tocuh devices attached or is there any way to use my solution but without "Inherits" for the property?

Or can anybody tell me if my solution causes Performance Problems or not and how to find those?

Thanks a lot!

Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900