diff --git a/src/MatBlazor.Demo/Demo/DemoMatSelect.razor b/src/MatBlazor.Demo/Demo/DemoMatSelect.razor index 51a55f81..7d69cb00 100644 --- a/src/MatBlazor.Demo/Demo/DemoMatSelect.razor +++ b/src/MatBlazor.Demo/Demo/DemoMatSelect.razor @@ -82,6 +82,47 @@ + + + MatSelect Guid? + + + + + + Bread, Cereal, Rice, and Pasta + Vegetables + Fruit + + + @guidValue + + @code + { + Guid? guidValue = new Guid("20A82054-F493-4C7B-81A4-4F9A1EDD7C2E"); + } + + + + + + Bread, Cereal, Rice, and Pasta + Vegetables + Fruit + + + @guidValue + + @code + { + Guid? guidValue = new Guid(""20A82054-F493-4C7B-81A4-4F9A1EDD7C2E""); + } + + ")> + + +
Helper Text
diff --git a/src/MatBlazor/Core/MatBlazorSwitchT.cs b/src/MatBlazor/Core/MatBlazorSwitchT.cs index 735603ab..667721b9 100644 --- a/src/MatBlazor/Core/MatBlazorSwitchT.cs +++ b/src/MatBlazor/Core/MatBlazorSwitchT.cs @@ -65,7 +65,9 @@ public virtual T FromBool(bool v) .Case>(new MatBlazorSwitchTDateTime()) .Case>(new MatBlazorSwitchTDateTimeNull()) .Case>(new MatBlazorSwitchTBool()) - .Case>(new MatBlazorSwitchTBoolNull()); + .Case>(new MatBlazorSwitchTBoolNull()) + .Case>(new MatBlazorSwitchTGuid()) + .Case>(new MatBlazorSwitchTGuidNull()); public static MatBlazorSwitchT Get() { diff --git a/src/MatBlazor/Core/MatBlazorSwitchTGuid.cs b/src/MatBlazor/Core/MatBlazorSwitchTGuid.cs new file mode 100644 index 00000000..1e2382ed --- /dev/null +++ b/src/MatBlazor/Core/MatBlazorSwitchTGuid.cs @@ -0,0 +1,67 @@ +using System; + +namespace MatBlazor +{ + public class MatBlazorSwitchTGuid : MatBlazorSwitchT + { + public override Guid Increase(Guid v, Guid step, Guid max) + { + throw new NotImplementedException(); + } + + public override Guid Decrease(Guid v, Guid step, Guid min) + { + throw new NotImplementedException(); + } + + public override Guid Round(Guid v, int dp) + { + throw new NotImplementedException(); + } + + public override Guid GetMinimum() + { + throw new NotImplementedException(); + } + + public override Guid GetMaximum() + { + throw new NotImplementedException(); + } + + public override Guid GetStep() + { + throw new NotImplementedException(); + } + + public override string FormatValueAsString(Guid v, string format) + { + return v.ToString(format); + } + + public override Guid ParseFromString(string v, string format) + { + return Guid.Parse(v); + } + + public override Guid FromDateTimeNull(DateTime? v) + { + throw new NotImplementedException(); + } + + public override DateTime? ToDateTimeNull(Guid v) + { + throw new NotImplementedException(); + } + + public override Guid FromBoolNull(bool? v, bool indeterminate) + { + throw new NotImplementedException(); + } + + public override Guid FromDecimal(decimal v) + { + throw new NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/src/MatBlazor/Core/MatBlazorSwitchTGuidNull.cs b/src/MatBlazor/Core/MatBlazorSwitchTGuidNull.cs new file mode 100644 index 00000000..aa33d2ef --- /dev/null +++ b/src/MatBlazor/Core/MatBlazorSwitchTGuidNull.cs @@ -0,0 +1,72 @@ +using System; + +namespace MatBlazor +{ + public class MatBlazorSwitchTGuidNull : MatBlazorSwitchT + { + public override Guid? Increase(Guid? v, Guid? step, Guid? max) + { + throw new NotImplementedException(); + } + + public override Guid? Decrease(Guid? v, Guid? step, Guid? min) + { + throw new NotImplementedException(); + } + + public override Guid? Round(Guid? v, int dp) + { + throw new NotImplementedException(); + } + + public override Guid? GetMinimum() + { + throw new NotImplementedException(); + } + + public override Guid? GetMaximum() + { + throw new NotImplementedException(); + } + + public override Guid? GetStep() + { + throw new NotImplementedException(); + } + + public override string FormatValueAsString(Guid? v, string format) + { + return v?.ToString(format); + } + + public override Guid? ParseFromString(string v, string format) + { + if (Guid.TryParse(v, out var result)) + { + return result; + } + + return null; + } + + public override Guid? FromDateTimeNull(DateTime? v) + { + throw new NotImplementedException(); + } + + public override DateTime? ToDateTimeNull(Guid? v) + { + throw new NotImplementedException(); + } + + public override Guid? FromBoolNull(bool? v, bool indeterminate) + { + throw new NotImplementedException(); + } + + public override Guid? FromDecimal(decimal v) + { + throw new NotImplementedException(); + } + } +} \ No newline at end of file