Jason Carr Posted January 30, 2019 Share Posted January 30, 2019 Hello all, sorry for another massive callout in the span of a couple days lol. @NJDave71 has generously contributed the code to his HelperControl plugin for Big Box themes and I've integrated it into Big Box, so going forward, the control itself will no longer be needed. However, themes will not be automatically changed to use the new built-in controls (sans for TotalGamesCount as mentioned in the other thread). There is no rush on this as the code for these features hasn't been changed, only integrated into Big Box, so there is no harm in continuing to use the HelperControl, at least for now. These new changes will be out in 9.4-beta-9, which should be out shortly, but it's not out quite yet. The controls and examples are below. RemoveNewLineConverter and ScrollableTextBlock Previously ScrollableTextBlock was already available in Big Box without the HelperControl, but it's a vertical scrolling TextBlock instead of a horizontal scrolling TextBlock like the HelperControl, so the name of the control in Big Box is now HorizontalScrollableTextBlock. RemoveNewLineConverter is new and simply removes new lines from text; it's typically used for the scrolling descriptions, which is why they are together here in this example: xmlns:wpf="clr-namespace:Unbroken.LaunchBox.Wpf;assembly=Unbroken.LaunchBox.Wpf" xmlns:controls="clr-namespace:Unbroken.LaunchBox.Wpf.Controls;assembly=Unbroken.LaunchBox.Wpf" <UserControl.Resources> <wpf:RemoveNewLineConverter x:Key="RemoveNewLineConverter" /> </UserControl.Resources> <controls:HorizontalScrollableTextBlock TextWrapping="Wrap" Text="{Binding Notes, Converter={StaticResource RemoveNewLineConverter}}" FontSize="46" Height="50" ScrollSpeed="100" /> FindStringConverter FindStringConverter is used largely to convert string values to different values. For example, to show an image based on the value of a field: xmlns:wpf="clr-namespace:Unbroken.LaunchBox.Wpf;assembly=Unbroken.LaunchBox.Wpf" <UserControl.Resources> <wpf:FindStringConverter x:Key="FindStringConverter" /> </UserControl.Resources> <Image> <Image.Style> <Style TargetType="{x:Type Image}"> <Style.Triggers> <DataTrigger Binding="{Binding Path=ActiveGame.PlayMode, Converter={StaticResource FindStringConverter}, ConverterParameter='Single Player'}" Value="True"> <Setter Property="Source" Value="pack://siteoforigin:,,,/Themes/Default/Single Player.png"/> </DataTrigger> <DataTrigger Binding="{Binding Path=ActiveGame.PlayMode, Converter={StaticResource FindStringConverter}, ConverterParameter='Cooperative'}" Value="True"> <Setter Property="Source" Value="pack://siteoforigin:,,,/Themes/Default/Cooperative.png"/> </DataTrigger> </Style.Triggers> </Style> </Image.Style> </Image> Thanks again to @NJDave71 for his code. @faeran @Mr. RetroLust @RetroHumanoid @wallmachine @eatkinola @bbweiners @keltoigael @Jack. @y2guru @whoozwah @SNAK3ATER @Rincewind @CriticalCid @shro2016 @broskiplays @Grila @NJDave71 @Hexxxer @PhillsDoodles @Zombeaver @Omen @Cookz718 @viking @OrochiMishima @nosh @ea4492 @Maddoc1007 @vsilvalopes @damageinc86 @walter10h @skainlurmis @Scottad @Nyny77 @Sithel @Akezhar @Thanos Reigns 2 1 1 Quote Link to comment Share on other sites More sharing options...
Mr. RetroLust Posted January 30, 2019 Share Posted January 30, 2019 Awesome \m/ ps Confirmation: Futurestate Neon Deluxe was converted successfully in beta 8. \m/ 1 Quote Link to comment Share on other sites More sharing options...
Jason Carr Posted January 30, 2019 Author Share Posted January 30, 2019 10 minutes ago, Mr. RetroLust said: Awesome \m/ ps Confirmation: Futurestate Neon Deluxe was converted successfully in beta 8. \m/ Sweet. 1 Quote Link to comment Share on other sites More sharing options...
faeran Posted February 6, 2019 Share Posted February 6, 2019 Hey @Jason Carr. Tried this out tonight with Beta 9. Unfortunately, unable to get the FIndStringConverter to work. It's unable to find FindStringConverter. It only seems to be able to find the ImageToSourceConverter in the namespace. Quote Link to comment Share on other sites More sharing options...
Jason Carr Posted February 6, 2019 Author Share Posted February 6, 2019 2 hours ago, faeran said: Hey @Jason Carr. Tried this out tonight with Beta 9. Unfortunately, unable to get the FIndStringConverter to work. It's unable to find FindStringConverter. It only seems to be able to find the ImageToSourceConverter in the namespace. I see. Somehow I managed to exclude the file from the project; sorry for that. I've fixed it for the next beta, which should be out tomorrow. 1 Quote Link to comment Share on other sites More sharing options...
Jason Carr Posted February 6, 2019 Author Share Posted February 6, 2019 Apparently RemoveNewLineConverter was excluded as well. Thanks for pointing that out @faeran. 1 Quote Link to comment Share on other sites More sharing options...
Jason Carr Posted February 8, 2019 Author Share Posted February 8, 2019 Hello all, @Maddoc1007 pointed out to me that the ScrollableTextBlock control wasn't working as expected when converting it over from the HelperControl version. This is because I hadn't realized that there were significant differences between the existing ScrollableTextBlock control in Big Box and @NJDave71's HelperControl version. As of 9.4-beta-11, which I just put out, there are now two available versions of this control: ScrollableTextBlock - The same control as what used to be included in Big Box, used for vertical scrolling text HorizontalScrollableTextBlock - The control from @NJDave71's HelperControl, used for horizontal scrolling text Sorry for the confusion on this. I've updated the examples in the first post of this topic to match the correct new usage. When converting your themes over to use the built-in scrollable text block control instead of the HelperControl version, you'll need to use HorizontalScrollableTextBlock instead of ScrollableTextBlock for the tag element. Quote Link to comment Share on other sites More sharing options...
NJDave71 Posted February 13, 2019 Share Posted February 13, 2019 (edited) How to replace the HelperControl using LB 9.4 Release Replace the ScrollableTextBlock with HorizontalScrollableTextBlock Remove xmlns:HelperControl="clr-namespace:HelperControl;assembly=HelperControl_v4" Add xmlns:wpf="clr-namespace:Unbroken.LaunchBox.Wpf;assembly=Unbroken.LaunchBox.Wpf" xmlns:controls="clr-namespace:Unbroken.LaunchBox.Wpf.Controls;assembly=Unbroken.LaunchBox.Wpf" Remove <HelperControl:RemoveNewLineConverter x:Key="NoNewline"/> Add <wpf:RemoveNewLineConverter x:Key="RemoveNewLineConverter" /> Replace Canvas Name ScrollingTextBlockCanvas with HorizontalScrollableTextBlockCanvas Replace HelperControl:ScrollableTextBlock with controls:HorizontalScrollableTextBlock Replace StaticResource NoNewline with StaticResource RemoveNewLineConverter Replace TotalGamesCount with GamesCount Remove xmlns:HelperControl="clr-namespace:HelperControl;assembly=HelperControl_v4" Replace <HelperControl:TotalGamesCount FontFamily="{StaticResource FontHead}" Foreground="#75c8f7" FontSize="31" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5,0,0,0" /> <TextBlock Text="{Binding GamesCount}" FontFamily="{StaticResource FontHead}" Foreground="#75c8f7" FontSize="31" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5,0,0,0" /> Replace FindString with FindStringConverter Remove xmlns:HelperControl="clr-namespace:HelperControl;assembly=HelperControl_v4" Add xmlns:wpf="clr-namespace:Unbroken.LaunchBox.Wpf;assembly=Unbroken.LaunchBox.Wpf" Remove <HelperControl:FindString x:Key="FindInString"/> Add <wpf:FindStringConverter x:Key="FindStringConverter" /> Search for "FindInString" and replace it with "FindStringConverter" Edited February 13, 2019 by NJDave71 3 Quote Link to comment Share on other sites More sharing options...
Jason Carr Posted February 13, 2019 Author Share Posted February 13, 2019 Thanks for that @NJDave71. Quote Link to comment Share on other sites More sharing options...
viking Posted March 4, 2019 Share Posted March 4, 2019 Hi @NJDave71 ! For a new theme, I'm trying to set up a Rating stars, based on community rating. To use a DataTrigger> Setter, I need data by .5 incremental (0.5 - 1.0 - 1.5 - ...) But the community rating are more like : 3.2564 Does your FindStringConverter can do that ? Round values by 0.5 incrementing ? If so, with which code ? Thx !!! Quote Link to comment Share on other sites More sharing options...
NJDave71 Posted March 4, 2019 Share Posted March 4, 2019 (edited) Hello @viking The Aeon Nox uses the StringFormat to set the Decimal places. Take a Look at the "CoverFlowWithDetailsGamesView" and find <MultiBinding StringFormat="{}pack://siteoforigin:,,,/Themes/Aeon Nox/Images/etc/score/{0:F1}.png"> <Binding Path="ActiveGame.CommunityOrLocalStarRating" /> </MultiBinding> I have set mine to 1 decimal 3.2564 becomes 3.2. There are 52 images, Hope this gives you some insight. Edited March 4, 2019 by NJDave71 Quote Link to comment Share on other sites More sharing options...
viking Posted March 4, 2019 Share Posted March 4, 2019 Thx @NJDave71 . I tried StringFormat too. Whis this : Binding="{Binding ActiveGame.CommunityStarRating, StringFormat=\{0:n1\}}" I have the same result as you = 3.2564 becomes 3.2. But 52 images for the stars is too mutch ! I also found in the Microsoft doc the StringFormat {G4} which should round to the nearest .5. But it does not work. I do not know why ... Maybe a bad syntax. I'm going to take a look at Aeon Nox Redux! Thx! Quote Link to comment Share on other sites More sharing options...
NJDave71 Posted March 4, 2019 Share Posted March 4, 2019 That is my Theme...... You are on the right track and I did the same reading through the Docs on StringFormat. If i stumble across something i will share it. 1 Quote Link to comment Share on other sites More sharing options...
NJDave71 Posted March 4, 2019 Share Posted March 4, 2019 @viking I would ask @Jason Carr StringFormat alters the number as is. You may need a converter that will perform a rounding to the nearest nth decimal. Quote Link to comment Share on other sites More sharing options...
viking Posted March 4, 2019 Share Posted March 4, 2019 Thx @NJDave71. I think I'm going to use your code model. For the 52 stars images, I will create a quick animation of 52 frames under photoshop. It will be quickly generated! Quote Link to comment Share on other sites More sharing options...
NJDave71 Posted March 4, 2019 Share Posted March 4, 2019 Did you try Text="{Binding Path=ActiveGame.CommunityOrLocalStarRating, StringFormat=N2} Quote Link to comment Share on other sites More sharing options...
viking Posted March 5, 2019 Share Posted March 5, 2019 Thx @NJDave71. I found a way, completely based on your work on Aeon Nox. Thx man ! Your code is very inspiring! <StackPanel Grid.Column="2" Grid.Row="8"> <TextBlock x:Name="Stars" Visibility="Collapsed"> <TextBlock.Text> <MultiBinding StringFormat="{}pack://siteoforigin:,,,/Themes/Colorful/Colorful_img/Stars/{0:F1}.png"> <Binding Path="ActiveGame.CommunityOrLocalStarRating" /> </MultiBinding> </TextBlock.Text> </TextBlock> <Image Source="{Binding Text, ElementName=Stars}" x:Name="RatingStars" Grid.Column="2" Grid.Row="8" HorizontalAlignment="Center" VerticalAlignment="Stretch" Stretch="Fill" RenderOptions.BitmapScalingMode="HighQuality" > </Image> </StackPanel> 1 Quote Link to comment Share on other sites More sharing options...
NJDave71 Posted March 5, 2019 Share Posted March 5, 2019 I am happy to hear your on your way.... We try our best to help one another. Good Luck with your theme and please share your results. Quote Link to comment Share on other sites More sharing options...
shro2016 Posted February 28, 2020 Share Posted February 28, 2020 (edited) Hi, I am trying to use the horizontalscrollabletextblock on a theme I am working on and whilst it is working it seems to be cutting off most of the notes text passed a certain character limit. Is there a maximum number of characters this control supports and is there anyway to increase it? Based on what I am seeing I suspect it is stopping at around 256 characters. Edited February 28, 2020 by shro2016 Quote Link to comment Share on other sites More sharing options...
shro2016 Posted February 28, 2020 Share Posted February 28, 2020 I fixed the issue, it turns out this control needs to be run inside the canvas command as with the vertical scrolling text block which is not mentioned above. If it is not run in a text block it will crop text at the width of the screen. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.