Jump to content
LaunchBox Community Forums

Working with GenresString


shro2016

Recommended Posts

I am building a new theme currently but really need to be able to reformat the Selectedgame.Genresstring binding so that it is not presented as genre1;genre2;genre3 as this looks very messy when displayed on the theme.

Does anyone know of any way to return only the first genre from the list or alternatively how to reformat the string so that the ; are removed?

Link to comment
Share on other sites

what is it returning there? a list? I can't check right now but if it is just a single genre you could try this.

string Genre = Selectedgame.Genresstring.Replace(';', '')); 

If it is a list of strings you can break it into an array using split

string [] Genres = Selectedgame.Genresstring.Split(';'); 

and then just call on Genre[0] to get the first genre.

 

Again, can't test this ATM so it may not be 100% correct.

 

 

 

Edited by Hexxxer
Link to comment
Share on other sites

  • 2 weeks later...
On 7/10/2017 at 10:40 PM, Hexxxer said:

what is it returning there? a list? I can't check right now but if it is just a single genre you could try this.


string Genre = Selectedgame.Genresstring.Replace(';', '')); 

If it is a list of strings you can break it into an array using split


string [] Genres = Selectedgame.Genresstring.Split(';'); 

and then just call on Genre[0] to get the first genre.

 

Again, can't test this ATM so it may not be 100% correct.

 

 

 

@Hexxxer Thanks for your help with this though unfortunately I have failed to get this working with the suggestions above. I cannot find a way to declare variables within the XAML file without generating an error - where should these lines be placed?

Link to comment
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
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...