ThemeResources don't reload all the time?! / Could not convert object '1,1,1,1'... (1 Viewer)

FreakyJ

Retired Team Member
  • Premium Supporter
  • July 25, 2010
    4,024
    1,420
    Home Country
    Germany Germany
    I tried to play a bit more with the basic stuff of MPF and without the workflow models it is much easier^^

    I changed the Themefiles of the default Skin while MP2 was running and there was no effect if I changed something :(
    After a while I thought: "Okay lets restart MP2" and now I got an error. Is it possible that MP2 doesn't reload the theme files during the runtime like the skin files?


    This should be the "magic" line (the first place in Button.xaml where "1,1,1,1" appears and like always in WPF it works fine, but not in MPF (I made already some changes to the WPF code to fit the MPF specifications):
    Code:
    <Border BorderBrush="#FFFFFFFF" BorderThickness="1,1,1,1" CornerRadius="4,4,4,4">

    But why does this line (original code from MP2 Button.xaml) work:
    Code:
     <Grid x:Name="GrowControl" RenderTransformOrigin="0.5,0.5" Margin="0,2,0,2">

    It is the same just another attribute...

    Complete log + theme file [line 220] as attachment

    P.S.
    You should allow .xaml extension for upload ;)
     

    Attachments

    • Buttons.rar
      4.5 KB

    Albert

    MP2 Developer
  • Premium Supporter
  • February 18, 2008
    1,297
    1,130
    45
    Freiburg im Breisgau, Germany
    Home Country
    Germany Germany
    AW: ThemeResources don't reload all the time?! / Could not convert object '1,1,1,1'..

    In your log file, see line #149. At the end, it says: "Could not convert object '1,1,1,1' to type 'Double'". That means that the SkinEngine needs a double value here. You can check that if you look into the class of Border, property BorderThickness: It's declared as double. Seems that we're different to WPF here.
    The type of the Margin property is "Thickness", so here, "0,2,0,2" is ok.

    You're right, the theme isn't reloaded at runtime. I wrote a plugin which you can find in the Resources folder, "ReloadSkin". Add it to the solution and run. That plugin adds hotkeys "F3" for reloading the current screen and "F4" for reloading the skin/theme.
     

    FreakyJ

    Retired Team Member
  • Premium Supporter
  • July 25, 2010
    4,024
    1,420
    Home Country
    Germany Germany
    AW: ThemeResources don't reload all the time?! / Could not convert object '1,1,1,1'..

    Yes, I saw this error message in the log file =) But I thought the system would take 4 times "1" and convert it to double and assign this value to every side, so I was confused. The same with "CornerRadius", I thought every number is for every corner... but as far as I understand it now MPF can only take one value and apply it to every corner...

    Another point is the Width attribute of the border element.
    Due to MSDN it should have a value "Auto", but MP2 hasn't. I also tried the "*", I saw it often and thought it is maybe a wildcard with the same function like "Auto", but I just get the same converting error like above...

    The grid element does support this:
    Code:
    <Grid.RowDefinitions>
    	<RowDefinition Height="0.507*"/>
    	<RowDefinition Height="0.493*"/>
    </Grid.RowDefinitions>

    And yes, this time I took a look into the source and found only this definitions:
    Code:
    _borderProperty = new SProperty(typeof(Brush), null);
          _backgroundProperty = new SProperty(typeof(Brush), null);
          _borderThicknessProperty = new SProperty(typeof(double), 1.0);
          _cornerRadiusProperty = new SProperty(typeof(double), 0.0);

    and in the grid.cs i found this comment:
    // Set the Width/Hight of the Columns/Rows according to the sizes of the children.
    so I guess this function isn't implemented in the border class >_>
    I guess there must be a file with the global attributes (the attributes which every element has), I think you didn't rewrote this functions for every element, but I can't find it yet...

    I'm getting closer and closer with MPF^^ But due to the big difference to WPF I have a lot of questions, sorry about that, but it also will help other people to understand MPF =)

    //Edit:
    What was the link to the source docs again? I can't find the link right now... I think it was something like srcdocs.team-mediaportal.com/MP2 or Mediaportal2...

    //Edit2:
    found it via google: http://src-doc.team-mediaportal.com/mediaportal_2/

    //Edit3:
    I have to correct myself:

    http://src-doc.team-mediaportal.com...1_controls_1_1_panels_1_1_row_definition.html

    the element "rowDefinition" supports wildcards/auto in the height element, it is of the type gridLength, but in the border class both (width and height) are of the type double.. is it intention or I'm at the moment absolutely off track?
     

    Albert

    MP2 Developer
  • Premium Supporter
  • February 18, 2008
    1,297
    1,130
    45
    Freiburg im Breisgau, Germany
    Home Country
    Germany Germany
    AW: ThemeResources don't reload all the time?! / Could not convert object '1,1,1,1'..

    MPF has a measuring model which is slightly different to WPF. Our Width/Height don't support the Auto setting and some control sizing might be a bit different.

    Auto isn't the same as *. When used in a Grid's columns or rows, Auto means the size is taken from the control located inside that cell, * means that the available space is used to measure the cell. If you have one cell size specified with * and another with 2*, the first will be half the size of the second and all two cells together take all the available space.
     

    Users who are viewing this thread

    Top Bottom