Skip to content

Commit

Permalink
fix: Fixed issue with cref in description.
Browse files Browse the repository at this point in the history
  • Loading branch information
HavenDV committed Jan 4, 2024
1 parent 9b88e60 commit 6e95414
Show file tree
Hide file tree
Showing 33 changed files with 3,620 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.ComponentModel;
using System.Security;
using H.Generators.Extensions;

namespace H.Generators;
Expand Down Expand Up @@ -51,8 +52,8 @@ private static string GenerateDescriptionAttribute(string? value)
return GenerateComponentModelAttribute(
nameof(DependencyPropertyData.Description),
isMultilineString
? $"@\"{value}\""
: $"\"{value}\"");
? $"@\"{SecurityElement.Escape(value)}\""
: $"\"{SecurityElement.Escape(value)}\"");
}

private static string GenerateTypeConverterAttribute(string? value)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using H.Generators.Extensions;
using System.Net;
using System.Security;

namespace H.Generators;

Expand All @@ -23,7 +24,7 @@ private static string GenerateXmlDocumentationFrom(
? property.Name
: $"<see cref=\"{property.Name}\"/>";
var body = isProperty
? property.Description != null ? $"{property.Description}<br/>" : " "
? property.Description != null ? $"{SecurityElement.Escape(property.Description)}<br/>" : " "
: $"Identifies the {name} dependency property.<br/>";
value ??= @$"<summary>
{body}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
//HintName: DefaultBindingMode.g.cs
#nullable enable

namespace DependencyPropertyGenerator;

/// <summary>
/// Describes the direction of the data flow in a binding.
/// </summary>
internal enum DefaultBindingMode
{
/// <summary>
/// Causes changes to either the source property or the target property to automatically
/// update the other. This type of binding is appropriate for editable forms or other
/// fully-interactive UI scenarios.
/// </summary>
TwoWay = 0,

/// <summary>
/// Updates the binding target (target) property when the binding source (source)
/// changes. This type of binding is appropriate if the control being bound is implicitly
/// read-only. For instance, you may bind to a source such as a stock ticker. Or
/// perhaps your target property has no control interface provided for making changes,
/// such as a data-bound background color of a table. If there is no need to monitor
/// the changes of the target property, using the System.Windows.Data.BindingMode.OneWay
/// binding mode avoids the overhead of the System.Windows.Data.BindingMode.TwoWay
/// binding mode.
/// </summary>
OneWay = 1,

/// <summary>
/// Updates the binding target when the application starts or when the data context
/// changes. This type of binding is appropriate if you are using data where either
/// a snapshot of the current state is appropriate to use or the data is truly static.
/// This type of binding is also useful if you want to initialize your target property
/// with some value from a source property and the data context is not known in advance.
/// This is essentially a simpler form of System.Windows.Data.BindingMode.OneWay
/// binding that provides better performance in cases where the source value does
/// not change.
/// </summary>
OneTime = 2,

/// <summary>
/// Updates the source property when the target property changes.
/// </summary>
OneWayToSource = 3,

/// <summary>
/// Uses the default System.Windows.Data.Binding.Mode value of the binding target.
/// The default value varies for each dependency property. In general, user-editable
/// control properties, such as those of text boxes and check boxes, default to two-way
/// bindings, whereas most other properties default to one-way bindings. A programmatic
/// way to determine whether a dependency property binds one-way or two-way by default
/// is to get the property metadata of the property using System.Windows.DependencyProperty.GetMetadata(System.Type)
/// and then check the Boolean value of the System.Windows.FrameworkPropertyMetadata.BindsTwoWayByDefault
/// property.
/// </summary>
Default = 4,
}
Loading

0 comments on commit 6e95414

Please sign in to comment.