Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for True text on Webview2 #140

Merged
merged 1 commit into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/CrissCross.WPF.WebView2/WebView2Wpf.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public class WebView2Wpf : ContentControl, IDisposable
nameof(Content),
typeof(object),
typeof(WebView2Wpf),
new PropertyMetadata(true, ContentChanged));
new PropertyMetadata(null, ContentChanged));

/// <summary>
/// The default background color property.
Expand Down
15 changes: 7 additions & 8 deletions src/CrissCross.WPF/NavigationWebView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ public class NavigationWebView : ContentControl, IDisposable, IUseNavigation, IA
/// </summary>
public static readonly DependencyProperty SourceProperty = DependencyProperty.Register(
nameof(Source),
typeof(string),
typeof(Uri),
typeof(NavigationWebView),
new PropertyMetadata(string.Empty, SourceChanged));
new PropertyMetadata(SourceChanged));

/// <summary>
/// The WPF DependencyProperty which backs the Microsoft.Web.WebView2.Wpf.WebView2.ZoomFactor property.
Expand All @@ -84,7 +84,7 @@ public class NavigationWebView : ContentControl, IDisposable, IUseNavigation, IA
nameof(Content),
typeof(object),
typeof(NavigationWebView),
new PropertyMetadata(true, ContentChanged));
new PropertyMetadata(null, ContentChanged));

/// <summary>
/// The default background color property.
Expand All @@ -104,7 +104,6 @@ public class NavigationWebView : ContentControl, IDisposable, IUseNavigation, IA
typeof(NavigationWebView),
new PropertyMetadata(true, AllowExternalDropPropertyChanged));

// Using a DependencyProperty as the backing store for DesignModeForegroundColor. This enables animation, styling, binding, etc...
/// <summary>
/// The design mode foreground color property.
/// </summary>
Expand Down Expand Up @@ -169,9 +168,9 @@ public System.Drawing.Color DesignModeForegroundColor
/// The source.
/// </value>
[Category("Common")]
public string? Source
public Uri Source
{
get => (string?)GetValue(SourceProperty);
get => (Uri)GetValue(SourceProperty);
set => SetValue(SourceProperty, value);
}

Expand Down Expand Up @@ -496,9 +495,9 @@ private static void DesignModeForegroundColorChanged(DependencyObject d, Depende

private static void SourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (d is NavigationWebView browser)
if (d is NavigationWebView browser && e.NewValue is Uri source)
{
browser._WebBrowser.Source = new((string)e.NewValue);
browser._WebBrowser.Source = source;
}
}

Expand Down
Loading