Jump to content
LaunchBox Community Forums

XAML Tips and Tricks


Recommended Posts

25 minutes ago, BMovieBen said:

Hello again master themers.  I am trying to build out the requisite TextFiltersView.xml and I have some questions I am hoping you can answer.

What's the difference between TopBoxesView: (nothing shows for me)


<transitions:TransitionPresenter TransitionSelector="{Binding TopBoxesTransitionSelector}" Content="{Binding TopBoxesView}" />

And BottomBoxesView: (shows recent games for me)


<transitions:TransitionPresenter TransitionSelector="{Binding BottomBoxesTransitionSelector}" Content="{Binding BottomBoxesView}" />

?

And finally, what images or videos are supposed to show for this on TextFiltersView?  I must not have the correct media downloaded because nothing is playing/showing:


<transitions:TransitionPresenter Grid.Column="1" TransitionSelector="{Binding ImageTransitionSelector}" Content="{Binding ImageView}" />

 

If memory serves me TopBoxes will give you box views for Favorites and BottomBoxes gives box view for Recently Played. The last one should add a transition effect for videos/images.

  • Thanks 1
Link to comment
Share on other sites

2 minutes ago, Retro808 said:

If memory serves me TopBoxes will give you box views for Favorites and BottomBoxes gives box view for Recently Played. The last one should add a transition effect for videos/images.

Right but if you're say in the Filters view, and you selected "Regions", where is the Binding for ImageView actually looking for images in terms of the folder structure? i.e. "North America"?

Link to comment
Share on other sites

On 4/12/2020 at 4:51 PM, strizzuth said:

I'm very far from decent at XAML and I need help with something that I hope is blindingly obvious to everyone else.  I basically just want to have a regular vertical wheel to select games but instead of images I want to include text.  What would be the way to go about this?

There might not be a good way to do this, unfortunately, if you don't want to use the text lists. Currently the wheels require images.

Link to comment
Share on other sites

I'm fairly new to BigBox, but creating my first theme for it (also new xaml but familiar with other languages). A few issues I'm running into.

  • The PlatformWheel1FiltersView is used for Platforms, Playlists, and Platform Categories
    • Is it possible to display different text depending on which type  of filter you are using?
      • For example I am showing Developer, CPU, etc. in text blocks, but if on Playlists or Platform Categories I would like to show something else.
    • The SelectedPlatform.TotalGameCount only works on the Platforms filter.
      • Is it possible to get total playlist count? Total item count in platform categories? (Edit: sort of found a solution. Found that Binding GamesCount will work for Platforms, Playlists and Platform Categories (except custom platform categories which contain only playlists))
        • Additionally for SelectedPlatform is there a way to get number of favorites for that platform?
  • Is it possible to use .svg images? Or can the support for this be added?
  • Is it possible to have theme settings and an interface where the user could change options? If so is there an example theme that uses something like this.
    • For example a setting (Theme Mode for example) could equal Light, Dark, Bananas, etc., then that value could be used in bindings and such.
Edited by ReenigneArcher
Link to comment
Share on other sites

2 minutes ago, Krakerman said:

If your looking to use svg in xaml you might want to look at this as it may help.

https://liftcodeplay.com/2015/09/14/converting-vectorsvg-images-into-xaml/

Thanks, I just checked that out. Not sure that's going to work for me. Adding 300 lines of code for one image isn't exactly ideal, and the main reason I'd like to use SVG is I already have hundreds of images in SVG format and don't want to convert them. Of course the real benefit is how the images scale. For now, I'll continue with PNG, although SVG image support was added to xaml by Microsoft in 2017 (https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.media.imaging.svgimagesource?view=winrt-18362).

Hopefully this can be added to BigBox. As long as the application was compiled for the proper version of Windows 10 (1703) or newer. As Windows 7 is end of life, I wouldn't think it would be a problem to get this added.

Link to comment
Share on other sites

We can look into SVG soon here, but unfortunately we do still need to support Windows 7 for the moment. We're not quite ready to get rid of Windows 7 support. Custom theme-specific settings are possible, but you'll have to build your own interface to manage them with a plugin, currently. However, theme-specific settings were an item on the poll, so they are planned (but I that was mainly for changing Big Box settings for each theme rather than custom settings).

  • Like 1
Link to comment
Share on other sites

Hoping someone has a solution to this. I finally found a way to read values from an XML file into XAML (as shown in first TextBlock, first 2 bindings). I want to use the text from the first TextBlock as the XPath in the second TextBlock, but I get an error (attached) when it tries to run. If I type out the values exactly as in the string format from the first TextBlock into the XPath of the second TextBlock it will work.

