-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #131 from FmgLib/130-columndefinitioncollectionext…
…ension-and-rowdefinitioncollectionextension-add 130 columndefinitioncollectionextension and rowdefinitioncollectionextension add
- Loading branch information
Showing
3 changed files
with
149 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/FmgLib.MauiMarkup/Core/Extensions/ColumnDefinitionCollectionExtension.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
namespace FmgLib.MauiMarkup; | ||
|
||
public static partial class ColumnDefinitionCollectionExtension | ||
{ | ||
public static ColumnDefinitionCollection Auto(this ColumnDefinitionCollection self, int count = 1) | ||
{ | ||
for (int i = 0; i < count; i++) | ||
{ | ||
self.Add(new ColumnDefinition(new GridLength(0.0, GridUnitType.Auto))); | ||
} | ||
|
||
return self; | ||
} | ||
|
||
public static ColumnDefinitionCollection Star(this ColumnDefinitionCollection self, double width = 1.0, int count = 1) | ||
{ | ||
for (int i = 0; i < count; i++) | ||
{ | ||
self.Add(new ColumnDefinition(new GridLength(width, GridUnitType.Star))); | ||
} | ||
|
||
return self; | ||
} | ||
|
||
public static ColumnDefinitionCollection Absolute(this ColumnDefinitionCollection self, double width, int count = 1) | ||
{ | ||
for (int i = 0; i < count; i++) | ||
{ | ||
self.Add(new ColumnDefinition(new GridLength(width, GridUnitType.Absolute))); | ||
} | ||
|
||
return self; | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/FmgLib.MauiMarkup/Core/Extensions/RowDefinitionCollectionExtension.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
namespace FmgLib.MauiMarkup; | ||
|
||
public static partial class RowDefinitionCollectionExtension | ||
{ | ||
public static RowDefinitionCollection Auto(this RowDefinitionCollection self, int count = 1) | ||
{ | ||
for (int i = 0; i < count; i++) | ||
{ | ||
self.Add(new RowDefinition(new GridLength(0.0, GridUnitType.Auto))); | ||
} | ||
|
||
return self; | ||
} | ||
|
||
public static RowDefinitionCollection Star(this RowDefinitionCollection self, double height = 1.0, int count = 1) | ||
{ | ||
for (int i = 0; i < count; i++) | ||
{ | ||
self.Add(new RowDefinition(new GridLength(height, GridUnitType.Star))); | ||
} | ||
|
||
return self; | ||
} | ||
|
||
public static RowDefinitionCollection Absolute(this RowDefinitionCollection self, double height, int count = 1) | ||
{ | ||
for (int i = 0; i < count; i++) | ||
{ | ||
self.Add(new RowDefinition(new GridLength(height, GridUnitType.Absolute))); | ||
} | ||
|
||
return self; | ||
} | ||
} |