Skip to content

1.5.0

Compare
Choose a tag to compare
@github-actions github-actions released this 23 Oct 10:46
· 2 commits to 79a4c13dc38fde0c7788a36b52fc6d4aa21cbd26 since this release
f8b5c62

Overview

Generally the new release contains a lot of internal refactoring that wont affect the end user in any way.
However there are still some API changes, new features and bug fixes.
Way more changes are planned.

API Change: Widget.Grid* properties were replaced with attached properties

Starting from the new version, setting Widget's Grid* properties should be done through the new api.
I.e. old code:

widget.GridRow = 2;
widget.GridColumn = 3;
widget.GridRowSpan = 4;
Widget.GridRowColumn = 5;

Should be replaced with:

Grid.SetRow(widget, 2);
Grid.SetColumn(widget, 3);
Grid.SetRowSpan(widget, 4);
Grid.SetColumnSpan(widget, 5);

Respectively old MML code:

<TextBlock GridRow="2" GridColumn="3" GridRowSpan="4" GridColumnSpan="5"/>

Should be replaced with:

<TextBlock Grid.Row="2" Grid.Column="3" Grid.RowSpan="4" Grid.ColumnSpan="5"/>

It's possible to update MML files automatically by loading them in the MyraPad, press Ctrl+F(Format Source) and Save.

New Feature: StackPanel's attached properties

Let's say we want to make StackPanel with 4 TextBlocks. And we want 3rd to fill all remaining space from 1st, 2nd and 4th.
Old code to archieve that is:

var stackPanel = new HorizontalStackPanel();
stackPanel.Proportions.Add(Propotion.Auto);
stackPanel.Proportions.Add(Propotion.Auto);
stackPanel.Proportions.Add(Propotion.Fill);
stackPanel.Proportions.Add(Propotion.Auto);

stackPanel.Widgets.Add(textBlock1);
stackPanel.Widgets.Add(textBlock2);
stackPanel.Widgets.Add(textBlock3);
stackPanel.Widgets.Add(textBlock4);

Now it could be done with following code:

var stackPanel = new HorizontalStackPanel();
StackPanel.SetProportionType(textBlock3, ProportionType.Fill);
stackPanel.Widgets.Add(textBlock1);
stackPanel.Widgets.Add(textBlock2);
stackPanel.Widgets.Add(textBlock3);
stackPanel.Widgets.Add(textBlock4);

Respectively old MML code:

<HorizontalStackPanel>
  <Proportions>
    <Proportion Type="Auto" />
    <Proportion Type="Auto" />
    <Proportion Type="Fill" />
    <Proportion Type="Auto" />
  </Propotions>
  <TextBlock Id="textBlock1"/>
  <TextBlock Id="textBlock2"/>
  <TextBlock Id="textBlock3"/>
  <TextBlock Id="textBlock4"/>
</HorizontalStackPanel>

Now it could be done with following:

<HorizontalStackPanel>
  <TextBlock Id="textBlock1"/>
  <TextBlock Id="textBlock2"/>
  <TextBlock Id="textBlock3" StackPanel.ProportionType="Fill"/>
  <TextBlock Id="textBlock4"/>
</HorizontalStackPanel>

Similarly the MML could be automatically updated through the MyraPad.

Closed Issues and Merged Pull Requests

#382 - Feature Request: Support custom widgets for property grid.
#392 - Fix memory leak
#401 - Myra doesnt properly restore ScissorRectangle if the window gets resized
#403 - Monogame CustomWidget drawline with (thickness > 1), the line is not drawing from center.
#405 - New asset management
#406 - Move onto FontStashSharp 1.3.0
#408 - Add attached properties
#409 - TextBox: When the text is selected via touch, the scrolling should follow the touch position
#411 - Refactoring: StackPanel should inherit from MultipleItemsContainerBase
#415 - Refactoring: Move all Grid layout code into separate class GridLayout
#416 - Refactoring: SplitPane should inherit from MultipleItemsContainerBase
#417 - Refactoring: Add ObservableCollection RealChildren to Widget class