...
...
...
<UserControl.Resources>
    <!--USER CONFIG XML FILE-->
    <XmlDataProvider x:Key="ConfigFile" Source="{}pack://siteoforigin:,,,/Themes/MyTheme/Configuration/config.xml" XPath="Config"/>
        
    <!--THEME CONFIG XML FILES-->
    <XmlDataProvider x:Key="ResourcesFile" Source="{}pack://siteoforigin:,,,/Themes/MyTheme/Resources/resources.xml" XPath="resources"/>
</UserControl.Resources>    
<Canvas Name="Canvas">
  <!--TESTING-->
  <TextBlock x:Name="Testing" Panel.ZIndex="10">
    <TextBlock.Text>
      <MultiBinding StringFormat="themes/theme[@title='{0}']/colorset[@title='{1}']/view[@title='{2}']/{3}/{4}">
        <Binding Source="{StaticResource ConfigFile}" XPath="theme"/>
        <Binding Source="{StaticResource ConfigFile}" XPath="colorset"/>
        <Binding Path="." Source="platform"/>
        <Binding Path="." Source="background"/>
        <Binding Path="." Source="color"/>
      </MultiBinding>
    </TextBlock.Text>
  </TextBlock>
  <TextBlock x:Name="Testing1" Panel.ZIndex="10">
    <TextBlock.Text>
      <MultiBinding StringFormat="{}{0}">
        <Binding Source="{StaticResource ResourcesFile}" XPath="{Binding ElementName=Testing, Path=Text}"/>
      </MultiBinding>
    </TextBlock.Text>
  </TextBlock>
</Canvas>
...
...
...

 

This method would be less ideal as it would require me to have many more XML files, but I also tried using a UserControl frame inside of the canvas (XmlDataProvider object has to be inside of a UserControl frame... I think). with the following code, which produced a similar error. It doesn't allow me to bind to the Source property.

    <Canvas Name="Canvas">
        <!--TESTING XML-->
        <!--colorset xml path-->
        <TextBlock x:Name="ColorsetXmlFilePath" Visibility="Collapsed">
            <TextBlock.Text>
                <MultiBinding StringFormat="{}pack://siteoforigin:,,,/Themes/RecalBigBox/Resources/{0}/{1}.xml">
                    <Binding Source="{StaticResource ConfigFile}" XPath="theme"/>
                    <Binding Source="{StaticResource ConfigFile}" XPath="colorset"/>
                </MultiBinding>
            </TextBlock.Text>
        </TextBlock>
        <UserControl>
            <UserControl.Resources>
                <!--LOAD THE COLORSET XML FILE-->
                <XmlDataProvider x:Key="ColorsetXmlFile" Source="{Binding ElementName=ColorsetXmlFilePath, Path=Text}" XPath="colorset"/>
            </UserControl.Resources>
        </UserControl>
        <!--THEME NAME FROM USER CONFIG FILE-->
        <TextBlock x:Name="BackgroundColor" Panel.ZIndex="10">
            <TextBlock.Text>
                <MultiBinding StringFormat="{}{0}">
                    <Binding Source="{StaticResource ColorsetXmlFile}" XPath="view[@title='platform']/background/color"/>
                </MultiBinding>
            </TextBlock.Text>
        </TextBlock>

 

Open to any solutions for importing values from a config file, whether xml or any other type of config.

Capture.JPG

Link to comment
Share on other sites

16 hours ago, ReenigneArcher said:

Hoping someone has a solution to this. I finally found a way to read values from an XML file into XAML (as shown in first TextBlock, first 2 bindings). I want to use the text from the first TextBlock as the XPath in the second TextBlock, but I get an error (attached) when it tries to run. If I type out the values exactly as in the string format from the first TextBlock into the XPath of the second TextBlock it will work.


...
...
...
<UserControl.Resources>
    <!--USER CONFIG XML FILE-->
    <XmlDataProvider x:Key="ConfigFile" Source="{}pack://siteoforigin:,,,/Themes/MyTheme/Configuration/config.xml" XPath="Config"/>
        
    <!--THEME CONFIG XML FILES-->
    <XmlDataProvider x:Key="ResourcesFile" Source="{}pack://siteoforigin:,,,/Themes/MyTheme/Resources/resources.xml" XPath="resources"/>
