Click here to Skip to main content
15,899,026 members

B1T ZeR0 - Professional Profile



Summary

    Blog RSS
1
Debator
4
Organiser
142
Participant
0
Author
0
Authority
0
Editor
0
Enquirer
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Reputation

Weekly Data. Recent events may not appear immediately. For information on Reputation please see the FAQ.

Privileges

Members need to achieve at least one of the given member levels in the given reputation categories in order to perform a given action. For example, to store personal files in your account area you will need to achieve Platinum level in either the Author or Authority category. The "If Owner" column means that owners of an item automatically have the privilege. The member types column lists member types who gain the privilege regardless of their reputation level.

ActionAuthorAuthorityDebatorEditorEnquirerOrganiserParticipantIf OwnerMember Types
Have no restrictions on voting frequencysilversilversilversilver
Bypass spam checks when posting contentsilversilversilversilversilversilvergoldSubEditor, Mentor, Protector, Editor
Store personal files in your account areaplatinumplatinumSubEditor, Editor
Have live hyperlinks in your profilebronzebronzebronzebronzebronzebronzesilverSubEditor, Protector, Editor
Have the ability to include a biography in your profilebronzebronzebronzebronzebronzebronzesilverSubEditor, Protector, Editor
Edit a Question in Q&AsilversilversilversilverYesSubEditor, Protector, Editor
Edit an Answer in Q&AsilversilversilversilverYesSubEditor, Protector, Editor
Delete a Question in Q&AYesSubEditor, Protector, Editor
Delete an Answer in Q&AYesSubEditor, Protector, Editor
Report an ArticlesilversilversilversilverSubEditor, Mentor, Protector, Editor
Approve/Disapprove a pending ArticlegoldgoldgoldgoldSubEditor, Mentor, Protector, Editor
Edit other members' articlesSubEditor, Protector, Editor
Create an article without requiring moderationplatinumSubEditor, Mentor, Protector, Editor
Approve/Disapprove a pending QuestionProtector
Approve/Disapprove a pending AnswerProtector
Report a forum messagesilversilverbronzeProtector, Editor
Approve/Disapprove a pending Forum MessageProtector
Have the ability to send direct emails to members in the forumsProtector
Create a new tagsilversilversilversilver
Modify a tagsilversilversilversilver

Actions with a green tick can be performed by this member.


 
AnswerCreating a different background color for your scrollbar using WPF Pin
B1T ZeR09-May-10 8:03
B1T ZeR09-May-10 8:03 
To create a different background color for your scroll bar, you simply need to create an extension method like below.
/// <summary>
/// Gets the Scrollbar for the current list box
/// </summary>
/// <param name="listBox">The ListBox to get he scrollbar from.</param>
/// <returns>ScrollBar</returns>
public static ScrollBar GetScrollBar(this ListBox listBox)
{
   //Need to start moving through the ListBox Visual Tree.
   //The ListBox only has one child, the Border Element
   Border scroll_border = System.Windows.Media.VisualTreeHelper.GetChild(listBox, 0) as Border;
   //Confirm we got the border element.
   if (scroll_border is Border)
   {
       //Need to get the next child, the ScrollViewer
       ScrollViewer scroll = scroll_border.Child as ScrollViewer;
       if (scroll is ScrollViewer)
       {
           //The ScrollViewer only has 1 Child as well.  Lets get it.
           Grid lbGrid = System.Windows.Media.VisualTreeHelper.GetChild(scroll, 0) as Grid;
           if (lbGrid is Grid)
           {
               //The Grid has four child elements
               /* Element 0 = Rectangle
                * Element 1 = ScrollContentPresenter
                * Element 2 = Vertical ScrollBar <- This is the one we want
                * Element 3 = Horizontal ScrollBar */
               ScrollBar sBar = System.Windows.Media.VisualTreeHelper.GetChild(lbGrid, 2) as ScrollBar;
               if (sBar is ScrollBar)
               {
                   return sBar;
               }
               else
               {
                   return null;
               }
           }
           else
           {
               return null;
           }
       }
       else
       {
           return null;
       }
   }
   else
   {
       return null;
   }
}


You will need to add the following using statements to your window.
using System.Windows.Media;
using System.Windows.Controls.Primitives;


Then in your code, most likely in the Window_Loaded() Method. Do the following:
//This will call the extension method and return the associated vertical scrollbar for the listbox.
ScrollBar sBar = lstSample.GetScrollBar();
if (sBar != null)
{
     sBar.Background = new LinearGradientBrush(Colors.LightGreen, Colors.Blue, 50);
}


That is it, a sample application is available to anyone, just shoot me an e-mail and I will be happy to send it over.
Rick Mathers
---
For God sent not his Son into the world to condemn the world; but that the world through him might be saved. John 3:17

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.