Jump to content
LaunchBox Community Forums
Jason Carr

XAML Tips and Tricks

Recommended Posts

Hi guys, I would appreciate any help... I can't seem to get the select games genre to appear in a textblock... Pretty much everything else appears except genre. I am trying


<TextBlock Text="{Binding Path=SelectedGame.Genre}"

Am i doing anything wrong?

Share this post


Link to post
Share on other sites

Not at my computer now to double-check, but try SelectedGame.Genres (note the pleural) or SelectedGame.GenresString. You can check the Documentation PDF in the Themes folder.

  • Like 1

Share this post


Link to post
Share on other sites
7 minutes ago, eatkinola said:

Not at my computer now to double-check, but try SelectedGame.Genres (note the pleural) or SelectedGame.GenresString. You can check the Documentation PDF in the Themes folder.

SelectedGame.GenresString worked thanks!

Share this post


Link to post
Share on other sites

@wallmachine: Try putting the TransitionPresenter (which itself contains the horizontal list of boxes) within a container of a specific size.  I did something similar for the Recent Games box list in one of my views, and it's working well.  Here's an excerpt from one of my views to show the idea.  I've been using Grid controls to layout my views in a way that scales according to the monitor resolution.  You'd need to adjust the column and row definitions according to the layout you're trying to achieve.




<Grid> 



    <Grid.ColumnDefinitions>



        <ColumnDefinition Width="30*"  />



        <ColumnDefinition Width="10*"  />



        <ColumnDefinition Width="2000*"/>



        <ColumnDefinition Width="840*" />



    </Grid.ColumnDefinitions>



    <Grid.RowDefinitions>



        <RowDefinition Height="10*" />



        <RowDefinition Height="90*" />



        <RowDefinition Height="60*" />



        <RowDefinition Height="385*"/>



        <RowDefinition Height="55*" />



    </Grid.RowDefinitions>



    ... other controls arranged in the grid



    <transitions:TransitionPresenter Grid.Column="1" Grid.ColumnSpan="3" Grid.Row="3"



              TransitionSelector="{Binding BottomBoxesTransitionSelector}"



              Content="{Binding BottomBoxesView}"/>



</Grid>

 

New Bitmap Image.jpg

Edited by eatkinola
added screenshot

Share this post


Link to post
Share on other sites

Hi does anyone know if it is possible to have the text pop up containing a games custom field. I'm guessing this is not possible since it says nothing about it in the Documentation.pdf but i thought i'd check here anyway.

 

Share this post


Link to post
Share on other sites

@wallmachine Video placement is still buggy and I have that as a priority on my list. Getting videos to align properly and fill their containers is sometimes problematic. Check out @CriticalCid's CriticalZone theme as an example though to see what is currently possible for video placement.

CoverFlow images currently don't support highlighted borders either, outside of using an image above or behind the control.

@Liam That is a good point; I don't think it's currently possible to display custom fields individually. We should look into that.

Share this post


Link to post
Share on other sites

I’ve explained it in another thread how I have centered the platform videos in my theme. I hope that’s helping. If you have any questions about it feel free to ask :)

 

Share this post


Link to post
Share on other sites

Hey everyone, I'm starting to dig to hopefully add some community suggestions to my theme, and didn't know if it was possible to have different images or backgrounds in the games list view. Basically ..lets say I choose snes, when it moves to games list could I have a different image there vs a different platform? I didn't think it was possible, but I was curious. Thanks everyone (and I'm very sorry if this has been mentioned and answered before)

Share this post


Link to post
Share on other sites

@skainlurmis: Yes, this is possible. I'm not at home now to cut and paste the code, but consider looking at the XAML for my Minimal-AO theme. The Games Wheel 2 and 3 pages use SelectedGame.PlatformName to find and load the platform clear logo. You should be able to do something very similar to change the background image based on platform.

Share this post


Link to post
Share on other sites
2 minutes ago, eatkinola said:

@skainlurmis: Yes, this is possible. I'm not at home now to cut and paste the code, but consider looking at the XAML for my Minimal-AO theme. The Games Wheel 2 and 3 pages use SelectedGame.PlatformName to find and load the platform clear logo. You should be able to do something very similar to change the background image based on platform.

Fantastic, thanks for that! I appreciate it! 

Share this post


Link to post
Share on other sites

So it looks like that bit of code is nested in a <Textblock.Text> header ...would that be necessary if it's pulling something different, ala a background image like we're talking about? I don't know enough code to know how necessary that header and footer are. 

Share this post


Link to post
Share on other sites