</UserControl.Resources>    
<Canvas Name="Canvas">
  <!--TESTING-->
  <TextBlock x:Name="Testing" Panel.ZIndex="10">
    <TextBlock.Text>
      <MultiBinding StringFormat="themes/theme[@title='{0}']/colorset[@title='{1}']/view[@title='{2}']/{3}/{4}">
        <Binding Source="{StaticResource ConfigFile}" XPath="theme"/>
        <Binding Source="{StaticResource ConfigFile}" XPath="colorset"/>
        <Binding Path="." Source="platform"/>
        <Binding Path="." Source="background"/>
        <Binding Path="." Source="color"/>
      </MultiBinding>
    </TextBlock.Text>
  </TextBlock>
  <TextBlock x:Name="Testing1" Panel.ZIndex="10">
    <TextBlock.Text>
      <MultiBinding StringFormat="{}{0}">
        <Binding Source="{StaticResource ResourcesFile}" XPath="{Binding ElementName=Testing, Path=Text}"/>
      </MultiBinding>
    </TextBlock.Text>
  </TextBlock>
</Canvas>
...
...
...

 

This method would be less ideal as it would require me to have many more XML files, but I also tried using a UserControl frame inside of the canvas (XmlDataProvider object has to be inside of a UserControl frame... I think). with the following code, which produced a similar error. It doesn't allow me to bind to the Source property.


    <Canvas Name="Canvas">
        <!--TESTING XML-->
        <!--colorset xml path-->
        <TextBlock x:Name="ColorsetXmlFilePath" Visibility="Collapsed">
            <TextBlock.Text>
                <MultiBinding StringFormat="{}pack://siteoforigin:,,,/Themes/RecalBigBox/Resources/{0}/{1}.xml">
                    <Binding Source="{StaticResource ConfigFile}" XPath="theme"/>
                    <Binding Source="{StaticResource ConfigFile}" XPath="colorset"/>
                </MultiBinding>
            </TextBlock.Text>
        </TextBlock>
        <UserControl>
            <UserControl.Resources>
                <!--LOAD THE COLORSET XML FILE-->
                <XmlDataProvider x:Key="ColorsetXmlFile" Source="{Binding ElementName=ColorsetXmlFilePath, Path=Text}" XPath="colorset"/>
            </UserControl.Resources>
        </UserControl>
        <!--THEME NAME FROM USER CONFIG FILE-->
        <TextBlock x:Name="BackgroundColor" Panel.ZIndex="10">
            <TextBlock.Text>
                <MultiBinding StringFormat="{}{0}">
                    <Binding Source="{StaticResource ColorsetXmlFile}" XPath="view[@title='platform']/background/color"/>
                </MultiBinding>
            </TextBlock.Text>
        </TextBlock>

 

Open to any solutions for importing values from a config file, whether xml or any other type of config.

Capture.JPG

Best method would be to develop a converter , the converter would accept a path to a config/xml file and a node you wish to retrieve a value from

Link to comment
Share on other sites

13 hours ago, wallmachine said:

Okay. I get the xaml part of it, the C# part of it, I sort of get... What I don't get is how to actually get started with the C# project (it's been 7 years since my intro to C# and definitely do not remember much of it), or how to make it a DLL that the theme can use. I'm making an assumption thinking it needs to be a DLL in the theme plugins folder. I'll keep googling, haha. Many xaml things I've looked up mention using a converter, so I suppose I should try to learn it.

Link to comment
Share on other sites

48 minutes ago, ReenigneArcher said:

Okay. I get the xaml part of it, the C# part of it, I sort of get... What I don't get is how to actually get started with the C# project (it's been 7 years since my intro to C# and definitely do not remember much of it), or how to make it a DLL that the theme can use. I'm making an assumption thinking it needs to be a DLL in the theme plugins folder. I'll keep googling, haha. Many xaml things I've looked up mention using a converter, so I suppose I should try to learn it.

If you want I can walk you thru it on discord if you like, my ID is Y2guru , I won’t be available until 5pm cst but I’m available all weekend 

  • Like 1
Link to comment
Share on other sites

Hey all, not sure if this is the right place for this or not, but I have a request to add a feature for theme creators. @Jason Carr  I need the ability to specify a fallback/default game art image if none exists, overriding the settings in LaunchBox for fallback images.  Here's why in my specific scenario.  I would love to be able to show the actual game cart image showing up in certain consoles for my theme, which works well right now assuming you have cart images.  I ran a test using N64 for example:

1052511059_BigBoxScreenshot-WoodPanels-TextGamesView-2020-04-2413_12_12.thumb.jpg.5268d92eda14259c224ed561ceea54bc.jpgThat said, I need to be able to specify a fallback generic cartridge to show, otherwise it'll fallback to whatever the user's specified in LaunchBox, which looks...bad.  In my case for instance if I'm missing a game cart image it falls back to a box image:

