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 7636253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:37:41+00:00 2026-05-31T07:37:41+00:00

ListBoxEx is derived from ListBox. its default style is <ResourceDictionary xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml xmlns:local=clr-namespace:ControlsLibrary> <Style

  • 0

ListBoxEx is derived from ListBox.

its default style is

<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:ControlsLibrary">
    <Style TargetType="{x:Type local:ListBoxEx}">
        <Setter Property="SelectAllToggleStyle">
            <Setter.Value>
                <Style TargetType="ToggleButton">
                    <Setter Property="Content" Value="Select All"/>
                    <Setter Property="Focusable" Value="True"/>
                    <Setter Property="Margin" Value="2,0,0,0"/>
                    <Setter Property="IsThreeState" Value="False"/>
                </Style>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:ListBoxEx}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            SnapsToDevicePixels="true"
                            Padding="{TemplateBinding Padding}"
                            VerticalAlignment="{TemplateBinding VerticalAlignment}"
                            HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
                            Height="{TemplateBinding Height}"
                            Width="{TemplateBinding Width}">
                        <DockPanel VerticalAlignment="Top" HorizontalAlignment="Stretch" LastChildFill="True">
                            <CheckBox Name="PART_SelectAllToggle" DockPanel.Dock="Top"/>
                            <Separator Margin="4" Visibility="{Binding Path=Visibility, ElementName=PART_SelectAllToggle}" DockPanel.Dock="Top"/>
                            <ItemsPresenter DockPanel.Dock="Top"/>
                        </DockPanel>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="ItemContainerStyle">
            <Setter.Value>
                <Style>
                    <Setter Property="ListBoxItem.Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="{x:Type ListBoxItem}">
                                <Border
                                SnapsToDevicePixels="true" 
                                Background="{TemplateBinding Background}" 
                                BorderBrush="{TemplateBinding BorderBrush}" 
                                BorderThickness="{TemplateBinding BorderThickness}"
                                Padding="{TemplateBinding Padding}"
                                VerticalAlignment="{TemplateBinding VerticalAlignment}"
                                HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
                                Height="{TemplateBinding Height}"
                                Width="{TemplateBinding Width}">

                                    <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}" 
                                              SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>

                                </Border>
                                <ControlTemplate.Triggers>
                                    <Trigger Property="IsMouseOver" Value="True">
                                        <Setter Property="Background" Value="{x:Static SystemColors.HighlightBrush}"/>
                                    </Trigger>
                                    <Trigger Property="IsSelected" Value="True">
                                        <Setter Property="Background" Value="{x:Static SystemColors.HotTrackBrush}"/>
                                        <Setter Property="Foreground" Value="White"/>
                                    </Trigger>
                                </ControlTemplate.Triggers>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                    <Setter Property="Control.VerticalAlignment" Value="Center"/>
                    <Setter Property="Control.FocusVisualStyle">
                        <Setter.Value>
                            <Style TargetType="Control">
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate>
                                            <Rectangle Margin="0" StrokeThickness="2"  Stroke="Black" SnapsToDevicePixels="true"/>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </Setter.Value>
                    </Setter>
                </Style>
            </Setter.Value>
        </Setter>
        <Setter Property="Padding" Value="4"/>
    </Style>
</ResourceDictionary>

No stack panels.

the xaml of the test window is:

<Window x:Class="WpfTesting.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:cl="clr-namespace:ControlsLibrary;assembly=ControlsLibrary" xmlns:System="clr-namespace:System;assembly=mscorlib" Title="MainWindow" Height="350" Width="300">
    <DockPanel Margin="5" HorizontalAlignment="Stretch" VerticalAlignment="Top">
        <cl:ListBoxEx  BorderThickness="2" BorderBrush="Black" ShowSelectAllToggle="True" Height="100" DockPanel.Dock="Top">
            <cl:ListBoxEx.Items>
                <System:String>QWERTY1</System:String>
                <System:String>QWERTY2</System:String>
                <System:String>QWERTY3</System:String>
                <System:String>QWERTY4</System:String>
                <System:String>QWERTY5</System:String>
                <System:String>QWERTY6</System:String>
                <System:String>QWERTY7</System:String>
                <System:String>QWERTY8</System:String>
            </cl:ListBoxEx.Items>
        </cl:ListBoxEx>
    </DockPanel>
</Window>

I can not understand why scrolling does not work. =(
Probably I’m missing something with the layout…but what?

  • 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-31T07:37:42+00:00Added an answer on May 31, 2026 at 7:37 am

    Your ControlTemplate does not contain a ScrollViewer. (No ScrollViewer -> No scrolling)

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

Sidebar

Related Questions

Making this tutorial: http://developer.android.com/resources/tutorials/notepad/notepad-ex1.html I have ListActivity-derived class and onCreateContextMenu, onContextItemSelected overrides. I think
I am working on a custom wpf control which is derived from a ListBox
anyone know how to raise an event on a ListBox when its redrawn. I'm
I am implementing a my custom class which needs to be derived from Panel.
I have two listboxes and two buttons. Each listbox is in its own div
I would like to write a ItemsControl derived custom control. This is partially from
I Have two listboxes when I drag One item from the source listbox I
There is a user defined component , derived from Container , inside my Form
I have a domain service, derived from LinqToEntitiesDomainService<FOOEntities> It has one method, IQueryable<Bar> GetBar().
I have two ListBoxes. First ListBox items are list of Products. and second ListBox

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.