Jump to content
LaunchBox Community Forums

Recommended Posts

Posted

Hi,

Is there a way to center the text in the games list? I'm working on some themes and it would be nice to not have the games list text be completely aligned to the left.

Thanks

Posted
On 3/8/2018 at 4:09 PM, mat091084 said:

Within the Theme folder there will be a Views folder, find the relevant .xaml file for your desired view and align to "Center".

Unfortunately for this list it's not as simple as that. I'm looking for a solution as well, getting close I hope.

  • Like 1
  • 3 weeks later...
Posted
On 3/7/2018 at 3:11 PM, bbweiners said:

Is there a way to center the text in the games list? I'm working on some themes and it would be nice to not have the games list text be completely aligned to the left.

This works for me, using styles (particularly the HorizonatalAlignment):

<!-- LISTBOX: BASE STYLE (PLUS TEXTBLOCK TEMPLATE) -->
<Style x:Key="ListBoxStyle_BASE" TargetType="ListBox">
    <Setter Property="ItemContainerStyle" Value="{StaticResource ListBoxItemStyle}" />
    <Setter Property="BorderBrush" Value="Transparent" />
    <Setter Property="Background" Value="Transparent" />
    <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Hidden" />
    <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Hidden" />
    <Setter Property="BorderThickness" Value="0" />
    <Setter Property="Padding" Value="0" />
    <Setter Property="Margin" Value="0" />
    <Setter Property="FocusVisualStyle" Value="{x:Null}" />
</Style>
<Style x:Key="ListBoxStyle_BASETB" TargetType="TextBlock">
    <Setter Property="Padding" Value="4" />
    <Setter Property="FontSize" Value="{StaticResource FluxListFontSize}" />
    <Setter Property="TextTrimming" Value="CharacterEllipsis" />
    <Setter Property="HorizontalAlignment" Value="Center" />
</Style>

<!-- LISTBOX: SYSMENU (LIST ITEM = TEXT) -->
<Style x:Key="ListBoxStyle_SYST" TargetType="ListBox" BasedOn="{StaticResource ListBoxStyle_BASE}">
    <Setter Property="ItemTemplate">
        <Setter.Value>
            <DataTemplate>
                <TextBlock Text="{Binding Path=Text}" Style="{StaticResource ListBoxStyle_BASETB}" />
            </DataTemplate>
        </Setter.Value>
    </Setter>
</Style>

Then in SystemView.xaml:

<ListBox Name="MenuItems" Style="{StaticResource ListBoxStyle_SYST}" />

Basically, you are assigning your own DataTemplate, to override that used by default in BigBox. It's a bit roundabout but works. There might be a simpler way, but I could not find one. Probably this weekend, I will post a new theme called FluxCRT that uses this list centering trick extensively -- it's a little different for certain views, so perhaps looking at the xaml of FluxCRT will help.

Posted
On 3/29/2018 at 10:58 PM, bbweiners said:

That's awesome! Thanks!

No problem! FYI just released FluxCRT which contains examples of this for TextFiltersView, TextGamesView (see TextListView), OptionsView, and SystemView.

 

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...