1131096336_BigBoxScreenshot-WoodPanels-TextGamesView-2020-04-2413_14_11.thumb.jpg.f14c31494b084fb1ba40d35a85ccb77b.jpgPlease consider adding this ability in a future version of LaunchBox.  Thank you and please let me know if I should move this request somewhere else.

Link to comment
Share on other sites

25 minutes ago, BMovieBen said:

Hey all, not sure if this is the right place for this or not, but I have a request to add a feature for theme creators. @Jason Carr  I need the ability to specify a fallback/default game art image if none exists, overriding the settings in LaunchBox for fallback images.  Here's why in my specific scenario.  I would love to be able to show the actual game cart image showing up in certain consoles for my theme, which works well right now assuming you have cart images.  I ran a test using N64 for example:

1052511059_BigBoxScreenshot-WoodPanels-TextGamesView-2020-04-2413_12_12.thumb.jpg.5268d92eda14259c224ed561ceea54bc.jpgThat said, I need to be able to specify a fallback generic cartridge to show, otherwise it'll fallback to whatever the user's specified in LaunchBox, which looks...bad.  In my case for instance if I'm missing a game cart image it falls back to a box image:

1131096336_BigBoxScreenshot-WoodPanels-TextGamesView-2020-04-2413_14_11.thumb.jpg.f14c31494b084fb1ba40d35a85ccb77b.jpgPlease consider adding this ability in a future version of LaunchBox.  Thank you and please let me know if I should move this request somewhere else.

I think we already have this  dont we? Try dropping these folders into Launchbox/Images/Platforms/Nintendo 64 and see if it works.

 

 

Nintendo 64.7z

Link to comment
Share on other sites

25 minutes ago, BMovieBen said:

Hey all, not sure if this is the right place for this or not, but I have a request to add a feature for theme creators. @Jason Carr  I need the ability to specify a fallback/default game art image if none exists, overriding the settings in LaunchBox for fallback images.  Here's why in my specific scenario.  I would love to be able to show the actual game cart image showing up in certain consoles for my theme, which works well right now assuming you have cart images.  I ran a test using N64 for example:

1052511059_BigBoxScreenshot-WoodPanels-TextGamesView-2020-04-2413_12_12.thumb.jpg.5268d92eda14259c224ed561ceea54bc.jpgThat said, I need to be able to specify a fallback generic cartridge to show, otherwise it'll fallback to whatever the user's specified in LaunchBox, which looks...bad.  In my case for instance if I'm missing a game cart image it falls back to a box image:

1131096336_BigBoxScreenshot-WoodPanels-TextGamesView-2020-04-2413_14_11.thumb.jpg.f14c31494b084fb1ba40d35a85ccb77b.jpgPlease consider adding this ability in a future version of LaunchBox.  Thank you and please let me know if I should move this request somewhere else.

If you use the COMMUNITY Theme creator then you can achieve exactly what you are requesting

  • Like 1
Link to comment
Share on other sites

49 minutes ago, BMovieBen said:

Hey all, not sure if this is the right place for this or not, but I have a request to add a feature for theme creators. @Jason Carr  I need the ability to specify a fallback/default game art image if none exists, overriding the settings in LaunchBox for fallback images.  Here's why in my specific scenario.  I would love to be able to show the actual game cart image showing up in certain consoles for my theme, which works well right now assuming you have cart images.  I ran a test using N64 for example:

1052511059_BigBoxScreenshot-WoodPanels-TextGamesView-2020-04-2413_12_12.thumb.jpg.5268d92eda14259c224ed561ceea54bc.jpgThat said, I need to be able to specify a fallback generic cartridge to show, otherwise it'll fallback to whatever the user's specified in LaunchBox, which looks...bad.  In my case for instance if I'm missing a game cart image it falls back to a box image:

1131096336_BigBoxScreenshot-WoodPanels-TextGamesView-2020-04-2413_14_11.thumb.jpg.f14c31494b084fb1ba40d35a85ccb77b.jpgPlease consider adding this ability in a future version of LaunchBox.  Thank you and please let me know if I should move this request somewhere else.

Try something like this.

<Image Source="{Binding Path=SelectedGame.CartFrontImagePath, FallbackValue='pack://siteoforigin:,,,/Themes/[theme]/Images/Default/Nintendo 64.png', TargetNullValue='pack://siteoforigin:,,,/Themes/[theme]/Images/Default/Nintendo 64.png'}" />

However, like y2guru suggests, this is built into the COMMUNITY Theme Creator, along with a ton of other functions that are not currently possible with just xaml.

  • Thanks 1
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...