Kioko Kiaza
Kioko Kiaza

Reputation: 1398

Hide Listbox ScrollBar created from code

I have this code to create a listbox on my Menu.xaml code behind (Menu.xaml.vb):

            Dim mm As New ListBox()
            AddHandler mm.SelectionChanged, AddressOf Me.ListBox_SelectionChanged

            mm.FontSize = 20
            Dim nn As New ListBoxItem
            nn.Content = "NOTIFICATIONS:"
            nn.Foreground = Brushes.White
            nn.Background = Brushes.DarkSlateBlue
            nn.FontSize = 44
            nn.FontWeight = FontWeights.Bold

            mm.Items.Add(nn)

Now I wanted to disable the scrolling, or in other case hide the scrollbar but if I check on mm properties there is no reference to the Scroll

any help or clue?

Thanks in advance

Upvotes: 1

Views: 800

Answers (1)

Nathan Hillyer
Nathan Hillyer

Reputation: 1979

ScrollViewer.SetHorizontalScrollBarVisibility(mm, ScrollBarVisibility.Disabled);
ScrollViewer.SetVerticalScrollBarVisibility(mm, ScrollBarVisibility.Disabled);

Upvotes: 3

Related Questions