MP2 - V2.4 TV Guide Seach button not working (1 Viewer)

ge2301

Lead Design MP2
  • Team MediaPortal
  • January 11, 2014
    8,741
    3,501
    Stuttgart
    Home Country
    Germany Germany
    WPF works completely different ;)

    @Brownard I gave it a try, but as expected commandbinding didn't work:
    XML:
                          <Button x:Name="PlayPauseButton" Margin="5,0,5,0">
                            <Button.Style>
                              <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} ? {2} : ({1} ? {3})">
                                <Binding Path="CanPlay"/>
                                <Binding Path="CanPause"/>
                                <Binding Source="{ThemeResource PlayButtonStyle}"/>
                                <Binding Source="{ThemeResource PauseButtonStyle}"/>
                              </MultiBinding>
                            </Button.Style>
                            <Button.Command>
                              <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} ? {2} : ({1} ? {3})">
                                <Binding Path="CanPlay"/>
                                <Binding Path="CanPause"/>
                                <Binding Source="{Command Play}"/>
                                <Binding Source="{Command Pause}"/>
                              </MultiBinding>
                            </Button.Command>
                            <Button.IsVisible>
                              <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} || {1}">
                                <Binding Path="CanPlay"/>
                                <Binding Path="CanPause"/>
                              </MultiBinding>
                            </Button.IsVisible>
                          </Button>
     

    TVWatcher

    Portal Pro
    January 9, 2020
    65
    5
    Home Country
    United Kingdom United Kingdom
    I've always believed DataFlex was an excellent Windows develpment environment. It seems that in this case at least it's better than that used for MP:)
     

    ge2301

    Lead Design MP2
  • Team MediaPortal
  • January 11, 2014
    8,741
    3,501
    Stuttgart
    Home Country
    Germany Germany
    I've always believed DataFlex was an excellent Windows develpment environment. It seems that in this case at least it's better than that used for MP:)
    It’s more like C, so not made for graphic surfaces. MPF used for MP2 is almost identical as WPF, which is standard for modern surfaces. Of course it’s possible to achieve everything, also your desired button behavior, with a model in C behind. But desired is always a solution with the existing capabilities to save time and effort. My trial was a xaml (MPF) only solution, which did not work yet.
     

    ge2301

    Lead Design MP2
  • Team MediaPortal
  • January 11, 2014
    8,741
    3,501
    Stuttgart
    Home Country
    Germany Germany
    Next try worked almost, I outsourced most things to a common style, but the datatrigger is not working correctly. In WPF this should work.
    XML:
    <Button x:Name="PlayPauseButton" Margin="5,0,5,0" Style="{ThemeResource PlayPauseButtonStyle}"/>
    
      <Style x:Key="PlayPauseButtonStyle" TargetType="{x:Type Button}">
        <Setter Property="Command" Value="{Command Pause}"/>
        <Style.Triggers>
          <DataTrigger Binding="CanPlay" Value="True">
            <Setter Property="Command" Value="{Command Play}"/>
          </DataTrigger>
        </Style.Triggers>
        <Setter Property="Template">
          <Setter.Value>
            <ControlTemplate TargetType="{x:Type Button}" >
              <Grid>
                <Image Source="PlayerControl\PLAY.NOFOCUS.PNG" Stretch="Uniform" Height="45" Width="45" Margin="0" VerticalAlignment="Center">
                  <Image.IsVisible>
                    <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} &amp;&amp; {1}">
                      <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="!HasFocus"/>
                      <Binding Path="CanPlay"/>
                    </MultiBinding>
                  </Image.IsVisible>
                </Image>
                <Image Source="PlayerControl\PLAY.FOCUS.PNG" Stretch="Uniform" Height="45" Width="45" Margin="0" VerticalAlignment="Center">
                  <Image.IsVisible>
                    <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} &amp;&amp; {1}">
                      <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="HasFocus"/>
                      <Binding Path="CanPlay"/>
                    </MultiBinding>
                  </Image.IsVisible>
                </Image>
                <Image Source="PlayerControl\PAUSE.NOFOCUS.PNG" Stretch="Uniform" Height="45" Width="45" Margin="0" VerticalAlignment="Center">
                  <Image.IsVisible>
                    <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} &amp;&amp; {1}">
                      <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="!HasFocus"/>
                      <Binding Path="CanPause"/>
                    </MultiBinding>
                  </Image.IsVisible>
                </Image>
                <Image Source="PlayerControl\PAUSE.FOCUS.PNG" Stretch="Uniform" Height="45" Width="45" Margin="0" VerticalAlignment="Center">
                  <Image.IsVisible>
                    <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} &amp;&amp; {1}">
                      <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="HasFocus"/>
                      <Binding Path="CanPause"/>
                    </MultiBinding>
                  </Image.IsVisible>
                </Image>
              </Grid>
            </ControlTemplate>
          </Setter.Value>
        </Setter>
      </Style>

    Using the current code and adding focus triggers also does not help:
    XML:
                          <Button x:Name="PlayButton" Style="{ThemeResource PlayButtonStyle}" Margin="5,0,5,0" IsVisible="{Binding CanPlay}"
                                  Command="{Command Play}">
                            <Button.Triggers>
                              <DataTrigger Binding="{Binding ElementName=PauseButton, Path=IsSelected}" Value="True">
                                <Setter Property="IsVisible" Value="True"/>
                                <Setter Property="SetFocus" Value="True"/>
                                <Setter Property="SetFocusPrio" Value="DefaultHigh"/>
                              </DataTrigger>
                            </Button.Triggers>
                          </Button>
                          <Button x:Name="PauseButton" Style="{ThemeResource PauseButtonStyle}" Margin="5,0,5,0" IsVisible="{Binding CanPause}"
                                  Command="{Command Pause}">
                            <Button.Triggers>
                              <DataTrigger Binding="{Binding ElementName=PlayButton, Path=IsSelected}" Value="True">
                                <Setter Property="IsVisible" Value="True"/>
                                <Setter Property="SetFocus" Value="True"/>
                                <Setter Property="SetFocusPrio" Value="DefaultHigh"/>
                              </DataTrigger>
                            </Button.Triggers>
                          </Button>
     
    Last edited:

    ge2301

    Lead Design MP2
  • Team MediaPortal
  • January 11, 2014
    8,741
    3,501
    Stuttgart
    Home Country
    Germany Germany
    @TVWatcher
    I could fix it, the solution was easy. We have already a tooglePause command, that toggles between play and pause. Accordingly I didn't need to add 2 separate commands pause and play as initially tought. The fix will be part of the next release. I can not offer a download fix, because my files are part of the unreleased MP2.4.1 and have other changes included that will not work on your system yet.

    As you know coding, you may also to fix it for yourself.
    • Open C:\Program Files (x86)\Team MediaPortal\MP2-Client\Plugins\WMCSkin\Skin\WMCSkin\themes\default\styles\Buttons.xml with an text editor (you may better copy it to dektop and copy it back later, because you might be asked for admin rights) and look for
    XML:
      <Style x:Key="PlayButtonStyle" TargetType="{x:Type Button}">
        <Setter Property="Template">
          <Setter.Value>
            <ControlTemplate TargetType="{x:Type Button}">
              <Grid>
                <Image x:Name="image" Source="PlayerControl\PLAY.NOFOCUS.PNG" Stretch="Uniform" Height="45" Width="45" VerticalAlignment="Center"/>
              </Grid>
              <ControlTemplate.Triggers>
                <Trigger Property="HasFocus" Value="True">
                  <Setter TargetName="image" Property="Source" Value="PlayerControl\PLAY.FOCUS.PNG"/>
                </Trigger>
              </ControlTemplate.Triggers>
            </ControlTemplate>
          </Setter.Value>
        </Setter>
      </Style>
    
      <Style x:Key="PauseButtonStyle" TargetType="{x:Type Button}">
        <Setter Property="Template">
          <Setter.Value>
            <ControlTemplate TargetType="{x:Type Button}">
              <Grid>
                <Image x:Name="image" Source="PlayerControl\PAUSE.NOFOCUS.PNG" Stretch="Uniform" Height="45" Width="45" VerticalAlignment="Center"/>
              </Grid>
              <ControlTemplate.Triggers>
                <Trigger Property="HasFocus" Value="True">
                  <Setter TargetName="image" Property="Source" Value="PlayerControl\PAUSE.FOCUS.PNG"/>
                </Trigger>
              </ControlTemplate.Triggers>
            </ControlTemplate>
          </Setter.Value>
        </Setter>
      </Style>

    and replace it with
    XML:
      <Style x:Key="PlayPauseButtonStyle" TargetType="{x:Type Button}">
        <Setter Property="Template">
          <Setter.Value>
            <ControlTemplate TargetType="{x:Type Button}" >
              <Grid>
                <Image Source="PlayerControl\PLAY.NOFOCUS.PNG" Stretch="Uniform" Height="45" Width="45" Margin="0" VerticalAlignment="Center">
                  <Image.IsVisible>
                    <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} &amp;&amp; {1}">
                      <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="!HasFocus"/>
                      <Binding Path="CanPlay"/>
                    </MultiBinding>
                  </Image.IsVisible>
                </Image>
                <Image Source="PlayerControl\PLAY.FOCUS.PNG" Stretch="Uniform" Height="45" Width="45" Margin="0" VerticalAlignment="Center">
                  <Image.IsVisible>
                    <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} &amp;&amp; {1}">
                      <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="HasFocus"/>
                      <Binding Path="CanPlay"/>
                    </MultiBinding>
                  </Image.IsVisible>
                </Image>
                <Image Source="PlayerControl\PAUSE.NOFOCUS.PNG" Stretch="Uniform" Height="45" Width="45" Margin="0" VerticalAlignment="Center">
                  <Image.IsVisible>
                    <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} &amp;&amp; {1}">
                      <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="!HasFocus"/>
                      <Binding Path="CanPause"/>
                    </MultiBinding>
                  </Image.IsVisible>
                </Image>
                <Image Source="PlayerControl\PAUSE.FOCUS.PNG" Stretch="Uniform" Height="45" Width="45" Margin="0" VerticalAlignment="Center">
                  <Image.IsVisible>
                    <MultiBinding Converter="{StaticResource ExpressionMultiValueConverter}" ConverterParameter="{}{0} &amp;&amp; {1}">
                      <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="HasFocus"/>
                      <Binding Path="CanPause"/>
                    </MultiBinding>
                  </Image.IsVisible>
                </Image>
              </Grid>
            </ControlTemplate>
          </Setter.Value>
        </Setter>
      </Style>

    Now open C:\Program Files (x86)\Team MediaPortal\MP2-Client\Plugins\WMCSkin\Skin\WMCSkin\themes\default\styles\MediaStyles.xaml with a text editor and look for (there are several positions!):
    XML:
                          <Button x:Name="PlayButton" Margin="5,0,5,0" Style="{ThemeResource PlayButtonStyle}"
                                  Command="{Command Play}"/>
                          <Button x:Name="PauseButton" Margin="5,0,5,0" Style="{ThemeResource PauseButtonStyle}"
                                  Command="{Command Pause}"/>
    and replace ALL of them with
    XML:
                          <Button x:Name="PlayPauseButton" Margin="5,0,5,0" Style="{ThemeResource PlayPauseButtonStyle}"
                                  Command="{Command TogglePause}"/>
     

    Users who are viewing this thread

    Top Bottom