Yeah, that text block element is just used to dynamically figure out the image path based on platform name; it's not displayed. If you want, send me the code snippet for how you currently load your image, and I'll send you back how it might be modified to choose an image path based on platform. There might be more than one way to do this, but it works for me.

Share this post


Link to post
Share on other sites

I don't believe I have anything right now code wise, (it's just a universal static image for all platforms at the moment) But I'll send you that regardless. So something I am realizing is that, to get videos to play where I wanted them, I did some hacky stuff that breaks things for other themes. For instance, for my theme to work, I had turned off "show game videos" and "show platform videos" in the options. I can't recall why I had to do that, but I realize that it's causing people trouble when they download it, so I need to find a better method for that. Are you ok with me digging in your code and snagging some of it if I can get it to work in my theme? 

Share this post


Link to post
Share on other sites

Sure, feel free to peruse the code and use anything you find helpful. Note it draws heavily on AOStyles (styles subfolder) to facilitate ease of maintenance and customization. When you see Static or DynamicResource, it's pulling from AOStyles.

Share this post


Link to post
Share on other sites

Great, thank you! Also, I haven't said so yet, but that theme is gorgeous, super clean, it feels really complete. You did really solid work on it, it shows. I really am just frankensteining stuff together, so I appreciate the help. Ok so my WheelGamesView just has the static background with game videos playing in a smaller box, so what I would be trying to accomplish would be platform specific background images ..so here is my code for just displaying the image as is. 


  <!--BACKGROUND IMAGE-->

            <Image Source="pack://siteoforigin:,,,/Themes/New Retro Big Box/Images/Game wheel.png" Grid.Column="0" Grid.Row="0"  RenderOptions.BitmapScalingMode="HighQuality" Panel.ZIndex="5" Grid.RowSpan="7" Grid.ColumnSpan="8"/>

 

Share this post


Link to post
Share on other sites
23 hours ago, Jason Carr said:
On 1/8/2017 at 9:53 PM, Liam said:

Hi does anyone know if it is possible to have the text pop up containing a games custom field. I'm guessing this is not possible since it says nothing about it in the Documentation.pdf but i thought i'd check here anyway.

 

@Liam That is a good point; I don't think it's currently possible to display custom fields individually. We should look into that.

@Jason Carr Thanks for the reply Jason, it would be cool if it could be implemented in the future.

Edited by Liam

Share this post


Link to post
Share on other sites

@skainlurmis: Try something like this, 


<TextBlock x:Name="FileName" Visibility="Collapsed" Text="{Binding SelectedGame.Platform, StringFormat='pack://siteoforigin:,,,/Themes/New Retro Big Box/Images/Game wheel {0}.png'}" />



<Image Source="{Binding Text, ElementName=FileName}" Grid.Column="0" Grid.Row="0" RenderOptions.BitmapScalingMode="HighQuality" Panel.ZIndex="5" Grid.RowSpan="7" Grid.ColumnSpan="8"/>

...where {0} will be filled in with SelectedGame.Platform.  You'd have to have a corresponding image named ".../Game wheel NES.png" or however your platforms are named.  Because peeps can name their platform whatever they want, you're probably better off doing something along these lines:


<TextBlock x:Name="FileName" Visibility="Collapsed" Text="{Binding SelectedGame.Platform, StringFormat='pack://siteoforigin:,,,/Themes/New Retro Big Box/Images/{0}/Game wheel.png'}" />



<Image Source="{Binding Text, ElementName=FileName}" Grid.Column="0" Grid.Row="0" RenderOptions.BitmapScalingMode="HighQuality" Panel.ZIndex="5" Grid.RowSpan="7" Grid.ColumnSpan="8"/>

If you take the second approach which I recommend, the trick will be to locate your platform-specific theme images in a folder that will automatically get renamed by LaunchBox when the user changes their platform name:

    e.g., ...\LaunchBox\Images\Platforms\Nintendo NES, etc.

...though this would require users to install your images outside your theme folder.  At this time, I don't have another solution for where to best locate these image files.   Maybe someone else can weigh in?

 

Share this post


Link to post
Share on other sites

When you say, "outside the theme folder" do you mean just that, they themselves would have to manually put the files where the live, considering that you can rename the platform folder? 

Share this post


Link to post
Share on other sites

@skainlurmis: Yes, they would need to be placed in a folder whose name is managed by LaunchBox. So, of a user changed the name of the 'Nintendo Entertainment System'  platform to 'NES', for example, your code would still be able to find the background. I'm not sure if subfolders within a theme are renamed by LaunchBox in this manner. You might want to confer with@Jason Carr.

Share this post


Link to post
Share on other sites

Join the conversation

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

Guest
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...