Scroll bars in ListBox in Xaml behaves differently when launched from another application

Viewed 51

I am working on Xaml form, which contains a ListBox. The scroll bars appear vertical when launched from my sample calling application (developed in Windows Forms using C#). The same form when launched from another 3rd party application (which I believe is WPF application), shows the scroll bars horizontally. The Xaml code of my ListBox is,

<ListBox x:Name="AppliedTagsListBox" ItemsSource="{Binding Path=Tags, Mode=TwoWay}" Style="{StaticResource TagsListBoxStyle}" ItemContainerStyle="{StaticResource TagsListBoxItemStyle}" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto" VerticalAlignment="Stretch" BorderBrush="Transparent"/>

<Style x:Key="TagsListBoxStyle" TargetType="{x:Type ListBox}">
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <WrapPanel IsItemsHost="True"></WrapPanel>
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="ItemTemplate">
            <Setter.Value>
                <DataTemplate>
                    <Border BorderThickness="1" BorderBrush="LightGray" CornerRadius="15,15,15,15" Margin="0,0,5,3">
                        <Border.Style>
                            <Style>
                                <Style.Triggers>
                                    <Trigger Property="Border.IsMouseOver" Value="True">
                                        <Setter Property="Border.Background" Value="SkyBlue"/>
                                    </Trigger>

                                </Style.Triggers>
                            </Style>
                        </Border.Style>
                        <DockPanel>
                            <TextBlock Padding="15,6,7,7" Text="{Binding}"/>
                            <Button FontWeight="Bold" Content="X" Background="Transparent" Margin="5,0,12,0" TextBlock.TextAlignment="Center" HorizontalAlignment="Stretch" BorderBrush="Transparent" Command="{Binding Path=RemoveTag}">
                                <Button.Resources>
                                    <Style TargetType="{x:Type Button}">
                                        <Setter Property="Template">
                                            <Setter.Value>
                                                <ControlTemplate TargetType="{x:Type Button}">
                                                    <Border Background="Transparent">
                                                        <!--<ContentPresenter HorizontalAlignment="Left" VerticalAlignment="Center"/>-->

                                                        <Image Height="10" Width="10" Source="images/icons/Cross.32.png"/>
                                                    </Border>
                                                </ControlTemplate>
                                            </Setter.Value>
                                        </Setter>
                                        <Style.Triggers>
                                            <Trigger Property="IsMouseOver" Value="True">
                                                <Setter Property="Cursor" Value="Hand"/>
                                            </Trigger>
                                        </Style.Triggers>
                                    </Style>
                                </Button.Resources>
                            </Button>
                        </DockPanel>
                    </Border>
                </DataTemplate>
            </Setter.Value>
        </Setter>
    </Style>


 <Style x:Key="TagsListBoxItemStyle" TargetType="{x:Type ListBoxItem}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListBoxItem}">
                    <Border Background="Transparent">
                        <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

Any suggestions on how can I get the same behavior on both the applications.

0 Answers
Related