Hello!
Running into some bugs with the VS Extension. Issues are with using a custom style on an element via custom attributes (when using specific styles not supported by the style tab). This seems to be happening for specific Radzen elements, but not all of them. I can confirm it does happen with RadzenDataGrid and RadzenTabs elements. ( I tested on some others like RadzenColumn, RadzenButton and it acted fine with those)
Two distinct issues are occurring for me. One is related to the style not setting/saving, the other is the style's contents being edited when it should not be.
A. Adding or editing an existing custom style on certain elements (like RadzenDataGrid) via the Radzen Properties windows>Custom Attributes will not render or even edit/make code changes to that style at all.
Examples:
- No existing style is listed on the element, adding a custom attribute, naming it "style", and placing a value (does not indicate any problem in the properties window). Nothing renders, no code is changed. Clicking away to another element and back on the element you edited will delete the "style" line in custom attributes you created OR a custom attribute with a "style" name will be in the properties window, but a blank value will be listed for it. (Not sure why sometimes it deletes and sometimes it clears the value)
- An existing style already is in place in your code (manually created in code view). The style custom attribute shows in the property window custom attributes section. Editing it in the property window custom attributes results in no change happening (rendering or actual code).
In both example cases, the following error shows up in the Radzen Blazor for Visual Studio Output window after the update is attempted in the properties window:
System.ArgumentNullException: Value cannot be null.
Parameter name: input
at System.Text.RegularExpressions.Regex.IsMatch(String input)
at System.Text.RegularExpressions.Regex.IsMatch(String input, String pattern)
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
at Radzen.VisualStudio.EditorPane.<SetPropertyAsync>d__62.MoveNext()
B) If you have a custom style already set for a RadzenDataGrid or RadzenTabs object and it has a variable set in the style (name that starts with two hyphens), then clicking an element within the design view WHILE the style tab of the Radzen Properties windows is open will edit the existing style and remove one of the hyphens. (This is usually an issue when we need to override a variable inside a single element and can't update it at the page or site level so we override the variable for a single element). Alternatively, clicking the element and then opening the styles tab can cause this same behavior. This one is very strange and does occur consistently, usually only one time after a page is loaded; if you "fix" the issue by undoing the code that breaks, it doesn't usually occur again until you close/reopen the .razor file.
Change that happens:
- If the style for an element is set like
<RadzenDataGrid Data="@uaShifts" TItem="TestDTO"
Style="--rz-grid-cell-padding: 3px 3px 3px 3px; --rz-grid-header-title-padding: 0px 0px 0px 5px; height: 770px; --rz-grid-header-title-padding-inline: 4px 0">.....</RadzenDataGrid>
- the style will be updated to
<RadzenDataGrid Data="@uaShifts" TItem="TestDTO"
Style="-rz-grid-cell-padding: 3px 3px 3px 3px; -rz-grid-header-title-padding: 0px 0px 0px 5px; height: 770px; -rz-grid-header-title-padding-inline: 4px 0">.....</RadzenDataGrid>
Examples:
- Freshly open a .razor file. Have the Radzen properties window open to the Styles tab. Click on an element inside of the RadzenDataGrid (I tested row text or header) - the hyphens get removed.
- Freshly open a .razor file. Have the Radzen properties window open but NOT on the Styles tab. Click on an element inside of the RadzenDataGrid (I tested row text or header). Now click the styles tab in the properties window - the hyphens get removed.
- Note that for issue B a Data and TItem attribute seem to be required for this issue to occur on the datagrid (it may happen without them, but all my examples used them).
Please let me know if you need additional information to replicate & resolve these problems!