diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000000..9225e97f11a --- /dev/null +++ b/.editorconfig @@ -0,0 +1,238 @@ +# Remove the line below if you want to inherit .editorconfig settings from higher directories +root = true + +# C# files +[*.cs] + +#### Core EditorConfig Options #### + +# Indentation and spacing +indent_size = 4 +indent_style = space +tab_width = 4 + +# New line preferences +end_of_line = crlf +insert_final_newline = false + +#### .NET Coding Conventions #### + +# this. and Me. preferences +dotnet_style_qualification_for_event = true:silent +dotnet_style_qualification_for_field = true:silent +dotnet_style_qualification_for_method = true:silent +dotnet_style_qualification_for_property = true:silent + +# Language keywords vs BCL types preferences +dotnet_style_predefined_type_for_locals_parameters_members = true:silent +dotnet_style_predefined_type_for_member_access = true:silent + +# Parentheses preferences +dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent +dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent +dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent +dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent + +# Modifier preferences +dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent + +# Expression-level preferences +csharp_style_deconstructed_variable_declaration = true:suggestion +csharp_style_inlined_variable_declaration = true:silent +csharp_style_throw_expression = true:suggestion +dotnet_style_coalesce_expression = true:suggestion +dotnet_style_collection_initializer = true:suggestion +dotnet_style_explicit_tuple_names = true:suggestion +dotnet_style_null_propagation = true:suggestion +dotnet_style_object_initializer = true:suggestion +dotnet_style_prefer_auto_properties = true:silent +dotnet_style_prefer_conditional_expression_over_assignment = true:silent +dotnet_style_prefer_conditional_expression_over_return = true:silent +dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion +dotnet_style_prefer_inferred_tuple_names = true:suggestion +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion + +# Field preferences +dotnet_style_readonly_field = true:suggestion + +#### C# Coding Conventions #### + +# var preferences +csharp_style_var_elsewhere = true:silent +csharp_style_var_for_built_in_types = true:silent +csharp_style_var_when_type_is_apparent = true:silent + +# Expression-bodied members +csharp_style_expression_bodied_accessors = false:silent +csharp_style_expression_bodied_constructors = false:silent +csharp_style_expression_bodied_indexers = false:silent +csharp_style_expression_bodied_lambdas = true:silent +csharp_style_expression_bodied_methods = false:silent +csharp_style_expression_bodied_operators = false:silent +csharp_style_expression_bodied_properties = false:silent + +# Pattern matching preferences +csharp_style_pattern_matching_over_as_with_null_check = true:silent +csharp_style_pattern_matching_over_is_with_cast_check = true:silent + +# Null-checking preferences +csharp_style_conditional_delegate_call = true:suggestion + +# Modifier preferences +csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async + +# Code-block preferences +csharp_prefer_braces = true:suggestion + +# Expression-level preferences +csharp_prefer_simple_default_expression = true:suggestion +csharp_style_pattern_local_over_anonymous_function = true:suggestion + +#### C# Formatting Rules #### + +# New line preferences +csharp_new_line_before_catch = true +csharp_new_line_before_else = true +csharp_new_line_before_finally = true +csharp_new_line_before_members_in_anonymous_types = true +csharp_new_line_before_members_in_object_initializers = true +csharp_new_line_before_open_brace = all +csharp_new_line_between_query_expression_clauses = true + +# Indentation preferences +csharp_indent_block_contents = true +csharp_indent_braces = false +csharp_indent_case_contents = true +csharp_indent_case_contents_when_block = true +csharp_indent_labels = one_less_than_current +csharp_indent_switch_labels = true + +# Space preferences +csharp_space_after_cast = false +csharp_space_after_colon_in_inheritance_clause = true +csharp_space_after_comma = true +csharp_space_after_dot = false +csharp_space_after_keywords_in_control_flow_statements = true +csharp_space_after_semicolon_in_for_statement = true +csharp_space_around_binary_operators = before_and_after +csharp_space_around_declaration_statements = false +csharp_space_before_colon_in_inheritance_clause = true +csharp_space_before_comma = false +csharp_space_before_dot = false +csharp_space_before_open_square_brackets = false +csharp_space_before_semicolon_in_for_statement = false +csharp_space_between_empty_square_brackets = false +csharp_space_between_method_call_empty_parameter_list_parentheses = false +csharp_space_between_method_call_name_and_opening_parenthesis = false +csharp_space_between_method_call_parameter_list_parentheses = false +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false +csharp_space_between_method_declaration_name_and_open_parenthesis = false +csharp_space_between_method_declaration_parameter_list_parentheses = false +csharp_space_between_parentheses = false +csharp_space_between_square_brackets = false + +# Wrapping preferences +csharp_preserve_single_line_blocks = true +csharp_preserve_single_line_statements = true + + +# Naming Symbols +# constant_fields - Define constant fields +dotnet_naming_symbols.constant_fields.applicable_kinds = field +dotnet_naming_symbols.constant_fields.required_modifiers = const +# non_private_readonly_fields - Define public, internal and protected readonly fields +dotnet_naming_symbols.non_private_readonly_fields.applicable_accessibilities = public, internal, protected +dotnet_naming_symbols.non_private_readonly_fields.applicable_kinds = field +dotnet_naming_symbols.non_private_readonly_fields.required_modifiers = readonly +# static_readonly_fields - Define static and readonly fields +dotnet_naming_symbols.static_readonly_fields.applicable_kinds = field +dotnet_naming_symbols.static_readonly_fields.required_modifiers = static, readonly +# private_readonly_fields - Define private readonly fields +dotnet_naming_symbols.private_readonly_fields.applicable_accessibilities = private +dotnet_naming_symbols.private_readonly_fields.applicable_kinds = field +dotnet_naming_symbols.private_readonly_fields.required_modifiers = readonly +# public_internal_fields - Define public and internal fields +dotnet_naming_symbols.public_internal_protected_fields.applicable_accessibilities = public, internal, protected +dotnet_naming_symbols.public_internal_protected_fields.applicable_kinds = field +# private_protected_fields - Define private and protected fields +dotnet_naming_symbols.private_protected_fields.applicable_accessibilities = private, protected +dotnet_naming_symbols.private_protected_fields.applicable_kinds = field +# public_symbols - Define any public symbol +dotnet_naming_symbols.public_symbols.applicable_accessibilities = public, internal, protected, protected_internal +dotnet_naming_symbols.public_symbols.applicable_kinds = method, property, event, delegate +# parameters - Defines any parameter +dotnet_naming_symbols.parameters.applicable_kinds = parameter +# non_interface_types - Defines class, struct, enum and delegate types +dotnet_naming_symbols.non_interface_types.applicable_kinds = class, struct, enum, delegate +# interface_types - Defines interfaces +dotnet_naming_symbols.interface_types.applicable_kinds = interface + +# Naming Styles +# camel_case - Define the camelCase style +dotnet_naming_style.camel_case.capitalization = camel_case +# pascal_case - Define the Pascal_case style +dotnet_naming_style.pascal_case.capitalization = pascal_case +# first_upper - The first character must start with an upper-case character +dotnet_naming_style.first_upper.capitalization = first_word_upper +# prefix_interface_interface_with_i - Interfaces must be PascalCase and the first character of an interface must be an 'I' +dotnet_naming_style.prefix_interface_interface_with_i.capitalization = pascal_case +dotnet_naming_style.prefix_interface_interface_with_i.required_prefix = I + +# Naming Rules + +# Async +dotnet_naming_rule.async_methods_end_in_async.severity = silent +dotnet_naming_rule.async_methods_end_in_async.symbols = any_async_methods +dotnet_naming_rule.async_methods_end_in_async.style = end_in_async + +dotnet_naming_symbols.any_async_methods.applicable_kinds = method +dotnet_naming_symbols.any_async_methods.applicable_accessibilities = * +dotnet_naming_symbols.any_async_methods.required_modifiers = async + +dotnet_naming_style.end_in_async.required_suffix = Async +dotnet_naming_style.end_in_async.capitalization = pascal_case + +# Constant fields must be PascalCase +dotnet_naming_rule.constant_fields_must_be_pascal_case.severity = silent +dotnet_naming_rule.constant_fields_must_be_pascal_case.symbols = constant_fields +dotnet_naming_rule.constant_fields_must_be_pascal_case.style = pascal_case +# Public, internal and protected readonly fields must be PascalCase +dotnet_naming_rule.non_private_readonly_fields_must_be_pascal_case.severity = silent +dotnet_naming_rule.non_private_readonly_fields_must_be_pascal_case.symbols = non_private_readonly_fields +dotnet_naming_rule.non_private_readonly_fields_must_be_pascal_case.style = pascal_case +# Static readonly fields must be PascalCase +dotnet_naming_rule.static_readonly_fields_must_be_pascal_case.severity = silent +dotnet_naming_rule.static_readonly_fields_must_be_pascal_case.symbols = static_readonly_fields +dotnet_naming_rule.static_readonly_fields_must_be_pascal_case.style = pascal_case +# Private readonly fields must be camelCase +dotnet_naming_rule.private_readonly_fields_must_be_camel_case.severity = silent +dotnet_naming_rule.private_readonly_fields_must_be_camel_case.symbols = private_readonly_fields +dotnet_naming_rule.private_readonly_fields_must_be_camel_case.style = camel_case +# Public and internal fields must be PascalCase +dotnet_naming_rule.public_internal_protected_fields_must_be_pascal_case.severity = silent +dotnet_naming_rule.public_internal_protected_fields_must_be_pascal_case.symbols = public_internal_protected_fields +dotnet_naming_rule.public_internal_protected_fields_must_be_pascal_case.style = pascal_case +# Private and protected fields must be camelCase +dotnet_naming_rule.private_fields_must_be_camel_case.severity = silent +dotnet_naming_rule.private_fields_must_be_camel_case.symbols = private_protected_fields +dotnet_naming_rule.private_fields_must_be_camel_case.style = prefix_private_field_with_underscore +# Public members must be capitalized +dotnet_naming_rule.public_members_must_be_capitalized.severity = silent +dotnet_naming_rule.public_members_must_be_capitalized.symbols = public_symbols +dotnet_naming_rule.public_members_must_be_capitalized.style = first_upper +# Parameters must be camelCase +dotnet_naming_rule.parameters_must_be_camel_case.severity = silent +dotnet_naming_rule.parameters_must_be_camel_case.symbols = parameters +dotnet_naming_rule.parameters_must_be_camel_case.style = camel_case +# Class, struct, enum and delegates must be PascalCase +dotnet_naming_rule.non_interface_types_must_be_pascal_case.severity = silent +dotnet_naming_rule.non_interface_types_must_be_pascal_case.symbols = non_interface_types +dotnet_naming_rule.non_interface_types_must_be_pascal_case.style = pascal_case +# Interfaces must be PascalCase and start with an 'I' +dotnet_naming_rule.interface_types_must_be_prefixed_with_i.severity = silent +dotnet_naming_rule.interface_types_must_be_prefixed_with_i.symbols = interface_types +dotnet_naming_rule.interface_types_must_be_prefixed_with_i.style = prefix_interface_interface_with_i +# prefix_private_field_with_underscore - Private fields must be prefixed with _ +dotnet_naming_style.prefix_private_field_with_underscore.capitalization = camel_case +dotnet_naming_style.prefix_private_field_with_underscore.required_prefix = _ + diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index dd3c9c7257a..d3f9dd4e928 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -3,6 +3,10 @@ PLEASE HELP US PROCESS GITHUB ISSUES FASTER BY PROVIDING THE FOLLOWING INFORMATI ISSUES MISSING IMPORTANT INFORMATION MAY BE CLOSED WITHOUT INVESTIGATION. --> + + + + ## I'm submitting a... diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 0284bbf979e..3dce68fa2f8 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -27,7 +27,7 @@ What kind of change does this PR introduce? Please check if your PR fulfills the following requirements: - [ ] Tested code with current [supported SDKs](../readme.md#supported) -- [ ] Docs have been added/updated which fit [documentation template](https://github.com/windows-toolkit/WindowsCommunityToolkit/blob/master/docs/.template.md). (for bug fixes / features) +- [ ] Pull Request has been submitted to the documentation repository [instructions](..\contributing.md#docs). Link: - [ ] Sample in sample app has been added / updated (for bug fixes / features) - [ ] Icon has been created (if new sample) following the [Thumbnail Style Guide and templates](https://github.com/windows-toolkit/WindowsCommunityToolkit-design-assets) - [ ] Tests for the changes have been added (for bug fixes / features) (if applicable) diff --git a/Directory.Build.props b/Directory.Build.props index a16c8db719d..4f6d23454b8 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -14,9 +14,6 @@ $(MSBuildProjectName.Contains('.Design')) $(MSBuildProjectName.Contains('Test')) $(MSBuildProjectName.Contains('Uwp')) - $(MSBuildProjectName.Contains('Win32')) - $(MSBuildProjectName.Contains('Wpf')) - $(MSBuildProjectName.Contains('Forms')) $(MSBuildProjectName.Contains('Sample')) 17763 16299 @@ -28,54 +25,6 @@ $(MSBuildThisFileDirectory)toolkit.snk - - - - Debug - AnyCPU - 15.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - 10.0.17763.0 - 10.0.17134.0 - - - 512 - true - prompt - 4 - - true - 1591 - Off - bin\$(Platform)\$(Configuration) - true - - - - true - full - $(DefineConstants);DEBUG;TRACE - false - - - true - pdbonly - true - $(DefineConstants);TRACE - - - - @@ -85,7 +34,7 @@ - + true diff --git a/Directory.Build.targets b/Directory.Build.targets index 6fc2390d33a..2f44693b6c2 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -19,21 +19,6 @@ - - - - 10.0.$(DefaultTargetPlatformVersion).0 - 10.0.$(DefaultTargetPlatformMinVersion).0 - - - - $(MSBuildProgramFiles32)\Windows Kits\10\UnionMetadata\$(TargetPlatformMinVersion)\Windows.winmd - $(MSBuildProgramFiles32)\Windows Kits\10\UnionMetadata\$(TargetPlatformVersion)\Windows.winmd - False - - - - diff --git a/Microsoft.Toolkit.Parsers/Markdown/Blocks/YamlHeaderBlock.cs b/Microsoft.Toolkit.Parsers/Markdown/Blocks/YamlHeaderBlock.cs new file mode 100644 index 00000000000..b2ca0c7b238 --- /dev/null +++ b/Microsoft.Toolkit.Parsers/Markdown/Blocks/YamlHeaderBlock.cs @@ -0,0 +1,166 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.Text; +using Microsoft.Toolkit.Parsers.Markdown.Helpers; + +namespace Microsoft.Toolkit.Parsers.Markdown.Blocks +{ + /// + /// Yaml Header. use for blog. + /// e.g. + /// --- + /// title: something + /// tag: something + /// --- + /// + public class YamlHeaderBlock : MarkdownBlock + { + /// + /// Initializes a new instance of the class. + /// + public YamlHeaderBlock() + : base(MarkdownBlockType.YamlHeader) + { + } + + /// + /// Gets or sets yaml header properties + /// + public Dictionary Children { get; set; } + + /// + /// Parse yaml header + /// + /// The markdown text. + /// The location of the first hash character. + /// The location of the end of the line. + /// The location of the actual end of the aprse. + /// Parsed class + internal static YamlHeaderBlock Parse(string markdown, int start, int end, out int realEndIndex) + { + // As yaml header, must be start a line with "---" + // and end with a line "---" + realEndIndex = start; + int lineStart = start; + if (end - start < 3) + { + return null; + } + + if (lineStart != 0 || markdown.Substring(start, 3) != "---") + { + return null; + } + + int startUnderlineIndex = Common.FindNextSingleNewLine(markdown, lineStart, end, out int startOfNextLine); + if (startUnderlineIndex - lineStart != 3) + { + return null; + } + + bool lockedFinalUnderline = false; + + // if current line not contain the ": ", check it is end of parse, if not, exit + // if next line is the end, exit + int pos = startOfNextLine; + List elements = new List(); + while (pos < end) + { + int nextUnderLineIndex = Common.FindNextSingleNewLine(markdown, pos, end, out startOfNextLine); + bool haveSeparator = markdown.Substring(pos, nextUnderLineIndex - pos).Contains(": "); + if (haveSeparator) + { + elements.Add(markdown.Substring(pos, nextUnderLineIndex - pos)); + } + else if (end - pos >= 3 && markdown.Substring(pos, 3) == "---") + { + lockedFinalUnderline = true; + realEndIndex = pos + 3; + break; + } + else if (startOfNextLine == pos + 1) + { + pos = startOfNextLine; + continue; + } + else + { + return null; + } + + pos = startOfNextLine; + } + + // if not have the end, return + if (!lockedFinalUnderline) + { + return null; + } + + // parse yaml header properties + if (elements.Count < 1) + { + return null; + } + + var result = new YamlHeaderBlock(); + var keys = new List(); + var values = new List(); + result.Children = new Dictionary(); + foreach (var item in elements) + { + string[] splits = item.Split(new string[] { ": " }, StringSplitOptions.None); + if (splits.Length < 2) + { + continue; + } + else + { + string key = splits[0]; + string value = splits[1]; + if (key.Trim().Length == 0) + { + continue; + } + + value = string.IsNullOrEmpty(value.Trim()) ? string.Empty : value; + result.Children.Add(key, value); + } + } + + if (result.Children == null) + { + return null; + } + + return result; + } + + /// + /// Converts the object into it's textual representation. + /// + /// The textual representation of this object. + public override string ToString() + { + if (Children == null) + { + return base.ToString(); + } + else + { + string result = string.Empty; + foreach (KeyValuePair item in Children) + { + result += item.Key + ": " + item.Value + "\n"; + } + + result.TrimEnd('\n'); + return result; + } + } + } +} diff --git a/Microsoft.Toolkit.Parsers/Markdown/Enums/InlineParseMethod.cs b/Microsoft.Toolkit.Parsers/Markdown/Enums/InlineParseMethod.cs index db1d3bfc8b5..fa9c9838837 100644 --- a/Microsoft.Toolkit.Parsers/Markdown/Enums/InlineParseMethod.cs +++ b/Microsoft.Toolkit.Parsers/Markdown/Enums/InlineParseMethod.cs @@ -76,6 +76,11 @@ internal enum InlineParseMethod /// Superscript, + /// + /// Sub script element. + /// + Subscript, + /// /// Image element. /// diff --git a/Microsoft.Toolkit.Parsers/Markdown/Enums/MarkdownBlockType.cs b/Microsoft.Toolkit.Parsers/Markdown/Enums/MarkdownBlockType.cs index 32d5c13ff2a..9443cd3e93c 100644 --- a/Microsoft.Toolkit.Parsers/Markdown/Enums/MarkdownBlockType.cs +++ b/Microsoft.Toolkit.Parsers/Markdown/Enums/MarkdownBlockType.cs @@ -57,6 +57,11 @@ public enum MarkdownBlockType /// /// A link block /// - LinkReference + LinkReference, + + /// + /// A Yaml header block + /// + YamlHeader } } \ No newline at end of file diff --git a/Microsoft.Toolkit.Parsers/Markdown/Enums/MarkdownInlineType.cs b/Microsoft.Toolkit.Parsers/Markdown/Enums/MarkdownInlineType.cs index 8d0fa9ee068..673e1c53263 100644 --- a/Microsoft.Toolkit.Parsers/Markdown/Enums/MarkdownInlineType.cs +++ b/Microsoft.Toolkit.Parsers/Markdown/Enums/MarkdownInlineType.cs @@ -54,6 +54,11 @@ public enum MarkdownInlineType /// Superscript, + /// + /// A subscript run + /// + Subscript, + /// /// A code run /// diff --git a/Microsoft.Toolkit.Parsers/Markdown/Helpers/Common.cs b/Microsoft.Toolkit.Parsers/Markdown/Helpers/Common.cs index 80fe0cf7e28..3e74b70d858 100644 --- a/Microsoft.Toolkit.Parsers/Markdown/Helpers/Common.cs +++ b/Microsoft.Toolkit.Parsers/Markdown/Helpers/Common.cs @@ -27,6 +27,7 @@ static Common() CommentInline.AddTripChars(_triggerList); StrikethroughTextInline.AddTripChars(_triggerList); SuperscriptTextInline.AddTripChars(_triggerList); + SubscriptTextInline.AddTripChars(_triggerList); CodeInline.AddTripChars(_triggerList); ImageInline.AddTripChars(_triggerList); EmojiInline.AddTripChars(_triggerList); @@ -183,6 +184,10 @@ private static InlineParseResult FindNextInlineElement(string markdown, int star parseResult = SuperscriptTextInline.Parse(markdown, pos, end); break; + case InlineParseMethod.Subscript: + parseResult = SubscriptTextInline.Parse(markdown, pos, end); + break; + case InlineParseMethod.Code: parseResult = CodeInline.Parse(markdown, pos, end); break; diff --git a/Microsoft.Toolkit.Parsers/Markdown/Inlines/CommentInline.cs b/Microsoft.Toolkit.Parsers/Markdown/Inlines/CommentInline.cs index 01b4bad39a2..082b862889a 100644 --- a/Microsoft.Toolkit.Parsers/Markdown/Inlines/CommentInline.cs +++ b/Microsoft.Toolkit.Parsers/Markdown/Inlines/CommentInline.cs @@ -47,7 +47,6 @@ internal static InlineParseResult Parse(string markdown, int start, int maxEnd) return null; } - // Check the start sequence. string startSequence = markdown.Substring(start); if (!startSequence.StartsWith(" + + The TabView control has multiple uses. + + + It has a lot of versitility out of the box for different scenarios. + + + You can enable drag-and-drop and reorder the tabs too. + + + This tab isn't closable because its IsClosable property is set to False, even when CanCloseTabs is True. + + + + + + + + + + + + + + + + + diff --git a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Twitter Service/TwitterPage.xaml.cs b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Twitter Service/TwitterPage.xaml.cs index 978cc363e1b..1259e763f67 100644 --- a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Twitter Service/TwitterPage.xaml.cs +++ b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Twitter Service/TwitterPage.xaml.cs @@ -78,7 +78,7 @@ private async void ConnectButton_OnClick(object sender, RoutedEventArgs e) if ((ex.Errors?.Errors?.Length > 0) && (ex.Errors.Errors[0].Code == 89)) { await new MessageDialog("Invalid or expired token. Logging out. Re-connect for new token.").ShowAsync(); - TwitterService.Instance.Logout(); + await TwitterService.Instance.LogoutAsync(); return; } else diff --git a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Weibo Service/WeiboPage.xaml.cs b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Weibo Service/WeiboPage.xaml.cs index f3b7032adb4..a5c70ac9e06 100644 --- a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Weibo Service/WeiboPage.xaml.cs +++ b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Weibo Service/WeiboPage.xaml.cs @@ -67,7 +67,7 @@ private async void ConnectButton_OnClick(object sender, RoutedEventArgs e) if (ex.Error.Code == 21332) { await new MessageDialog("Invalid or expired token. Logging out. Re-connect for new token.").ShowAsync(); - WeiboService.Instance.Logout(); + await WeiboService.Instance.LogoutAsync(); return; } else diff --git a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/samples.json b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/samples.json index 768919107c7..fbefd9bd7e3 100644 --- a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/samples.json +++ b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/samples.json @@ -7,290 +7,301 @@ "Name": "TextToolbar", "Type": "TextToolbarPage", "About": "A Toolbar for Editing Text attached to a RichEditBox. It can format RTF and Markdown, or use a Custom Formatter, and specify your own Formatter with Buttons and Actions.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/TextToolbar", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/TextToolbar", "XamlCodeFile": "TextToolbar.bind", "CodeFile": "TextToolbarCode.bind", "Icon": "/SamplePages/TextToolbar/TextToolbar.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/controls/TextToolbar.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/controls/TextToolbar.md" + }, + { + "Name": "TabView", + "Type": "TabViewPage", + "About": "A control for displaying multiple items in the same space and allows a user to easily switch between them.", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/TabView", + "XamlCodeFile": "TabViewXaml.bind", + "Icon": "/SamplePages/TabView/TabView.png", + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/controls/TabView.md" }, { "Name": "DataGrid", "Type": "DataGridPage", "About": "Control that presents data in a customizable table of rows and columns.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/DataGrid", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/DataGrid", "XamlCodeFile": "DataGridCode.bind", "Icon": "/SamplePages/DataGrid/DataGrid.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/controls/DataGrid.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/controls/DataGrid.md" }, { "Name": "Carousel", "Type": "CarouselPage", "About": "Presents items in a carousel control. It reacts to changes in the layout as well as the content so it can adapt to different form factors automatically.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/Carousel", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/Carousel", "XamlCodeFile": "CarouselCode.bind", "Icon": "/SamplePages/Carousel/Carousel.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/controls/Carousel.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/controls/Carousel.md" }, { "Name": "AdaptiveGridView", "Type": "AdaptiveGridViewPage", "About": "Presents items in a evenly-spaced set of columns to fill the total available display space. It reacts to changes in the layout as well as the content so it can adapt to different form factors automatically.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/AdaptiveGridView", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/AdaptiveGridView", "XamlCodeFile": "AdaptiveGridViewCode.bind", "Icon": "/SamplePages/AdaptiveGridView/AdaptiveGridView.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/controls/AdaptiveGridView.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/controls/AdaptiveGridView.md" }, { "Name": "UniformGrid", "Type": "UniformGridPage", "About": "Presents items in a evenly-spaced set of rows or columns to fill the total available display space. It reacts to changes in the layout as well as the content so it can adapt to different form factors automatically.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/UniformGrid", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/UniformGrid", "XamlCodeFile": "UniformGridXaml.bind", "Icon": "/SamplePages/UniformGrid/UniformGrid.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/controls/UniformGrid.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/controls/UniformGrid.md" }, { "Name": "RangeSelector", "Type": "RangeSelectorPage", "About": "The RangeSelector is a \"double slider\" control for range values.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/RangeSelector", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/RangeSelector", "XamlCodeFile": "RangeSelectorCode.bind", "Icon": "/SamplePages/RangeSelector/RangeSelector.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/controls/RangeSelector.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/controls/RangeSelector.md" }, { "Name": "ImageEx", "Type": "ImageExPage", "About": "Images are downloaded asynchronously showing a load indicator. Source images are then stored in the App local cache to preserve resources and load time.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/ImageEx", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/ImageEx", "XamlCodeFile": "ImageExCode.bind", "Icon": "/SamplePages/ImageEx/ImageEx.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/controls/ImageEx.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/controls/ImageEx.md" }, { "Name": "HeaderedTextBlock", "Type": "HeaderedTextBlockPage", "About": "The HeaderedTextBlock control is designed to provide a header for read only text. This control is useful for displaying read only forms.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/HeaderedTextBlock", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/HeaderedTextBlock", "XamlCodeFile": "HeaderedTextBlockCode.bind", "Icon": "/SamplePages/HeaderedTextBlock/HeaderedTextBlock.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/controls/HeaderedTextBlock.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/controls/HeaderedTextBlock.md", + "BadgeUpdateVersionRequired": "DEPRECATED", + "DeprecatedWarning": "The HeaderedTextBlock has been replaced with the HeaderedContentControl and will be removed in a future major release." }, { "Name": "MasterDetailsView", "Type": "MasterDetailsViewPage", "About": "The MasterDetailsView control allows the user to implement the Master/Details design pattern.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/MasterDetailsView", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/MasterDetailsView", "XamlCodeFile": "MasterDetailsView.bind", "CodeFile": "MasterDetailsViewCode.bind", "Icon": "/SamplePages/MasterDetailsView/MasterDetailsView.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/controls/MasterDetailsView.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/controls/MasterDetailsView.md" }, { "Name": "MarkdownTextBlock", "Type": "MarkdownTextBlockPage", "About": "An efficient and extensible control that can parse and render markdown.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/MarkdownTextBlock", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/MarkdownTextBlock", "XamlCodeFile": "MarkdownTextBlock.bind", "CodeFile": "MarkdownTextBlockCode.bind", "Icon": "/SamplePages/MarkdownTextBlock/MarkdownTextBlock.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/controls/MarkdownTextBlock.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/controls/MarkdownTextBlock.md" }, { "Name": "RadialGauge", "Type": "RadialGaugePage", "About": "The radial gauge displays a value within a range, using a needle on a circular face.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/RadialGauge", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/RadialGauge", "XamlCodeFile": "RadialGaugeCode.bind", "Icon": "/SamplePages/RadialGauge/RadialGauge.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/controls/RadialGauge.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/controls/RadialGauge.md" }, { "Name": "RadialProgressBar", "Type": "RadialProgressBarPage", "About": "The radial progress bar displays progress as a circle getting filled.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/RadialProgressBar", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/RadialProgressBar", "XamlCodeFile": "RadialProgressBarCode.bind", "Icon": "/SamplePages/RadialProgressBar/RadialProgressBar.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/controls/RadialProgressBar.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/controls/RadialProgressBar.md" }, { "Name": "RotatorTile", "Type": "RotatorTilePage", "About": "RotatorTile is an ItemsControl that rotates through a set of items one-by-one. It enables you to show multiple items of data in a live-tile like way.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/RotatorTile", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/RotatorTile", "XamlCodeFile": "RotatorTileCode.bind", "Icon": "/SamplePages/RotatorTile/RotatorTile.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/controls/RotatorTile.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/controls/RotatorTile.md" }, { "Name": "BladeView", "Type": "BladePage", "About": "BladeView provides a horizontal collection of blades for master-detail scenarios. The control is based on the experience demonstrated by the Azure Portal.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/BladeView", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/BladeView", "XamlCodeFile": "BladeCode.bind", "Icon": "/SamplePages/BladeView/BladeView.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/controls/BladeView.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/controls/BladeView.md" }, { "Name": "ScrollHeader", "Type": "ScrollHeaderPage", "About": "A UI control that works as a ListView or GridView header control with quick return, sticky and fade behavior.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/ScrollHeader", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/ScrollHeader", "XamlCodeFile": "ScrollHeaderCode.bind", "Icon": "/SamplePages/ScrollHeader/ScrollHeader.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/controls/ScrollHeader.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/controls/ScrollHeader.md" }, { "Name": "GridSplitter", "Type": "GridSplitterPage", "About": "GridSplitter represents the control that redistributes space between columns or rows of a Grid control.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/GridSplitter", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/GridSplitter", "XamlCodeFile": "GridSplitter.bind", "Icon": "/SamplePages/GridSplitter/GridSplitter.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/controls/GridSplitter.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/controls/GridSplitter.md" }, { "Name": "DropShadowPanel", "Type": "DropShadowPanelPage", "About": "DropShadowPanel contol allows the creation of a DropShadow for any Xaml FrameworkElement in markup.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/DropShadowPanel", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/DropShadowPanel", "XamlCodeFile": "DropShadowPanelXaml.bind", "Icon": "/SamplePages/DropShadowPanel/DropShadowPanel.png", "BadgeUpdateVersionRequired": "Anniversary Update required", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/controls/DropShadowPanel.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/controls/DropShadowPanel.md" }, { "Name": "Loading", "Type": "LoadingPage", "About": "LoadingControl helps to show content with animation to the user while the app is doing some calculation.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/Loading", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/Loading", "XamlCodeFile": "LoadingCode.bind", "Icon": "/SamplePages/Loading/Loading.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/controls/Loading.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/controls/Loading.md" }, { "Name": "Expander", "Type": "ExpanderPage", "About": "Expander control allows user to show/hide content based on a boolean state.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/Expander", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/Expander", "XamlCodeFile": "ExpanderXaml.bind", "Icon": "/SamplePages/Expander/Expander.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/controls/Expander.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/controls/Expander.md" }, { "Name": "TileControl", "Type": "TileControlPage", "About": "A ContentControl that show an image repeated many times.The control can be synchronized with a Scrollviewer and animated easily", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/TileControl", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/TileControl", "XamlCodeFile": "TileControl.bind", "Icon": "/SamplePages/TileControl/TileControl.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/controls/TileControl.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/controls/TileControl.md" }, { "Name": "WrapPanel", "Type": "WrapPanelPage", "About": "The WrapPanel Control positions child elements in sequential position from left to right, breaking content to the next line at the edge of the containing box.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/WrapPanel", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/WrapPanel", "XamlCodeFile": "WrapPanel.bind", "Icon": "/SamplePages/WrapPanel/WrapPanel.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/controls/WrapPanel.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/controls/WrapPanel.md" }, { "Name": "OrbitView", "Type": "OrbitViewPage", "About": "The OrbitView Control positions items in a circle around a center element and supports orbits and anchors.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/OrbitView", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/OrbitView", "XamlCodeFile": "OrbitViewXaml.bind", "Icon": "/SamplePages/OrbitView/OrbitView.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/controls/OrbitView.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/controls/OrbitView.md" }, { "Name": "Menu", "Type": "MenuPage", "About": "Represents a Windows menu control that enables you to hierarchically organize elements associated with commands and event handlers.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/Menu", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/Menu", "XamlCodeFile": "Menu.bind", "Icon": "/SamplePages/Menu/Menu.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/controls/Menu.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/controls/Menu.md" }, { "Name": "InAppNotification", "Type": "InAppNotificationPage", "About": "The In App Notification control offers the ability to show local notifications in your application.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/InAppNotification", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/InAppNotification", "XamlCodeFile": "InAppNotificationXaml.bind", "CodeFile": "InAppNotificationCode.bind", "Icon": "/SamplePages/InAppNotification/InAppNotification.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/controls/InAppNotification.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/controls/InAppNotification.md" }, { "Name": "DockPanel", "Type": "DockPanelPage", "About": "Defines an area where you can arrange child elements either horizontally or vertically, relative to each other.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/DockPanel", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/DockPanel", "XamlCodeFile": "DockPanel.bind", "Icon": "/SamplePages/DockPanel/DockPanel.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/controls/DockPanel.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/controls/DockPanel.md" }, { "Name": "HeaderedContentControl", "Type": "HeaderedContentControlPage", "About": "Allows content to be displayed with a specified header.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/HeaderedContentControl", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/HeaderedContentControl", "XamlCodeFile": "HeaderedContentControlXaml.bind", "Icon": "/SamplePages/HeaderedContentControl/HeaderedContentControl.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/controls/HeaderedContentControl.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/controls/HeaderedContentControl.md" }, { "Name": "HeaderedItemsControl", "Type": "HeaderedItemsControlPage", "About": "Allows items to be displayed with a specified header.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/HeaderedItemsControl", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/HeaderedItemsControl", "XamlCodeFile": "HeaderedItemsControlXaml.bind", "Icon": "/SamplePages/HeaderedItemsControl/HeaderedItemsControl.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/controls/HeaderedItemsControl.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/controls/HeaderedItemsControl.md" }, { "Name": "StaggeredPanel", "Type": "StaggeredPanelPage", "About": "The StaggeredPanel allows for layout of items in a column approach where an item will be added to whichever column has used the least amount of space.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/StaggeredPanel", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/StaggeredPanel", "XamlCodeFile": "StaggeredPanel.bind", "Icon": "/SamplePages/StaggeredPanel/StaggeredPanel.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/controls/StaggeredPanel.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/controls/StaggeredPanel.md" }, { "Name": "LayoutTransformControl", "Type": "LayoutTransformControlPage", "About": "Control that implements support for transformations as if applied by LayoutTransform.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/LayoutTransformControl", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/LayoutTransformControl", "XamlCodeFile": "LayoutTransformControlXaml.bind", "Icon": "/SamplePages/LayoutTransformControl/LayoutTransformControl.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/controls/LayoutTransformControl.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/controls/LayoutTransformControl.md" }, { "Name": "CameraPreview", "Type": "CameraPreviewPage", "About": "Allows to easily preview video from available camera frame source groups and also get realtime video frames/ software bitmaps from the selected source.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/CameraPreview", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/CameraPreview", "XamlCodeFile": "CameraPreviewXaml.bind", "CodeFile": "CameraPreviewCode.bind", "Icon": "/SamplePages/CameraPreview/CameraPreview.png", "BadgeUpdateVersionRequired": "April 2018 update required", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/controls/CameraPreview.md", + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/controls/CameraPreview.md", "ApiCheck": "Windows.Devices.Input.Preview.GazeInputSourcePreview" // check for April update }, { "Name": "InfiniteCanvas", "Type": "InfiniteCanvasPage", "About": "InfiniteCanvas is a canvas that supports Infinite Scrolling, Ink, Text, Format Text, Zoom in/out, Redo, Undo, Export canvas data, Import canvas data.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/InfiniteCanvas", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/InfiniteCanvas", "XamlCodeFile": "InfiniteCanvas.bind", "Icon": "/SamplePages/InfiniteCanvas/InfiniteCanvas.png", "ApiCheck": "Windows.UI.Xaml.Controls.ColorPicker", "BadgeUpdateVersionRequired": "Fall Creators Update required", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/controls/InfiniteCanvas.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/controls/InfiniteCanvas.md" } ] }, @@ -302,63 +313,63 @@ "Name": "Fade", "Type": "FadeBehaviorPage", "About": "Opacity of XAML elements using composition", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors", "CodeFile": "FadeBehaviorCode.bind", "XamlCodeFile": "FadeBehaviorXaml.bind", "Icon": "/SamplePages/Fade/FadeBehavior.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/animations/Fade.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/animations/Fade.md" }, { "Name": "Scale", "Type": "ScaleBehaviorPage", "About": "Scale of XAML elements using composition", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors", "CodeFile": "ScaleBehaviorCode.bind", "XamlCodeFile": "ScaleBehaviorXaml.bind", "Icon": "/SamplePages/Scale/scaleBehavior.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/animations/Scale.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/animations/Scale.md" }, { "Name": "Offset", "Type": "OffsetBehaviorPage", "About": "Offset of XAML elements using composition", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors", "CodeFile": "OffsetBehaviorCode.bind", "XamlCodeFile": "OffsetBehaviorXaml.bind", "Icon": "/SamplePages/Offset/offsetBehavior.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/animations/Offset.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/animations/Offset.md" }, { "Name": "Rotate", "Type": "RotateBehaviorPage", "About": "Rotation on XAML elements using composition", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors", "CodeFile": "RotateBehaviorCode.bind", "XamlCodeFile": "RotateBehaviorXaml.bind", "Icon": "/SamplePages/Rotate/rotateBehavior.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/animations/Rotate.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/animations/Rotate.md" }, { "Name": "Blur", "Type": "BlurBehaviorPage", "About": "Blur XAML elements using composition", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors", "CodeFile": "BlurBehaviorCode.bind", "XamlCodeFile": "BlurBehaviorXaml.bind", "Icon": "/SamplePages/Blur/blurBehavior.png", "BadgeUpdateVersionRequired": "Anniversary Update required", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/animations/Blur.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/animations/Blur.md" }, { "Name": "Saturation", "Type": "SaturationBehaviorPage", "About": "Saturate XAML elements using composition", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors", "CodeFile": "SaturationBehaviorCode.bind", "XamlCodeFile": "SaturationBehaviorXaml.bind", "Icon": "/SamplePages/Saturation/saturationBehavior.png", "BadgeUpdateVersionRequired": "Anniversary Update required", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/animations/Saturation.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/animations/Saturation.md" }, { "Name": "Light", @@ -366,99 +377,106 @@ "About": "The Light effect will be removed in a future major release", "BadgeUpdateVersionRequired": "DEPRECATED", "DeprecatedWarning": "The Light effect will be removed in a future major release", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors", "CodeFile": "LightBehaviorCode.bind", "XamlCodeFile": "LightBehaviorXaml.bind", "Icon": "/SamplePages/Light/LightBehavior.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/animations/Light.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/animations/Light.md" }, { "Name": "FadeHeader", "Type": "FadeHeaderBehaviorPage", "About": "Fade ListView and GridView Headers", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors", "CodeFile": "FadeHeaderBehaviorCode.bind", "XamlCodeFile": "FadeHeaderBehaviorXaml.bind", "Icon": "/SamplePages/FadeHeader/FadeHeaderBehavior.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/animations/FadeHeader.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/animations/FadeHeader.md" }, { "Name": "ReorderGridAnimation", "Type": "ReorderGridPage", "About": "Animates items of a grid when the size changes", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Animations", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Animations", "XamlCodeFile": "ReorderGrid.bind", "Icon": "/SamplePages/ReorderGridAnimation/ReorderGrid.png", "BadgeUpdateVersionRequired": "Anniversary Update required", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/animations/ReorderGrid.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/animations/ReorderGrid.md" }, { "Name": "Implicit Animations", "Type": "ImplicitAnimationsPage", "About": "Attached properties to enable Implicit animations (including Show and Hide animations) through XAML", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Animations", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Animations", "Icon": "/SamplePages/Implicit Animations/ImplicitAnimations.png", "XamlCodeFile": "ImplicitAnimationsCode.bind", "BadgeUpdateVersionRequired": "Creators Update required", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/animations/ImplicitAnimations.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/animations/ImplicitAnimations.md" }, { "Name": "Connected Animations", "Type": "ConnectedAnimationsPage", "About": "Attached properties to enable Connected animations through XAML", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Animations/ConnectedAnimations", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Animations/ConnectedAnimations", "XamlCodeFile": "ConnectedAnimationsCode.bind", "DisableXamlEditorRendering": true, "Icon": "/SamplePages/Connected Animations/ConnectedAnimations.png", "BadgeUpdateVersionRequired": "Creators Update required", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/animations/ConnectedAnimations.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/animations/ConnectedAnimations.md" } ] }, { - "Name": "Win32 Controls", + "Name": "WPF and WinForms Controls", "Samples": [ { "Name": "WindowsXamlHost", "About": "This guide helps you add UWP XAML controls to your WPF", "Icon": "/Assets/Helpers.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/controls/wpf-winforms/WindowsXamlHost.md", - "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Win32" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/controls/wpf-winforms/WindowsXamlHost.md", + "CodeUrl": "https://github.com/windows-toolkit/Microsoft.Toolkit.Win32" }, { "Name": "WebView", "About": "The Windows Community Toolkit provides a version of the UWP web view control that can be used in WPF and Windows Forms applications. This control embeds a view into your application that renders web content using the Microsoft Edge rendering engine", "Icon": "/Assets/Helpers.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/controls/wpf-winforms/WebView.md", - "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Win32" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/controls/wpf-winforms/WebView.md", + "CodeUrl": "https://github.com/windows-toolkit/Microsoft.Toolkit.Win32" }, { "Name": "WebViewCompatible", "About": "The Windows Community Toolkit provides a version of the UWP web view control that can be used in WPF and Windows Forms applications. This control embeds a view into your application that renders web content in one of two ways. For client environments that support the WebViewControl (Windows 10), that implementation is used. For legacy systems, System.Windows.Controls.WebBrowser implements the view", "Icon": "/Assets/Helpers.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/controls/wpf-winforms/WebViewCompatible.md", - "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Win32" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/controls/wpf-winforms/WebViewCompatible.md", + "CodeUrl": "https://github.com/windows-toolkit/Microsoft.Toolkit.Win32" }, { "Name": "InkCanvas", "About": "This control is a wrapper to enable use of the UWP InkCanvas control in Windows Forms or WPF", "Icon": "/Assets/Helpers.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/controls/wpf-winforms/InkCanvas.md", - "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Win32" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/controls/wpf-winforms/InkCanvas.md", + "CodeUrl": "https://github.com/windows-toolkit/Microsoft.Toolkit.Win32" }, { "Name": "InkToolbar", "About": "This control is a wrapper to enable use of the UWP InkToolbar control in Windows Forms or WPF", "Icon": "/Assets/Helpers.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/controls/wpf-winforms/InkToolbar.md", - "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Win32" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/controls/wpf-winforms/InkToolbar.md", + "CodeUrl": "https://github.com/windows-toolkit/Microsoft.Toolkit.Win32" }, { "Name": "MediaPlayerElement", "About": "This control is a wrapper to enable use of the UWP MediaPlayerElement control in Windows Forms or WPF", "Icon": "/Assets/Helpers.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/controls/wpf-winforms/MediaPlayerElement.md", - "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Win32" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/controls/wpf-winforms/MediaPlayerElement.md", + "CodeUrl": "https://github.com/windows-toolkit/Microsoft.Toolkit.Win32" + }, + { + "Name": "MapControl", + "About": "This control is a wrapper to enable use of the UWP MapControl control in Windows Forms or WPF", + "Icon": "/Assets/Helpers.png", + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/controls/wpf-winforms/MapControl.md", + "CodeUrl": "https://github.com/windows-toolkit/Microsoft.Toolkit.Win32" } ] }, @@ -470,56 +488,56 @@ "Name": "AadLogin", "Type": "AadLoginPage", "About": "The AadLogin Control leverages existing .NET login libraries to support basic AAD sign-in processes for Microsoft Graph.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls.Graph/AadLogin", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls.Graph/AadLogin", "CodeFile": "AadLoginCode.bind", "XamlCodeFile": "AadLoginXaml.bind", "Icon": "/SamplePages/AadLogin/AadLogin.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/graph/AadLogin.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/graph/AadLogin.md" }, { "Name": "ProfileCard", "Type": "ProfileCardPage", "About": "The ProfileCard Control is a simple way to display a user in multiple different formats and mixes of name/image/e-mail.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls.Graph/ProfileCard", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls.Graph/ProfileCard", "XamlCodeFile": "ProfileCardXaml.bind", "Icon": "/SamplePages/ProfileCard/ProfileCard.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/graph/ProfileCard.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/graph/ProfileCard.md" }, { "Name": "PeoplePicker", "Type": "PeoplePickerPage", "About": "The PeoplePicker Control is a simple control that allows for selection of one or more users from an organizational AD.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls.Graph/PeoplePicker", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls.Graph/PeoplePicker", "XamlCodeFile": "PeoplePickerXaml.bind", "Icon": "/SamplePages/PeoplePicker/PeoplePicker.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/graph/PeoplePicker.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/graph/PeoplePicker.md" }, { "Name": "SharePointFileList", "Type": "SharePointFileListPage", "About": "The SharePointFileList Control displays a simple list of SharePoint Files.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls.Graph/SharePointFileList", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls.Graph/SharePointFileList", "CodeFile": "SharePointFileListCode.bind", "XamlCodeFile": "SharePointFileListXaml.bind", "Icon": "/SamplePages/SharePointFileList/SharePointFileList.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/graph/SharePointFileList.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/graph/SharePointFileList.md" }, { "Name": "PowerBIEmbedded", "Type": "PowerBIEmbeddedPage", "About": "The PowerBI embedded control is a simple wrapper to an IFRAME for a PowerBI embed.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls.Graph/PowerBIEmbedded", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls.Graph/PowerBIEmbedded", "Icon": "/SamplePages/PowerBIEmbedded/PowerBIEmbedded.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/graph/PowerBIEmbedded.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/graph/PowerBIEmbedded.md" }, { "Name": "PlannerTaskList", "Type": "PlannerTaskListPage", "About": "The PlannerTaskList Control displays a simple list of Planner tasks.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls.Graph/PlannerTaskList", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls.Graph/PlannerTaskList", "XamlCodeFile": "PlannerTaskListXaml.bind", "Icon": "/SamplePages/PlannerTaskList/PlannerTaskList.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/graph/PlannerTaskList.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/graph/PlannerTaskList.md" } ] }, @@ -531,64 +549,64 @@ "Name": "Facebook Service", "Type": "FacebookPage", "About": "The Facebook Service allows you to retrieve or publish data to Facebook graph.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.Services/Services/Facebook", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.Services/Services/Facebook", "CodeFile": "FacebookCode.bind", "Icon": "/SamplePages/Facebook Service/FacebookLogo.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/services/Facebook.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/services/Facebook.md" }, { "Name": "Twitter Service", "Type": "TwitterPage", "About": "The Twitter Service allows you to retrieve or publish data to Twitter.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.Services/Services/Twitter", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Services/Services/Twitter", "CodeFile": "TwitterCode.bind", "Icon": "/SamplePages/Twitter Service/TwitterLogo.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/services/Twitter.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/services/Twitter.md" }, { "Name": "Weibo Service", "Type": "WeiboPage", "About": "The Weibo Service allows you to retrieve or publish data to Weibo.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.Services/Services/Weibo", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Services/Services/Weibo", "CodeFile": "WeiboCode.bind", "Icon": "/SamplePages/Weibo Service/WeiboLogo.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/services/Weibo.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/services/Weibo.md" }, { "Name": "Microsoft Graph Service", "Type": "MicrosoftGraphPage", "About": "The Microsoft Graph service allows you to connect to Microsoft Graph Office 365 API.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.Services/Services/MicrosoftGraph", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Services/Services/MicrosoftGraph", "CodeFile": "MicrosoftGraphCode.bind", "Icon": "/SamplePages/Microsoft Graph Service/mslogo.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/services/MicrosoftGraph.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/services/MicrosoftGraph.md" }, { "Name": "OneDrive Service", "Type": "OneDrivePage", "About": "The OneDrive service allows you to get your files from OneDrive using an Microsoft Account or OneDrive For Business using an Office 365 account", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.Services/Services/OneDrive/", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Services/Services/OneDrive/", "CodeFile": "OneDriveCode.bind", "Icon": "/SamplePages/OneDrive Service/OneDriveLogo.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/services/OneDrive.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/services/OneDrive.md" }, { "Name": "LinkedIn Service", "Type": "LinkedInPage", "About": "The LinkedIn service allows you to connect to retrieve or publish data to LinkedIn.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.Services/Services/LinkedIn/", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Services/Services/LinkedIn/", "CodeFile": "LinkedInCode.bind", "Icon": "/SamplePages/LinkedIn Service/LinkedInLogo.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/services/Linkedin.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/services/Linkedin.md" }, { "Name": "Microsoft Translator Service", "Type": "MicrosoftTranslatorPage", "About": "The Microsoft Translator Service allows you to translate text into many languages.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.Services/Services/MicrosoftTranslator", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Services/Services/MicrosoftTranslator", "CodeFile": "MicrosoftTranslatorCode.bind", "Icon": "/SamplePages/Microsoft Translator Service/TranslatorService.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/services/MicrosoftTranslator.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/services/MicrosoftTranslator.md" } ] }, @@ -600,31 +618,31 @@ "Name": "LiveTile", "Type": "LiveTilePage", "About": "This shows how to update a Live Tile with a rich Adaptive notification.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.Notifications", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.Notifications", "CodeFile": "LiveTileCode.bind", "JavaScriptCodeFile": "LiveTileCodeJavaScript.bind", "Icon": "/SamplePages/LiveTile/LiveTile.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/notifications/NotificationsOverview.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/notifications/NotificationsOverview.md" }, { "Name": "Toast", "Type": "ToastPage", "About": "This shows how to send a Toast notification.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.Notifications", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.Notifications", "CodeFile": "ToastCode.bind", "JavaScriptCodeFile": "ToastCodeJavaScript.bind", "Icon": "/SamplePages/Toast/Toast.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/notifications/NotificationsOverview.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/notifications/NotificationsOverview.md" }, { "Name": "WeatherLiveTileAndToast", "Type": "WeatherLiveTileAndToastPage", "About": "This shows how to send a Weather Live Tile and Toast notification, displaying the forecast.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.Notifications", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.Notifications", "CodeFile": "WeatherLiveTileAndToastCode.bind", "JavaScriptCodeFile": "WeatherLiveTileAndToastCodeJavaScript.bind", "Icon": "/SamplePages/WeatherLiveTileAndToast/WeatherLiveTileAndToast.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/notifications/NotificationsOverview.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/notifications/NotificationsOverview.md" } ] }, @@ -636,111 +654,111 @@ "Name": "ImageCache", "Type": "ImageCachePage", "About": "The ImageCache allows persistence of images with an option to use in-memory storage.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/blob/master/Microsoft.Toolkit.Uwp.UI/Cache/ImageCache.cs", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/blob/master/Microsoft.Toolkit.Uwp.UI/Cache/ImageCache.cs", "CodeFile": "ImageCacheCode.bind", "XamlCodeFile": "ImageCacheXaml.bind", "Icon": "/SamplePages/ImageCache/ImageCache.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/helpers/ImageCache.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/helpers/ImageCache.md" }, { "Name": "Object Storage", "Type": "ObjectStoragePage", "About": "The Object Storage helper allows you to easily read and save objects in your application, both locally or on every device (roaming).", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp/Helpers/ObjectStorage", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp/Helpers/ObjectStorage", "CodeFile": "ObjectStorageCode.bind", "Icon": "/SamplePages/Object Storage/ObjectStorage.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/helpers/ObjectStorage.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/helpers/ObjectStorage.md" }, { "Name": "Incremental Loading Collection", "Type": "IncrementalLoadingCollectionPage", "About": "Allows to create collections that can be loaded incrementally, as user requests more items in the view. This type of collections can be bound to controls like GridView and ListView.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp/IncrementalLoadingCollection", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp/IncrementalLoadingCollection", "CodeFile": "IncrementalLoadingCollectionCode.bind", "Icon": "/SamplePages/Incremental Loading Collection/icon.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/helpers/IncrementalLoadingCollection.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/helpers/IncrementalLoadingCollection.md" }, { "Name": "BackgroundTaskHelper", "Type": "BackgroundTaskHelperPage", "About": "Allows easy registration and maintenance of background task", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/blob/master/Microsoft.Toolkit.Uwp/Helpers/BackgroundTaskHelper.cs", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/blob/master/Microsoft.Toolkit.Uwp/Helpers/BackgroundTaskHelper.cs", "CodeFile": "BackgroundTaskHelperCode.bind", "Icon": "/Assets/Helpers.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/helpers/BackgroundTaskHelper.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/helpers/BackgroundTaskHelper.md" }, { "Name": "NetworkHelper", "Type": "NetworkHelperPage", "About": "The NetworkHelper class is used to determine whether the app has Internet, and if it is on a metered Internet connection", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.Connectivity/Network", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.Connectivity/Network", "CodeFile": "NetworkHelperCode.bind", "Icon": "/SamplePages/NetworkHelper/NetworkHelper.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/helpers/NetworkHelper.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/helpers/NetworkHelper.md" }, { "Name": "BluetoothLEHelper", "Type": "BluetoothLEHelperPage", "About": "The Bluetooth LE helper class is used to connect and interact with bluetooth LE devices.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.Connectivity/BluetoothLEHelper", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.Connectivity/BluetoothLEHelper", "CodeFile": "BluetoothLEHelperCode.bind", "Icon": "/SamplePages/BluetoothLEHelper/BluetoothLEHelper.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/helpers/BluetoothLEHelper.md", + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/helpers/BluetoothLEHelper.md", "BadgeUpdateVersionRequired": "Creators Update required" }, { "Name": "SystemInformation", "Type": "SystemInformationPage", "About": "The SystemInformation class provides easy access to some of system/app/device information", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp/Helpers/SystemInformation.cs", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp/Helpers/SystemInformation.cs", "CodeFile": "SystemInformationCode.bind", "Icon": "/SamplePages/SystemInformation/SystemInformation.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/helpers/SystemInformation.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/helpers/SystemInformation.md" }, { "Name": "PrintHelper", "Type": "PrintHelperPage", "About": "Allows to easily print XAML controls", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp/Helpers/PrintHelper", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp/Helpers/PrintHelper", "CodeFile": "PrintHelperCode.bind", "XamlCodeFile": "PrintHelperXaml.bind", "Icon": "/SamplePages/PrintHelper/PrintHelper.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/helpers/PrintHelper.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/helpers/PrintHelper.md" }, { "Name": "DispatcherHelper", "Type": "DispatcherHelperPage", "About": "Allows easy interaction with Windows Runtime core message dispatcher for multi-threaded scenario (I.E: Run code on UI thread). ", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/blob/master/Microsoft.Toolkit.Uwp/Helpers/DispatcherHelper.cs", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/blob/master/Microsoft.Toolkit.Uwp/Helpers/DispatcherHelper.cs", "CodeFile": "DispatcherHelperCode.bind", "Icon": "/Assets/Helpers.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/helpers/DispatcherHelper.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/helpers/DispatcherHelper.md" }, { "Name": "AdvancedCollectionView", "Type": "AdvancedCollectionViewPage", "About": "Allows you to easily sort and filter your collections before displaying them.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI/AdvancedCollectionView", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI/AdvancedCollectionView", "CodeFile": "AdvancedCollectionView.bind", "Icon": "/SamplePages/AdvancedCollectionView/AdvancedCollectionView.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/helpers/AdvancedCollectionView.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/helpers/AdvancedCollectionView.md" }, { "Name": "CameraHelper", "Type": "CameraHelperPage", "About": "Allows to easily get camera frame sources available for media capture to preview video and get real time video frames/software bitmaps.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/blob/master/Microsoft.Toolkit.Uwp/Helpers/CameraHelper/CameraHelper.cs", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/blob/master/Microsoft.Toolkit.Uwp/Helpers/CameraHelper/CameraHelper.cs", "CodeFile": "CameraHelperCode.bind", "Icon": "/SamplePages/CameraHelper/CameraHelper.png", "BadgeUpdateVersionRequired": "April 2018 update required", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/helpers/CameraHelper.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/helpers/CameraHelper.md" }, { "Name": "ThemeListener", "Type": "ThemeListenerPage", "About": "The ThemeListener allows you to keep track of changes to the System Theme.", "Icon": "/Assets/Helpers.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/helpers/ThemeListener.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/helpers/ThemeListener.md" } ] }, @@ -752,78 +770,78 @@ "Name": "BackdropBlurBrush", "Type": "BackdropBlurBrushPage", "About": "Brush which fills the contents with a blurred version of whatever's behind it.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI/Brushes/BackdropBlurBrush.cs", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI/Media/BackdropBlurBrush.cs", "XamlCodeFile": "BackdropBlurBrushXaml.bind", "Icon": "/SamplePages/BackdropBlurBrush/BackdropBlurBrush.png", "BadgeUpdateVersionRequired": "Creators Update required", "ApiCheck": "Windows.UI.Xaml.Media.XamlCompositionBrushBase", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/brushes/BackdropBlurBrush.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/brushes/BackdropBlurBrush.md" }, { "Name": "BackdropInvertBrush", "Type": "BackdropInvertBrushPage", "About": "Brush which fills the contents with an inverted version of whatever's behind it.", - "CodeUrl": "https://github.com/Microsoft/UWPCommunitToolkit/tree/master/Microsoft.Toolkit.Uwp.UI/Brushes/BackdropInvertBrush.cs", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI/Media/BackdropInvertBrush.cs", "XamlCodeFile": "BackdropInvertBrushXaml.bind", "Icon": "/SamplePages/BackdropInvertBrush/BackdropInvertBrush.png", "BadgeUpdateVersionRequired": "Creators Update required", "ApiCheck": "Windows.UI.Xaml.Media.XamlCompositionBrushBase", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/brushes/BackdropInvertBrush.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/brushes/BackdropInvertBrush.md" }, { "Name": "BackdropGammaTransferBrush", "Type": "BackdropGammaTransferBrushPage", "About": "Brush which fills the contents with a gamma modified version of whatever's behind it.", - "CodeUrl": "https://github.com/Microsoft/UWPCommunitToolkit/tree/master/Microsoft.Toolkit.Uwp.UI/Brushes/BackdropGammaTransferBrush.cs", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI/Media/BackdropGammaTransferBrush.cs", "XamlCodeFile": "BackdropGammaTransferBrushXaml.bind", "Icon": "/SamplePages/BackdropGammaTransferBrush/BackdropGammaTransferBrush.png", "BadgeUpdateVersionRequired": "Creators Update required", "ApiCheck": "Windows.UI.Xaml.Media.XamlCompositionBrushBase", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/brushes/BackdropGammaTransferBrush.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/brushes/BackdropGammaTransferBrush.md" }, { "Name": "BackdropSaturationBrush", "Type": "BackdropSaturationBrushPage", "About": "Brush which applies a Saturation effect to whatever's behind it.", - "CodeUrl": "https://github.com/Microsoft/UWPCommunitToolkit/tree/master/Microsoft.Toolkit.Uwp.UI/Brushes/BackdropSaturationBrush.cs", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI/Media/BackdropSaturationBrush.cs", "XamlCodeFile": "BackdropSaturationBrushXaml.bind", "Icon": "/SamplePages/BackdropSaturationBrush/BackdropSaturationBrush.png", "BadgeUpdateVersionRequired": "Creators Update required", "ApiCheck": "Windows.UI.Xaml.Media.XamlCompositionBrushBase", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/brushes/BackdropSaturationBrush.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/brushes/BackdropSaturationBrush.md" }, { "Name": "BackdropSepiaBrush", "Type": "BackdropSepiaBrushPage", "About": "Brush which applies a Sepia effect to whatever's behind it.", - "CodeUrl": "https://github.com/Microsoft/UWPCommunitToolkit/tree/master/Microsoft.Toolkit.Uwp.UI/Brushes/BackdropSepiaBrush.cs", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI/Media/BackdropSepiaBrush.cs", "XamlCodeFile": "BackdropSepiaBrushXaml.bind", "Icon": "/SamplePages/BackdropSepiaBrush/BackdropSepiaBrush.png", "BadgeUpdateVersionRequired": "Creators Update required", "ApiCheck": "Windows.UI.Xaml.Media.XamlCompositionBrushBase", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/brushes/BackdropSepiaBrush.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/brushes/BackdropSepiaBrush.md" }, { "Name": "ImageBlendBrush", "Type": "ImageBlendBrushPage", "About": "Brush which applies a blending effect a given image from whatever's behind it.", - "CodeUrl": "https://github.com/Microsoft/UWPCommunitToolkit/tree/master/Microsoft.Toolkit.Uwp.UI/Brushes/ImageBlendBrush.cs", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI/Media/ImageBlendBrush.cs", "XamlCodeFile": "ImageBlendBrushXaml.bind", "Icon": "/SamplePages/ImageBlendBrush/ImageBlendBrush.png", "BadgeUpdateVersionRequired": "Creators Update required", "ApiCheck": "Windows.UI.Xaml.Media.XamlCompositionBrushBase", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/brushes/ImageBlendBrush.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/brushes/ImageBlendBrush.md" }, { "Name": "RadialGradientBrush", "Type": "RadialGradientBrushPage", "About": "A composition brush which creates a radial gradient effect.", - "CodeUrl": "https://github.com/Microsoft/UWPCommunitToolkit/tree/master/Microsoft.Toolkit.Uwp.UI/Brushes/RadialGradientBrush.cs", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI/Media/RadialGradientBrush.cs", "XamlCodeFile": "RadialGradientBrushXaml.bind", "Icon": "/SamplePages/RadialGradientBrush/RadialGradientBrush.png", "BadgeUpdateVersionRequired": "Creators Update required", "ApiCheck": "Windows.UI.Xaml.Media.XamlCompositionBrushBase", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/brushes/RadialGradientBrush.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/brushes/RadialGradientBrush.md" } ] }, @@ -835,92 +853,100 @@ "Name": "ListViewExtensions", "Type": "ListViewExtensionsPage", "About": "Extensions for all controls that inherit from ListViewBase like ListView.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI/Extensions/ListViewExtensions", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI/Extensions/ListViewExtensions", "XamlCodeFile": "ListViewExtensionsCode.bind", "Icon": "/Assets/Helpers.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/extensions/ListViewExtensions.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/extensions/ListViewExtensions.md" }, { "Name": "ViewExtensions", "Type": "ViewExtensionsPage", "About": "View extensions to set StatusBar and TitleBar properties.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI/Extensions", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI/Extensions", "XamlCodeFile": "ViewExtensionsCode.bind", "Icon": "/SamplePages/ViewExtensions/ViewExtensions.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/extensions/ViewExtensions.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/extensions/ViewExtensions.md" }, { "Name": "TextBoxMask", "Type": "TextBoxMaskPage", "About": "TextBox Mask property allows a user to more easily enter fixed width text in TextBox control where you would like them to enter the data in a certain format", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI/Extensions/TextBoxMask", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI/Extensions/TextBoxMask", "XamlCodeFile": "TextBoxMask.bind", "Icon": "/SamplePages/TextBoxMask/TextBoxMask.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/extensions/TextBoxMask.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/extensions/TextBoxMask.md" }, { "Name": "Mouse", "Type": "MouseCursorPage", "About": "Mouse.Cursor attached property enables you to easily change the mouse cursor over specific Framework elements.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI/Extensions/Mouse", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI/Extensions/Mouse", "XamlCodeFile": "MouseCursorPage.bind", "Icon": "/SamplePages/Mouse/MouseCursor.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/extensions/MouseCursor.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/extensions/MouseCursor.md" }, { "Name": "TextBoxRegex", "Type": "TextBoxRegexPage", "About": "TextBoxRegex helps developer to validate a TextBox with a regular expression using the Regex property.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI/Extensions/TextBoxRegEx", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI/Extensions/TextBoxRegEx", "XamlCodeFile": "TextBoxRegex.bind", "Icon": "/SamplePages/TextBoxRegex/TextBoxRegex.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/extensions/TextBoxRegex.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/extensions/TextBoxRegex.md" }, { "Name": "SurfaceDialTextbox", "Type": "SurfaceDialTextboxPage", "About": "Enables support for Surface Dial on any given Textbox. Rotate the Dial to change the numeric value of the Textbox.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI/Extensions/SurfaceDialTextbox", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI/Extensions/SurfaceDialTextbox", "XamlCodeFile": "SurfaceDialTextboxCode.bind", "Icon": "/SamplePages/SurfaceDialTextbox/SurfaceDialTextbox.png", "BadgeUpdateVersionRequired": "Anniversary Update required", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/extensions/SurfaceDialTextboxHelper.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/extensions/SurfaceDialTextboxHelper.md" }, { "Name": "Visual Extensions", "Type": "VisualExtensionsPage", "About": "Attached properties to modify object visual properties through XAML", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI/Extensions/Visual", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI/Extensions/Visual", "XamlCodeFile": "VisualExtensionsCode.bind", "Icon": "/SamplePages/Visual Extensions/VisualExtensions.png", "BadgeUpdateVersionRequired": "Creators Update required", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/extensions/VisualExtensions.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/extensions/VisualExtensions.md" }, { "Name": "FrameworkElementExtensions", "Type": "FrameworkElementExtensionsPage", "About": "Extensions for all the FrameworkElement controls.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI/Extensions/FrameworkElement", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI/Extensions/FrameworkElement", "XamlCodeFile": "FrameworkElementExtensionsCode.bind", "Icon": "/Assets/Helpers.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/extensions/FrameworkElementExtensions.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/extensions/FrameworkElementExtensions.md" }, { "Name": "StringExtensions", "Type": "StringExtensionsPage", "About": "String Extensions to validate strings", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit/Extensions", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit/Extensions", "Icon": "/Assets/Helpers.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/extensions/StringExtensions.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/extensions/StringExtensions.md" }, { "Name": "ScrollViewerExtensions", "Type": "ScrollViewerExtensionsPage", "About": "Extensions for all controls that contain a ScrollViewer like ListView.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI/Extensions/ScrollViewer", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI/Extensions/ScrollViewer", "XamlCodeFile": "ScrollViewerExtensionsCode.bind", "Icon": "/Assets/Helpers.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/extensions/ScrollViewerExtensions.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/extensions/ScrollViewerExtensions.md" + }, + { + "Name": "OnDevice", + "Type": "OnDevicePage", + "About": "The OnDevice markup extension allows you to customize UI appearance on a per-DeviceFamily basis.", + "Icon": "/SamplePages/OnDevice/OnDevice.png", + "XamlCodeFile": "OnDeviceXaml.bind", + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/extensions/OnDeviceMarkup.md" } ] }, @@ -933,14 +959,14 @@ "Type": "MarkdownParserPage", "About": "The Markdown Parser allows you to parse a Markdown String into a Markdown Document, and then Render it with a Markdown Renderer.", "Icon": "/Assets/Helpers.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/parsers/MarkdownParser.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/parsers/MarkdownParser.md" }, { "Name": "RSS Parser", "Type": "RssParserPage", "About": "The RSS Parser allows you to parse an RSS content String into RSS Schema.", "Icon": "/Assets/Helpers.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/parsers/RssParser.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/parsers/RssParser.md" } ] }, @@ -952,26 +978,26 @@ "Name": "AlignmentGrid", "Type": "AlignmentGridPage", "About": "AlignmentGrid is used to display a grid to help aligning controls.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.DeveloperTools/AlignmentGrid", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.DeveloperTools/AlignmentGrid", "XamlCodeFile": "AlignmentGridXaml.bind", "Icon": "/SamplePages/AlignmentGrid/AlignmentGrid.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/developer-tools/AlignmentGrid.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/developer-tools/AlignmentGrid.md" }, { "Name": "FocusTracker", "Type": "FocusTrackerPage", "About": "FocusTracker can be used to display information about the current focused XAML element.", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.DeveloperTools/FocusTracker", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.DeveloperTools/FocusTracker", "XamlCodeFile": "FocusTrackerXaml.bind", "Icon": "/SamplePages/FocusTracker/FocusTracker.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/developer-tools/FocusTracker.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/developer-tools/FocusTracker.md" }, { "Name": "PlatformSpecificAnalyzer", "About": "Platform Specific Analyzer is a Roslyn analyzer that analyzes and suggests code fixes to ensure that any version / platform specific API are guarded by correct runtime checks", "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.PlatformSpecificAnalyzer", "Icon": "/Assets/Helpers.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/platform-specific/PlatformSpecificAnalyzer.md" + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/platform-specific/PlatformSpecificAnalyzer.md" } ] }, @@ -986,14 +1012,14 @@ "XamlCodeFile": "GazeInteractionXaml.bind", "CodeFile": "GazeInteractionCode.bind", "Icon": "/SamplePages/GazeInteraction/GazeInteraction.png", - "DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/WindowsCommunityToolkit/master/docs/gaze/GazeInteractionLibrary.md", + "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/gaze/GazeInteractionLibrary.md", "ApiCheck": "Windows.Devices.Input.Preview.GazeInputSourcePreview" }, { "Name": "GazeTracing", "Type": "GazeTracingPage", "About": "Shows how to use the Windows 10 API for eye trackers", - "CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.Input.Gaze/", + "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.Input.Gaze/", "XamlCodeFile": "GazeTracingXaml.bind", "CodeFile": "GazeTracingCode.bind", "Icon": "/SamplePages/GazeTracing/GazeTracing.png", diff --git a/Microsoft.Toolkit.Uwp.SampleApp/Styles/Generic.xaml b/Microsoft.Toolkit.Uwp.SampleApp/Styles/Generic.xaml index 3e5053a21da..1be4af82321 100644 --- a/Microsoft.Toolkit.Uwp.SampleApp/Styles/Generic.xaml +++ b/Microsoft.Toolkit.Uwp.SampleApp/Styles/Generic.xaml @@ -1014,7 +1014,6 @@ - diff --git a/Microsoft.Toolkit.Uwp.SampleApp/Styles/ThemeInjector.cs b/Microsoft.Toolkit.Uwp.SampleApp/Styles/ThemeInjector.cs index 36a027e964d..5e809a8495c 100644 --- a/Microsoft.Toolkit.Uwp.SampleApp/Styles/ThemeInjector.cs +++ b/Microsoft.Toolkit.Uwp.SampleApp/Styles/ThemeInjector.cs @@ -30,13 +30,15 @@ public static void InjectThemeResources(ResourceDictionary dict) { TintColor = Helpers.ColorHelper.ToColor("#FF333333"), TintOpacity = 0.8, - BackgroundSource = AcrylicBackgroundSource.Backdrop + BackgroundSource = AcrylicBackgroundSource.Backdrop, + FallbackColor = Helpers.ColorHelper.ToColor("#FF333333") }, LightAcrylic = new AcrylicBrush { TintColor = Colors.White, TintOpacity = 0.8, BackgroundSource = AcrylicBackgroundSource.Backdrop, + FallbackColor = Colors.White } }); @@ -47,13 +49,15 @@ public static void InjectThemeResources(ResourceDictionary dict) { TintColor = Helpers.ColorHelper.ToColor("#FF111111"), TintOpacity = 0.7, - BackgroundSource = AcrylicBackgroundSource.Backdrop + BackgroundSource = AcrylicBackgroundSource.Backdrop, + FallbackColor = Helpers.ColorHelper.ToColor("#FF111111") }, LightAcrylic = new AcrylicBrush { TintColor = Helpers.ColorHelper.ToColor("#FFDDDDDD"), TintOpacity = 0.6, BackgroundSource = AcrylicBackgroundSource.Backdrop, + FallbackColor = Helpers.ColorHelper.ToColor("#FFDDDDDD") } }); } diff --git a/Microsoft.Toolkit.Uwp.SampleApp/landingPageLinks.json b/Microsoft.Toolkit.Uwp.SampleApp/landingPageLinks.json index f8e55a999ec..5708c57ede0 100644 --- a/Microsoft.Toolkit.Uwp.SampleApp/landingPageLinks.json +++ b/Microsoft.Toolkit.Uwp.SampleApp/landingPageLinks.json @@ -1,6 +1,6 @@ { "new-section-title": "What's New", - "new-samples": [ "DataGrid", "PlannerTaskList", "PowerBIEmbedded", "Twitter Service", "LinkedIn Service" ], + "new-samples": [ "WindowsXamlHost", "TabView", "Weibo Service", "InkCanvas", "WebViewCompatible" ], "resources": [ { "title": "Toolkit", diff --git a/Microsoft.Toolkit.Uwp.SampleApp/readme.md b/Microsoft.Toolkit.Uwp.SampleApp/readme.md index b475896a007..eeda72797c1 100644 --- a/Microsoft.Toolkit.Uwp.SampleApp/readme.md +++ b/Microsoft.Toolkit.Uwp.SampleApp/readme.md @@ -20,6 +20,7 @@ This makes it easy for a developer to test out values for a control and then cop In order to provide a property UI and associated code, you have to define a the .bind XAML file associated with your page. Here is an example: + ```xaml @@ -179,14 +180,22 @@ If the specified type is not found on the system running the sample app the samp ### Adding documentation -Every API must be accompanied by Markdown documentation in the docs folder in the root of this repo. +Every API must be accompanied by Markdown documentation in the [documentation repository](..\contributing.md#docs). Use the DocumentationUrl property to add a link to the raw documentation in *samples.json*. Please follow the following pattern: -`https://raw.githubusercontent.com/windows-toolkit/WindowsCommunityToolkit/{branch}/docs/{folder/file.md}` +`https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/{branch}/docs/{folder/file.md}` > NOTE: When building and running the app in release mode, the branch will automatically be changed to **master** before loading. -> Note: The documentation is also packaged with the sample app. If there is no network connection, or the documentation is not yet on github, the sample app will use the packaged version + +> NOTE: The documentation is also packaged with the sample app. If there is no network connection, or the documentation is not yet on github, the sample app will use the packaged version + +> NOTE: To test your documentation in the sample app while running in debug mode, the docs repository will need to be cloned in the same folder as this repository and named **WindowsCommunityToolkitDocs**. For exaple, this folder structure works best: +> ``` +> repositories +> ├── WindowsCommunityToolkit +> ├── WindowsCommunityToolkitDocs +> ``` ### CodeUrl diff --git a/Microsoft.Toolkit.Uwp.UI.Animations/AnimationSet.cs b/Microsoft.Toolkit.Uwp.UI.Animations/AnimationSet.cs index e63bb66ba37..fa8632942f2 100644 --- a/Microsoft.Toolkit.Uwp.UI.Animations/AnimationSet.cs +++ b/Microsoft.Toolkit.Uwp.UI.Animations/AnimationSet.cs @@ -626,8 +626,8 @@ private void HandleCompleted(bool stopped = false) if (_animationTCS != null && !_animationTCS.Task.IsCompleted) { - Completed?.Invoke(this, new AnimationSetCompletedEventArgs() { Completed = _storyboardCompleted && _compositionCompleted }); _animationTCS.SetResult(State == AnimationSetState.Completed); + Completed?.Invoke(this, new AnimationSetCompletedEventArgs() { Completed = _storyboardCompleted && _compositionCompleted }); } } } diff --git a/Microsoft.Toolkit.Uwp.UI.Animations/ConnectedAnimations/Connected.cs b/Microsoft.Toolkit.Uwp.UI.Animations/ConnectedAnimations/Connected.cs index 7e85818af9a..e5dfdcf01b4 100644 --- a/Microsoft.Toolkit.Uwp.UI.Animations/ConnectedAnimations/Connected.cs +++ b/Microsoft.Toolkit.Uwp.UI.Animations/ConnectedAnimations/Connected.cs @@ -371,11 +371,27 @@ public static void UnregisterListItemForConnectedAnimation(this Page page, ListV /// /// The Frame handling the navigation /// The data item from a list control to be animated during next frame navigation + [Obsolete("Method is replaced by SetListDataItemForNextConnectedAnimation")] public static void SetListDataItemForNextConnectedAnnimation(this Frame frame, object item) { GetConnectedAnimationHelper(frame)?.SetParameterForNextFrameNavigation(item); } + /// + /// Sets the object that will be used during next Frame navigation for + /// Connected Animation involving a list control (item must be an element of + /// ListViewBase.ItemsSource collection). + /// Useful if the parameter used during page navigation is different from the + /// data item in the list control. Also useful during back navigation if the + /// item navigating back to is different from the item that was navigated from. + /// + /// The Frame handling the navigation + /// The data item from a list control to be animated during next frame navigation + public static void SetListDataItemForNextConnectedAnimation(this Frame frame, object item) + { + GetConnectedAnimationHelper(frame)?.SetParameterForNextFrameNavigation(item); + } + private static void OnKeyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { if (!ApiInformationHelper.IsCreatorsUpdateOrAbove) diff --git a/Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/DataGrid/DataGrid.xaml b/Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/DataGrid/DataGrid.xaml index 8a17e0610a6..021cef53831 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/DataGrid/DataGrid.xaml +++ b/Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/DataGrid/DataGrid.xaml @@ -12,26 +12,50 @@ + xmlns:local="using:Microsoft.Toolkit.Uwp.UI.Controls" + xmlns:localprimitives="using:Microsoft.Toolkit.Uwp.UI.Controls.Primitives"> + + + + + + + + + + + + + + + + + + + + + + + + @@ -56,13 +80,7 @@ 0.8 - - - - - - - + @@ -352,7 +370,7 @@ - + @@ -503,7 +521,11 @@ - + + + + + @@ -875,7 +897,7 @@ - + diff --git a/Microsoft.Toolkit.Uwp.UI.Controls.Design/Microsoft.Toolkit.Uwp.UI.Controls.Design.csproj b/Microsoft.Toolkit.Uwp.UI.Controls.Design/Microsoft.Toolkit.Uwp.UI.Controls.Design.csproj index 279b3485d4d..c07758a751b 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls.Design/Microsoft.Toolkit.Uwp.UI.Controls.Design.csproj +++ b/Microsoft.Toolkit.Uwp.UI.Controls.Design/Microsoft.Toolkit.Uwp.UI.Controls.Design.csproj @@ -82,6 +82,7 @@ + @@ -101,6 +102,7 @@ + Code diff --git a/Microsoft.Toolkit.Uwp.UI.Controls.Design/TabViewItemMetadata.cs b/Microsoft.Toolkit.Uwp.UI.Controls.Design/TabViewItemMetadata.cs new file mode 100644 index 00000000000..6ed6bc37bf8 --- /dev/null +++ b/Microsoft.Toolkit.Uwp.UI.Controls.Design/TabViewItemMetadata.cs @@ -0,0 +1,43 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Microsoft.Toolkit.Uwp.UI.Controls.Design.Common; +using Microsoft.Windows.Design; +using Microsoft.Windows.Design.Features; +using Microsoft.Windows.Design.Metadata; +using Microsoft.Windows.Design.Model; +using Microsoft.Windows.Design.PropertyEditing; +using System.ComponentModel; + +namespace Microsoft.Toolkit.Uwp.UI.Controls.Design +{ + + internal class TabViewItemMetadata : AttributeTableBuilder + { + public TabViewItemMetadata() + : base() + { + AddCallback(typeof(TabViewItem), + b => + { + b.AddCustomAttributes(nameof(TabViewItem.Header), + new CategoryAttribute(Properties.Resources.CategoryCommon) + ); + b.AddCustomAttributes(nameof(TabViewItem.HeaderTemplate), + new CategoryAttribute(Properties.Resources.CategoryCommon), + new EditorBrowsableAttribute(EditorBrowsableState.Advanced) + ); + b.AddCustomAttributes(nameof(TabViewItem.IsClosable), + new CategoryAttribute(Properties.Resources.CategoryCommon) + ); + b.AddCustomAttributes(nameof(TabViewItem.Icon), + new CategoryAttribute(Properties.Resources.CategoryCommon) + ); + + b.AddCustomAttributes(new ToolboxCategoryAttribute(ToolboxCategoryPaths.Toolkit, false)); + } + ); + } + } +} \ No newline at end of file diff --git a/Microsoft.Toolkit.Uwp.UI.Controls.Design/TabViewMetadata.cs b/Microsoft.Toolkit.Uwp.UI.Controls.Design/TabViewMetadata.cs new file mode 100644 index 00000000000..7bfa77541db --- /dev/null +++ b/Microsoft.Toolkit.Uwp.UI.Controls.Design/TabViewMetadata.cs @@ -0,0 +1,54 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Microsoft.Toolkit.Uwp.UI.Controls.Design.Common; +using Microsoft.Windows.Design; +using Microsoft.Windows.Design.Metadata; +using Microsoft.Windows.Design.PropertyEditing; +using System.ComponentModel; + +namespace Microsoft.Toolkit.Uwp.UI.Controls.Design +{ + internal class TabViewMetadata : AttributeTableBuilder + { + public TabViewMetadata() + : base() + { + AddCallback(typeof(Microsoft.Toolkit.Uwp.UI.Controls.TabView), + b => + { + // Layout + b.AddCustomAttributes(nameof(TabView.TabWidthBehavior), new CategoryAttribute(Properties.Resources.CategoryLayout)); + b.AddCustomAttributes(nameof(TabView.SelectedTabWidth), new CategoryAttribute(Properties.Resources.CategoryLayout)); + b.AddCustomAttributes(nameof(TabView.IsCloseButtonOverlay), new CategoryAttribute(Properties.Resources.CategoryLayout)); + + // Interactions + b.AddCustomAttributes(nameof(TabView.CanCloseTabs), new CategoryAttribute(Properties.Resources.CategoryCommon)); + + // Templates + b.AddCustomAttributes(nameof(TabView.ItemHeaderTemplate), + new CategoryAttribute(Properties.Resources.CategoryCommon), + new EditorBrowsableAttribute(EditorBrowsableState.Advanced) + ); + b.AddCustomAttributes(nameof(TabView.TabActionHeader), new CategoryAttribute(Properties.Resources.CategoryCommon)); + b.AddCustomAttributes(nameof(TabView.TabActionHeaderTemplate), + new CategoryAttribute(Properties.Resources.CategoryCommon), + new EditorBrowsableAttribute(EditorBrowsableState.Advanced) + ); + b.AddCustomAttributes(nameof(TabView.TabEndHeader), new CategoryAttribute(Properties.Resources.CategoryCommon)); + b.AddCustomAttributes(nameof(TabView.TabEndHeaderTemplate), + new CategoryAttribute(Properties.Resources.CategoryCommon), + new EditorBrowsableAttribute(EditorBrowsableState.Advanced) + ); + b.AddCustomAttributes(nameof(TabView.TabStartHeader), new CategoryAttribute(Properties.Resources.CategoryCommon)); + b.AddCustomAttributes(nameof(TabView.TabStartHeaderTemplate), + new CategoryAttribute(Properties.Resources.CategoryCommon), + new EditorBrowsableAttribute(EditorBrowsableState.Advanced) + ); + b.AddCustomAttributes(new ToolboxCategoryAttribute(ToolboxCategoryPaths.Toolkit, false)); + } + ); + } + } +} diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/GridSplitter/GridSplitter.cs b/Microsoft.Toolkit.Uwp.UI.Controls/GridSplitter/GridSplitter.cs index 350ac4705d8..0a7b44d9989 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls/GridSplitter/GridSplitter.cs +++ b/Microsoft.Toolkit.Uwp.UI.Controls/GridSplitter/GridSplitter.cs @@ -162,6 +162,7 @@ private RowDefinition SiblingRow public GridSplitter() { DefaultStyleKey = typeof(GridSplitter); + Loaded += GridSplitter_Loaded; } /// @@ -178,6 +179,8 @@ protected override void OnApplyTemplate() ManipulationStarted -= GridSplitter_ManipulationStarted; ManipulationCompleted -= GridSplitter_ManipulationCompleted; + _hoverWrapper?.UnhookEvents(); + // Register Events Loaded += GridSplitter_Loaded; PointerEntered += GridSplitter_PointerEntered; @@ -187,7 +190,7 @@ protected override void OnApplyTemplate() ManipulationStarted += GridSplitter_ManipulationStarted; ManipulationCompleted += GridSplitter_ManipulationCompleted; - _hoverWrapper?.UnhookEvents(); + _hoverWrapper?.UpdateHoverElement(Element); ManipulationMode = ManipulationModes.TranslateX | ManipulationModes.TranslateY; } diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/HeaderedContentControl/HeaderedContentControl.cs b/Microsoft.Toolkit.Uwp.UI.Controls/HeaderedContentControl/HeaderedContentControl.cs index 9d6d4fa9c31..cd3dab1565b 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls/HeaderedContentControl/HeaderedContentControl.cs +++ b/Microsoft.Toolkit.Uwp.UI.Controls/HeaderedContentControl/HeaderedContentControl.cs @@ -12,6 +12,8 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls /// public class HeaderedContentControl : ContentControl { + private const string PartHeaderPresenter = "HeaderPresenter"; + /// /// Initializes a new instance of the class. /// @@ -38,12 +40,34 @@ public HeaderedContentControl() typeof(HeaderedContentControl), new PropertyMetadata(null)); + /// + /// Identifies the dependency property. + /// + public static readonly DependencyProperty OrientationProperty = DependencyProperty.Register( + nameof(Orientation), + typeof(Orientation), + typeof(HeaderedContentControl), + new PropertyMetadata(Orientation.Vertical, OnOrientationChanged)); + + /// + /// Gets or sets the used for the header. + /// + /// + /// If set to the header will be above the content. + /// If set to the header will be to the left of the content. + /// + public Orientation Orientation + { + get { return (Orientation)GetValue(OrientationProperty); } + set { SetValue(OrientationProperty, value); } + } + /// /// Gets or sets the data used for the header of each control. /// public object Header { - get { return (object)GetValue(HeaderProperty); } + get { return GetValue(HeaderProperty); } set { SetValue(HeaderProperty, value); } } @@ -56,6 +80,14 @@ public DataTemplate HeaderTemplate set { SetValue(HeaderTemplateProperty, value); } } + /// + protected override void OnApplyTemplate() + { + base.OnApplyTemplate(); + + SetHeaderVisibility(); + } + /// /// Called when the property changes. /// @@ -65,10 +97,32 @@ protected virtual void OnHeaderChanged(object oldValue, object newValue) { } + private static void OnOrientationChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + var control = (HeaderedContentControl)d; + + var orientation = control.Orientation == Orientation.Vertical + ? nameof(Orientation.Vertical) + : nameof(Orientation.Horizontal); + + VisualStateManager.GoToState(control, orientation, true); + } + private static void OnHeaderChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var control = (HeaderedContentControl)d; + control.SetHeaderVisibility(); control.OnHeaderChanged(e.OldValue, e.NewValue); } + + private void SetHeaderVisibility() + { + if (GetTemplateChild(PartHeaderPresenter) is FrameworkElement headerPresenter) + { + headerPresenter.Visibility = Header != null + ? Visibility.Visible + : Visibility.Collapsed; + } + } } } \ No newline at end of file diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/HeaderedContentControl/HeaderedContentControl.xaml b/Microsoft.Toolkit.Uwp.UI.Controls/HeaderedContentControl/HeaderedContentControl.xaml index 3f491dea985..2c713168efc 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls/HeaderedContentControl/HeaderedContentControl.xaml +++ b/Microsoft.Toolkit.Uwp.UI.Controls/HeaderedContentControl/HeaderedContentControl.xaml @@ -13,8 +13,33 @@ - - + + + + + + + + + + + + + + + + + + + diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/HeaderedItemsControl/HeaderedItemsControl.cs b/Microsoft.Toolkit.Uwp.UI.Controls/HeaderedItemsControl/HeaderedItemsControl.cs index fd4bd0f5847..d854c1804ec 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls/HeaderedItemsControl/HeaderedItemsControl.cs +++ b/Microsoft.Toolkit.Uwp.UI.Controls/HeaderedItemsControl/HeaderedItemsControl.cs @@ -38,12 +38,21 @@ public HeaderedItemsControl() typeof(HeaderedItemsControl), new PropertyMetadata(null)); + /// + /// Identifies the dependency property. + /// + public static readonly DependencyProperty OrientationProperty = DependencyProperty.Register( + nameof(Orientation), + typeof(Orientation), + typeof(HeaderedItemsControl), + new PropertyMetadata(Orientation.Vertical)); + /// /// Gets or sets the data used for the header of each control. /// public object Header { - get { return (object)GetValue(HeaderProperty); } + get { return GetValue(HeaderProperty); } set { SetValue(HeaderProperty, value); } } @@ -56,6 +65,19 @@ public DataTemplate HeaderTemplate set { SetValue(HeaderTemplateProperty, value); } } + /// + /// Gets or sets the used for the header. + /// + /// + /// If set to the header will be above the content. + /// If set to the header will be to the left of the content. + /// + public Orientation Orientation + { + get { return (Orientation)GetValue(OrientationProperty); } + set { SetValue(OrientationProperty, value); } + } + /// /// Called when the property changes. /// diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/HeaderedItemsControl/HeaderedItemsControl.xaml b/Microsoft.Toolkit.Uwp.UI.Controls/HeaderedItemsControl/HeaderedItemsControl.xaml index 9442c40346a..dcb57cbfd27 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls/HeaderedItemsControl/HeaderedItemsControl.xaml +++ b/Microsoft.Toolkit.Uwp.UI.Controls/HeaderedItemsControl/HeaderedItemsControl.xaml @@ -7,7 +7,7 @@ - + diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/HeaderedTextBlock/HeaderedTextBlock.cs b/Microsoft.Toolkit.Uwp.UI.Controls/HeaderedTextBlock/HeaderedTextBlock.cs index 873308a8a78..b30dfea1d3d 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls/HeaderedTextBlock/HeaderedTextBlock.cs +++ b/Microsoft.Toolkit.Uwp.UI.Controls/HeaderedTextBlock/HeaderedTextBlock.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Markup; @@ -13,6 +14,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls /// [TemplatePart(Name = "HeaderContentPresenter", Type = typeof(ContentPresenter))] [ContentProperty(Name = nameof(Inlines))] + [Obsolete("The HeaderedTextBlock has been replaced with the more generic HeaderedContentControl.")] public partial class HeaderedTextBlock : Control { private ContentPresenter _headerContentPresenter; diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/InAppNotification/InAppNotification.Events.cs b/Microsoft.Toolkit.Uwp.UI.Controls/InAppNotification/InAppNotification.Events.cs index 05dd9d6b390..35dc848e240 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls/InAppNotification/InAppNotification.Events.cs +++ b/Microsoft.Toolkit.Uwp.UI.Controls/InAppNotification/InAppNotification.Events.cs @@ -39,8 +39,8 @@ private void DismissButton_Click(object sender, RoutedEventArgs e) private void DismissTimer_Tick(object sender, object e) { - Dismiss(InAppNotificationDismissKind.Timeout); _dismissTimer.Stop(); + Dismiss(InAppNotificationDismissKind.Timeout); } private void OpenAnimationTimer_Tick(object sender, object e) diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/InAppNotification/InAppNotification.xaml b/Microsoft.Toolkit.Uwp.UI.Controls/InAppNotification/InAppNotification.xaml index b0e0a0ae557..d40f196017c 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls/InAppNotification/InAppNotification.xaml +++ b/Microsoft.Toolkit.Uwp.UI.Controls/InAppNotification/InAppNotification.xaml @@ -1,8 +1,9 @@ - + diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/InAppNotification/Styles/MSEdgeNotificationStyle.xaml b/Microsoft.Toolkit.Uwp.UI.Controls/InAppNotification/Styles/MSEdgeNotificationStyle.xaml index 0155c5d25bc..120368a79f5 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls/InAppNotification/Styles/MSEdgeNotificationStyle.xaml +++ b/Microsoft.Toolkit.Uwp.UI.Controls/InAppNotification/Styles/MSEdgeNotificationStyle.xaml @@ -3,46 +3,60 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:Microsoft.Toolkit.Uwp.UI.Controls"> + + + + + + + + + + + + + + + + - - - - - - - - + + + + diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/RadialGauge/RadialGauge.cs b/Microsoft.Toolkit.Uwp.UI.Controls/RadialGauge/RadialGauge.cs index 93d455b7faa..5341d97e71f 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls/RadialGauge/RadialGauge.cs +++ b/Microsoft.Toolkit.Uwp.UI.Controls/RadialGauge/RadialGauge.cs @@ -210,13 +210,14 @@ private void ThemeListener_ThemeChanged(ThemeListener sender) private void RadialGauge_KeyDown(object sender, KeyRoutedEventArgs e) { - var step = 1; + double step = 1; var ctrl = Window.Current.CoreWindow.GetKeyState(VirtualKey.Control); if (ctrl.HasFlag(CoreVirtualKeyStates.Down)) { step = 5; } + step = Math.Max(StepSize, step); if (e.Key == VirtualKey.Left) { Value = Math.Max(Minimum, Value - step); @@ -796,7 +797,7 @@ private void SetGaugeValueFromPoint(Point p) return; } - Value = value; + Value = RoundToMultiple(value, StepSize); } private Point ScalePoint(double angle, double middleOfScale) @@ -831,6 +832,11 @@ private double Mod(double number, double divider) private double RoundToMultiple(double number, double multiple) { double modulo = number % multiple; + if (double.IsNaN(modulo)) + { + return number; + } + if ((multiple - modulo) <= modulo) { modulo = multiple - modulo; diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/RotatorTile/RotatorTile.cs b/Microsoft.Toolkit.Uwp.UI.Controls/RotatorTile/RotatorTile.cs index c9224f37fcf..6b66d44974f 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls/RotatorTile/RotatorTile.cs +++ b/Microsoft.Toolkit.Uwp.UI.Controls/RotatorTile/RotatorTile.cs @@ -98,6 +98,10 @@ protected override void OnApplyTemplate() _nextElement = GetTemplateChild(NextPartName) as FrameworkElement; _translate = GetTemplateChild(TranslatePartName) as TranslateTransform; _stackPanel = GetTemplateChild(StackPartName) as StackPanel; + + // set the correct defaults for translate transform + UpdateTranslateXY(); + if (_stackPanel != null) { if (Direction == RotateDirection.Down || Direction == RotateDirection.Right) @@ -144,9 +148,6 @@ private void RotatorTile_SizeChanged(object sender, SizeChangedEventArgs e) private void RotatorTile_Loaded(object sender, RoutedEventArgs e) { - // set the correct defaults for translate transform - UpdateTranslateXY(); - // Start timer after control has loaded _timer?.Start(); } @@ -272,6 +273,11 @@ private void RotateToNextItem() private void UpdateTranslateXY() { + if (_translate == null) + { + return; + } + if (Direction == RotateDirection.Left || Direction == RotateDirection.Up) { _translate.X = _translate.Y = 0; diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/TabView/TabClosingEventArgs.cs b/Microsoft.Toolkit.Uwp.UI.Controls/TabView/TabClosingEventArgs.cs new file mode 100644 index 00000000000..dabb94ed9ad --- /dev/null +++ b/Microsoft.Toolkit.Uwp.UI.Controls/TabView/TabClosingEventArgs.cs @@ -0,0 +1,40 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace Microsoft.Toolkit.Uwp.UI.Controls +{ + /// + /// Event arguments for event. + /// + public class TabClosingEventArgs : EventArgs + { + /// + /// Initializes a new instance of the class. + /// + /// Item being closed. + /// container being closed. + public TabClosingEventArgs(object item, TabViewItem tab) + { + Item = item; + Tab = tab; + } + + /// + /// Gets the Item being closed. + /// + public object Item { get; private set; } + + /// + /// Gets the Tab being closed. + /// + public TabViewItem Tab { get; private set; } + + /// + /// Gets or sets a value indicating whether the notification should be closed. + /// + public bool Cancel { get; set; } + } +} \ No newline at end of file diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/TabView/TabDraggedOutsideEventArgs.cs b/Microsoft.Toolkit.Uwp.UI.Controls/TabView/TabDraggedOutsideEventArgs.cs new file mode 100644 index 00000000000..dcf351aab9b --- /dev/null +++ b/Microsoft.Toolkit.Uwp.UI.Controls/TabView/TabDraggedOutsideEventArgs.cs @@ -0,0 +1,35 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace Microsoft.Toolkit.Uwp.UI.Controls +{ + /// + /// A class used by the TabDraggedOutside Event + /// + public class TabDraggedOutsideEventArgs : EventArgs + { + /// + /// Initializes a new instance of the class. + /// + /// data context of element dragged + /// container being dragged. + public TabDraggedOutsideEventArgs(object item, TabViewItem tab) + { + Item = item; + Tab = tab; + } + + /// + /// Gets or sets the Item/Data Context of the item being dragged outside of the . + /// + public object Item { get; set; } + + /// + /// Gets the Tab being dragged outside of the . + /// + public TabViewItem Tab { get; private set; } + } +} diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/TabView/TabView.HeaderLayout.cs b/Microsoft.Toolkit.Uwp.UI.Controls/TabView/TabView.HeaderLayout.cs new file mode 100644 index 00000000000..16885700b35 --- /dev/null +++ b/Microsoft.Toolkit.Uwp.UI.Controls/TabView/TabView.HeaderLayout.cs @@ -0,0 +1,221 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Linq; +using Windows.UI.Xaml; + +namespace Microsoft.Toolkit.Uwp.UI.Controls +{ + /// + /// TabView methods related to calculating the width of the Headers. + /// + public partial class TabView + { + // Attached property for storing widths of tabs if set by other means during layout. + private static double GetOriginalWidth(TabViewItem obj) + { + return (double)obj.GetValue(OriginalWidthProperty); + } + + private static void SetOriginalWidth(TabViewItem obj, double value) + { + obj.SetValue(OriginalWidthProperty, value); + } + + // Using a DependencyProperty as the backing store for MyProperty. This enables animation, styling, binding, etc... + private static readonly DependencyProperty OriginalWidthProperty = + DependencyProperty.RegisterAttached("OriginalWidth", typeof(double), typeof(TabView), new PropertyMetadata(null)); + + private static void OnLayoutEffectingPropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args) + { + var tabview = sender as TabView; + if (tabview != null && tabview._hasLoaded) + { + tabview.TabView_SizeChanged(tabview, null); + } + } + + private void TabView_SizeChanged(object sender, SizeChangedEventArgs e) + { + // We need to do this calculation here in Size Changed as the + // Columns don't have their Actual Size calculated in Measure or Arrange. + if (_hasLoaded && _tabViewContainer != null) + { + // Look for our special columns to calculate size of other 'stuff' + var taken = _tabViewContainer.ColumnDefinitions.Sum(cd => GetIgnoreColumn(cd) ? 0 : cd.ActualWidth); + + // Get the column we want to work on for available space + var tabc = _tabViewContainer.ColumnDefinitions.FirstOrDefault(cd => GetConstrainColumn(cd)); + if (tabc != null) + { + var available = ActualWidth - taken; + var required = 0.0; + var mintabwidth = double.MaxValue; + + if (TabWidthBehavior == TabWidthMode.Actual) + { + if (_tabScroller != null) + { + // If we have a scroll container, get its size. + required = _tabScroller.ExtentWidth; + } + + // Restore original widths + foreach (var item in Items) + { + var tab = ContainerFromItem(item) as TabViewItem; + if (tab == null) + { + continue; // container not generated yet + } + + if (tab.ReadLocalValue(OriginalWidthProperty) != DependencyProperty.UnsetValue) + { + tab.Width = GetOriginalWidth(tab); + } + } + } + else if (available > 0) + { + // Calculate the width for each tab from the provider and determine how much space they take. + foreach (var item in Items) + { + var tab = ContainerFromItem(item) as TabViewItem; + if (tab == null) + { + continue; // container not generated yet + } + + mintabwidth = Math.Min(mintabwidth, tab.MinWidth); + + double width = double.NaN; + + switch (TabWidthBehavior) + { + case TabWidthMode.Equal: + width = ProvideEqualWidth(tab, item, available); + break; + case TabWidthMode.Compact: + width = ProvideCompactWidth(tab, item, available); + break; + } + + if (tab.ReadLocalValue(OriginalWidthProperty) == DependencyProperty.UnsetValue) + { + SetOriginalWidth(tab, tab.Width); + } + + if (width > double.Epsilon) + { + tab.Width = width; + required += Math.Max(Math.Min(width, tab.MaxWidth), tab.MinWidth); + } + else + { + tab.Width = GetOriginalWidth(tab); + required += tab.ActualWidth; + } + } + } + else + { + // Fix negative bounds. + available = 0.0; + + // Still need to determine a 'minimum' width (if available) + // TODO: Consolidate this logic with above better? + foreach (var item in Items) + { + var tab = ContainerFromItem(item) as TabViewItem; + if (tab == null) + { + continue; // container not generated yet + } + + mintabwidth = Math.Min(mintabwidth, tab.MinWidth); + } + } + + if (!(mintabwidth < double.MaxValue)) + { + mintabwidth = 0.0; // No Containers, no visual, 0 size. + } + + if (available > mintabwidth) + { + // Constrain the column based on our required and available space + tabc.MaxWidth = available; + } + + //// TODO: If it's less, should we move the selected tab to only be the one shown by default? + + if (available <= mintabwidth || Math.Abs(available - mintabwidth) < double.Epsilon) + { + tabc.Width = new GridLength(mintabwidth); + } + else if (required >= available) + { + // Fix size as we don't have enough space for all the tabs. + tabc.Width = new GridLength(available); + } + else + { + // We haven't filled up our space, so we want to expand to take as much as needed. + tabc.Width = GridLength.Auto; + } + } + } + } + + private double ProvideEqualWidth(TabViewItem tab, object item, double availableWidth) + { + if (double.IsNaN(SelectedTabWidth)) + { + if (Items.Count <= 1) + { + return availableWidth; + } + + return Math.Max(tab.MinWidth, availableWidth / Items.Count); + } + else if (Items.Count() <= 1) + { + // Default case of a single tab, make it full size. + return Math.Min(SelectedTabWidth, availableWidth); + } + else + { + var width = (availableWidth - SelectedTabWidth) / (Items.Count - 1); + + // Constrain between Min and Selected (Max) + if (width < tab.MinWidth) + { + width = tab.MinWidth; + } + else if (width > SelectedTabWidth) + { + width = SelectedTabWidth; + } + + // If it's selected make it full size, otherwise whatever the size should be. + return tab.IsSelected + ? Math.Min(SelectedTabWidth, availableWidth) + : width; + } + } + + private double ProvideCompactWidth(TabViewItem tab, object item, double availableWidth) + { + // If we're selected and have a value for that, then just return that. + if (tab.IsSelected && !double.IsNaN(SelectedTabWidth)) + { + return SelectedTabWidth; + } + + // Otherwise use min size. + return tab.MinWidth; + } + } +} diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/TabView/TabView.ItemSources.cs b/Microsoft.Toolkit.Uwp.UI.Controls/TabView/TabView.ItemSources.cs new file mode 100644 index 00000000000..61f61623b6f --- /dev/null +++ b/Microsoft.Toolkit.Uwp.UI.Controls/TabView/TabView.ItemSources.cs @@ -0,0 +1,115 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Reflection; +using Windows.Foundation.Collections; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls.Primitives; + +namespace Microsoft.Toolkit.Uwp.UI.Controls +{ + /// + /// TabView methods related to tracking Items and ItemsSource changes. + /// + public partial class TabView + { + // Temporary tracking of previous collections for removing events. + private MethodInfo _removeItemsSourceMethod; + + /// + protected override void OnItemsChanged(object e) + { + IVectorChangedEventArgs args = (IVectorChangedEventArgs)e; + + base.OnItemsChanged(e); + + if (args.CollectionChange == CollectionChange.ItemRemoved && SelectedIndex == -1) + { + // If we remove the selected item we should select the previous item + int startIndex = (int)args.Index + 1; + if (startIndex > Items.Count) + { + startIndex = 0; + } + + SelectedIndex = FindNextTabIndex(startIndex, -1); + } + + // Update Sizing (in case there are less items now) + TabView_SizeChanged(this, null); + } + + private void ItemContainerGenerator_ItemsChanged(object sender, ItemsChangedEventArgs e) + { + var action = (CollectionChange)e.Action; + if (action == CollectionChange.Reset) + { + // Reset collection to reload later. + _hasLoaded = false; + } + } + + private void SetInitialSelection() + { + if (SelectedItem == null) + { + // If we have an index, but didn't get the selection, make the selection + if (SelectedIndex >= 0 && SelectedIndex < Items.Count) + { + SelectedItem = Items[SelectedIndex]; + } + + // Otherwise, select the first item by default + else if (Items.Count >= 1) + { + SelectedItem = Items[0]; + } + } + } + + // Finds the next visible & enabled tab index. + private int FindNextTabIndex(int startIndex, int direction) + { + int index = startIndex; + if (direction != 0) + { + for (int i = 0; i < Items.Count; i++) + { + index += direction; + + if (index >= Items.Count) + { + index = 0; + } + else if (index < 0) + { + index = Items.Count - 1; + } + + var tabItem = ContainerFromIndex(index) as TabViewItem; + if (tabItem != null && tabItem.IsEnabled && tabItem.Visibility == Visibility.Visible) + { + break; + } + } + } + + return index; + } + + private void ItemsSource_PropertyChanged(DependencyObject sender, DependencyProperty dp) + { + // Use reflection to store a 'Remove' method of any possible collection in ItemsSource + // Cache for efficiency later. + if (ItemsSource != null) + { + _removeItemsSourceMethod = ItemsSource.GetType().GetMethod("Remove"); + } + else + { + _removeItemsSourceMethod = null; + } + } + } +} diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/TabView/TabView.Properties.cs b/Microsoft.Toolkit.Uwp.UI.Controls/TabView/TabView.Properties.cs new file mode 100644 index 00000000000..5d33b33f1cc --- /dev/null +++ b/Microsoft.Toolkit.Uwp.UI.Controls/TabView/TabView.Properties.cs @@ -0,0 +1,245 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; + +namespace Microsoft.Toolkit.Uwp.UI.Controls +{ + /// + /// TabView properties. + /// + public partial class TabView + { + /// + /// Gets or sets the content to appear to the left or above the tab strip. + /// + public object TabStartHeader + { + get { return (object)GetValue(TabStartHeaderProperty); } + set { SetValue(TabStartHeaderProperty, value); } + } + + /// + /// Identifies the dependency property. + /// + /// The identifier for the dependency property. + public static readonly DependencyProperty TabStartHeaderProperty = + DependencyProperty.Register(nameof(TabStartHeader), typeof(object), typeof(TabView), new PropertyMetadata(null, OnLayoutEffectingPropertyChanged)); + + /// + /// Gets or sets the for the . + /// + public DataTemplate TabStartHeaderTemplate + { + get { return (DataTemplate)GetValue(TabStartHeaderTemplateProperty); } + set { SetValue(TabStartHeaderTemplateProperty, value); } + } + + /// + /// Identifies the dependency property. + /// + /// The identifier for the dependency property. + public static readonly DependencyProperty TabStartHeaderTemplateProperty = + DependencyProperty.Register(nameof(TabStartHeaderTemplate), typeof(DataTemplate), typeof(TabView), new PropertyMetadata(null, OnLayoutEffectingPropertyChanged)); + + /// + /// Gets or sets the content to appear next to the tab strip. + /// + public object TabActionHeader + { + get { return (object)GetValue(TabActionHeaderProperty); } + set { SetValue(TabActionHeaderProperty, value); } + } + + /// + /// Identifies the dependency property. + /// + /// The identifier for the dependency property. + public static readonly DependencyProperty TabActionHeaderProperty = + DependencyProperty.Register(nameof(TabActionHeader), typeof(object), typeof(TabView), new PropertyMetadata(null, OnLayoutEffectingPropertyChanged)); + + /// + /// Gets or sets the for the . + /// + public DataTemplate TabActionHeaderTemplate + { + get { return (DataTemplate)GetValue(TabActionHeaderTemplateProperty); } + set { SetValue(TabActionHeaderTemplateProperty, value); } + } + + /// + /// Identifies the dependency property. + /// + /// The identifier for the dependency property. + public static readonly DependencyProperty TabActionHeaderTemplateProperty = + DependencyProperty.Register(nameof(TabActionHeaderTemplate), typeof(DataTemplate), typeof(TabView), new PropertyMetadata(null, OnLayoutEffectingPropertyChanged)); + + /// + /// Gets or sets the content to appear to the right or below the tab strip. + /// + public object TabEndHeader + { + get { return (object)GetValue(TabEndHeaderProperty); } + set { SetValue(TabEndHeaderProperty, value); } + } + + /// + /// Identifies the dependency property. + /// + /// The identifier for the dependency property. + public static readonly DependencyProperty TabEndHeaderProperty = + DependencyProperty.Register(nameof(TabEndHeader), typeof(object), typeof(TabView), new PropertyMetadata(null, OnLayoutEffectingPropertyChanged)); + + /// + /// Gets or sets the for the . + /// + public DataTemplate TabEndHeaderTemplate + { + get { return (DataTemplate)GetValue(TabEndHeaderTemplateProperty); } + set { SetValue(TabEndHeaderTemplateProperty, value); } + } + + /// + /// Identifies the dependency property. + /// + /// The identifier for the dependency property. + public static readonly DependencyProperty TabEndHeaderTemplateProperty = + DependencyProperty.Register(nameof(TabEndHeaderTemplate), typeof(DataTemplate), typeof(TabView), new PropertyMetadata(null, OnLayoutEffectingPropertyChanged)); + + /// + /// Gets or sets the default for the . + /// + public DataTemplate ItemHeaderTemplate + { + get { return (DataTemplate)GetValue(ItemHeaderTemplateProperty); } + set { SetValue(ItemHeaderTemplateProperty, value); } + } + + /// + /// Identifies the dependency property. + /// + /// The identifier for the dependency property. + public static readonly DependencyProperty ItemHeaderTemplateProperty = + DependencyProperty.Register(nameof(ItemHeaderTemplate), typeof(DataTemplate), typeof(TabView), new PropertyMetadata(null, OnLayoutEffectingPropertyChanged)); + + /// + /// Gets or sets a value indicating whether by default a Tab can be closed or not if no value to is provided. + /// + public bool CanCloseTabs + { + get { return (bool)GetValue(CanCloseTabsProperty); } + set { SetValue(CanCloseTabsProperty, value); } + } + + /// + /// Identifies the dependency property. + /// + /// The identifier for the dependency property. + public static readonly DependencyProperty CanCloseTabsProperty = + DependencyProperty.Register(nameof(CanCloseTabs), typeof(bool), typeof(TabView), new PropertyMetadata(false, OnLayoutEffectingPropertyChanged)); + + /// + /// Gets or sets a value indicating whether a Close Button should be included in layout calculations. + /// + public bool IsCloseButtonOverlay + { + get { return (bool)GetValue(IsCloseButtonOverlayProperty); } + set { SetValue(IsCloseButtonOverlayProperty, value); } + } + + /// + /// Identifies the dependency property. + /// + /// The identifier for the dependency property. + public static readonly DependencyProperty IsCloseButtonOverlayProperty = + DependencyProperty.Register(nameof(IsCloseButtonOverlay), typeof(bool), typeof(TabView), new PropertyMetadata(false, OnLayoutEffectingPropertyChanged)); + + /// + /// Gets or sets a value indicating the size of the selected tab. By default this is set to Auto and the selected tab size doesn't change. + /// + public double SelectedTabWidth + { + get { return (double)GetValue(SelectedTabWidthProperty); } + set { SetValue(SelectedTabWidthProperty, value); } + } + + /// + /// Identifies the dependency property. + /// + /// The identifier for the dependency property. + public static readonly DependencyProperty SelectedTabWidthProperty = + DependencyProperty.Register(nameof(SelectedTabWidth), typeof(double), typeof(TabView), new PropertyMetadata(double.NaN, OnLayoutEffectingPropertyChanged)); + + /// + /// Gets or sets the current which determins how tab headers' width behave. + /// + public TabWidthMode TabWidthBehavior + { + get { return (TabWidthMode)GetValue(TabWidthBehaviorProperty); } + set { SetValue(TabWidthBehaviorProperty, value); } + } + + /// + /// Identifies the dependency property. + /// + /// The identifier for the dependency property. + public static readonly DependencyProperty TabWidthBehaviorProperty = + DependencyProperty.Register(nameof(TabWidthBehavior), typeof(TabWidthMode), typeof(TabView), new PropertyMetadata(TabWidthMode.Actual, OnLayoutEffectingPropertyChanged)); + + /// + /// Gets the attached property value to indicate if this grid column should be ignored when calculating header sizes. + /// + /// Grid Column. + /// Boolean indicating if this column is ignored by TabViewHeader logic. + public static bool GetIgnoreColumn(ColumnDefinition obj) + { + return (bool)obj.GetValue(IgnoreColumnProperty); + } + + /// + /// Sets the attached property value for + /// + /// Grid Column. + /// Boolean value + public static void SetIgnoreColumn(ColumnDefinition obj, bool value) + { + obj.SetValue(IgnoreColumnProperty, value); + } + + /// + /// Identifies the attached property. + /// + /// The identifier for the IgnoreColumn attached property. + public static readonly DependencyProperty IgnoreColumnProperty = + DependencyProperty.RegisterAttached("IgnoreColumn", typeof(bool), typeof(TabView), new PropertyMetadata(false)); + + /// + /// Gets the attached value indicating this column should be restricted for the headers. + /// + /// Grid Column. + /// True if this column should be constrained. + public static bool GetConstrainColumn(ColumnDefinition obj) + { + return (bool)obj.GetValue(ConstrainColumnProperty); + } + + /// + /// Sets the attached property value for the + /// + /// Grid Column. + /// Boolean value. + public static void SetConstrainColumn(ColumnDefinition obj, bool value) + { + obj.SetValue(ConstrainColumnProperty, value); + } + + /// + /// Identifies the attached property. + /// + /// The identifier for the ConstrainColumn attached property. + public static readonly DependencyProperty ConstrainColumnProperty = + DependencyProperty.RegisterAttached("ConstrainColumn", typeof(bool), typeof(TabView), new PropertyMetadata(false)); + } +} diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/TabView/TabView.cs b/Microsoft.Toolkit.Uwp.UI.Controls/TabView/TabView.cs new file mode 100644 index 00000000000..89a6a0c6e89 --- /dev/null +++ b/Microsoft.Toolkit.Uwp.UI.Controls/TabView/TabView.cs @@ -0,0 +1,316 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Linq; +using Microsoft.Toolkit.Uwp.UI.Extensions; +using Windows.ApplicationModel.DataTransfer; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; +using Windows.UI.Xaml.Controls.Primitives; +using Windows.UI.Xaml.Data; + +namespace Microsoft.Toolkit.Uwp.UI.Controls +{ + /// + /// TabView is a control for displaying a set of tabs and their content. + /// + [TemplatePart(Name = TabContentPresenterName, Type = typeof(ContentPresenter))] + [TemplatePart(Name = TabViewContainerName, Type = typeof(Grid))] + [TemplatePart(Name = TabsItemsPresenterName, Type = typeof(ItemsPresenter))] + [TemplatePart(Name = TabsScrollViewerName, Type = typeof(ScrollViewer))] + [TemplatePart(Name = TabsScrollBackButtonName, Type = typeof(ButtonBase))] + [TemplatePart(Name = TabsScrollForwardButtonName, Type = typeof(ButtonBase))] + public partial class TabView : ListViewBase + { + private const int ScrollAmount = 50; // TODO: Should this be based on TabWidthMode + + private const string TabContentPresenterName = "TabContentPresenter"; + private const string TabViewContainerName = "TabViewContainer"; + private const string TabsItemsPresenterName = "TabsItemsPresenter"; + private const string TabsScrollViewerName = "ScrollViewer"; + private const string TabsScrollBackButtonName = "ScrollBackButton"; + private const string TabsScrollForwardButtonName = "ScrollForwardButton"; + + private ContentPresenter _tabContentPresenter; + private Grid _tabViewContainer; + private ItemsPresenter _tabItemsPresenter; + private ScrollViewer _tabScroller; + private ButtonBase _tabScrollBackButton; + private ButtonBase _tabScrollForwardButton; + + private bool _hasLoaded; + private bool _isDragging; + + /// + /// Initializes a new instance of the class. + /// + public TabView() + { + DefaultStyleKey = typeof(TabView); + + // Container Generation Hooks + RegisterPropertyChangedCallback(ItemsSourceProperty, ItemsSource_PropertyChanged); + ItemContainerGenerator.ItemsChanged += ItemContainerGenerator_ItemsChanged; + + // Drag and Layout Hooks + DragItemsStarting += TabView_DragItemsStarting; + DragItemsCompleted += TabView_DragItemsCompleted; + SizeChanged += TabView_SizeChanged; + + // Selection Hook + SelectionChanged += TabView_SelectionChanged; + } + + /// + /// Occurs when a tab is dragged by the user outside of the . Generally, this paradigm is used to create a new-window with the torn-off tab. + /// The creation and handling of the new-window is left to the app's developer. + /// + public event EventHandler TabDraggedOutside; + + /// + /// Occurs when a tab's Close button is clicked. Set to true to prevent automatic Tab Closure. + /// + public event EventHandler TabClosing; + + /// + protected override DependencyObject GetContainerForItemOverride() => new TabViewItem(); + + /// + protected override bool IsItemItsOwnContainerOverride(object item) + { + return item is TabViewItem; + } + + /// + protected override void OnApplyTemplate() + { + base.OnApplyTemplate(); + + if (_tabItemsPresenter != null) + { + _tabItemsPresenter.SizeChanged -= TabView_SizeChanged; + } + + if (_tabScroller != null) + { + _tabScroller.Loaded -= ScrollViewer_Loaded; + } + + _tabContentPresenter = GetTemplateChild(TabContentPresenterName) as ContentPresenter; + _tabViewContainer = GetTemplateChild(TabViewContainerName) as Grid; + _tabItemsPresenter = GetTemplateChild(TabsItemsPresenterName) as ItemsPresenter; + _tabScroller = GetTemplateChild(TabsScrollViewerName) as ScrollViewer; + + if (_tabItemsPresenter != null) + { + _tabItemsPresenter.SizeChanged += TabView_SizeChanged; + } + + if (_tabScroller != null) + { + _tabScroller.Loaded += ScrollViewer_Loaded; + } + } + + private void ScrollViewer_Loaded(object sender, RoutedEventArgs e) + { + _tabScroller.Loaded -= ScrollViewer_Loaded; + + if (_tabScrollBackButton != null) + { + _tabScrollBackButton.Click -= ScrollTabBackButton_Click; + } + + if (_tabScrollForwardButton != null) + { + _tabScrollForwardButton.Click -= ScrollTabForwardButton_Click; + } + + _tabScrollBackButton = _tabScroller.FindDescendantByName(TabsScrollBackButtonName) as ButtonBase; + _tabScrollForwardButton = _tabScroller.FindDescendantByName(TabsScrollForwardButtonName) as ButtonBase; + + if (_tabScrollBackButton != null) + { + _tabScrollBackButton.Click += ScrollTabBackButton_Click; + } + + if (_tabScrollForwardButton != null) + { + _tabScrollForwardButton.Click += ScrollTabForwardButton_Click; + } + } + + private void ScrollTabBackButton_Click(object sender, RoutedEventArgs e) + { + _tabScroller.ChangeView(Math.Max(0, _tabScroller.HorizontalOffset - ScrollAmount), null, null); + } + + private void ScrollTabForwardButton_Click(object sender, RoutedEventArgs e) + { + _tabScroller.ChangeView(Math.Min(_tabScroller.ScrollableWidth, _tabScroller.HorizontalOffset + ScrollAmount), null, null); + } + + private void TabView_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + if (_isDragging) + { + // Skip if we're dragging, we'll reset when we're done. + return; + } + + if (_tabContentPresenter != null) + { + if (SelectedItem == null) + { + _tabContentPresenter.Content = null; + _tabContentPresenter.ContentTemplate = null; + } + else + { + if (ContainerFromItem(SelectedItem) is TabViewItem container) + { + _tabContentPresenter.Content = container.Content; + _tabContentPresenter.ContentTemplate = container.ContentTemplate; + } + } + } + + // If our width can be effected by the selection, need to run algorithm. + if (!double.IsNaN(SelectedTabWidth)) + { + TabView_SizeChanged(sender, null); + } + } + + /// + protected override void PrepareContainerForItemOverride(DependencyObject element, object item) + { + base.PrepareContainerForItemOverride(element, item); + + var tabitem = element as TabViewItem; + + tabitem.Loaded += TabViewItem_Loaded; + tabitem.Closing += TabViewItem_Closing; + + if (tabitem.Header == null) + { + tabitem.Header = item; + } + + if (tabitem.HeaderTemplate == null) + { + var headertemplatebinding = new Binding() + { + Source = this, + Path = new PropertyPath(nameof(ItemHeaderTemplate)), + Mode = BindingMode.OneWay + }; + tabitem.SetBinding(TabViewItem.HeaderTemplateProperty, headertemplatebinding); + } + + if (tabitem.IsClosable != true && tabitem.ReadLocalValue(TabViewItem.IsClosableProperty) == DependencyProperty.UnsetValue) + { + var iscloseablebinding = new Binding() + { + Source = this, + Path = new PropertyPath(nameof(CanCloseTabs)), + Mode = BindingMode.OneWay, + }; + tabitem.SetBinding(TabViewItem.IsClosableProperty, iscloseablebinding); + } + } + + private void TabViewItem_Loaded(object sender, RoutedEventArgs e) + { + var tabitem = sender as TabViewItem; + + tabitem.Loaded -= TabViewItem_Loaded; + + // Only need to do this once. + if (!_hasLoaded) + { + _hasLoaded = true; + + // Need to set a tab's selection on load, otherwise ListView resets to null. + SetInitialSelection(); + + // Need to make sure ContentPresenter is set to content based on selection. + TabView_SelectionChanged(this, null); + + // Need to make sure we've registered our removal method. + ItemsSource_PropertyChanged(this, null); + + // Make sure we complete layout now. + TabView_SizeChanged(this, null); + } + } + + private void TabViewItem_Closing(object sender, TabClosingEventArgs e) + { + var item = ItemFromContainer(e.Tab); + + var args = new TabClosingEventArgs(item, e.Tab); + TabClosing?.Invoke(this, args); + + if (!args.Cancel) + { + if (ItemsSource != null) + { + _removeItemsSourceMethod?.Invoke(ItemsSource, new object[] { item }); + } + else + { + Items.Remove(item); + } + } + } + + private void TabView_DragItemsStarting(object sender, DragItemsStartingEventArgs e) + { + // Keep track of drag so we don't modify content until done. + _isDragging = true; + } + + private void TabView_DragItemsCompleted(ListViewBase sender, DragItemsCompletedEventArgs args) + { + _isDragging = false; + + // args.DropResult == None when outside of area (e.g. create new window) + if (args.DropResult == DataPackageOperation.None) + { + var item = args.Items.FirstOrDefault(); + var tab = ContainerFromItem(item) as TabViewItem; + + if (tab == null && item is FrameworkElement fe) + { + tab = fe.FindParent(); + } + + if (tab == null) + { + // We still don't have a TabViewItem, most likely is a static TabViewItem in the template being dragged and not selected. + // This is a fallback scenario for static tabs. + // Note: This can be wrong if two TabViewItems share the exact same Content (i.e. a string), this should be unlikely in any practical scenario. + for (int i = 0; i < Items.Count; i++) + { + var tabItem = ContainerFromIndex(i) as TabViewItem; + if (ReferenceEquals(tabItem.Content, item)) + { + tab = tabItem; + break; + } + } + } + + TabDraggedOutside?.Invoke(this, new TabDraggedOutsideEventArgs(item, tab)); + } + else + { + // If dragging the active tab, there's an issue with the CP blanking. + TabView_SelectionChanged(this, null); + } + } + } +} diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/TabView/TabView.xaml b/Microsoft.Toolkit.Uwp.UI.Controls/TabView/TabView.xaml new file mode 100644 index 00000000000..7a4d0ef0c27 --- /dev/null +++ b/Microsoft.Toolkit.Uwp.UI.Controls/TabView/TabView.xaml @@ -0,0 +1,734 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + 0,0,8,0 + 8,0,-8,0 + 0,1,1,0 + 16 + 48 + 40 + NaN + 32 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/TabView/TabViewItem.Properties.cs b/Microsoft.Toolkit.Uwp.UI.Controls/TabView/TabViewItem.Properties.cs new file mode 100644 index 00000000000..3ce0f3e5483 --- /dev/null +++ b/Microsoft.Toolkit.Uwp.UI.Controls/TabView/TabViewItem.Properties.cs @@ -0,0 +1,79 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; + +namespace Microsoft.Toolkit.Uwp.UI.Controls +{ + /// + /// Item Container for a . + /// + public partial class TabViewItem + { + /// + /// Gets or sets the header content for the tab. + /// + public object Header + { + get { return (object)GetValue(HeaderProperty); } + set { SetValue(HeaderProperty, value); } + } + + /// + /// Identifies the dependency property. + /// + /// The identifier for the dependency property. + public static readonly DependencyProperty HeaderProperty = + DependencyProperty.Register(nameof(Header), typeof(object), typeof(TabViewItem), new PropertyMetadata(null)); + + /// + /// Gets or sets the icon to appear in the tab header. + /// + public IconElement Icon + { + get { return (IconElement)GetValue(IconProperty); } + set { SetValue(IconProperty, value); } + } + + /// + /// Identifies the dependency property. + /// + /// The identifier for the dependency property. + public static readonly DependencyProperty IconProperty = + DependencyProperty.Register(nameof(Icon), typeof(IconElement), typeof(TabViewItem), new PropertyMetadata(null)); + + /// + /// Gets or sets the template to override for the tab header. + /// + public DataTemplate HeaderTemplate + { + get { return (DataTemplate)GetValue(HeaderTemplateProperty); } + set { SetValue(HeaderTemplateProperty, value); } + } + + /// + /// Identifies the dependency property. + /// + /// The identifier for the dependency property. + public static readonly DependencyProperty HeaderTemplateProperty = + DependencyProperty.Register(nameof(HeaderTemplate), typeof(DataTemplate), typeof(TabViewItem), new PropertyMetadata(null)); + + /// + /// Gets or sets a value indicating whether the tab can be closed by the user with the close button. + /// + public bool IsClosable + { + get { return (bool)GetValue(IsClosableProperty); } + set { SetValue(IsClosableProperty, value); } + } + + /// + /// Identifies the dependency property. + /// + /// The identifier for the dependency property. + public static readonly DependencyProperty IsClosableProperty = + DependencyProperty.Register(nameof(IsClosable), typeof(bool), typeof(TabViewItem), new PropertyMetadata(null)); + } +} diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/TabView/TabViewItem.cs b/Microsoft.Toolkit.Uwp.UI.Controls/TabView/TabViewItem.cs new file mode 100644 index 00000000000..1b3832a2d4d --- /dev/null +++ b/Microsoft.Toolkit.Uwp.UI.Controls/TabView/TabViewItem.cs @@ -0,0 +1,99 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using Windows.Devices.Input; +using Windows.UI.Input; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; +using Windows.UI.Xaml.Controls.Primitives; +using Windows.UI.Xaml.Input; + +namespace Microsoft.Toolkit.Uwp.UI.Controls +{ + /// + /// Item Container for a . + /// + [TemplatePart(Name = TabCloseButtonName, Type = typeof(ButtonBase))] + public partial class TabViewItem : ListViewItem + { + private const string TabCloseButtonName = "CloseButton"; + + private ButtonBase _tabCloseButton; + + private bool _isMiddleClick; + + /// + /// Initializes a new instance of the class. + /// + public TabViewItem() + { + DefaultStyleKey = typeof(TabViewItem); + } + + /// + /// Fired when the Tab's close button is clicked. + /// + public event EventHandler Closing; + + /// + protected override void OnApplyTemplate() + { + base.OnApplyTemplate(); + + if (_tabCloseButton != null) + { + _tabCloseButton.Click -= TabCloseButton_Click; + } + + _tabCloseButton = GetTemplateChild(TabCloseButtonName) as ButtonBase; + + if (_tabCloseButton != null) + { + _tabCloseButton.Click += TabCloseButton_Click; + } + } + + /// + protected override void OnPointerPressed(PointerRoutedEventArgs e) + { + base.OnPointerPressed(e); + + _isMiddleClick = false; + + if (e.Pointer.PointerDeviceType == PointerDeviceType.Mouse) + { + PointerPoint pointerPoint = e.GetCurrentPoint(this); + + // Record if middle button is pressed + if (pointerPoint.Properties.IsMiddleButtonPressed) + { + _isMiddleClick = true; + } + } + } + + /// + protected override void OnPointerReleased(PointerRoutedEventArgs e) + { + base.OnPointerReleased(e); + + // Close on Middle-Click + if (_isMiddleClick) + { + TabCloseButton_Click(this, null); + } + + _isMiddleClick = false; + } + + private void TabCloseButton_Click(object sender, RoutedEventArgs e) + { + if (IsClosable) + { + Closing?.Invoke(this, new TabClosingEventArgs(Content, this)); + } + } + } +} diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/TabView/TabWidthMode.cs b/Microsoft.Toolkit.Uwp.UI.Controls/TabView/TabWidthMode.cs new file mode 100644 index 00000000000..65b1ce03844 --- /dev/null +++ b/Microsoft.Toolkit.Uwp.UI.Controls/TabView/TabWidthMode.cs @@ -0,0 +1,36 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Windows.UI.Xaml; + +namespace Microsoft.Toolkit.Uwp.UI.Controls +{ + /// + /// Possible modes for how to layout a Header's Width in the . + /// + public enum TabWidthMode + { + /// + /// Each tab header takes up as much space as it needs. This is similar to how WPF and Visual Studio Code behave. + /// Suggest to keep set to false. + /// is ignored. + /// In this scenario, tab width behavior is effectively turned off. This can be useful when using custom styling or a custom panel for layout of as well. + /// + Actual, + + /// + /// Each tab header will use the minimal space set by on the . + /// Suggest to set the to show more content for the selected item. + /// + Compact, + + /// + /// Each tab header will fill to fit the available space. If is set, that will be used as a Maximum Width. + /// This is similar to how Microsoft Edge behaves when used with the . + /// Suggest to set to true. + /// Suggest to set to 200 and the TabViewItemHeaderMinWidth Resource to 90. + /// + Equal, + } +} diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/Themes/Generic.xaml b/Microsoft.Toolkit.Uwp.UI.Controls/Themes/Generic.xaml index 0a86342e01d..b40433ce5b2 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls/Themes/Generic.xaml +++ b/Microsoft.Toolkit.Uwp.UI.Controls/Themes/Generic.xaml @@ -26,5 +26,6 @@ + \ No newline at end of file diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/VisualStudioToolsManifest.xml b/Microsoft.Toolkit.Uwp.UI.Controls/VisualStudioToolsManifest.xml index caefeb140a4..e2bc71350ef 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls/VisualStudioToolsManifest.xml +++ b/Microsoft.Toolkit.Uwp.UI.Controls/VisualStudioToolsManifest.xml @@ -33,6 +33,8 @@ + + diff --git a/Microsoft.Toolkit.Uwp.UI/Converters/DoubleToObjectConverter.cs b/Microsoft.Toolkit.Uwp.UI/Converters/DoubleToObjectConverter.cs new file mode 100644 index 00000000000..cadeeae4043 --- /dev/null +++ b/Microsoft.Toolkit.Uwp.UI/Converters/DoubleToObjectConverter.cs @@ -0,0 +1,160 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Data; + +namespace Microsoft.Toolkit.Uwp.UI.Converters +{ + /// + /// This class converts a double value into an other object. + /// Can be used to convert doubles to visibility, a couple of colors, couple of images, etc. + /// If GreaterThan and LessThan are both set, the logic looks for a value inbetween the two values. + /// Otherwise the logic looks for the value to be GreaterThan or LessThan the specified value. + /// The ConverterParameter can be used to invert the logic. + /// + [Bindable] + public class DoubleToObjectConverter : DependencyObject, IValueConverter + { + /// + /// Identifies the property. + /// + public static readonly DependencyProperty TrueValueProperty = + DependencyProperty.Register(nameof(TrueValue), typeof(object), typeof(DoubleToObjectConverter), new PropertyMetadata(null)); + + /// + /// Identifies the property. + /// + public static readonly DependencyProperty FalseValueProperty = + DependencyProperty.Register(nameof(FalseValue), typeof(object), typeof(DoubleToObjectConverter), new PropertyMetadata(null)); + + /// + /// Identifies the property. + /// + public static readonly DependencyProperty NullValueProperty = + DependencyProperty.Register(nameof(NullValue), typeof(object), typeof(DoubleToObjectConverter), new PropertyMetadata(null)); + + /// + /// Identifies the property. + /// + public static readonly DependencyProperty GreaterThanProperty = + DependencyProperty.Register(nameof(GreaterThan), typeof(double), typeof(DoubleToObjectConverter), new PropertyMetadata(double.NaN)); + + /// + /// Identifies the property. + /// + public static readonly DependencyProperty LessThanProperty = + DependencyProperty.Register(nameof(LessThan), typeof(double), typeof(DoubleToObjectConverter), new PropertyMetadata(double.NaN)); + + /// + /// Gets or sets the value to be returned when the expression is true + /// + public object TrueValue + { + get { return GetValue(TrueValueProperty); } + set { SetValue(TrueValueProperty, value); } + } + + /// + /// Gets or sets the value to be returned when the expression is false + /// + public object FalseValue + { + get { return GetValue(FalseValueProperty); } + set { SetValue(FalseValueProperty, value); } + } + + /// + /// Gets or sets the value to be returned when the value passed is null + /// + public object NullValue + { + get { return GetValue(NullValueProperty); } + set { SetValue(NullValueProperty, value); } + } + + /// + /// Gets or sets the value to check if the value is GreaterThan this value. + /// + public double GreaterThan + { + get { return (double)GetValue(GreaterThanProperty); } + set { SetValue(GreaterThanProperty, value); } + } + + /// + /// Gets or sets the value to check if the value is LessThan this value. + /// + public double LessThan + { + get { return (double)GetValue(LessThanProperty); } + set { SetValue(LessThanProperty, value); } + } + + /// + /// Convert a boolean value to an other object. + /// + /// The source data being passed to the target. + /// The type of the target property, as a type reference. + /// An optional parameter to be used to invert the converter logic. + /// The language of the conversion. + /// The value to be passed to the target dependency property. + public object Convert(object value, Type targetType, object parameter, string language) + { + if (value == null) + { + return NullValue; + } + + double vd = 0.0; // DEFAULT? + if (value is double dbl) + { + vd = dbl; + } + else if (double.TryParse(value.ToString(), out double result)) + { + vd = result; + } + + var boolValue = false; + + if (GreaterThan != double.NaN && LessThan != double.NaN && + vd > GreaterThan && vd < LessThan) + { + boolValue = true; + } + else if (GreaterThan != double.NaN && vd > GreaterThan) + { + boolValue = true; + } + else if (LessThan != double.NaN && vd < LessThan) + { + boolValue = true; + } + + // Negate if needed + if (ConverterTools.TryParseBool(parameter)) + { + boolValue = !boolValue; + } + + return ConverterTools.Convert(boolValue ? TrueValue : FalseValue, targetType); + } + + /// + /// Convert back the value to a boolean + /// + /// If the parameter is a reference type, must match its reference to return true. + /// The target data being passed to the source. + /// The type of the target property, as a type reference (System.Type for Microsoft .NET, a TypeName helper struct for Visual C++ component extensions (C++/CX)). + /// An optional parameter to be used to invert the converter logic. + /// The language of the conversion. + /// The value to be passed to the source object. + public object ConvertBack(object value, Type targetType, object parameter, string language) + { + throw new NotImplementedException(); + } + } +} diff --git a/Microsoft.Toolkit.Uwp.UI/Converters/DoubleToVisibilityConverter.cs b/Microsoft.Toolkit.Uwp.UI/Converters/DoubleToVisibilityConverter.cs new file mode 100644 index 00000000000..9a88789b784 --- /dev/null +++ b/Microsoft.Toolkit.Uwp.UI/Converters/DoubleToVisibilityConverter.cs @@ -0,0 +1,26 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Windows.UI.Xaml; +using Windows.UI.Xaml.Data; + +namespace Microsoft.Toolkit.Uwp.UI.Converters +{ + /// + /// This class converts a double value into a Visibility enumeration. + /// + [Bindable] + public class DoubleToVisibilityConverter : DoubleToObjectConverter + { + /// + /// Initializes a new instance of the class. + /// + public DoubleToVisibilityConverter() + { + TrueValue = Visibility.Visible; + FalseValue = Visibility.Collapsed; + NullValue = Visibility.Collapsed; + } + } +} diff --git a/Microsoft.Toolkit.Uwp.UI/Extensions/FrameworkElement/FrameworkElementExtensions.cs b/Microsoft.Toolkit.Uwp.UI/Extensions/FrameworkElement/FrameworkElementExtensions.ActualSize.cs similarity index 96% rename from Microsoft.Toolkit.Uwp.UI/Extensions/FrameworkElement/FrameworkElementExtensions.cs rename to Microsoft.Toolkit.Uwp.UI/Extensions/FrameworkElement/FrameworkElementExtensions.ActualSize.cs index 46794fb119a..e16dfcab52c 100644 --- a/Microsoft.Toolkit.Uwp.UI/Extensions/FrameworkElement/FrameworkElementExtensions.cs +++ b/Microsoft.Toolkit.Uwp.UI/Extensions/FrameworkElement/FrameworkElementExtensions.ActualSize.cs @@ -18,7 +18,7 @@ public static partial class FrameworkElementExtensions /// /// Attached for enabling actual size binding on any . /// - public static readonly DependencyProperty EnableActualSizeBindingProperty = DependencyProperty.RegisterAttached("EnableActualSizeBinding", typeof(bool), typeof(FrameworkElementExtensions), new PropertyMetadata(false, OnEnableActualSizeBindingtPropertyChanged)); + public static readonly DependencyProperty EnableActualSizeBindingProperty = DependencyProperty.RegisterAttached("EnableActualSizeBinding", typeof(bool), typeof(FrameworkElementExtensions), new PropertyMetadata(false, OnEnableActualSizeBindingPropertyChanged)); /// /// Attached for binding a for the @@ -90,7 +90,7 @@ public static void SetActualWidth(FrameworkElement obj, double value) obj.SetValue(ActualWidthProperty, value); } - private static void OnEnableActualSizeBindingtPropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args) + private static void OnEnableActualSizeBindingPropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args) { var baseElement = sender as FrameworkElement; if (baseElement == null) diff --git a/Microsoft.Toolkit.Uwp.UI/Extensions/FrameworkElement/FrameworkElementExtensions.RelativeAncestor.cs b/Microsoft.Toolkit.Uwp.UI/Extensions/FrameworkElement/FrameworkElementExtensions.RelativeAncestor.cs new file mode 100644 index 00000000000..1b04197e110 --- /dev/null +++ b/Microsoft.Toolkit.Uwp.UI/Extensions/FrameworkElement/FrameworkElementExtensions.RelativeAncestor.cs @@ -0,0 +1,89 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using Windows.UI.Xaml; + +namespace Microsoft.Toolkit.Uwp.UI.Extensions +{ + /// + /// Provides attached dependency properties for the + /// + public static partial class FrameworkElementExtensions + { + /// + /// Retrieves the parent object of this framework element found of the given . + /// + /// FrameworkElement + /// Parent object + public static object GetAncestor(DependencyObject obj) + { + return (object)obj.GetValue(AncestorProperty); + } + + /// + /// Sets the parent object of the framework element (internal). + /// + /// Parent object + /// FrameworkElement + public static void SetAncestor(DependencyObject obj, object value) + { + obj.SetValue(AncestorProperty, value); + } + + /// + /// Attached for retrieving a parent for the + /// + public static readonly DependencyProperty AncestorProperty = + DependencyProperty.RegisterAttached("Ancestor", typeof(object), typeof(FrameworkElementExtensions), new PropertyMetadata(null)); + + /// + /// Gets the Type of Ancestor to look for from this element. + /// + /// Blah blah + public static Type GetAncestorType(DependencyObject obj) + { + return (Type)obj.GetValue(AncestorTypeProperty); + } + + /// + /// Sets the to look for from this element and place in the . + /// + public static void SetAncestorType(DependencyObject obj, Type value) + { + obj.SetValue(AncestorTypeProperty, value); + } + + /// + /// Attached for retrieving a parent for the based on the provided in the . + /// + public static readonly DependencyProperty AncestorTypeProperty = + DependencyProperty.RegisterAttached("AncestorType", typeof(Type), typeof(FrameworkElementExtensions), new PropertyMetadata(null, AncestorType_PropertyChanged)); + + private static void AncestorType_PropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args) + { + if (obj is FrameworkElement fe) + { + fe.Loaded -= FrameworkElement_Loaded; + + if (args.NewValue != null) + { + fe.Loaded += FrameworkElement_Loaded; + if (fe.Parent != null) + { + FrameworkElement_Loaded(fe, null); + } + } + } + } + + private static void FrameworkElement_Loaded(object sender, RoutedEventArgs e) + { + if (sender is FrameworkElement fe) + { + SetAncestor(fe, fe.FindAscendant(GetAncestorType(fe))); + } + } + } +} diff --git a/Microsoft.Toolkit.Uwp.UI/Extensions/Markup/OnDevice.cs b/Microsoft.Toolkit.Uwp.UI/Extensions/Markup/OnDevice.cs new file mode 100644 index 00000000000..21fdf480344 --- /dev/null +++ b/Microsoft.Toolkit.Uwp.UI/Extensions/Markup/OnDevice.cs @@ -0,0 +1,89 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using Windows.ApplicationModel; +using Windows.UI.Xaml.Data; +using Windows.UI.Xaml.Markup; + +namespace Microsoft.Toolkit.Uwp.UI.Extensions.Markup +{ + /// + /// The OnDevice markup extension allows you to customize UI appearance on a per-DeviceFamily basis. + /// + /// + /// The next TextBlock will show the text 'Hello' on desktop computers, 'World' on Xbox and 'Hi' on all other devices + /// + /// + /// + /// + [Bindable] + public class OnDevice : MarkupExtension + { + /// + /// Gets or sets the default value for this property + /// + public object Default { get; set; } + + /// + /// Gets or sets a value for this property on Desktop + /// + public object Desktop { get; set; } + + /// + /// Gets or sets a value for this property on Holographic + /// + public object Holographic { get; set; } + + /// + /// Gets or sets a value for this property on IoT + /// + public object IoT { get; set; } + + /// + /// Gets or sets a value for this property on Team + /// + public object Team { get; set; } + + /// + /// Gets or sets a value for this property on Xbox + /// + public object Xbox { get; set; } + + /// + /// Returns an object value for the current DeviceFamily, Default is used when it is not set. + /// + /// The object value to set on the property where the extension is applied. + protected override object ProvideValue() + { + string deviceFamily = null; + if (DesignMode.DesignMode2Enabled) + { + // TODO: detect DeviceFamily in XAML Designer (device dropdown) + // deviceFamily = ??? + } + else + { + deviceFamily = Uwp.Helpers.SystemInformation.DeviceFamily; + } + + switch (deviceFamily) + { + case "Windows.Desktop": + return this.Desktop ?? this.Default; + case "Windows.Holographic": + return this.Holographic ?? this.Default; + case "Windows.IoT": + return this.IoT ?? this.Default; + case "Windows.Team": + return this.Team ?? this.Default; + case "Windows.Xbox": + return this.Xbox ?? this.Default; + default: + return this.Default; + } + } + } +} diff --git a/Microsoft.Toolkit.Uwp.UI/Extensions/Tree/VisualTree.cs b/Microsoft.Toolkit.Uwp.UI/Extensions/Tree/VisualTree.cs index ef1d33fb5b7..73177af5c27 100644 --- a/Microsoft.Toolkit.Uwp.UI/Extensions/Tree/VisualTree.cs +++ b/Microsoft.Toolkit.Uwp.UI/Extensions/Tree/VisualTree.cs @@ -78,6 +78,37 @@ public static T FindDescendant(this DependencyObject element) return retValue; } + /// + /// Find first descendant control of a specified type. + /// + /// Parent element. + /// Type of descendant. + /// Descendant control or null if not found. + public static object FindDescendant(this DependencyObject element, Type type) + { + object retValue = null; + var childrenCount = VisualTreeHelper.GetChildrenCount(element); + + for (var i = 0; i < childrenCount; i++) + { + var child = VisualTreeHelper.GetChild(element, i); + if (child.GetType() == type) + { + retValue = child; + break; + } + + retValue = FindDescendant(child, type); + + if (retValue != null) + { + break; + } + } + + return retValue; + } + /// /// Find all descendant controls of the specified type. /// @@ -157,6 +188,29 @@ public static T FindAscendant(this DependencyObject element) return parent.FindAscendant(); } + /// + /// Find first visual ascendant control of a specified type. + /// + /// Child element. + /// Type of ascendant to look for. + /// Ascendant control or null if not found. + public static object FindAscendant(this DependencyObject element, Type type) + { + var parent = VisualTreeHelper.GetParent(element); + + if (parent == null) + { + return null; + } + + if (parent.GetType() == type) + { + return parent; + } + + return parent.FindAscendant(type); + } + /// /// Find all visual ascendants for the element. /// diff --git a/Microsoft.Toolkit.Uwp.UI/Helpers/ThemeListener.cs b/Microsoft.Toolkit.Uwp.UI/Helpers/ThemeListener.cs index c8209ff93f2..42e75842550 100644 --- a/Microsoft.Toolkit.Uwp.UI/Helpers/ThemeListener.cs +++ b/Microsoft.Toolkit.Uwp.UI/Helpers/ThemeListener.cs @@ -78,7 +78,7 @@ private void Accessible_HighContrastChanged(AccessibilitySettings sender, object private async void Settings_ColorValuesChanged(UISettings sender, object args) { // Getting called off thread, so we need to dispatch to request value. - await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => + await CoreApplication.MainView?.CoreWindow?.Dispatcher?.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { // TODO: This doesn't stop the multiple calls if we're in our faked 'White' HighContrast Mode below. if (CurrentTheme != Application.Current.RequestedTheme || diff --git a/Microsoft.Toolkit.Uwp.UI/Media/CanvasBrushBase.cs b/Microsoft.Toolkit.Uwp.UI/Media/CanvasBrushBase.cs index 0f21bd83396..44c2b488da6 100644 --- a/Microsoft.Toolkit.Uwp.UI/Media/CanvasBrushBase.cs +++ b/Microsoft.Toolkit.Uwp.UI/Media/CanvasBrushBase.cs @@ -29,6 +29,10 @@ public abstract class CanvasBrushBase : XamlCompositionBrushBase /// protected float SurfaceHeight { get; set; } + private CanvasDevice _device; + + private CompositionGraphicsDevice _graphics; + /// /// Implemented by parent class and called when canvas is being constructed for brush. /// @@ -45,6 +49,22 @@ protected override void OnConnected() { base.OnConnected(); + if (_device != null) + { + _device.DeviceLost -= CanvasDevice_DeviceLost; + } + + _device = CanvasDevice.GetSharedDevice(); + _device.DeviceLost += CanvasDevice_DeviceLost; + + if (_graphics != null) + { + _graphics.RenderingDeviceReplaced -= CanvasDevice_RenderingDeviceReplaced; + } + + _graphics = CanvasComposition.CreateCompositionGraphicsDevice(Window.Current.Compositor, _device); + _graphics.RenderingDeviceReplaced += CanvasDevice_RenderingDeviceReplaced; + // Delay creating composition resources until they're required. if (CompositionBrush == null) { @@ -55,16 +75,12 @@ protected override void OnConnected() } var size = new Vector2(SurfaceWidth, SurfaceHeight); - - var device = CanvasDevice.GetSharedDevice(); - var graphics = CanvasComposition.CreateCompositionGraphicsDevice(Window.Current.Compositor, device); - - var surface = graphics.CreateDrawingSurface(size.ToSize(), DirectXPixelFormat.B8G8R8A8UIntNormalized, DirectXAlphaMode.Premultiplied); + var surface = _graphics.CreateDrawingSurface(size.ToSize(), DirectXPixelFormat.B8G8R8A8UIntNormalized, DirectXAlphaMode.Premultiplied); using (var session = CanvasComposition.CreateDrawingSession(surface)) { // Call Implementor to draw on session. - if (!OnDraw(device, session, size)) + if (!OnDraw(_device, session, size)) { return; } @@ -77,6 +93,18 @@ protected override void OnConnected() } } + private void CanvasDevice_RenderingDeviceReplaced(CompositionGraphicsDevice sender, object args) + { + OnDisconnected(); + OnConnected(); + } + + private void CanvasDevice_DeviceLost(CanvasDevice sender, object args) + { + OnDisconnected(); + OnConnected(); + } + /// /// Deconstructs the Composition Brush. /// @@ -84,6 +112,18 @@ protected override void OnDisconnected() { base.OnDisconnected(); + if (_device != null) + { + _device.DeviceLost -= CanvasDevice_DeviceLost; + _device = null; + } + + if (_graphics != null) + { + _graphics.RenderingDeviceReplaced -= CanvasDevice_RenderingDeviceReplaced; + _graphics = null; + } + // Dispose of composition resources when no longer in use. if (CompositionBrush != null) { diff --git a/Microsoft.Toolkit.Uwp/Helpers/BackgroundTaskHelper.cs b/Microsoft.Toolkit.Uwp/Helpers/BackgroundTaskHelper.cs index d3b8eb02e73..7f400811d85 100644 --- a/Microsoft.Toolkit.Uwp/Helpers/BackgroundTaskHelper.cs +++ b/Microsoft.Toolkit.Uwp/Helpers/BackgroundTaskHelper.cs @@ -9,32 +9,32 @@ namespace Microsoft.Toolkit.Uwp.Helpers { /// - /// This class provides static helper methods for background task. + /// This class provides static helper methods for background tasks. /// public static class BackgroundTaskHelper { /// - /// Check if a background task is registered. + /// Determines whether a background task is registered. /// /// The name of the background task class - /// True/False indicating if a background task was registered or not + /// true if a background task was registered; otherwise, false. public static bool IsBackgroundTaskRegistered(string backgroundTaskName) { return BackgroundTaskRegistration.AllTasks.Any(t => t.Value.Name == backgroundTaskName); } /// - /// Check if a background task is registered. + /// Determines whether a background task is registered. /// /// The type of the background task. This class has to implement IBackgroundTask - /// True/False indicating if a background task was registered or not + /// true if a background task was registered; otherwise, false. public static bool IsBackgroundTaskRegistered(Type backgroundTaskType) { return IsBackgroundTaskRegistered(backgroundTaskType.Name); } /// - /// Register a background task with conditions. + /// Registers a background task with conditions. /// If the task is already registered, return null. /// Or set to true to un-register the old one and then re-register. /// @@ -86,7 +86,7 @@ public static BackgroundTaskRegistration Register(string backgroundTaskName, str } /// - /// Register a background task with conditions. + /// Registers a background task with conditions. /// If the task is already registered and has the same trigger, returns the existing registration if it has the same trigger. /// If the task is already registered but has different trigger, return null by default. /// Or set to true to un-register the old one and then re-register. @@ -103,8 +103,8 @@ public static BackgroundTaskRegistration Register(Type backgroundTaskType, IBack } /// - /// This registers under the Single Process Model. WARNING: Single Process Model only works with Windows 10 Anniversary Update (14393) and later. - /// Register a background task with conditions. + /// Registers under the Single Process Model. WARNING: Single Process Model only works with Windows 10 Anniversary Update (14393) and later. + /// Registers a background task with conditions. /// If the task is already registered and has the same trigger, returns the existing registration if it has the same trigger. /// If the task is already registered but has different trigger, return null by default. /// Or set to true to un-register the old one and then re-register. @@ -121,17 +121,17 @@ public static BackgroundTaskRegistration Register(string backgroundTaskName, IBa } /// - /// Unregister a background task + /// Unregisters a background task. /// /// The type of the background task - /// /// Force the background task to quit if it is currently running (at the time of unregistering). Default value is true. + /// Force the background task to quit if it is currently running (at the time of unregistering). Default value is true. public static void Unregister(Type backgroundTaskType, bool forceExit = true) { Unregister(backgroundTaskType.Name, forceExit); } /// - /// Unregister a background task + /// Unregisters a background task. /// /// The name of the background task class /// Force the background task to quit if it is currently running (at the time of unregistering). Default value is true. @@ -141,7 +141,7 @@ public static void Unregister(string backgroundTaskName, bool forceExit = true) } /// - /// Unregister a background task + /// Unregisters a background task. /// /// A background task that was previously registered with the system /// Force the background task to quit if it is currently running (at the time of unregistering). Default value is true. @@ -151,20 +151,20 @@ public static void Unregister(IBackgroundTaskRegistration backgroundTask, bool f } /// - /// Get the registered background task of the given type. + /// Returns the registered background task of the given type. /// /// Type of the background task class. This class has to implement IBackgroundTask - /// Background task if there is such background task registered. Otherwise, null + /// The registered background task if it exists; otherwise, null. public static IBackgroundTaskRegistration GetBackgroundTask(Type backgroundTaskType) { return GetBackgroundTask(backgroundTaskType.Name); } /// - /// Get the registered background task of the given type. + /// Returns the registered background task of the given type. /// /// Name of the background task class - /// background task if there is such background task registered. Otherwise, null + /// The registered background task if it exists; otherwise, null. public static IBackgroundTaskRegistration GetBackgroundTask(string backgroundTaskName) { return BackgroundTaskRegistration.AllTasks.FirstOrDefault(t => t.Value.Name == backgroundTaskName).Value; diff --git a/Microsoft.Toolkit.Uwp/Helpers/CameraHelper/CameraHelper.cs b/Microsoft.Toolkit.Uwp/Helpers/CameraHelper/CameraHelper.cs index 2c16fa6a99f..2df16f0c836 100644 --- a/Microsoft.Toolkit.Uwp/Helpers/CameraHelper/CameraHelper.cs +++ b/Microsoft.Toolkit.Uwp/Helpers/CameraHelper/CameraHelper.cs @@ -15,7 +15,7 @@ namespace Microsoft.Toolkit.Uwp.Helpers { /// - /// Camera Helper class to capture frames from available camera sources. + /// Helper class for capturing frames from available camera sources. /// Make sure you have the capability webcam enabled for your app to access the device's camera. /// public class CameraHelper : IDisposable @@ -31,7 +31,7 @@ public class CameraHelper : IDisposable private bool _initialized; /// - /// Gets a list of MediaFrameSourceGroups available for video preview or video record. + /// Gets a list of available for video preview or video record. /// /// A list. public static async Task> GetFrameSourceGroupsAsync() @@ -51,7 +51,7 @@ public static async Task> GetFrameSourceGro } /// - /// Gets the available MediaFrameFormats on the source. + /// Gets a list of available on the source. /// public List FrameFormatsAvailable { get => _frameFormatsAvailable; } @@ -74,7 +74,7 @@ public MediaFrameSourceGroup FrameSourceGroup public MediaFrameSource PreviewFrameSource { get => _previewFrameSource; } /// - /// Event raised when a new frame arrives. + /// Occurs when a new frame arrives. /// public event EventHandler FrameArrived; @@ -118,11 +118,11 @@ public async Task InitializeAndStartCaptureAsync() } else { - // verify selected group is part of existing FrameSourceGroups + // Verify selected group is part of existing FrameSourceGroups _group = _frameSourceGroups.FirstOrDefault(g => g.Id == _group.Id); } - // if there is no camera source available, we can't proceed. + // If there is no camera source available, we can't proceed if (_group == null) { return CameraHelperResult.NoFrameSourceGroupAvailable; @@ -224,7 +224,7 @@ private async Task InitializeMediaCaptureAsync() return CameraHelperResult.NoFrameSourceAvailable; } - // get only formats of a certain framerate and compatible subtype for previewing, order them by resolution + // Get only formats of a certain framerate and compatible subtype for previewing, order them by resolution _frameFormatsAvailable = _previewFrameSource.SupportedFormats.Where(format => format.FrameRate.Numerator / format.FrameRate.Denominator >= 15 // fps && (string.Compare(format.Subtype, MediaEncodingSubtypes.Nv12, true) == 0 @@ -237,7 +237,7 @@ private async Task InitializeMediaCaptureAsync() return CameraHelperResult.NoCompatibleFrameFormatAvailable; } - // set the format with the higest resolution available by default + // Set the format with the higest resolution available by default var defaultFormat = _frameFormatsAvailable.Last(); await _previewFrameSource.SetFormatAsync(defaultFormat); } @@ -270,7 +270,7 @@ private async Task InitializeMediaCaptureAsync() } /// - /// Stops reading from the frame reader, disposes of the reader. + /// Stops reading from the frame reader and disposes of the reader. /// /// A representing the asynchronous operation. private async Task StopReaderAsync() diff --git a/Microsoft.Toolkit.Uwp/Helpers/CameraHelper/CameraHelperResult.cs b/Microsoft.Toolkit.Uwp/Helpers/CameraHelper/CameraHelperResult.cs index 81f1a6cc616..902f5f03221 100644 --- a/Microsoft.Toolkit.Uwp/Helpers/CameraHelper/CameraHelperResult.cs +++ b/Microsoft.Toolkit.Uwp/Helpers/CameraHelper/CameraHelperResult.cs @@ -5,37 +5,37 @@ namespace Microsoft.Toolkit.Uwp.Helpers { /// - /// Enum indicating result of Camera Helper initialization. + /// Enum indicating result of initialization. /// public enum CameraHelperResult { /// - /// Initialization is Successful + /// Initialization was successful. /// Success, /// - /// Initialization failed, Frame Reader Creation failed + /// Initialization failed; Frame Reader Creation failed. /// CreateFrameReaderFailed, /// - /// Initialization failed, Unable to start Frame Reader + /// Initialization failed; Unable to start Frame Reader. /// StartFrameReaderFailed, /// - /// Initialization failed, Frame Source Group is null + /// Initialization failed; Frame Source Group is null. /// NoFrameSourceGroupAvailable, /// - /// Initialization failed, Frame Source is null + /// Initialization failed; Frame Source is null. /// NoFrameSourceAvailable, /// - /// Access to camera is denied. + /// Access to the camera is denied. /// CameraAccessDenied, @@ -45,7 +45,7 @@ public enum CameraHelperResult InitializationFailed_UnknownError, /// - /// Initialization failed, there is no compatible frame format exposed via the frame source + /// Initialization failed; No compatible frame format exposed by the frame source. /// NoCompatibleFrameFormatAvailable } diff --git a/Microsoft.Toolkit.Uwp/Helpers/CameraHelper/FrameEventArgs.cs b/Microsoft.Toolkit.Uwp/Helpers/CameraHelper/FrameEventArgs.cs index b54d05f2b5b..ce860bffa1e 100644 --- a/Microsoft.Toolkit.Uwp/Helpers/CameraHelper/FrameEventArgs.cs +++ b/Microsoft.Toolkit.Uwp/Helpers/CameraHelper/FrameEventArgs.cs @@ -11,7 +11,7 @@ namespace Microsoft.Toolkit.Uwp.Helpers { /// - /// EventArgs to be used by FrameArrived Event + /// Provides data for the event. /// public class FrameEventArgs : EventArgs { @@ -20,7 +20,7 @@ public class FrameEventArgs : EventArgs private SemaphoreSlim _semaphore = new SemaphoreSlim(1); /// - /// Gets Video Frame + /// Gets the video frame. /// public VideoFrame VideoFrame { @@ -28,8 +28,8 @@ public VideoFrame VideoFrame { _semaphore.Wait(); - // videoFrame could be disposed at any time so we need to create a copy we can use - // this api is only available on 17134 - so we return the original VideoFrame on older versions + // The VideoFrame could be disposed at any time so we need to create a copy we can use. + // This API is only available on 17134 so we return the original VideoFrame on older versions. if (_videoFrameCopy == null && ApiInformation.IsMethodPresent("Windows.Media.VideoFrame", "CreateWithSoftwareBitmap", 1) && _videoFrame != null && diff --git a/Microsoft.Toolkit.Uwp/Helpers/ColorHelper.cs b/Microsoft.Toolkit.Uwp/Helpers/ColorHelper.cs index d7eb74c0586..3a98aaee165 100644 --- a/Microsoft.Toolkit.Uwp/Helpers/ColorHelper.cs +++ b/Microsoft.Toolkit.Uwp/Helpers/ColorHelper.cs @@ -5,6 +5,7 @@ using System; using System.Reflection; using Windows.UI; +using Color = Windows.UI.Color; namespace Microsoft.Toolkit.Uwp.Helpers { @@ -14,10 +15,11 @@ namespace Microsoft.Toolkit.Uwp.Helpers public static class ColorHelper { /// - /// Returns a color based on XAML color string. + /// Creates a from a XAML color string. + /// Any format used in XAML should work. /// - /// The color string. Any format used in XAML should work. - /// Parsed color + /// The XAML color string. + /// The created . public static Color ToColor(this string colorString) { if (string.IsNullOrEmpty(colorString)) @@ -120,20 +122,20 @@ public static Color ToColor(this string colorString) } /// - /// Converts a Color value to a string representation of the value in hexadecimal. + /// Converts a to a hexadecimal string representation. /// - /// The Color to convert. - /// Returns a string representing the hex value. + /// The color to convert. + /// The hexadecimal string representation of the color. public static string ToHex(this Color color) { return $"#{color.A:X2}{color.R:X2}{color.G:X2}{color.B:X2}"; } /// - /// Returns the color value as a premultiplied Int32 - 4 byte ARGB structure. + /// Converts a to a premultiplied Int32 - 4 byte ARGB structure. /// - /// the Color to convert - /// Returns a int representing the color. + /// The color to convert. + /// The int representation of the color. public static int ToInt(this Color color) { var a = color.A + 1; @@ -142,10 +144,10 @@ public static int ToInt(this Color color) } /// - /// Converts an RGBA Color the HSL representation. + /// Converts a to an . /// - /// The Color to convert. - /// HslColor. + /// The to convert. + /// The converted . public static HslColor ToHsl(this Color color) { const double toDouble = 1.0 / 255; @@ -187,10 +189,10 @@ public static HslColor ToHsl(this Color color) } /// - /// Converts an RGBA Color the HSV representation. + /// Converts a to an . /// - /// Color to convert. - /// HsvColor + /// The to convert. + /// The converted . public static HsvColor ToHsv(this Color color) { const double toDouble = 1.0 / 255; @@ -231,13 +233,13 @@ public static HsvColor ToHsv(this Color color) } /// - /// Returns a Color struct based on HSL model. + /// Creates a from the specified hue, saturation, lightness, and alpha values. /// /// 0..360 range hue /// 0..1 range saturation /// 0..1 range lightness /// 0..1 alpha - /// A Color object + /// The created . public static Color FromHsl(double hue, double saturation, double lightness, double alpha = 1.0) { if (hue < 0 || hue > 360) @@ -297,13 +299,13 @@ public static Color FromHsl(double hue, double saturation, double lightness, dou } /// - /// Returns a Color struct based on HSV model. + /// Creates a from the specified hue, saturation, value, and alpha values. /// /// 0..360 range hue /// 0..1 range saturation /// 0..1 range value /// 0..1 alpha - /// A Color object + /// The created . public static Color FromHsv(double hue, double saturation, double value, double alpha = 1.0) { if (hue < 0 || hue > 360) diff --git a/Microsoft.Toolkit.Uwp/Helpers/DispatcherHelper.cs b/Microsoft.Toolkit.Uwp/Helpers/DispatcherHelper.cs index a7fd5541123..1fb644509fa 100644 --- a/Microsoft.Toolkit.Uwp/Helpers/DispatcherHelper.cs +++ b/Microsoft.Toolkit.Uwp/Helpers/DispatcherHelper.cs @@ -15,9 +15,9 @@ namespace Microsoft.Toolkit.Uwp.Helpers public static class DispatcherHelper { /// - /// Execute the given function asynchronously on UI thread of the main view + /// Executes the given function asynchronously on UI thread of the main view. /// - /// returned data type of the function + /// Returned data type of the function /// Asynchronous function to be executed asynchronously on UI thread /// Dispatcher execution priority, default is normal /// Awaitable Task with type @@ -27,9 +27,9 @@ public static Task ExecuteOnUIThreadAsync(Func> function, CoreDisp } /// - /// Execute the given function asynchronously on given view's UI thread. Default view is the main view. + /// Executes the given function asynchronously on given view's UI thread. Default view is the main view. /// - /// returned data type of the function + /// Returned data type of the function /// View for the to be executed on /// Asynchronous function to be executed asynchronously on UI thread /// Dispatcher execution priority, default is normal @@ -38,14 +38,14 @@ public static Task ExecuteOnUIThreadAsync(this CoreApplicationView viewToE { if (viewToExecuteOn == null) { - throw new ArgumentNullException("viewToExecuteOn can't be null!"); + throw new ArgumentNullException(nameof(viewToExecuteOn)); } return viewToExecuteOn.Dispatcher.AwaitableRunAsync(function, priority); } /// - /// Execute the given function asynchronously on given view's UI thread. Default view is the main view. + /// Executes the given function asynchronously on given view's UI thread. Default view is the main view. /// /// View for the to be executed on /// Asynchronous function to be executed asynchronously on UI thread @@ -55,14 +55,14 @@ public static Task ExecuteOnUIThreadAsync(this CoreApplicationView viewToExecute { if (viewToExecuteOn == null) { - throw new ArgumentNullException("viewToExecuteOn can't be null!"); + throw new ArgumentNullException(nameof(viewToExecuteOn)); } return viewToExecuteOn.Dispatcher.AwaitableRunAsync(function, priority); } /// - /// Execute the given function asynchronously on UI thread of the main view + /// Executes the given function asynchronously on UI thread of the main view. /// /// Asynchronous function to be executed asynchronously on UI thread /// Dispatcher execution priority, default is normal @@ -73,7 +73,7 @@ public static Task ExecuteOnUIThreadAsync(Func function, CoreDispatcherPri } /// - /// Execute the given function asynchronously on given view's UI thread. Default view is the main view. + /// Executes the given function asynchronously on given view's UI thread. Default view is the main view. /// /// View for the to be executed on /// Asynchronous function to be executed asynchronously on UI thread @@ -83,14 +83,14 @@ public static Task ExecuteOnUIThreadAsync(this CoreApplicationView viewToExecute { if (viewToExecuteOn == null) { - throw new ArgumentNullException("viewToExecuteOn can't be null!"); + throw new ArgumentNullException(nameof(viewToExecuteOn)); } return viewToExecuteOn.Dispatcher.AwaitableRunAsync(function, priority); } /// - /// Execute the given function asynchronously on given view's UI thread. Default view is the main view. + /// Executes the given function asynchronously on given view's UI thread. Default view is the main view. /// /// Asynchronous function to be executed asynchronously on UI thread /// Dispatcher execution priority, default is normal @@ -101,9 +101,9 @@ public static Task ExecuteOnUIThreadAsync(Action function, CoreDispatcherPriorit } /// - /// Execute the given function asynchronously on given view's UI thread. Default view is the main view. + /// Executes the given function asynchronously on given view's UI thread. Default view is the main view. /// - /// returned data type of the function + /// Returned data type of the function /// View for the to be executed on /// Synchronous function with return type to be executed on UI thread /// Dispatcher execution priority, default is normal @@ -112,16 +112,16 @@ public static Task ExecuteOnUIThreadAsync(this CoreApplicationView viewToE { if (viewToExecuteOn == null) { - throw new ArgumentNullException("viewToExecuteOn can't be null!"); + throw new ArgumentNullException(nameof(viewToExecuteOn)); } return viewToExecuteOn.Dispatcher.AwaitableRunAsync(function, priority); } /// - /// Execute the given function asynchronously on given view's UI thread. Default view is the main view. + /// Executes the given function asynchronously on given view's UI thread. Default view is the main view. /// - /// returned data type of the function + /// Returned data type of the function /// Synchronous function to be executed on UI thread /// Dispatcher execution priority, default is normal /// Awaitable Task @@ -133,7 +133,7 @@ public static Task ExecuteOnUIThreadAsync(Func function, CoreDispatcher /// /// Extension method for CoreDispatcher. Offering an actual awaitable Task with optional result that will be executed on the given dispatcher /// - /// returned data type of the function + /// Returned data type of the function /// Dispatcher of a thread to run /// Asynchrounous function to be executed asynchrounously on the given dispatcher /// Dispatcher execution priority, default is normal @@ -142,7 +142,7 @@ public static Task AwaitableRunAsync(this CoreDispatcher dispatcher, Func< { if (function == null) { - throw new ArgumentNullException("function can't be null!"); + throw new ArgumentNullException(nameof(function)); } var taskCompletionSource = new TaskCompletionSource(); @@ -182,7 +182,7 @@ public static Task AwaitableRunAsync(this CoreDispatcher dispatcher, Func { if (function == null) { - throw new ArgumentNullException("function can't be null!"); + throw new ArgumentNullException(nameof(function)); } var taskCompletionSource = new TaskCompletionSource(); @@ -214,7 +214,7 @@ public static Task AwaitableRunAsync(this CoreDispatcher dispatcher, Func /// /// Extension method for CoreDispatcher. Offering an actual awaitable Task with optional result that will be executed on the given dispatcher /// - /// returned data type of the function + /// Returned data type of the function /// Dispatcher of a thread to run /// Function to be executed asynchrounously on the given dispatcher /// Dispatcher execution priority, default is normal @@ -223,7 +223,7 @@ public static Task AwaitableRunAsync(this CoreDispatcher dispatcher, Func< { if (function == null) { - throw new ArgumentNullException("function can't be null!"); + throw new ArgumentNullException(nameof(function)); } var taskCompletionSource = new TaskCompletionSource(); diff --git a/Microsoft.Toolkit.Uwp/Helpers/ObjectStorage/BaseObjectStorageHelper.cs b/Microsoft.Toolkit.Uwp/Helpers/ObjectStorage/BaseObjectStorageHelper.cs index cae730a4cf0..32c6c41cb6b 100644 --- a/Microsoft.Toolkit.Uwp/Helpers/ObjectStorage/BaseObjectStorageHelper.cs +++ b/Microsoft.Toolkit.Uwp/Helpers/ObjectStorage/BaseObjectStorageHelper.cs @@ -12,38 +12,38 @@ namespace Microsoft.Toolkit.Uwp.Helpers { /// - /// Shared implementation of ObjectStorageHelper + /// Shared implementation of ObjectStorageHelper. /// public abstract class BaseObjectStorageHelper : IObjectStorageHelper { private JsonSerializer serializer = new JsonSerializer(); /// - /// Gets or sets settings container + /// Gets or sets the settings container. /// protected ApplicationDataContainer Settings { get; set; } /// - /// Gets or sets storage folder + /// Gets or sets the storage folder. /// protected StorageFolder Folder { get; set; } /// - /// Detect if a setting already exists + /// Determines whether a setting already exists. /// /// Key of the setting (that contains object) - /// True if a value exists + /// true if the setting exists; otherwise, false. public bool KeyExists(string key) { return Settings.Values.ContainsKey(key); } /// - /// Detect if a setting already exists in composite. + /// Determines whether a setting already exists in composite. /// /// Key of the composite (that contains settings) /// Key of the setting (that contains object) - /// True if a value exists + /// true if the setting exists; otherwise, false. public bool KeyExists(string compositeKey, string key) { if (KeyExists(compositeKey)) @@ -59,7 +59,7 @@ public bool KeyExists(string compositeKey, string key) } /// - /// Retrieve single item by its key. + /// Retrieves a single item by its key. /// /// Type of object retrieved /// Key of the object @@ -91,7 +91,7 @@ public T Read(string key, T @default = default(T)) } /// - /// Retrieve single item by its key in composite. + /// Retrieves a single item by its key in composite. /// /// Type of object retrieved /// Key of the composite (that contains settings) @@ -114,7 +114,7 @@ public T Read(string compositeKey, string key, T @default = default(T)) } /// - /// Save single item by its key. + /// Saves a single item by its key. /// This method should be considered for objects that do not exceed 8k bytes during the lifetime of the application /// (refers to for complex/large objects). /// @@ -137,7 +137,7 @@ public void Save(string key, T value) } /// - /// Save a group of items by its key in a composite. + /// Saves a group of items by its key in a composite. /// This method should be considered for objects that do not exceed 8k bytes during the lifetime of the application /// (refers to for complex/large objects) and for groups of settings which /// need to be treated in an atomic way. @@ -176,17 +176,17 @@ public void Save(string compositeKey, IDictionary values) } /// - /// Detect if a file already exists + /// Determines whether a file already exists. /// /// Key of the file (that contains object) - /// True if a value exists + /// true if the file exists; otherwise, false. public Task FileExistsAsync(string filePath) { return Folder.FileExistsAsync(filePath); } /// - /// Retrieve object from file. + /// Retrieves an object from a file. /// /// Type of object retrieved /// Path to the file that contains the object @@ -199,13 +199,13 @@ public async Task ReadFileAsync(string filePath, T @default = default(T)) } /// - /// Save object inside file. + /// Saves an object inside a file. /// There is no limitation to use this method (refers to method for simple objects). /// /// Type of object saved /// Path to the file that will contain the object /// Object to save - /// When this method completes, it returns the where the object was saved + /// The where the object was saved public Task SaveFileAsync(string filePath, T value) { return StorageFileHelper.WriteTextToFileAsync(Folder, JsonConvert.SerializeObject(value), filePath, CreationCollisionOption.ReplaceExisting); diff --git a/Microsoft.Toolkit.Uwp/Helpers/ObjectStorage/IObjectStorageHelper.cs b/Microsoft.Toolkit.Uwp/Helpers/ObjectStorage/IObjectStorageHelper.cs index 15b199515d2..f706e67f4cf 100644 --- a/Microsoft.Toolkit.Uwp/Helpers/ObjectStorage/IObjectStorageHelper.cs +++ b/Microsoft.Toolkit.Uwp/Helpers/ObjectStorage/IObjectStorageHelper.cs @@ -9,19 +9,19 @@ namespace Microsoft.Toolkit.Uwp.Helpers { /// - /// Service used to store data + /// Service used to store data. /// public interface IObjectStorageHelper { /// - /// Detect if a setting already exists + /// Determines whether a setting already exists. /// /// Key of the setting (that contains object) /// True if a value exists bool KeyExists(string key); /// - /// Detect if a setting already exists in composite. + /// Determines whether a setting already exists in composite. /// /// Key of the composite (that contains settings) /// Key of the setting (that contains object) @@ -29,7 +29,7 @@ public interface IObjectStorageHelper bool KeyExists(string compositeKey, string key); /// - /// Retrieve single item by its key + /// Retrieves a single item by its key. /// /// Type of object retrieved /// Key of the object @@ -38,7 +38,7 @@ public interface IObjectStorageHelper T Read(string key, T @default = default(T)); /// - /// Retrieve single item by its key in composite. + /// Retrieves a single item by its key in composite. /// /// Type of object retrieved /// Key of the composite (that contains settings) @@ -48,7 +48,7 @@ public interface IObjectStorageHelper T Read(string compositeKey, string key, T @default = default(T)); /// - /// Save single item by its key + /// Saves a single item by its key. /// /// Type of object saved /// Key of the value saved @@ -56,7 +56,7 @@ public interface IObjectStorageHelper void Save(string key, T value); /// - /// Save a group of items by its key in a composite. + /// Saves a group of items by its key in a composite. /// This method should be considered for objects that do not exceed 8k bytes during the lifetime of the application /// (refers to for complex/large objects) and for groups of settings which /// need to be treated in an atomic way. @@ -67,14 +67,14 @@ public interface IObjectStorageHelper void Save(string compositeKey, IDictionary values); /// - /// Detect if a file already exists + /// Determines whether a file already exists. /// /// Key of the file (that contains object) /// True if a value exists Task FileExistsAsync(string filePath); /// - /// Retrieve object from file + /// Retrieves an object from a file. /// /// Type of object retrieved /// Path to the file that contains the object @@ -83,7 +83,7 @@ public interface IObjectStorageHelper Task ReadFileAsync(string filePath, T @default = default(T)); /// - /// Save object inside file + /// Saves an object inside a file. /// /// Type of object saved /// Path to the file that will contain the object diff --git a/Microsoft.Toolkit.Uwp/Helpers/ObjectStorage/LocalObjectStorageHelper.cs b/Microsoft.Toolkit.Uwp/Helpers/ObjectStorage/LocalObjectStorageHelper.cs index 02c5f99ff30..9be235382c5 100644 --- a/Microsoft.Toolkit.Uwp/Helpers/ObjectStorage/LocalObjectStorageHelper.cs +++ b/Microsoft.Toolkit.Uwp/Helpers/ObjectStorage/LocalObjectStorageHelper.cs @@ -7,7 +7,7 @@ namespace Microsoft.Toolkit.Uwp.Helpers { /// - /// Store data in the Local environment (only on the current device) + /// Store data in the Local environment (only on the current device). /// public class LocalObjectStorageHelper : BaseObjectStorageHelper { diff --git a/Microsoft.Toolkit.Uwp/Helpers/ObjectStorage/RoamingObjectStorageHelper.cs b/Microsoft.Toolkit.Uwp/Helpers/ObjectStorage/RoamingObjectStorageHelper.cs index d2a1e9789aa..62c9e5e832b 100644 --- a/Microsoft.Toolkit.Uwp/Helpers/ObjectStorage/RoamingObjectStorageHelper.cs +++ b/Microsoft.Toolkit.Uwp/Helpers/ObjectStorage/RoamingObjectStorageHelper.cs @@ -7,7 +7,7 @@ namespace Microsoft.Toolkit.Uwp.Helpers { /// - /// Store data in the Roaming environment (shared around all user devices) + /// Store data in the Roaming environment (shared across all user devices). /// public class RoamingObjectStorageHelper : BaseObjectStorageHelper { diff --git a/Microsoft.Toolkit.Uwp/Helpers/PackageVersionHelper.cs b/Microsoft.Toolkit.Uwp/Helpers/PackageVersionHelper.cs index d964cba1fcb..db05533a07c 100644 --- a/Microsoft.Toolkit.Uwp/Helpers/PackageVersionHelper.cs +++ b/Microsoft.Toolkit.Uwp/Helpers/PackageVersionHelper.cs @@ -7,25 +7,25 @@ namespace Microsoft.Toolkit.Uwp.Helpers { /// - /// This class provides static helper methods for . + /// This class provides static helper methods for . /// public static class PackageVersionHelper { /// - /// Returns a string representing the version number, of the format 'Major.Minor.Build.Revision' + /// Returns a string representation of a version with the format 'Major.Minor.Build.Revision'. /// - /// The PackageVersion to convert to a string - /// String of the format 'Major.Minor.Build.Revision' + /// The to convert to a string + /// Version string of the format 'Major.Minor.Build.Revision' public static string ToFormattedString(this PackageVersion packageVersion) { return $"{packageVersion.Major}.{packageVersion.Minor}.{packageVersion.Build}.{packageVersion.Revision}"; } /// - /// Convert a formatted string representing a version number as a PackageVersion object + /// Converts a string representation of a version number to an equivalent . /// - /// String of the format 'Major.Minor.Build.Revision' - /// A Package Version object + /// Version string of the format 'Major.Minor.Build.Revision' + /// The parsed public static PackageVersion ToPackageVersion(this string formattedVersionNumber) { var parts = formattedVersionNumber.Split('.'); diff --git a/Microsoft.Toolkit.Uwp/Helpers/PrintHelper/PrintHelper.cs b/Microsoft.Toolkit.Uwp/Helpers/PrintHelper/PrintHelper.cs index 7ccdb17dd28..e9911340b9b 100644 --- a/Microsoft.Toolkit.Uwp/Helpers/PrintHelper/PrintHelper.cs +++ b/Microsoft.Toolkit.Uwp/Helpers/PrintHelper/PrintHelper.cs @@ -16,28 +16,28 @@ namespace Microsoft.Toolkit.Uwp.Helpers { /// /// Helper class used to simplify document printing. - /// Based on https://github.com/Microsoft/Windows-universal-samples/blob/master/Samples/Printing/cs/PrintHelper.cs /> /// It allows you to render a framework element per page. /// + /// Based on https://github.com/Microsoft/Windows-universal-samples/blob/master/Samples/Printing/cs/PrintHelper.cs public class PrintHelper : IDisposable { /// - /// Event raised when print was successful + /// Occurs when a print was successful. /// public event Action OnPrintSucceeded; /// - /// Event raised when print failed + /// Occurs when a print fails. /// public event Action OnPrintFailed; /// - /// Event raised when print is cancelled by the user + /// Occurs when a print is canceled by the user. /// public event Action OnPrintCanceled; /// - /// Event which is called after print preview pages are generated. + /// Occurs after print preview pages are generated. /// /// /// You can use this event to tweak the final rendering by adding/moving controls in the page. @@ -45,12 +45,12 @@ public class PrintHelper : IDisposable public event Action> OnPreviewPagesCreated; /// - /// Gets or sets the percent of app's margin width + /// Gets or sets the percentage of the app's margin width. /// public double ApplicationContentMarginLeft { get; set; } = 0.03; /// - /// Gets or sets the percent of app's margin height + /// Gets or sets the percentage of the app's margin height. /// public double ApplicationContentMarginTop { get; set; } = 0.03; @@ -61,37 +61,38 @@ public class PrintHelper : IDisposable private PrintDocument _printDocument; /// - /// Marker interface for document source + /// Marker interface for document source. /// private IPrintDocumentSource _printDocumentSource; /// - /// A list of UIElements used to store the print preview pages. This gives easy access - /// to any desired preview page. + /// The list of elements used to store the print preview pages. + /// This gives easy access to any desired preview page. /// private List _printPreviewPages; /// - /// A hidden canvas used to hold pages we wish to print + /// A hidden canvas used to hold pages we wish to print. /// private Canvas _printCanvas; + private Panel _canvasContainer; private string _printTaskName; private Dictionary _stateBags = new Dictionary(); private bool _directPrint = false; /// - /// Gets the list of Framework element to print + /// The list of elements to print. /// private List _elementsToPrint; /// - /// Gets the options for the print dialog + /// The options for the print dialog. /// private PrintHelperOptions _printHelperOptions; /// - /// Gets the default options for the print dialog + /// The default options for the print dialog. /// private PrintHelperOptions _defaultPrintHelperOptions; @@ -99,7 +100,7 @@ public class PrintHelper : IDisposable /// Initializes a new instance of the class. /// /// XAML panel used to attach printing canvas. Can be hidden in your UI with Opacity = 0 for instance - /// /// Default settings for the print tasks + /// Default settings for the print tasks public PrintHelper(Panel canvasContainer, PrintHelperOptions defaultPrintHelperOptions = null) { if (canvasContainer == null) @@ -121,10 +122,10 @@ public PrintHelper(Panel canvasContainer, PrintHelperOptions defaultPrintHelperO } /// - /// Add an element to the list of printable elements. + /// Adds an element to the list of elements to print. /// - /// Framework element to print - /// The element cannot have a parent. He must not be included in any visual tree. + /// Framework element to print. + /// The element cannot have a parent; It must not be included in any visual tree. public void AddFrameworkElementToPrint(FrameworkElement element) { if (element.Parent != null) @@ -136,7 +137,7 @@ public void AddFrameworkElementToPrint(FrameworkElement element) } /// - /// Remove an element from the list of printable elements + /// Removes an element from the list of elements to print. /// /// Framework element to remove public void RemoveFrameworkElementToPrint(FrameworkElement element) @@ -145,7 +146,7 @@ public void RemoveFrameworkElementToPrint(FrameworkElement element) } /// - /// Empties the list of printable elements + /// Removes all elements from the list of elements to print. /// public void ClearListOfPrintableFrameworkElements() { @@ -153,11 +154,11 @@ public void ClearListOfPrintableFrameworkElements() } /// - /// Start the print task. + /// Starts the print task. /// /// Name of the print task to use - /// Directly print the content of the container instead of relying on list built with AddFrameworkElementToPrint method - /// A representing the asynchronous operation + /// Directly print the content of the container instead of relying on list built with method + /// A representing the asynchronous operation. public async Task ShowPrintUIAsync(string printTaskName, bool directPrint = false) { this._directPrint = directPrint; @@ -171,12 +172,12 @@ public async Task ShowPrintUIAsync(string printTaskName, bool directPrint = fals } /// - /// Start the print task. + /// Starts the print task. /// /// Name of the print task to use /// Settings for the print task - /// Directly print the content of the container instead of relying on list built with AddFrameworkElementToPrint method - /// A representing the asynchronous operation + /// Directly print the content of the container instead of relying on list built with method + /// A representing the asynchronous operation. public Task ShowPrintUIAsync(string printTaskName, PrintHelperOptions printHelperOptions, bool directPrint = false) { _printHelperOptions = printHelperOptions; @@ -240,7 +241,7 @@ private void DetachCanvas() /// This is the event handler for PrintManager.PrintTaskRequested. /// /// PrintManager - /// PrintTaskRequestedEventArgs + /// PrintTaskRequestedEventArgs private void PrintTaskRequested(PrintManager sender, PrintTaskRequestedEventArgs e) { PrintTask printTask = null; @@ -265,20 +266,20 @@ private void PrintTaskRequested(PrintManager sender, PrintTaskRequestedEventArgs switch (args.Completion) { case PrintTaskCompletion.Failed: - { - OnPrintFailed?.Invoke(); - break; - } + { + OnPrintFailed?.Invoke(); + break; + } case PrintTaskCompletion.Canceled: - { - OnPrintCanceled?.Invoke(); - break; - } + { + OnPrintCanceled?.Invoke(); + break; + } case PrintTaskCompletion.Submitted: - { - OnPrintSucceeded?.Invoke(); - break; - } + { + OnPrintSucceeded?.Invoke(); + break; + } } }); }; @@ -365,7 +366,8 @@ private void ApplyPrintSettings(PrintTask printTask) } /// - /// This is the event handler for PrintDocument.Paginate. It creates print preview pages for the app. + /// This is the event handler for . + /// It creates print preview pages for the app. /// /// PrintDocument /// Paginate Event Arguments @@ -413,9 +415,9 @@ private void CreatePrintPreviewPages(object sender, PaginateEventArgs e) } /// - /// This is the event handler for PrintDocument.GetPrintPreviewPage. It provides a specific print preview page, - /// in the form of an UIElement, to an instance of PrintDocument. PrintDocument subsequently converts the UIElement - /// into a page that the Windows print system can deal with. + /// This is the event handler for . + /// It provides a specific print preview page, in the form of an UIElement, to an instance of PrintDocument. + /// PrintDocument subsequently converts the UIElement into a page that the Windows print system can deal with. /// /// PrintDocument /// Arguments containing the preview requested page @@ -426,15 +428,15 @@ private void GetPrintPreviewPage(object sender, GetPreviewPageEventArgs e) } /// - /// This is the event handler for PrintDocument.AddPages. It provides all pages to be printed, in the form of - /// UIElements, to an instance of PrintDocument. PrintDocument subsequently converts the UIElements - /// into a pages that the Windows print system can deal with. + /// This is the event handler for . + /// It provides all pages to be printed, in the form of UIElements, to an instance of PrintDocument. + /// PrintDocument subsequently converts the UIElements into a pages that the Windows print system can deal with. /// /// PrintDocument /// Add page event arguments containing a print task options reference private void AddPrintPages(object sender, AddPagesEventArgs e) { - // Loop over all of the preview pages and add each one to add each page to be printied + // Loop over all of the preview pages and add each one to add each page to be printed for (int i = 0; i < _printPreviewPages.Count; i++) { // We should have all pages ready at this point... @@ -448,10 +450,9 @@ private void AddPrintPages(object sender, AddPagesEventArgs e) } /// - /// This function creates and adds one print preview page to the internal cache of print preview - /// pages stored in printPreviewPages. + /// Creates and adds one print preview page to the internal cache of print preview pages stored in . /// - /// FrameworkElement that is used to represent the "printing page" + /// FrameworkElement used to represent the "printing page" /// Printer's page description private void AddOnePrintPreviewPage(FrameworkElement element, PrintPageDescription printPageDescription) { @@ -473,7 +474,7 @@ private void AddOnePrintPreviewPage(FrameworkElement element, PrintPageDescripti double marginWidth = Math.Max(printPageDescription.PageSize.Width - printPageDescription.ImageableRect.Width, printPageDescription.PageSize.Width * ApplicationContentMarginLeft * 2); double marginHeight = Math.Max(printPageDescription.PageSize.Height - printPageDescription.ImageableRect.Height, printPageDescription.PageSize.Height * ApplicationContentMarginTop * 2); - // Set-up "printable area" on the "paper" + // Set up the "printable area" on the "paper" element.VerticalAlignment = VerticalAlignment.Top; element.HorizontalAlignment = HorizontalAlignment.Left; @@ -517,7 +518,7 @@ private void ClearPageCache() } } - _printPreviewPages.Clear(); + _printPreviewPages.Clear(); }); } } diff --git a/Microsoft.Toolkit.Uwp/Helpers/PrintHelper/PrintHelperOptions.cs b/Microsoft.Toolkit.Uwp/Helpers/PrintHelper/PrintHelperOptions.cs index d3e41618d8a..4e66ef6f987 100644 --- a/Microsoft.Toolkit.Uwp/Helpers/PrintHelper/PrintHelperOptions.cs +++ b/Microsoft.Toolkit.Uwp/Helpers/PrintHelper/PrintHelperOptions.cs @@ -13,7 +13,7 @@ namespace Microsoft.Toolkit.Uwp.Helpers { /// - /// Public class to store settings applicable to a print task + /// Represents options used in a print task. /// public class PrintHelperOptions { @@ -73,18 +73,18 @@ public class PrintHelperOptions public PrintOrientation Orientation { get; set; } /// - /// Gets the options that will be displayed in the printing dialog + /// Gets the options that will be displayed in the printing dialog. /// public IList DisplayedOptions { get; private set; } /// - /// Gets the possible display options + /// The possible display options. /// private IEnumerable _possibleDisplayOptions; /// /// Gets or sets a value indicating whether the default displayed options should be kept. - /// Defaults to true + /// Defaults to true. /// public bool ExtendDisplayedOptions { get; set; } @@ -101,7 +101,7 @@ public PrintHelperOptions(bool extendDisplayedOptions = true) } /// - /// Adds a display option + /// Adds a display option. /// /// Display option to add. Must be a part of the class public void AddDisplayOption(string displayOption) @@ -120,7 +120,7 @@ public void AddDisplayOption(string displayOption) } /// - /// Removes a display option + /// Removes a display option. /// /// Display option to add. Must be a part of the class public void RemoveDisplayOption(string displayOption) diff --git a/Microsoft.Toolkit.Uwp/Helpers/PrintHelper/PrintHelperStateBag.cs b/Microsoft.Toolkit.Uwp/Helpers/PrintHelper/PrintHelperStateBag.cs index c2fa5cc879c..b98c3dd7984 100644 --- a/Microsoft.Toolkit.Uwp/Helpers/PrintHelper/PrintHelperStateBag.cs +++ b/Microsoft.Toolkit.Uwp/Helpers/PrintHelper/PrintHelperStateBag.cs @@ -7,37 +7,37 @@ namespace Microsoft.Toolkit.Uwp.Helpers { /// - /// Internal class used to store values updated by the PrintHelper + /// Internal class used to store values updated by . /// internal class PrintHelperStateBag { /// - /// Gets or sets the stored horizontal alignment + /// Gets or sets the stored horizontal alignment. /// public HorizontalAlignment HorizontalAlignment { get; set; } /// - /// Gets or sets the stored vertical alignment + /// Gets or sets the stored vertical alignment. /// public VerticalAlignment VerticalAlignment { get; set; } /// - /// Gets or sets the stored width + /// Gets or sets the stored width. /// public double Width { get; set; } /// - /// Gets or sets the stored height + /// Gets or sets the stored height. /// public double Height { get; set; } /// - /// Gets or sets the stored margin + /// Gets or sets the stored margin. /// public Thickness Margin { get; set; } /// - /// Capture the current element state + /// Captures the current element state. /// /// Element to capture state from public void Capture(FrameworkElement element) @@ -50,7 +50,7 @@ public void Capture(FrameworkElement element) } /// - /// Restore stored state to given element + /// Restores stored state to given element. /// /// Element to restore state to public void Restore(FrameworkElement element) diff --git a/Microsoft.Toolkit.Uwp/Helpers/ScreenUnitHelper.cs b/Microsoft.Toolkit.Uwp/Helpers/ScreenUnitHelper.cs index b9ea60fd4d6..0fb75aa4fd5 100644 --- a/Microsoft.Toolkit.Uwp/Helpers/ScreenUnitHelper.cs +++ b/Microsoft.Toolkit.Uwp/Helpers/ScreenUnitHelper.cs @@ -17,12 +17,12 @@ public static class ScreenUnitHelper private const float CentimeterToInchRatio = 2.54f; /// - /// Convert a value from a screen unit to another one (ex: 1cm => 37.7953px) + /// Converts a screen unit to another screen unit (ex: 1cm => 37.7953px). /// /// Start unit /// End unit /// The value to convert (using start unit) - /// Returns the result of the conversion + /// The result of the conversion public static float Convert(ScreenUnit from, ScreenUnit to, float value) { if (from == to) diff --git a/Microsoft.Toolkit.Uwp/Helpers/StorageFileHelper.cs b/Microsoft.Toolkit.Uwp/Helpers/StorageFileHelper.cs index 356653855ab..f07093ab223 100644 --- a/Microsoft.Toolkit.Uwp/Helpers/StorageFileHelper.cs +++ b/Microsoft.Toolkit.Uwp/Helpers/StorageFileHelper.cs @@ -31,7 +31,7 @@ public static class StorageFileHelper /// The creation collision options. Default is ReplaceExisting. /// /// - /// Returns the saved containing the text. + /// The saved containing the text. /// /// /// Exception thrown if the file location or file name are null or empty. @@ -63,7 +63,7 @@ public static class StorageFileHelper /// The creation collision options. Default is ReplaceExisting. /// /// - /// Returns the saved containing the text. + /// The saved containing the text. /// /// /// Exception thrown if the file location or file name are null or empty. @@ -98,7 +98,7 @@ public static class StorageFileHelper /// The creation collision options. Default is ReplaceExisting. /// /// - /// Returns the saved containing the text. + /// The saved containing the text. /// /// /// Exception thrown if the file location or file name are null or empty. @@ -134,7 +134,7 @@ public static class StorageFileHelper /// The creation collision options. Default is ReplaceExisting. /// /// - /// Returns the saved containing the text. + /// The saved containing the text. /// /// /// Exception thrown if the file location or file name are null or empty. @@ -174,7 +174,7 @@ public static class StorageFileHelper /// The creation collision options. Default is ReplaceExisting. /// /// - /// Returns the saved containing the bytes. + /// The saved containing the bytes. /// /// /// Exception thrown if the file location or file name are null or empty. @@ -206,7 +206,7 @@ public static class StorageFileHelper /// The creation collision options. Default is ReplaceExisting. /// /// - /// Returns the saved containing the bytes. + /// The saved containing the bytes. /// /// /// Exception thrown if the file location or file name are null or empty. @@ -241,7 +241,7 @@ public static class StorageFileHelper /// The creation collision options. Default is ReplaceExisting. /// /// - /// Returns the saved containing the bytes. + /// The saved containing the bytes. /// /// /// Exception thrown if the file location or file name are null or empty. @@ -277,7 +277,7 @@ public static class StorageFileHelper /// The creation collision options. Default is ReplaceExisting. /// /// - /// Returns the saved containing the bytes. + /// The saved containing the bytes. /// /// /// Exception thrown if the file location or file name are null or empty. @@ -311,7 +311,7 @@ public static class StorageFileHelper /// The relative file path. /// /// - /// Returns the stored value. + /// The stored value. /// /// /// Exception thrown if the is null or empty. @@ -334,7 +334,7 @@ public static Task ReadTextFromPackagedFileAsync(string fileName) /// The relative file path. /// /// - /// Returns the stored value. + /// The stored value. /// /// /// Exception thrown if the is null or empty. @@ -357,7 +357,7 @@ public static Task ReadTextFromLocalCacheFileAsync(string fileName) /// The relative file path. /// /// - /// Returns the stored value. + /// The stored value. /// /// /// Exception thrown if the is null or empty. @@ -383,7 +383,7 @@ public static Task ReadTextFromLocalFileAsync(string fileName) /// The relative file path. /// /// - /// Returns the stored value. + /// The stored value. /// /// /// Exception thrown if the is null or empty. @@ -411,7 +411,7 @@ public static Task ReadTextFromLocalFileAsync(string fileName) /// The relative file path. /// /// - /// Returns the stored value. + /// The stored value. /// /// /// Exception thrown if the is null or empty. @@ -436,7 +436,7 @@ public static Task ReadTextFromLocalFileAsync(string fileName) /// The relative file path. /// /// - /// Returns the stored array. + /// The stored array. /// /// /// Exception thrown if the is null or empty. @@ -459,7 +459,7 @@ public static Task ReadBytesFromPackagedFileAsync(string fileName) /// The relative file path. /// /// - /// Returns the stored array. + /// The stored array. /// /// /// Exception thrown if the is null or empty. @@ -482,7 +482,7 @@ public static Task ReadBytesFromLocalCacheFileAsync(string fileName) /// The relative file path. /// /// - /// Returns the stored array. + /// The stored array. /// /// /// Exception thrown if the is null or empty. @@ -508,7 +508,7 @@ public static Task ReadBytesFromLocalFileAsync(string fileName) /// The relative file path. /// /// - /// Returns the stored array. + /// The stored array. /// /// /// Exception thrown if the is null or empty. @@ -536,7 +536,7 @@ public static Task ReadBytesFromLocalFileAsync(string fileName) /// The relative file path. /// /// - /// Returns the stored array. + /// The stored array. /// /// /// Exception thrown if the is null or empty. @@ -561,7 +561,7 @@ public static Task ReadBytesFromLocalFileAsync(string fileName) /// The . /// /// - /// Returns the stored array. + /// The stored array. /// public static async Task ReadBytesAsync(this StorageFile file) { @@ -595,7 +595,7 @@ public static async Task ReadBytesAsync(this StorageFile file) /// The , indicating if the subfolders should also be searched through. /// /// - /// Returns true, if the file exists. + /// true if the file exists; otherwise, false. /// public static Task FileExistsAsync(this StorageFolder folder, string fileName, bool isRecursive = false) => isRecursive @@ -606,7 +606,7 @@ public static Task FileExistsAsync(this StorageFolder folder, string fileN /// Gets a value indicating whether a filename is correct or not using the Storage feature. /// /// The filename to test. Must include the file extension and is not case-sensitive. - /// Returns true if the filename is valid. + /// true if the filename is valid; otherwise, false. public static bool IsFileNameValid(string fileName) { var illegalChars = Path.GetInvalidFileNameChars(); @@ -617,7 +617,7 @@ public static bool IsFileNameValid(string fileName) /// Gets a value indicating whether a file path is correct or not using the Storage feature. /// /// The file path to test. Must include the file extension and is not case-sensitive. - /// Returns true if the file path is valid. + /// true if the file path is valid; otherwise, false. public static bool IsFilePathValid(string filePath) { var illegalChars = Path.GetInvalidPathChars(); @@ -634,7 +634,7 @@ public static bool IsFilePathValid(string filePath) /// The filename of the file to search for. Must include the file extension and is not case-sensitive. /// /// - /// Returns true, if the file exists. + /// true if the file exists; otherwise, false. /// internal static async Task FileExistsInFolderAsync(StorageFolder folder, string fileName) { @@ -652,7 +652,7 @@ internal static async Task FileExistsInFolderAsync(StorageFolder folder, s /// The filename of the file to search for. Must include the file extension and is not case-sensitive. /// /// - /// Returns true, if the file exists. + /// true if the file exists; otherwise, false. /// /// /// Exception thrown if the contains a quotation mark. @@ -678,7 +678,7 @@ internal static async Task FileExistsInSubtreeAsync(StorageFolder rootFold /// Returns a from a /// /// Folder Id - /// + /// The internal static StorageFolder GetFolderFromKnownFolderId(KnownFolderId knownFolderId) { StorageFolder workingFolder; @@ -731,4 +731,4 @@ internal static StorageFolder GetFolderFromKnownFolderId(KnownFolderId knownFold return workingFolder; } } -} \ No newline at end of file +} diff --git a/Microsoft.Toolkit.Uwp/Helpers/StreamHelper.cs b/Microsoft.Toolkit.Uwp/Helpers/StreamHelper.cs index e90e73ff4ba..7c9f4937803 100644 --- a/Microsoft.Toolkit.Uwp/Helpers/StreamHelper.cs +++ b/Microsoft.Toolkit.Uwp/Helpers/StreamHelper.cs @@ -22,11 +22,11 @@ public static class StreamHelper private static HttpClient client = new HttpClient(); /// - /// Get the response stream returned by a HTTP get request. + /// Gets the response stream returned by a HTTP get request. /// /// Uri to request. - /// instance of - /// Response stream + /// A used to cancel the operation. + /// The response stream public static async Task GetHttpStreamAsync(this Uri uri, CancellationToken cancellationToken = default(CancellationToken)) { var outputStream = new InMemoryRandomAccessStream(); @@ -47,11 +47,11 @@ public static async Task GetHttpStreamAsync(this Uri uri, C } /// - /// Get the response stream returned by a HTTP get request and save it to a local file. + /// Gets the response stream returned by a HTTP get request and save it to a local file. /// /// Uri to request. /// StorageFile to save the stream to. - /// True if success. + /// A representing the asynchronous operation. public static async Task GetHttpStreamToStorageFileAsync( this Uri uri, StorageFile targetFile) @@ -72,11 +72,11 @@ public static async Task GetHttpStreamAsync(this Uri uri, C } /// - /// Return a stream to a specified file from the installation folder. + /// Gets a stream to a specified file from the installation folder. /// /// Relative name of the file to open. Can contains subfolders. /// File access mode. Default is read. - /// File stream + /// The file stream public static Task GetPackagedFileStreamAsync( string fileName, FileAccessMode accessMode = FileAccessMode.Read) @@ -86,11 +86,11 @@ public static async Task GetHttpStreamAsync(this Uri uri, C } /// - /// Return a stream to a specified file from the application local folder. + /// Gets a stream to a specified file from the application local folder. /// /// Relative name of the file to open. Can contains subfolders. /// File access mode. Default is read. - /// File stream + /// The file stream public static Task GetLocalFileStreamAsync( string fileName, FileAccessMode accessMode = FileAccessMode.Read) @@ -100,11 +100,11 @@ public static async Task GetHttpStreamAsync(this Uri uri, C } /// - /// Return a stream to a specified file from the application local cache folder. + /// Gets a stream to a specified file from the application local cache folder. /// - /// Relative name of the file to open. Can contains subfolders. + /// Relative name of the file to open. Can contain subfolders. /// File access mode. Default is read. - /// File stream + /// The file stream public static Task GetLocalCacheFileStreamAsync( string fileName, FileAccessMode accessMode = FileAccessMode.Read) @@ -114,12 +114,12 @@ public static async Task GetHttpStreamAsync(this Uri uri, C } /// - /// Return a stream to a specified file from the application local cache folder. + /// Gets a stream to a specified file from the application local cache folder. /// /// The well known folder ID to use /// Relative name of the file to open. Can contains subfolders. /// File access mode. Default is read. - /// File stream + /// The file stream public static Task GetKnowFoldersFileStreamAsync( KnownFolderId knownFolderId, string fileName, @@ -130,11 +130,11 @@ public static async Task GetHttpStreamAsync(this Uri uri, C } /// - /// Read stream content as a string. + /// Reads stream content as a string. /// /// Stream to read from. - /// Encoding to use. Can be set to null (ASCII will be used in this case). - /// Stream content. + /// Encoding to use. If set to null, ASCII will be used. + /// The stream content public static async Task ReadTextAsync( this IRandomAccessStream stream, Encoding encoding = null) diff --git a/Microsoft.Toolkit.Uwp/Helpers/SystemInformation.cs b/Microsoft.Toolkit.Uwp/Helpers/SystemInformation.cs index d1e9660c04e..68444250c10 100644 --- a/Microsoft.Toolkit.Uwp/Helpers/SystemInformation.cs +++ b/Microsoft.Toolkit.Uwp/Helpers/SystemInformation.cs @@ -16,7 +16,7 @@ namespace Microsoft.Toolkit.Uwp.Helpers { /// - /// Defines class providing information of OS and application + /// This class provides info about the app and the system. /// public static class SystemInformation { @@ -24,43 +24,31 @@ public static class SystemInformation private static DateTime _sessionStart; /// - /// Gets Application's name + /// Gets the application's name. /// public static string ApplicationName { get; } /// - /// Gets Application's version + /// Gets the application's version. /// public static PackageVersion ApplicationVersion { get; } /// - /// Gets the most preferred culture by the user + /// Gets the user's most preferred culture. /// public static CultureInfo Culture { get; } /// - /// Gets device's family + /// Gets the device's family. /// /// Common values include: /// - /// - /// "Windows.Desktop" - /// - /// - /// "Windows.Mobile" - /// - /// - /// "Windows.Xbox" - /// - /// - /// "Windows.Holographic" - /// - /// - /// "Windows.Team" - /// - /// - /// "Windows.IoT" - /// + /// "Windows.Desktop" + /// "Windows.Mobile" + /// "Windows.Xbox" + /// "Windows.Holographic" + /// "Windows.Team" + /// "Windows.IoT" /// /// /// Prepare your code for other values. @@ -68,34 +56,34 @@ public static class SystemInformation public static string DeviceFamily { get; } /// - /// Gets operating system + /// Gets the operating system's name. /// public static string OperatingSystem { get; } /// - /// Gets operating system version + /// Gets the operating system's version. /// public static OSVersion OperatingSystemVersion { get; } /// - /// Gets used processor architecture + /// Gets the processor architecture. /// public static ProcessorArchitecture OperatingSystemArchitecture { get; } /// - /// Gets available memory + /// Gets the available memory. /// public static float AvailableMemory => (float)MemoryManager.AppMemoryUsageLimit / 1024 / 1024; /// - /// Gets device model. - /// Will be empty if the device model couldn't be determined (ex: when running in a virtual machine). + /// Gets the device's model. + /// Will be empty if the model couldn't be determined (For example: when running in a virtual machine). /// public static string DeviceModel { get; } /// - /// Gets device's manufacturer. - /// Will be empty if the device manufacturer couldn't be determined (ex: when running in a virtual machine). + /// Gets the device's manufacturer. + /// Will be empty if the manufacturer couldn't be determined (For example: when running in a virtual machine). /// public static string DeviceManufacturer { get; } @@ -118,43 +106,43 @@ public static class SystemInformation public static PackageVersion FirstVersionInstalled { get; } /// - /// Gets the DateTime (in UTC) when the app was launched for the first time + /// Gets the DateTime (in UTC) when the app was launched for the first time. /// public static DateTime FirstUseTime { get; } /// - /// Gets the DateTime (in UTC) when the app was previously launched, not including this instance. - /// Will be DateTime.MinValue if `TrackAppUse` has not been called. + /// Gets the DateTime (in UTC) when the app was last launched, not including this instance. + /// Will be if has not been called yet. /// public static DateTime LastLaunchTime { get; private set; } /// - /// Gets the number of times the app has been launched since the last reset. - /// Will be zero if `TrackAppUse` has not been called. + /// Gets the number of times the app has been launched. + /// Will be 0 if has not been called yet. /// public static long LaunchCount { get; private set; } /// /// Gets the number of times the app has been launched. - /// Will be zero if `TrackAppUse` has not been called. + /// Will be 0 if has not been called yet. /// public static long TotalLaunchCount { get; private set; } /// /// Gets the DateTime (in UTC) that this instance of the app was launched. - /// Will be DateTime.MinValue if `TrackAppUse` has not been called. + /// Will be if has not been called yet. /// public static DateTime LaunchTime { get; private set; } /// - /// Gets the DateTime (in UTC) when the launch count was previously reset, not including this instance. - /// Will be DateTime.MinValue if `TrackAppUse` has not been called. + /// Gets the DateTime (in UTC) when the launch count was last reset. + /// Will be if has not been called yet. /// public static DateTime LastResetTime { get; private set; } /// /// Gets the length of time this instance of the app has been running. - /// Will be TimeSpan.MinValue if `TrackAppUse` has not been called. + /// Will be if has not been called yet. /// public static TimeSpan AppUptime { @@ -176,7 +164,7 @@ public static TimeSpan AppUptime } /// - /// Track app launch information + /// Tracks information about the app's launch. /// /// Details about the launch request and process. public static void TrackAppUse(LaunchActivatedEventArgs args) @@ -233,16 +221,16 @@ void App_VisibilityChanged(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.Vi } /// - /// Launch the store app so the user can leave a review + /// Launches the store app so the user can leave a review. /// - /// A representing the asynchronous operation + /// A representing the asynchronous operation. public static async Task LaunchStoreForReviewAsync() { await Launcher.LaunchUriAsync(new Uri(string.Format("ms-windows-store://review/?PFN={0}", Package.Current.Id.FamilyName))); } /// - /// Add to the record of how long the app has been running. + /// Adds to the record of how long the app has been running. /// Use this to optionally include time spent in background tasks or extended execution. /// /// The amount to time to add @@ -253,7 +241,7 @@ public static void AddToAppUptime(TimeSpan duration) } /// - /// Reset launch count + /// Resets the launch count. /// public static void ResetLaunchCount() { diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.Controls.WebView/Microsoft.Toolkit.Forms.UI.Controls.WebView.csproj b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.Controls.WebView/Microsoft.Toolkit.Forms.UI.Controls.WebView.csproj deleted file mode 100644 index 14e5e9dcc53..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.Controls.WebView/Microsoft.Toolkit.Forms.UI.Controls.WebView.csproj +++ /dev/null @@ -1,48 +0,0 @@ - - - - net462 - Microsoft.Toolkit.Forms.UI.Controls - Microsoft.Toolkit.Forms.UI.Controls.WebView - true - - Windows Community Toolkit WebView Windows Forms Controls - This library provides WebView user controls for Windows Forms. It is part of the Windows Community Toolkit. - WebView Win32 WindowsForms - - $(DefineConstants);WINFORMS - - 10.0.17134.0 - - - - $(DefineConstants);DEV_DEBUG;DEBUG_LAYOUT; - - - - - - - - - - - - - - - - - - - - - - - $(WINDIR)\Microsoft.NET\Framework\v4.0.30319\System.Net.Http.dll - - - $(WINDIR)\Microsoft.NET\Framework\v4.0.30319\System.Runtime.WindowsRuntime.dll - - - diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.Controls.WebView/Properties/AssemblyInfo.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.Controls.WebView/Properties/AssemblyInfo.cs deleted file mode 100644 index 9d9fff27852..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.Controls.WebView/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Resources; -using System.Runtime.InteropServices; - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -[assembly: NeutralResourcesLanguage("en-US")] \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.Controls.WebView/TaskExtensions.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.Controls.WebView/TaskExtensions.cs deleted file mode 100644 index 6e47ce659a6..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.Controls.WebView/TaskExtensions.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Windows.Forms; - -namespace System.Threading.Tasks -{ - /// - /// Contains extensions to process a task within a nested Windows Forms message loop - /// - internal static partial class TaskExtensions - { - public static T WaitWithNestedMessageLoop(this Task task) - { - while (!task.IsCompleted) - { - Application.DoEvents(); - } - - return task.Result; - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.Controls.WebView/WebView.BaseProperties.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.Controls.WebView/WebView.BaseProperties.cs deleted file mode 100644 index 5b5567cab0a..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.Controls.WebView/WebView.BaseProperties.cs +++ /dev/null @@ -1,221 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.ComponentModel; -using System.Drawing; -using System.Windows.Forms; - -namespace Microsoft.Toolkit.Forms.UI.Controls -{ - /// - public partial class WebView : Control - { - /// - /// Gets or sets a value indicating whether the control can accept data that the user drags onto it. - /// - /// if the control can accept data that the user drags onto it; otherwise, . - /// The value of is modified. - /// cannot be modified and is not visible in the designer. - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public override bool AllowDrop - { - get => base.AllowDrop; - set => throw new NotSupportedException(); - } - - /// - /// Gets or sets the background color for the control. - /// - /// A that represents the background color of the control. - /// The value of is modified. - /// cannot be modified and is not visible in the designer. - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public override Color BackColor - { - get => base.BackColor; - set => throw new NotSupportedException(); - } - - /// - /// Gets or sets the background image displayed in the control. - /// - /// An that represents the image to display in the background of the control. - /// The value of is modified. - /// cannot be modified and is not visible in the designer. - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public override Image BackgroundImage - { - get => base.BackgroundImage; - set => throw new NotSupportedException(); - } - - /// - /// Gets or sets the background image layout as defined in the enumeration. - /// - /// One of the values of . - /// The value of is modified. - /// cannot be modified and is not visible in the designer. - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public override ImageLayout BackgroundImageLayout - { - get => base.BackgroundImageLayout; - set => throw new NotSupportedException(); - } - - /// - /// Gets or sets the cursor that is displayed when the mouse pointer is over the control. - /// - /// A that represents the cursor to display when the mouse pointer is over the control. - /// The value of is modified. - /// cannot be modified and is not visible in the designer. - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public override Cursor Cursor - { - get => base.Cursor; - set => throw new NotSupportedException(); - } - - // Shadowed because the property is not virtual and we needed to override the behavior - - /// - /// Gets or sets a value indicating whether the control can respond to user interaction. - /// - /// if the control can respond to user interaction; otherwise, . - /// The value of is modified. - /// cannot be modified and is not visible in the designer. - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public new bool Enabled - { - get => base.Enabled; - set => throw new NotSupportedException(); - } - - /// - /// Gets or sets the font of the text displayed by the control. - /// - /// The to apply to the text displayed by the control. - /// The value of is modified. - /// cannot be modified and is not visible in the designer. - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public override Font Font - { - get => base.Font; - set => throw new NotSupportedException(); - } - - /// - /// Gets or sets the foreground color of the control. - /// - /// The foreground of the control. - /// The value of is modified. - /// cannot be modified and is not visible in the designer. - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public override Color ForeColor - { - get => base.ForeColor; - set => throw new NotSupportedException(); - } - - // Shadowed so we can put the attributes here to hide it in the designer - - /// - /// Gets or sets the Input Method Editor (IME) mode of the control. - /// - /// One of the values. The default is . - /// /// The property is not visible in the designer. - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public new ImeMode ImeMode - { - get => base.ImeMode; - set => base.ImeMode = value; - } - - // New so we can put the attributes here to hide it in the designer - - /// - /// Gets or sets padding within the control. - /// - /// A representing the control's internal spacing characteristics. - /// /// The property is not visible in the designer. - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public new Padding Padding - { - get => base.Padding; - set => base.Padding = value; - } - - /// - /// Gets or sets a value indicating whether control's elements are aligned to support locales using right-to-left fonts. - /// - /// One of the values. - /// The value of the property is modified. - /// The property cannot be modified and is not visible in the designer. - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - [Localizable(false)] - public override RightToLeft RightToLeft - { - get => RightToLeft.No; - set => throw new NotSupportedException(); - } - - /// - /// Gets or sets the text associated with this control. - /// - /// The text displayed in the control. - /// The value of the property is modified. - /// The property cannot be modified and is not visible in the designer. - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - [Bindable(false)] - public override string Text - { - get => string.Empty; - set => throw new NotSupportedException(); - } - - /// - /// Gets or sets a value indicating whether to use the wait cursor for the current control and all child controls. - /// - /// to use the wait cursor for the current control and all child controls; otherwise, . - /// The value of the property is modified. - /// The property cannot be modified and is not visible in the designer. - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public new bool UseWaitCursor - { - get => base.UseWaitCursor; - set => throw new NotSupportedException(); - } - - /// - /// Gets the default size of the control. - /// - /// The default of the control. - protected override Size DefaultSize => new Size(250, 250); - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.Controls.WebView/WebView.Events.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.Controls.WebView/WebView.Events.cs deleted file mode 100644 index d61cea783a4..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.Controls.WebView/WebView.Events.cs +++ /dev/null @@ -1,349 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using Microsoft.Toolkit.Win32.UI.Controls; -using Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT; -using WebViewControlAcceleratorKeyPressedEventArgs = Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT.WebViewControlAcceleratorKeyPressedEventArgs; -using WebViewControlContentLoadingEventArgs = Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT.WebViewControlContentLoadingEventArgs; -using WebViewControlDOMContentLoadedEventArgs = Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT.WebViewControlDOMContentLoadedEventArgs; -using WebViewControlLongRunningScriptDetectedEventArgs = Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT.WebViewControlLongRunningScriptDetectedEventArgs; -using WebViewControlMoveFocusRequestedEventArgs = Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT.WebViewControlMoveFocusRequestedEventArgs; -using WebViewControlNavigationStartingEventArgs = Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT.WebViewControlNavigationStartingEventArgs; -using WebViewControlNewWindowRequestedEventArgs = Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT.WebViewControlNewWindowRequestedEventArgs; -using WebViewControlPermissionRequestedEventArgs = Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT.WebViewControlPermissionRequestedEventArgs; -using WebViewControlScriptNotifyEventArgs = Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT.WebViewControlScriptNotifyEventArgs; -using WebViewControlUnsupportedUriSchemeIdentifiedEventArgs = Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT.WebViewControlUnsupportedUriSchemeIdentifiedEventArgs; -using WebViewControlUnviewableContentIdentifiedEventArgs = Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT.WebViewControlUnviewableContentIdentifiedEventArgs; - -namespace Microsoft.Toolkit.Forms.UI.Controls -{ - /// - public partial class WebView : IWebView - { - /// - public event EventHandler AcceleratorKeyPressed = (sender, args) => { }; - - /// - /// - /// Occurs when the status of whether the current contains a full screen element or not changes. - /// - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1009:DeclareEventHandlersCorrectly", Justification = "Declaration of WinRT type")] - [StringResourceCategory(Constants.CategoryAction)] - [StringResourceDescription(Constants.DescriptionWebViewContainsFullScreenElement)] - public event EventHandler ContainsFullScreenElementChanged = (sender, args) => { }; - - /// - /// Occurs when the has started loading new content. - /// - [StringResourceCategory(Constants.CategoryAction)] - [StringResourceDescription(Constants.DescriptionWebViewContentLoading)] - public event EventHandler ContentLoading = (sender, args) => { }; - - /// - /// Occurs when the finished parsing the current content. - /// - [StringResourceCategory(Constants.CategoryAction)] - [StringResourceDescription(Constants.DescriptionWebViewDomContentLoaded)] - public event EventHandler DOMContentLoaded = (sender, args) => { }; - - /// - /// Occurs when a frame in the has started loading new content. - /// - [StringResourceCategory(Constants.CategoryAction)] - [StringResourceDescription(Constants.DescriptionWebViewFrameContentLoading)] - public event EventHandler FrameContentLoading = (sender, args) => { }; - - /// - /// Occurs when a frame in the finished parsing its current content. - /// - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "DOM", Justification ="Name of WinRT type")] - [StringResourceCategory(Constants.CategoryAction)] - [StringResourceDescription(Constants.DescriptionWebViewFrameDomContentLoaded)] - public event EventHandler FrameDOMContentLoaded = (sender, args) => { }; - - /// - /// Occurs when a frame in the finished navigating to new content. - /// - [StringResourceCategory(Constants.CategoryAction)] - [StringResourceDescription(Constants.DescriptionWebViewFrameNavigationCompleted)] - public event EventHandler FrameNavigationCompleted = (sender, args) => { }; - - /// - /// Occurs when a frame in the navigates to new content. - /// - [StringResourceCategory(Constants.CategoryAction)] - [StringResourceDescription(Constants.DescriptionWebViewFrameNavigationStarting)] - public event EventHandler FrameNavigationStarting = (sender, args) => { }; - - /// - /// Occurs periodically while the executes JavaScript, letting you halt the script. - /// - /// - /// Your app might appear unresponsive while scripts are running. This event provides an opportunity to interrupt a long-running - /// script. To determine how long the script has been running, check the - /// property of the object. To halt the script, set the event args - /// property to true. The halted script will - /// not execute again unless it is reloaded during a subseqent navigation. - /// - /// - /// - /// - [StringResourceCategory(Constants.CategoryAction)] - [StringResourceDescription(Constants.DescriptionWebViewLongRunningScriptDetected)] - public event EventHandler LongRunningScriptDetected = (sender, args) => { }; - - /// - /// Occurs when a focus move is requested. - /// - [StringResourceCategory(Constants.CategoryAction)] - [StringResourceDescription(Constants.DescriptionWebViewMoveFocusRequested)] - public event EventHandler MoveFocusRequested = (sender, args) => { }; - - /// - /// Occurs when the control finished navigating to new content. - /// - [StringResourceCategory(Constants.CategoryAction)] - [StringResourceDescription(Constants.DescriptionWebViewNavigationCompleted)] - public event EventHandler NavigationCompleted = (sender, args) => { }; - - /// - /// Occurs before the navigates to new content. - /// - [StringResourceCategory(Constants.CategoryAction)] - [StringResourceDescription(Constants.DescriptionWebViewNavigationStarting)] - public event EventHandler NavigationStarting = (sender, args) => { }; - - /// eds - /// Occurs when an action is performed that causes content to be opened in a new window. - /// - [StringResourceCategory(Constants.CategoryAction)] - [StringResourceDescription(Constants.DescriptionWebViewNewWindowRequested)] - public event EventHandler NewWindowRequested = (sender, args) => { }; - - /// - /// Occurs when an action in a requires that permission be granted. - /// - /// - /// The types of permission that can be requested are defined in the enumeration. - /// - /// If you don't handle the event, the denies permission by default. - /// - /// When you handle a permission request in , you get a object as - /// the value of the property. You can call Allow to grant the request, - /// Deny to deny the request, or Defer to defer the request until a later time. - /// - [StringResourceCategory(Constants.CategoryAction)] - [StringResourceDescription(Constants.DescriptionWebViewPermissionRequested)] - public event EventHandler PermissionRequested = (sender, args) => { }; - - /// - /// Occurs when the content contained in the control passes a string to the application by using JavaScript. - /// - [StringResourceCategory(Constants.CategoryAction)] - [StringResourceDescription(Constants.DescriptionWebViewScriptNotify)] - public event EventHandler ScriptNotify = (sender, args) => { }; - - /// - /// Occurs when shows a warning page for content that was reported as unsafe by SmartScreen filter. - /// - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1009:DeclareEventHandlersCorrectly", Justification ="Declaration of WinRT type")] - [StringResourceCategory(Constants.CategoryAction)] - [StringResourceDescription(Constants.DescriptionWebViewUnsafeContentWarningDisplaying)] - public event EventHandler UnsafeContentWarningDisplaying = (sender, args) => { }; - - /// - /// Occurs when an attempt is made to navigate to a using a scheme that does not support. - /// - [StringResourceCategory(Constants.CategoryAction)] - [StringResourceDescription(Constants.DescriptionWebViewUnsupportedUriSchemeIdentified)] - public event EventHandler UnsupportedUriSchemeIdentified = (sender, args) => { }; - - /// - /// Occurs when attempts to download an unsupported file. - /// - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Unviewable", Justification ="Name from WinRT type")] - [StringResourceCategory(Constants.CategoryAction)] - [StringResourceDescription(Constants.DescriptionWebViewUnviewableContentIdentified)] - public event EventHandler UnviewableContentIdentified = (sender, args) => { }; - - private void OnAcceleratorKeyPressed(object sender, WebViewControlAcceleratorKeyPressedEventArgs args) - { - var handler = AcceleratorKeyPressed; - if (handler != null) - { - handler(this, args); - } - } - - private void OnContainsFullScreenElementChanged(object sender, object args) - { - var handler = ContainsFullScreenElementChanged; - if (handler != null) - { - handler(this, args); - } - } - - private void OnContentLoading(object sender, WebViewControlContentLoadingEventArgs args) - { - var handler = ContentLoading; - if (handler != null) - { - handler(this, args); - } - } - - private void OnDOMContentLoaded(object sender, WebViewControlDOMContentLoadedEventArgs args) - { - var handler = DOMContentLoaded; - if (handler != null) - { - handler(this, args); - } - } - - private void OnFrameContentLoading(object sender, WebViewControlContentLoadingEventArgs args) - { - var handler = FrameContentLoading; - if (handler != null) - { - handler(this, args); - } - } - - private void OnFrameDOMContentLoaded(object sender, WebViewControlDOMContentLoadedEventArgs args) - { - var handler = FrameDOMContentLoaded; - if (handler != null) - { - handler(this, args); - } - } - - private void OnFrameNavigationCompleted(object sender, WebViewControlNavigationCompletedEventArgs args) - { - var handler = FrameNavigationCompleted; - if (handler != null) - { - handler(this, args); - } - } - - private void OnFrameNavigationStarting(object sender, WebViewControlNavigationStartingEventArgs args) - { - var handler = FrameNavigationStarting; - if (handler != null) - { - handler(this, args); - } - } - - private void OnGotFocus(object sender, object args) - { - OnGotFocus(EventArgs.Empty); - } - - private void OnLongRunningScriptDetected(object sender, WebViewControlLongRunningScriptDetectedEventArgs args) - { - var handler = LongRunningScriptDetected; - if (handler != null) - { - handler(this, args); - } - } - - private void OnLostFocus(object sender, object args) - { - OnLostFocus(EventArgs.Empty); - } - - private void OnMoveFocusRequested(object sender, WebViewControlMoveFocusRequestedEventArgs args) - { - var handler = MoveFocusRequested; - if (handler != null) - { - handler(this, args); - } - } - - private void OnNavigationCompleted(object sender, WebViewControlNavigationCompletedEventArgs args) - { - // We could have used - // if (NavigationCompleted != null) NavigationCompleted(this, args); - // However, if there is a subscriber and the moment the null check and the call to - // the event handler by the method is invoked, the subscriber may unsubscribe - // (e.g. on a different thread) and cause a NullReferenceException. - // To work around this create a temporarly local variable to store the reference and check that - var handler = NavigationCompleted; - if (handler != null) - { - handler(this, args); - } - } - - private void OnNavigationStarting(object sender, WebViewControlNavigationStartingEventArgs args) - { - var handler = NavigationStarting; - if (handler != null) - { - handler(this, args); - } - } - - private void OnNewWindowRequested(object sender, WebViewControlNewWindowRequestedEventArgs args) - { - var handler = NewWindowRequested; - if (handler != null) - { - handler(this, args); - } - } - - private void OnPermissionRequested(object sender, WebViewControlPermissionRequestedEventArgs args) - { - var handler = PermissionRequested; - if (handler != null) - { - handler(this, args); - } - } - - private void OnScriptNotify(object sender, WebViewControlScriptNotifyEventArgs args) - { - var handler = ScriptNotify; - if (handler != null) - { - handler(this, args); - } - } - - private void OnUnsafeContentWarningDisplaying(object sender, object args) - { - var handler = UnsafeContentWarningDisplaying; - if (handler != null) - { - handler(this, args); - } - } - - private void OnUnsupportedUriSchemeIdentified(object sender, WebViewControlUnsupportedUriSchemeIdentifiedEventArgs args) - { - var handler = UnsupportedUriSchemeIdentified; - if (handler != null) - { - handler(this, args); - } - } - - private void OnUnviewableContentIdentified(object sender, WebViewControlUnviewableContentIdentifiedEventArgs args) - { - var handler = UnviewableContentIdentified; - if (handler != null) - { - handler(this, args); - } - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.Controls.WebView/WebView.Init.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.Controls.WebView/WebView.Init.cs deleted file mode 100644 index 577e6d96557..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.Controls.WebView/WebView.Init.cs +++ /dev/null @@ -1,222 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.ComponentModel; -using Microsoft.Toolkit.Win32.UI.Controls; -using Microsoft.Toolkit.Win32.UI.Controls.Interop; -using Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT; -using WebViewControlProcessCapabilityState = Windows.Web.UI.Interop.WebViewControlProcessCapabilityState; - -namespace Microsoft.Toolkit.Forms.UI.Controls -{ - /// - public partial class WebView : ISupportInitialize - { - // Initialization flag for ISupportInitialize - private InitializationState _initializationState; - - internal WebView(WebViewControlHost webViewControl) - : this() - { - _webViewControl = webViewControl ?? throw new ArgumentNullException(nameof(webViewControl)); - Process = _webViewControl.Process; - - EnsureInitialized(); - } - - private bool Initialized => _initializationState == InitializationState.IsInitialized; - - private bool Initializing => _initializationState == InitializationState.IsInitializing; - - private bool WebViewControlInitialized => _webViewControl != null; - - void ISupportInitialize.BeginInit() - { - if (Initialized) - { - // Cannot initialize WebView since it is already completely initialized - throw new InvalidOperationException(DesignerUI.E_WEBVIEW_ALREADY_INITIALIZED); - } - - if (Initializing) - { - // Cannot initialize WebView since it is already being initialized - throw new InvalidOperationException(DesignerUI.E_WEBVIEW_ALREADY_INITIALIZING); - } - - _initializationState = InitializationState.IsInitializing; - } - - void ISupportInitialize.EndInit() - { - if (!Initializing) - { - // Cannot complete WebView initialization that is not being initialized - throw new InvalidOperationException(DesignerUI.E_WEBVIEW_NOT_INITIALIZING); - } - - if (!DesignMode) - { - OSVersionHelper.ThrowIfBeforeWindows10April2018(); - } - - try - { - Initialize(); - } - catch (TypeLoadException) - { - // Some types are exposed that the designer tries to reflect over, throwing TypeLoadException - // We're okay to ignore this if we're not in design mode - if (!DesignMode) - { - throw; - } - } - } - - private void CheckInitialized() - { - if (!Initialized) - { - // Initialization incomplete - throw new InvalidOperationException(DesignerUI.E_WEBVIEW_NOT_INITIALIZED); - } - } - - // Ensures this class is initialized. Initialization involves using ISupportInitialize methods - private void EnsureInitialized() - { - // If already disposed, do nothing - if (IsDisposed) - { - throw new ObjectDisposedException(GetType().Name); - } - - // If not already initialized and not already initializing - if (!Initialized && !Initializing) - { - ((ISupportInitialize)this).BeginInit(); - ((ISupportInitialize)this).EndInit(); - } - } - - private void Initialize() - { - Verify.AreEqual(_initializationState, InitializationState.IsInitializing); - - // This is causing freezing - if (!DesignMode) - { - OSVersionHelper.ThrowIfBeforeWindows10April2018(); - - if (!WebViewControlInitialized) - { - if (Process == null) - { - // Was not injected via ctor, create using defaults - var options = new Win32.UI.Controls.Interop.WinRT.WebViewControlProcessOptions() - { - PrivateNetworkClientServerCapability = - (Win32.UI.Controls.Interop.WinRT.WebViewControlProcessCapabilityState)(_delayedPrivateNetworkEnabled - ? WebViewControlProcessCapabilityState.Enabled - : WebViewControlProcessCapabilityState.Disabled), - EnterpriseId = _delayedEnterpriseId - }; - - Process = new WebViewControlProcess(options); - } - else - { - Verify.IsNotNull(Process); - - _delayedPrivateNetworkEnabled = Process.IsPrivateNetworkClientServerCapabilityEnabled; - _delayedEnterpriseId = Process.EnterpriseId; - } - - Verify.IsNotNull(Process); - - _webViewControl = Process.CreateWebViewControlHost(Handle, ClientRectangle); - SubscribeEvents(); - - // Set values. They could have been changed in the designer - IsScriptNotifyAllowed = _delayedIsScriptNotifyAllowed; - IsIndexedDBEnabled = _delayedIsIndexDbEnabled; - IsJavaScriptEnabled = _delayedIsJavaScriptEnabled; - - // This will cause a navigation - Source = _delayedSource; - } - else - { - // Already provided control - SubscribeEvents(); - } - - _webViewControl.IsVisible = true; - } - - _initializationState = InitializationState.IsInitialized; - } - - private void SubscribeEvents() - { - if (_webViewControl == null) - { - return; - } - - _webViewControl.AcceleratorKeyPressed += OnAcceleratorKeyPressed; - _webViewControl.ContainsFullScreenElementChanged += OnContainsFullScreenElementChanged; - _webViewControl.ContentLoading += OnContentLoading; - _webViewControl.DOMContentLoaded += OnDOMContentLoaded; - _webViewControl.FrameContentLoading += OnFrameContentLoading; - _webViewControl.FrameDOMContentLoaded += OnFrameDOMContentLoaded; - _webViewControl.FrameNavigationCompleted += OnFrameNavigationCompleted; - _webViewControl.FrameNavigationStarting += OnFrameNavigationStarting; - _webViewControl.GotFocus += OnGotFocus; - _webViewControl.LongRunningScriptDetected += OnLongRunningScriptDetected; - _webViewControl.LostFocus += OnLostFocus; - _webViewControl.MoveFocusRequested += OnMoveFocusRequested; - _webViewControl.NavigationCompleted += OnNavigationCompleted; - _webViewControl.NavigationStarting += OnNavigationStarting; - _webViewControl.NewWindowRequested += OnNewWindowRequested; - _webViewControl.PermissionRequested += OnPermissionRequested; - _webViewControl.ScriptNotify += OnScriptNotify; - _webViewControl.UnsafeContentWarningDisplaying += OnUnsafeContentWarningDisplaying; - _webViewControl.UnsupportedUriSchemeIdentified += OnUnsupportedUriSchemeIdentified; - _webViewControl.UnviewableContentIdentified += OnUnviewableContentIdentified; - } - - private void UnsubscribeEvents() - { - if (_webViewControl == null) - { - return; - } - - _webViewControl.AcceleratorKeyPressed -= OnAcceleratorKeyPressed; - _webViewControl.ContainsFullScreenElementChanged -= OnContainsFullScreenElementChanged; - _webViewControl.ContentLoading -= OnContentLoading; - _webViewControl.DOMContentLoaded -= OnDOMContentLoaded; - _webViewControl.FrameContentLoading -= OnFrameContentLoading; - _webViewControl.FrameDOMContentLoaded -= OnFrameDOMContentLoaded; - _webViewControl.FrameNavigationCompleted -= OnFrameNavigationCompleted; - _webViewControl.FrameNavigationStarting -= OnFrameNavigationStarting; - _webViewControl.GotFocus -= OnGotFocus; - _webViewControl.LongRunningScriptDetected -= OnLongRunningScriptDetected; - _webViewControl.LostFocus -= OnLostFocus; - _webViewControl.MoveFocusRequested -= OnMoveFocusRequested; - _webViewControl.NavigationCompleted -= OnNavigationCompleted; - _webViewControl.NavigationStarting -= OnNavigationStarting; - _webViewControl.NewWindowRequested -= OnNewWindowRequested; - _webViewControl.PermissionRequested -= OnPermissionRequested; - _webViewControl.ScriptNotify -= OnScriptNotify; - _webViewControl.UnsafeContentWarningDisplaying -= OnUnsafeContentWarningDisplaying; - _webViewControl.UnsupportedUriSchemeIdentified -= OnUnsupportedUriSchemeIdentified; - _webViewControl.UnviewableContentIdentified -= OnUnviewableContentIdentified; - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.Controls.WebView/WebView.Navigation.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.Controls.WebView/WebView.Navigation.cs deleted file mode 100644 index 994596caf1c..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.Controls.WebView/WebView.Navigation.cs +++ /dev/null @@ -1,132 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Net.Http; -using Microsoft.Toolkit.Win32.UI.Controls; -using Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT; - -namespace Microsoft.Toolkit.Forms.UI.Controls -{ - // Navigation Journaling - - /// - public partial class WebView : IWebView - { - /// - [Browsable(false)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public bool CanGoBack => _webViewControl?.CanGoBack ?? false; - - /// - [Browsable(false)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public bool CanGoForward => _webViewControl?.CanGoForward ?? false; - - /// - public bool GoBack() - { - var retval = true; - try - { - _webViewControl.GoBack(); - } - catch (Exception e) - { - if (e.IsSecurityOrCriticalException()) - { - throw; - } - - retval = false; - } - - return retval; - } - - /// - public bool GoForward() - { - var retval = true; - try - { - _webViewControl.GoForward(); - } - catch (Exception e) - { - if (e.IsSecurityOrCriticalException()) - { - throw; - } - - retval = false; - } - - return retval; - } - - /// - public override void Refresh() - { - try - { - _webViewControl?.Refresh(); - } - catch (Exception e) - { - if (e.IsSecurityOrCriticalException()) - { - throw; - } - } - } - - /// - public void Stop() - { - try - { - _webViewControl?.Stop(); - } - catch (Exception e) - { - if (e.IsSecurityOrCriticalException()) - { - throw; - } - } - } - - /// - public void Navigate(Uri source) => _webViewControl?.Navigate(source); - - /// - public void Navigate(string source) - { - Verify.IsFalse(IsDisposed); - Verify.IsNotNull(_webViewControl); - _webViewControl?.Navigate(source); - } - - /// - [Obsolete("Use NavigateToLocalStreamUri(Uri, IUriToStreamResolver) instead")] - public void NavigateToLocal(string relativePath) => _webViewControl?.NavigateToLocal(relativePath); - - /// - public void NavigateToString(string text) => _webViewControl?.NavigateToString(text); - - /// - public void NavigateToLocalStreamUri(Uri relativePath, IUriToStreamResolver streamResolver) => _webViewControl?.NavigateToLocalStreamUri(relativePath, streamResolver); - - /// - public void Navigate( - Uri requestUri, - HttpMethod httpMethod, - string content = null, - IEnumerable> headers = null) => - _webViewControl.Navigate(requestUri, httpMethod, content, headers); - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.Controls.WebView/WebView.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.Controls.WebView/WebView.cs deleted file mode 100644 index 673a7c92ab6..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.Controls.WebView/WebView.cs +++ /dev/null @@ -1,577 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Drawing.Drawing2D; -using System.Runtime.InteropServices; -using System.Security; -using System.Security.Permissions; -using System.Threading.Tasks; -using System.Windows.Forms; -using Microsoft.Toolkit.Win32.UI.Controls; -using Microsoft.Toolkit.Win32.UI.Controls.Interop.Win32; -using Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT; -using WebViewControlDeferredPermissionRequest = Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT.WebViewControlDeferredPermissionRequest; -using WebViewControlMoveFocusReason = Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT.WebViewControlMoveFocusReason; -using WebViewControlProcess = Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT.WebViewControlProcess; -using WebViewControlSettings = Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT.WebViewControlSettings; - -namespace Microsoft.Toolkit.Forms.UI.Controls -{ - /// - /// This class is an implementation of for Windows Forms. This class cannot be inherited. - /// - /// - /// - [Designer(typeof(WebViewDesigner))] - [DefaultProperty(Constants.ComponentDefaultProperty)] - [DefaultEvent(Constants.ComponentDefaultEvent)] - [Docking(DockingBehavior.AutoDock)] - [Description("Embeds a view into your application that renders web content using the Microsoft Edge rendering engine")] - [SecurityCritical] - [PermissionSet(SecurityAction.InheritanceDemand, Name = Constants.SecurityPermissionSetName)] - public sealed partial class WebView : Control, IWebView, ISupportInitialize - { - private string _delayedEnterpriseId = WebViewDefaults.EnterpriseId; - private bool _delayedIsIndexDbEnabled = WebViewDefaults.IsIndexedDBEnabled; - private bool _delayedIsJavaScriptEnabled = WebViewDefaults.IsJavaScriptEnabled; - private bool _delayedIsScriptNotifyAllowed = WebViewDefaults.IsScriptNotifyEnabled; - private bool _delayedPrivateNetworkEnabled = WebViewDefaults.IsPrivateNetworkEnabled; - private Uri _delayedSource; - private WebViewControlHost _webViewControl; - private bool _webViewControlClosed; - - /// - /// Initializes a new instance of the class. - /// - public WebView() - { - Paint += OnWebViewPaint; - Layout += OnWebViewLayout; - } - - public WebView(WebViewControlProcess process) - : this() - { - Process = process; - } - - internal WebViewControlHost Host => _webViewControl; - - /// - protected override void DestroyHandle() - { - // In RS4 if a component is not completely cleaned up it could cause a hang, which was fixed in RS5 - // For compatability with RS4, call Close to remove the HWNDs to avoid a possible message storm and UI lock up - Close(); - - base.DestroyHandle(); - } - - /// - protected override void OnHandleDestroyed(EventArgs e) - { - // In RS4 if a component is not completely cleaned up it could cause a hang, which was fixed in RS5 - // For compatability with RS4, call Close to remove the HWNDs to avoid a possible message storm and UI lock up - Close(); - - base.OnHandleDestroyed(e); - } - - /// - /// Gets a value indicating whether is supported in this environment. - /// - /// if this instance is supported; otherwise, . - public static bool IsSupported => WebViewControlHost.IsSupported; - - /// - [Browsable(false)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public bool ContainsFullScreenElement - { - get - { - Verify.IsFalse(IsDisposed); - Verify.IsNotNull(_webViewControl); - return _webViewControl?.ContainsFullScreenElement ?? false; - } - } - - /// - /// Gets a value indicating whether the is currently in design mode. - /// - /// if the is currently in design mode; otherwise, . - [Browsable(false)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public new bool DesignMode => IsInDesignMode(); - - /// - /// Gets the document title. - /// - /// The document title. - /// - [Browsable(false)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public string DocumentTitle - { - get - { - Verify.IsFalse(IsDisposed); - Verify.IsNotNull(_webViewControl); - return _webViewControl?.DocumentTitle; - } - } - - /// - [StringResourceCategory(Constants.CategoryBehavior)] - [DefaultValue(WebViewDefaults.EnterpriseId)] - public string EnterpriseId - { - get - { - Verify.IsFalse(IsDisposed); - Verify.Implies(Initializing, !Initialized); -#if DEBUG - if (!DesignMode) - { - Verify.Implies(Initialized, WebViewControlInitialized); - } -#endif - return WebViewControlInitialized - ? _webViewControl.Process.EnterpriseId - : _delayedEnterpriseId; - } - - set - { - Verify.IsFalse(IsDisposed); - _delayedEnterpriseId = value; - if (!DesignMode) - { - EnsureInitialized(); - if (WebViewControlInitialized - && !string.Equals(_delayedEnterpriseId, _webViewControl.Process.EnterpriseId, StringComparison.OrdinalIgnoreCase)) - { - throw new InvalidOperationException(DesignerUI.E_CANNOT_CHANGE_AFTER_INIT); - } - } - } - } - - /// - /// Gets a value indicating whether this is focused. - /// - /// if focused; otherwise, . - /// - /// Returns if this or any of its child windows has focus. - public override bool Focused - { - get - { - if (base.Focused) - { - return true; - } - - var hwndFocus = UnsafeNativeMethods.GetFocus(); - var ret = hwndFocus != IntPtr.Zero - && NativeMethods.IsChild(new HandleRef(this, Handle), new HandleRef(null, hwndFocus)); - - return ret; - } - } - - /// - /// Gets or sets a value indicating whether this instance is indexed database enabled. - /// - /// if this instance is indexed database enabled; otherwise, . - /// - [StringResourceCategory(Constants.CategoryBehavior)] - [DefaultValue(WebViewDefaults.IsIndexedDBEnabled)] - public bool IsIndexedDBEnabled - { - get - { - Verify.IsFalse(IsDisposed); - Verify.Implies(Initializing, !Initialized); -#if DEBUG - if (!DesignMode) - { - Verify.Implies(Initialized, WebViewControlInitialized); - } -#endif - return WebViewControlInitialized - ? _webViewControl.Settings.IsIndexedDBEnabled - : _delayedIsIndexDbEnabled; - } - - set - { - Verify.IsFalse(IsDisposed); - _delayedIsIndexDbEnabled = value; - if (!DesignMode) - { - EnsureInitialized(); - if (WebViewControlInitialized) - { - _webViewControl.Settings.IsIndexedDBEnabled = value; - } - } - } - } - - /// - /// Gets or sets a value indicating whether the use of JavaScript is allowed. - /// - /// true if the use of JavaScript is allowed; otherwise, false. - /// - [StringResourceCategory(Constants.CategoryBehavior)] - [DefaultValue(WebViewDefaults.IsJavaScriptEnabled)] - public bool IsJavaScriptEnabled - { - get - { - Verify.IsFalse(IsDisposed); - Verify.Implies(Initializing, !Initialized); -#if DEBUG - if (!DesignMode) - { - Verify.Implies(Initialized, WebViewControlInitialized); - } -#endif - return WebViewControlInitialized - ? _webViewControl.Settings.IsJavaScriptEnabled - : _delayedIsJavaScriptEnabled; - } - - set - { - Verify.IsFalse(IsDisposed); - _delayedIsJavaScriptEnabled = value; - if (!DesignMode) - { - EnsureInitialized(); - if (WebViewControlInitialized) - { - _webViewControl.Settings.IsJavaScriptEnabled = value; - } - } - } - } - - /// - /// Gets or sets a value indicating whether is allowed; - /// - /// true if is allowed; otherwise, false. - /// - [StringResourceCategory(Constants.CategoryBehavior)] - [DefaultValue(WebViewDefaults.IsScriptNotifyEnabled)] - public bool IsScriptNotifyAllowed - { - get - { - Verify.IsFalse(IsDisposed); - Verify.Implies(Initializing, !Initialized); -#if DEBUG - if (!DesignMode) - { - Verify.Implies(Initialized, WebViewControlInitialized); - } -#endif - return WebViewControlInitialized - ? _webViewControl.Settings.IsScriptNotifyAllowed - : _delayedIsScriptNotifyAllowed; - } - - set - { - Verify.IsFalse(IsDisposed); - _delayedIsScriptNotifyAllowed = value; - if (!DesignMode) - { - EnsureInitialized(); - if (WebViewControlInitialized) - { - _webViewControl.Settings.IsScriptNotifyAllowed = value; - } - } - } - } - - /// - /// - /// Gets or sets a value indicating whether this instance is private network client server capability enabled. - /// - /// if this instance is private network client server capability enabled; otherwise, . - /// Value cannot be set once the control is initialized. - [StringResourceCategory(Constants.CategoryBehavior)] - [DefaultValue(WebViewDefaults.IsPrivateNetworkEnabled)] - public bool IsPrivateNetworkClientServerCapabilityEnabled - { - get - { - Verify.IsFalse(IsDisposed); - Verify.Implies(Initializing, !Initialized); -#if DEBUG - if (!DesignMode) - { - Verify.Implies(Initialized, WebViewControlInitialized); - } -#endif - return WebViewControlInitialized - ? _webViewControl.Process.IsPrivateNetworkClientServerCapabilityEnabled - : _delayedPrivateNetworkEnabled; - } - - set - { - Verify.IsFalse(IsDisposed); - _delayedPrivateNetworkEnabled = value; - if (!DesignMode) - { - EnsureInitialized(); - if (WebViewControlInitialized - && _webViewControl.Process.IsPrivateNetworkClientServerCapabilityEnabled != _delayedPrivateNetworkEnabled) - { - throw new InvalidOperationException(DesignerUI.E_CANNOT_CHANGE_AFTER_INIT); - } - } - } - } - - /// - /// Gets a object that the control is hosted in. - /// - /// The object that the control is hosted in. - [Browsable(false)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public WebViewControlProcess Process { get; private set; } - - /// - /// Gets a object that contains properties to enable or disable features. - /// - /// A object that contains properties to enable or disable features. - [Browsable(false)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public WebViewControlSettings Settings - { - get - { - Verify.IsFalse(IsDisposed); - Verify.Implies(Initializing, !Initialized); -#if DEBUG - if (!DesignMode) - { - Verify.Implies(Initialized, WebViewControlInitialized); - } -#endif - return _webViewControl?.Settings; - } - } - - /// - /// Gets or sets the Uniform Resource Identifier (URI) source of the HTML content to display in the . - /// - /// The Uniform Resource Identifier (URI) source of the HTML content to display in the . - [Bindable(true)] - [StringResourceCategory(Constants.CategoryBehavior)] - [StringResourceDescription(Constants.DescriptionSource)] - [TypeConverter(typeof(WebBrowserUriTypeConverter))] - [DefaultValue((string)null)] - public Uri Source - { - get - { - Verify.IsFalse(IsDisposed); - Verify.Implies(Initializing, !Initialized); -#if DEBUG - if (!DesignMode) - { - Verify.Implies(Initialized, WebViewControlInitialized); - } -#endif - return WebViewControlInitialized - ? _webViewControl.Source - : _delayedSource; - } - - set - { - Verify.IsFalse(IsDisposed); - _delayedSource = value; - if (!DesignMode) - { - EnsureInitialized(); - if (WebViewControlInitialized) - { - if (Initializing && value != null) - { - // During initialization if there is no Source set a navigation to "about:blank" will occur - _webViewControl.Source = value; - } - else if (Initialized) - { - // After the control is initialized send all values, regardless of if they are null - _webViewControl.Source = value; - } - } - } - } - } - - /// - /// Gets the version of EDGEHTML.DLL used by the control. - /// - /// The version of EDGEHTML.DLL used by the control. - [Browsable(false)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public Version Version => _webViewControl?.Version; - - /// - [Obsolete("This item has been depreciated and will be removed in a future version. Use AddInitializeScript(string script) instead.", false)] - public void AddPreLoadedScript(string script) => AddInitializeScript(script); - - /// - public void AddInitializeScript(string script) - { - Verify.IsFalse(IsDisposed); - Verify.Implies(Initializing, !Initialized); -#if DEBUG - if (!DesignMode) - { - Verify.Implies(Initialized, WebViewControlInitialized); - } -#endif - _webViewControl?.AddInitializeScript(script); - } - - /// - /// Closes this control. - /// - public void Close() - { - var webViewControlAlreadyClosed = _webViewControlClosed; - _webViewControlClosed = true; - - // Unsubscribe all events: - UnsubscribeEvents(); - - if (!webViewControlAlreadyClosed) - { - _webViewControl?.Close(); - _webViewControl?.Dispose(); - } - - _webViewControl = null; - Process = null; - } - - /// - /// Gets the deferred permission request with the specified Id. - /// - /// The Id of the deferred permission request. - /// A object of the specified . - public WebViewControlDeferredPermissionRequest GetDeferredPermissionRequestById(uint id) => _webViewControl?.GetDeferredPermissionRequestById(id); - - /// - public string InvokeScript(string scriptName) => InvokeScript(scriptName, null); - - /// - public string InvokeScript(string scriptName, params string[] arguments) => InvokeScript(scriptName, (IEnumerable)arguments); - - /// - public string InvokeScript(string scriptName, IEnumerable arguments) - { - // WebViewControlHost ends up calling InvokeScriptAsync anyway - // The problem we have is that InvokeScript could be called from a UI thread and waiting for an async result that could lead to deadlock - return InvokeScriptAsync(scriptName, arguments).WaitWithNestedMessageLoop(); - } - - /// - public Task InvokeScriptAsync(string scriptName) => _webViewControl?.InvokeScriptAsync(scriptName); - - /// - public Task InvokeScriptAsync(string scriptName, params string[] arguments) => - _webViewControl?.InvokeScriptAsync(scriptName, arguments); - - /// - public Task InvokeScriptAsync(string scriptName, IEnumerable arguments) - => _webViewControl?.InvokeScriptAsync(scriptName, arguments); - - /// - public void MoveFocus(WebViewControlMoveFocusReason reason) => _webViewControl?.MoveFocus(reason); - - /// - /// Releases the unmanaged resources used by the and its child controls and optionally releases the managed resources. - /// - /// to release both managed and unmanaged resources; to release only unmanaged resources. - protected override void Dispose(bool disposing) - { - try - { - if (disposing) - { - Close(); - _webViewControl?.Dispose(); - _webViewControl = null; - Process = null; - } - } - finally - { - base.Dispose(disposing); - } - } - - private bool IsInDesignMode() - { - var wpfDesignMode = LicenseManager.UsageMode == LicenseUsageMode.Designtime; - var formsDesignMode = System.Diagnostics.Process.GetCurrentProcess().ProcessName == "devenv"; - return wpfDesignMode || formsDesignMode; - } - - // Ensures the WebViewControl's size stays in sync - private void OnWebViewLayout(object sender, LayoutEventArgs e) - { - // This event is raised once at startup with the AffectedControl and AffectedProperty properties - // on the LayoutEventArgs as null. - if (e.AffectedControl != null && e.AffectedProperty != null) - { - // Ensure that the affected property is the Bounds property to the control - if (e.AffectedProperty == nameof(Bounds)) - { - // In a typical control the DisplayRectangle is the interior canvas of the control - // and in a scrolling control the DisplayRectangle would be larger than the ClientRectangle. - // However, that is abstracted from us in WebView so we need to synchronize the ClientRectangle - // and permit WebView to handle scrolling based on the new viewport - UpdateBounds(ClientRectangle); - } - } - } - - private void OnWebViewPaint(object sender, PaintEventArgs e) - { - if (!DesignMode) - { - return; - } - - using (var g = e.Graphics) - { - using (var hb = new HatchBrush(HatchStyle.ZigZag, Color.Black, BackColor)) - { - g.FillRectangle(hb, ClientRectangle); - } - } - } - - private void UpdateBounds(Rectangle bounds) - { - _webViewControl?.UpdateBounds(bounds); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.Controls.WebView/WebViewControlHostExtensions.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.Controls.WebView/WebViewControlHostExtensions.cs deleted file mode 100644 index dae2354af27..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.Controls.WebView/WebViewControlHostExtensions.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Drawing; -using Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT; - -namespace Microsoft.Toolkit.Forms.UI.Controls -{ - internal static class WebViewControlHostExtensions - { - /// - /// Updates the location and size of . - /// - /// A instance - /// A containing numerical values that represent the location and size of the control. - /// - /// is . - /// is translated into a . - internal static void UpdateBounds(this WebViewControlHost host, Rectangle bounds) - { - global::Windows.Foundation.Rect CreateBounds() - { - return new global::Windows.Foundation.Rect( - bounds.X, - bounds.Y, - bounds.Width, - bounds.Height); - } - - if (host is null) - { - throw new ArgumentNullException(nameof(host)); - } - - host.UpdateBounds(CreateBounds()); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.Controls.WebView/WebViewControlProcessExtensions.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.Controls.WebView/WebViewControlProcessExtensions.cs deleted file mode 100644 index f4430803026..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.Controls.WebView/WebViewControlProcessExtensions.cs +++ /dev/null @@ -1,201 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Drawing; -using System.Threading.Tasks; -using System.Windows.Forms; -using Microsoft.Toolkit.Win32.UI.Controls; -using Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT; -using Windows.Foundation; -using WebViewControlProcess = Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT.WebViewControlProcess; - -namespace Microsoft.Toolkit.Forms.UI.Controls -{ - /// - /// Extends the funcionality of for Windows Forms. - /// - internal static class WebViewControlProcessExtensions - { - /// - /// Creates a within the context of . - /// - /// An instance of . - /// The parent window handle hosting the control. - /// A containing numerical values that represent the location and size of the control. - /// An instance. - /// - /// is equal to , or - /// is . - /// - internal static IWebView CreateWebView( - this WebViewControlProcess process, - IntPtr hostWindowHandle, - Rectangle bounds) - { - if (process is null) - { - throw new ArgumentNullException(nameof(process)); - } - - if (hostWindowHandle == IntPtr.Zero) - { - throw new ArgumentNullException(nameof(hostWindowHandle)); - } - - return new WebView(process.CreateWebViewControlHost(hostWindowHandle, bounds)); - } - - /// - /// Creates a within the context of . - /// - /// An instance of . - /// An instance of to parent the . - /// An instance. - /// Occurs when is . - internal static IWebView CreateWebView( - this WebViewControlProcess process, - Control control) - { - if (control == null) - { - throw new ArgumentNullException(nameof(control)); - } - - return process.CreateWebView(control, control.Bounds); - } - - /// - /// Creates a within the context of . - /// - /// An instance of . - /// An instance of to parent the . - /// A containing numerical values that represent the location and size of the control. - /// An instance. - /// Occurs when is . - internal static IWebView CreateWebView( - this WebViewControlProcess process, - Control control, - Rectangle bounds) - { - if (control == null) - { - throw new ArgumentNullException(nameof(control)); - } - - return process.CreateWebView(control.Handle, bounds); - } - - /// - /// Creates a within the context of . - /// - /// An instance of . - /// The parent window handle hosting the control. - /// A containing numerical values that represent the location and size of the control. - /// An instance. - /// - /// is equal to , or - /// is . - /// - internal static async Task CreateWebViewAsync( - this WebViewControlProcess process, - IntPtr hostWindowHandle, - Rectangle bounds) - { - if (process is null) - { - throw new ArgumentNullException(nameof(process)); - } - - if (hostWindowHandle == IntPtr.Zero) - { - throw new ArgumentNullException(nameof(hostWindowHandle)); - } - - return new WebView(await process.CreateWebViewControlHostAsync(hostWindowHandle, bounds).ConfigureAwait(false)); - } - - /// - /// Creates a within the context of . - /// - /// An instance of . - /// An instance of to parent the . - /// An instance. - /// Occurs when is . - internal static Task CreateWebViewAsync( - this WebViewControlProcess process, - Control control) - { - if (control == null) - { - throw new ArgumentNullException(nameof(control)); - } - - return process.CreateWebViewAsync(control, control.Bounds); - } - - /// - /// Creates a within the context of . - /// - /// An instance of . - /// An instance of to parent the . - /// A containing numerical values that represent the location and size of the control. - /// An instance. - /// Occurs when is . - internal static async Task CreateWebViewAsync( - this WebViewControlProcess process, - Control control, - Rectangle bounds) - { - if (control == null) - { - throw new ArgumentNullException(nameof(control)); - } - - var webViewControl = await process.CreateWebViewAsync(control.Handle, bounds).ConfigureAwait(false); - control.Controls.Add((Control)webViewControl); - return webViewControl; - } - - /// - /// Creates a within the context of . - /// - /// An instance of . - /// The parent window handle hosting the control. - /// A containing numerical values that represent the location and size of the control. - /// A . - /// is equal to - /// - internal static WebViewControlHost CreateWebViewControlHost( - this WebViewControlProcess process, - IntPtr hostWindowHandle, - Rectangle bounds) - { - Verify.IsNotNull(process); - Verify.IsFalse(hostWindowHandle == IntPtr.Zero); - var f = process.CreateWebViewControlHostAsync(hostWindowHandle, bounds).ConfigureAwait(false); - return f.GetAwaiter().GetResult(); - } - - /// - /// Asynchronously creates a within the context of . - /// - /// An instance of . - /// The parent window handle hosting the control. - /// A containing numerical values that represent the location and size of the control. - /// An asynchronous operation that completes with a . - /// is equal to - internal static Task CreateWebViewControlHostAsync( - this WebViewControlProcess process, - IntPtr hostWindowHandle, - Rectangle bounds) - { - Verify.IsNotNull(process); - Verify.IsFalse(hostWindowHandle == IntPtr.Zero); - - var rect = new Rect(bounds.X, bounds.Y, bounds.Width, bounds.Height); - return process.CreateWebViewControlHostAsync(hostWindowHandle, rect); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.Controls.WebView/WebViewDesigner.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.Controls.WebView/WebViewDesigner.cs deleted file mode 100644 index c9fea2e4f96..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.Controls.WebView/WebViewDesigner.cs +++ /dev/null @@ -1,98 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections; -using System.ComponentModel; -using System.Security; -using System.Windows.Forms.Design; - -namespace Microsoft.Toolkit.Forms.UI.Controls -{ - /// - internal class WebViewDesigner : ControlDesigner - { - public Uri Source - { - get => (Uri)ShadowProperties[nameof(WebView.Source)]; - set => ShadowProperties[nameof(WebView.Source)] = value; - } - - public bool IsScriptNotifyAllowed - { - get => (bool)ShadowProperties[nameof(WebView.IsScriptNotifyAllowed)]; - set => ShadowProperties[nameof(WebView.IsScriptNotifyAllowed)] = value; - } - - public bool IsJavaScriptEnabled - { - get => (bool)ShadowProperties[nameof(WebView.IsJavaScriptEnabled)]; - set => ShadowProperties[nameof(WebView.IsJavaScriptEnabled)] = value; - } - - public bool IsIndexedDBEnabled - { - get => (bool)ShadowProperties[nameof(WebView.IsIndexedDBEnabled)]; - set => ShadowProperties[nameof(WebView.IsIndexedDBEnabled)] = value; - } - - public bool IsPrivateNetworkClientServerCapabilityEnabled - { - get => (bool)ShadowProperties[nameof(WebView.IsPrivateNetworkClientServerCapabilityEnabled)]; - set => ShadowProperties[nameof(WebView.IsPrivateNetworkClientServerCapabilityEnabled)] = value; - } - - protected override InheritanceAttribute InheritanceAttribute - { - [SecurityCritical] - get - { - if (base.InheritanceAttribute == InheritanceAttribute.Inherited) - { - return InheritanceAttribute.InheritedReadOnly; - } - - return base.InheritanceAttribute; - } - } - - public override void InitializeNewComponent(IDictionary defaultValues) - { - base.InitializeNewComponent(defaultValues); - - var webView = (WebView)Component; - if (webView != null) - { - // Set MinimumSize in the designer, so that the control doesn't go to 0-height - webView.MinimumSize = new System.Drawing.Size(20, 20); - } - } - - protected override void PreFilterProperties(IDictionary properties) - { - base.PreFilterProperties(properties); - - // Handle shadowed properties - var shadowProps = new[] - { - nameof(WebView.Source), - nameof(WebView.IsScriptNotifyAllowed), - nameof(WebView.IsJavaScriptEnabled), - nameof(WebView.IsIndexedDBEnabled), - nameof(WebView.IsPrivateNetworkClientServerCapabilityEnabled) - }; - PropertyDescriptor prop; - Attribute[] empty = new Attribute[0]; - - for (var i = 0; i < shadowProps.Length; i++) - { - prop = (PropertyDescriptor)properties[shadowProps[i]]; - if (prop != null) - { - properties[shadowProps[i]] = TypeDescriptor.CreateProperty(typeof(WebViewDesigner), prop, empty); - } - } - } - } -} diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.Controls/Microsoft.Toolkit.Forms.UI.Controls.csproj b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.Controls/Microsoft.Toolkit.Forms.UI.Controls.csproj deleted file mode 100644 index a467095db8d..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.Controls/Microsoft.Toolkit.Forms.UI.Controls.csproj +++ /dev/null @@ -1,48 +0,0 @@ - - - - net462 - Microsoft.Toolkit.Forms.UI.Controls - Microsoft.Toolkit.Forms.UI.Controls - true - - Windows Community Toolkit Windows Forms Controls - This library provides XAML user controls for Windows Forms. It is part of the Windows Community Toolkit. - Win32 WindowsForms UWP XAML - - - 10.0.17692.0 - - - - $(DefineConstants);DEV_DEBUG;DEBUG_LAYOUT - - - - - - - - - - - - - - - - - - - - - - - $(WINDIR)\Microsoft.NET\Framework\v4.0.30319\System.Runtime.WindowsRuntime.dll - - - - - - - diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.Controls/Properties/AssemblyInfo.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.Controls/Properties/AssemblyInfo.cs deleted file mode 100644 index 59d02ecfba0..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.Controls/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,9 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Resources; -using System.Runtime.InteropServices; - -[assembly: ComVisible(false)] -[assembly: NeutralResourcesLanguage("en-US")] \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.Controls/Properties/launchSettings.json b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.Controls/Properties/launchSettings.json deleted file mode 100644 index e7afb357485..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.Controls/Properties/launchSettings.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "profiles": { - "Microsoft.Toolkit.Win32.UI.Controls": { - "commandName": "Executable", - "executablePath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\IDE\\devenv.exe" - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.Controls/WindowsXamlHostBaseExt.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.Controls/WindowsXamlHostBaseExt.cs deleted file mode 100644 index 4657ccd435b..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.Controls/WindowsXamlHostBaseExt.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using Microsoft.Toolkit.Forms.UI.XamlHost; -using Microsoft.Toolkit.Win32.UI.XamlHost; -using Windows.UI.Xaml; - -namespace Microsoft.Toolkit.Forms.UI.Controls -{ - public abstract class WindowsXamlHostBaseExt : WindowsXamlHostBase - { - private readonly string initialTypeName; - - protected FrameworkElement XamlElement { get; private set; } - - protected WindowsXamlHostBaseExt(string typeName) - { - initialTypeName = typeName; - InitializeElement(); - } - - internal virtual void InitializeElement() - { - XamlElement = UWPTypeFactory.CreateXamlContentByType(initialTypeName); - ChildInternal = XamlElement; - XamlElement.SetWrapper(this); - } - - protected override void Dispose(bool disposing) - { - base.Dispose(disposing); - XamlElement.ClearWrapper(); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.Controls/WrapperLookup.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.Controls/WrapperLookup.cs deleted file mode 100644 index 4ff3c84e176..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.Controls/WrapperLookup.cs +++ /dev/null @@ -1,56 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using Windows.UI.Xaml; - -namespace Microsoft.Toolkit.Forms.UI.Controls -{ - /// - /// WrapperLookup is a set of extension methods to extend to make it relatively easy - /// to find its associated WindowsXamlHostBaseExt. - /// (WPF Interop uses an attached DependencyProperty for this). - /// - public static class WrapperLookup - { - private static readonly IDictionary> _controlCollection = new Dictionary>(); - - public static WindowsXamlHostBaseExt GetWrapper(this FrameworkElement control) - { - if (control == null) - { - return null; - } - - _controlCollection.TryGetValue(control, out var weakRef); - if (weakRef.TryGetTarget(out var result)) - { - return result; - } - - return null; - } - - public static void SetWrapper(this FrameworkElement control, WindowsXamlHostBaseExt wrapper) - { - if (control == null || wrapper == null) - { - return; - } - - _controlCollection.Add(control, new WeakReference(wrapper)); - } - - public static void ClearWrapper(this FrameworkElement control) - { - if (control == null) - { - return; - } - - _controlCollection.Remove(control); - } - } -} diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/DpiScalingPanel.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/DpiScalingPanel.cs deleted file mode 100644 index 834a715ed4c..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/DpiScalingPanel.cs +++ /dev/null @@ -1,119 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; - -namespace Microsoft.Toolkit.Forms.UI.XamlHost -{ - /// - /// Panel that implements a scale factor for the XAML content using a render transform - /// - internal class DpiScalingPanel : Windows.UI.Xaml.Controls.Panel - { - public DpiScalingPanel() - { - } - - /// - /// Measures wrapped UWP XAML content using passed in size availableSize - /// - /// Available Size - /// XAML DesiredSize - protected override Windows.Foundation.Size MeasureOverride(Windows.Foundation.Size availableSize) - { - Windows.Foundation.Size desiredSize = new Windows.Foundation.Size(0, 0); - - Windows.UI.Xaml.UIElement element = Child; - - if (element != null) - { - element.Measure(new Windows.Foundation.Size(availableSize.Width / _scalingFactor, availableSize.Height / _scalingFactor)); - desiredSize.Width = element.DesiredSize.Width * _scalingFactor; - desiredSize.Height = element.DesiredSize.Height * _scalingFactor; - } - - desiredSize.Width = Math.Min(desiredSize.Width, availableSize.Width); - desiredSize.Height = Math.Min(desiredSize.Height, availableSize.Height); - - return desiredSize; - } - - /// - /// Arranges wrapped UWP XAML content using passed in size constraint - /// - /// Final Size - /// Size - protected override Windows.Foundation.Size ArrangeOverride(Windows.Foundation.Size finalSize) - { - Windows.UI.Xaml.UIElement element = Child; - - if (element != null) - { - Windows.Foundation.Rect finalRect = new Windows.Foundation.Rect(0, 0, finalSize.Width / _scalingFactor, finalSize.Height / _scalingFactor); - element.Arrange(finalRect); - } - - return base.ArrangeOverride(finalSize); - } - - /// - /// Gets or sets XAML content - /// - public Windows.UI.Xaml.UIElement Child - { - get - { - return Children.Count > 0 ? Children[0] : null; - } - - set - { - Children.Clear(); - Children.Add(value); - - SetScalingFactor(_scalingFactor); - } - } - - /// - /// Sets the scaling factor of the panel - /// New scaling factor - /// - public void SetScalingFactor(double newScalingFactor) - { - // Do not touch any user set render transform on the XAML element - // if scaling is not necessary and was not enabled before - if (newScalingFactor == 1.0f && _scalingFactor == 1.0f) - { - return; - } - - _scalingFactor = newScalingFactor; - - Windows.UI.Xaml.UIElement element = Child; - - if (element == null) - { - return; - } - - if (newScalingFactor == 1.0f) - { - element.RenderTransform = null; - return; - } - - Windows.UI.Xaml.Media.ScaleTransform newScaleTransform = new Windows.UI.Xaml.Media.ScaleTransform(); - newScaleTransform.ScaleX = newScalingFactor; - newScaleTransform.ScaleY = newScalingFactor; - - element.RenderTransform = newScaleTransform; - } - - /// - /// The currently applied scaling factor - /// - private double _scalingFactor = 1.0f; - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/Interop/Win32/NativeDefines.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/Interop/Win32/NativeDefines.cs deleted file mode 100644 index 66593b66ee0..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/Interop/Win32/NativeDefines.cs +++ /dev/null @@ -1,35 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using Microsoft.Toolkit.Win32.UI.Controls.Interop.Win32; - -namespace Microsoft.Toolkit.Forms.UI.XamlHost.Interop.Win32 -{ - /// - /// Definitions required for native interop - /// - internal static partial class NativeDefines - { - // Window Messages - public const int WM_MOVE = (int)WM.MOVE; - public const int WM_SIZE = (int)WM.SIZE; - public const int WM_WINDOWPOSCHANGING = (int)WM.WINDOWPOSCHANGING; - public const int WM_WINDOWPOSCHANGED = (int)WM.WINDOWPOSCHANGED; - public const int WM_SETFOCUS = (int)WM.SETFOCUS; - public const int WM_KILLFOCUS = (int)WM.KILLFOCUS; - public const int WM_KEYDOWN = (int)WM.KEYDOWN; - public const int WM_KEYUP = (int)WM.KEYUP; - public const int WM_DPICHANGED_AFTERPARENT = (int)WM.DPICHANGED_AFTERPARENT; - - // Window Styles - public const uint WS_EX_CONTROLPARENT = 0x00010000; - public const int GWL_STYLE = -16; - public const int GWL_EXSTYLE = -20; - - public static IntPtr HWND_TOP { get; } = IntPtr.Zero; - - public static IntPtr HWND_TOPMOST { get; } = IntPtr.Zero - 1; - } -} diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/Interop/Win32/SafeNativeMethods.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/Interop/Win32/SafeNativeMethods.cs deleted file mode 100644 index 1fac02a2eb7..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/Interop/Win32/SafeNativeMethods.cs +++ /dev/null @@ -1,50 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Runtime.InteropServices; -using System.Runtime.Versioning; -using Microsoft.Toolkit.Win32.UI.Controls.Interop.Win32; - -namespace Microsoft.Toolkit.Forms.UI.XamlHost.Interop.Win32 -{ - /// - /// This class is for methods that are safe for anyone to call. Callers of these methods are not required to perform a full security review to make sure that the usage is secure because the methods are harmless for any caller. - /// - internal static partial class SafeNativeMethods - { - /// - /// Retrieves the handle to the window that has the keyboard focus, if the window is attached - /// to the calling thread's message queue. - /// - /// Window handle of window that currently has focus - [DllImport(ExternDll.User32, ExactSpelling = true, CharSet = CharSet.Auto)] - [ResourceExposure(ResourceScope.None)] - public static extern IntPtr GetFocus(); - - /// - /// Changes the size, position, and Z order of a child, pop-up, or top-level window.These windows are ordered according to their appearance on the screen. The topmost window receives the highest rank and is the first window in the Z order. - /// - /// Handle to target window - /// A handle to the window to precede the positioned window in the Z order. - /// The new position of the left side of the window, in client coordinates. - /// The new position of the top of the window, in client coordinates. - /// The new width of the window, in pixels. - /// The new height of the window, in pixels. - /// The window sizing and positioning flags. This parameter can be a combination of the following values. - /// If the function succeeds, the return value is nonzero. Otherwise, call GLE. - [DllImport(ExternDll.User32, ExactSpelling = true, CharSet = CharSet.Auto)] - [ResourceExposure(ResourceScope.None)] - internal static extern IntPtr SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int cx, int cy, int flags); - - /// - /// Retrieves the dpi value of a window. - /// - /// Handle to target window - /// The dpi value or 0 for an invalid window. - [DllImport(ExternDll.User32, ExactSpelling = true, CharSet = CharSet.Auto)] - [ResourceExposure(ResourceScope.None)] - public static extern uint GetDpiForWindow(IntPtr hWnd); - } -} diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/Interop/Win32/SetWindowPosFlags.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/Interop/Win32/SetWindowPosFlags.cs deleted file mode 100644 index 40e324c0149..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/Interop/Win32/SetWindowPosFlags.cs +++ /dev/null @@ -1,14 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Forms.UI.XamlHost.Interop.Win32 -{ - /// - /// SetWindowPos Flags - /// - internal static partial class SetWindowPosFlags - { - public static readonly int SHOWWINDOW = 0x0040; - } -} diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/Interop/Win32/UnsafeNativeMethods.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/Interop/Win32/UnsafeNativeMethods.cs deleted file mode 100644 index 1646397d878..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/Interop/Win32/UnsafeNativeMethods.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Runtime.InteropServices; -using Microsoft.Toolkit.Win32.UI.Controls.Interop.Win32; - -namespace Microsoft.Toolkit.Forms.UI.XamlHost.Interop.Win32 -{ - /// - /// This class is for methods that are potentially dangerous. Any caller of these methods must perform a full security review to make sure that the usage is secure because no stack walk will be performed. - /// - internal static partial class UnsafeNativeMethods - { - /// - /// This code returns a pointer to a native control with focus. - /// - /// - /// SecurityCritical: This code happens to return a critical resource and causes unmanaged code elevation - /// - /// handle - [DllImport(ExternDll.User32, EntryPoint = "SetFocus", ExactSpelling = true, CharSet = CharSet.Auto, SetLastError = true)] - internal static extern IntPtr IntSetFocus(IntPtr hWnd); - - /// - /// Changes an attribute of the specified window. The function also sets the 32-bit (long) value at the specified offset into the extra window memory. - /// - /// Target window - /// Zero-based offset - /// The replacement value - /// A positive integer indicates success; zero indicates failure - [DllImport(ExternDll.User32, SetLastError = true)] - internal static extern int SetWindowLong(IntPtr hWnd, int nIndex, uint dwNewLong); - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/Microsoft.Toolkit.Forms.UI.XamlHost.csproj b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/Microsoft.Toolkit.Forms.UI.XamlHost.csproj deleted file mode 100644 index 959d36254f0..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/Microsoft.Toolkit.Forms.UI.XamlHost.csproj +++ /dev/null @@ -1,74 +0,0 @@ - - - - net462 - Microsoft.Toolkit.Forms.UI.XamlHost - Microsoft.Toolkit.Forms.UI.XamlHost - true - - Windows Community Toolkit XAMLHost for Windows Forms - This library provides XAML islands interop helpers for Windows Forms. It is part of the Windows Community Toolkit. - XAML Islands Win32 Forms WindowsForms WinForms XamlHost - - - 10.0.17692.0 - - - - - - - - - - - - - - - - - - - - - - - - - - 4.0 - - - - $(WINDIR)\Microsoft.NET\Framework\v4.0.30319\System.Runtime.WindowsRuntime.dll - - - $(WINDIR)\Microsoft.NET\Framework\v4.0.30319\System.Runtime.WindowsRuntime.UI.Xaml.dll - - - - - - True - True - Resources.resx - - - True - Settings.settings - True - - - ResXFileCodeGenerator - Resources.Designer.cs - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - - \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/Properties/AssemblyInfo.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/Properties/AssemblyInfo.cs deleted file mode 100644 index 59d02ecfba0..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,9 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Resources; -using System.Runtime.InteropServices; - -[assembly: ComVisible(false)] -[assembly: NeutralResourcesLanguage("en-US")] \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/Properties/Resources.Designer.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/Properties/Resources.Designer.cs deleted file mode 100644 index 1e4ebf58432..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/Properties/Resources.Designer.cs +++ /dev/null @@ -1,63 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Microsoft.Toolkit.Forms.UI.XamlHost.Properties { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.Toolkit.Forms.UI.XamlHost.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - } -} diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/Properties/Resources.resx b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/Properties/Resources.resx deleted file mode 100644 index af7dbebbace..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/Properties/Resources.resx +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/Properties/Settings.Designer.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/Properties/Settings.Designer.cs deleted file mode 100644 index 14415d7f1f5..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/Properties/Settings.Designer.cs +++ /dev/null @@ -1,26 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Microsoft.Toolkit.Win32.UI.Interop.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.7.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - } -} diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/Properties/Settings.settings b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/Properties/Settings.settings deleted file mode 100644 index 033d7a5e9e2..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/WindowsXamlHost.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/WindowsXamlHost.cs deleted file mode 100644 index 9e938837246..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/WindowsXamlHost.cs +++ /dev/null @@ -1,93 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.ComponentModel; -using System.Windows.Forms; -using Microsoft.Toolkit.Win32.UI.XamlHost; - -namespace Microsoft.Toolkit.Forms.UI.XamlHost -{ - /// - /// A sample Windows Forms control that hosts XAML content - /// - [DesignerCategory("code")] - public class WindowsXamlHost : WindowsXamlHostBase - { - /// - /// Gets or sets a value indicating whether the control dynamically sizes to its content - /// - [ReadOnly(false)] - [Browsable(true)] - [DefaultValue(false)] - [Category("Layout")] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] - public override bool AutoSize - { - get => base.AutoSize; - - set => base.AutoSize = value; - } - - /// - /// Gets or sets the automatic size mode. - /// - /// The automatic size mode. - /// A value indicating if the control dynamically sizes to its content. - [ReadOnly(false)] - [Browsable(true)] - [Category("Layout")] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] - public AutoSizeMode AutoSizeMode - { - get => GetAutoSizeMode(); - - set => SetAutoSizeMode(value); - } - - /// - /// Gets or sets XAML Content by type name - /// - /// XamlClassLibrary.MyUserControl - /// - /// Content creation is deferred until after the parent hwnd has been created. - /// - [Browsable(true)] - [Category("XAML")] - public string InitialTypeName - { - get; - set; - } - - /// - /// Gets or sets XAML content for XamlContentHost - /// - /// The . - [Browsable(false)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public Windows.UI.Xaml.UIElement Child - { - get => (_xamlSource.Content as DpiScalingPanel).Child; - - set => ChildInternal = value; - } - - /// - /// Raises the event. - /// - /// An that contains the event data. - /// Assign window render target to UWP XAML content. - protected override void OnHandleCreated(EventArgs e) - { - // Create content if TypeName has been set and xamlRoot has not been set - if (!DesignMode && !string.IsNullOrEmpty(InitialTypeName) && Child == null) - { - Child = UWPTypeFactory.CreateXamlContentByType(InitialTypeName); - } - - base.OnHandleCreated(e); - } - } -} diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/WindowsXamlHostBase.KeyboardFocus.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/WindowsXamlHostBase.KeyboardFocus.cs deleted file mode 100644 index e51089c372f..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/WindowsXamlHostBase.KeyboardFocus.cs +++ /dev/null @@ -1,127 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Runtime.InteropServices; -using System.Windows.Forms; -using Microsoft.Toolkit.Forms.UI.XamlHost.Interop.Win32; - -namespace Microsoft.Toolkit.Forms.UI.XamlHost -{ - /// - /// WindowsXamlHostBase hosts UWP XAML content inside Windows Forms - /// - public partial class WindowsXamlHostBase - { - /// - /// Last Focus Request GUID to uniquely identify Focus operations, primarily used with error callbacks - /// - private Guid _lastFocusRequest = Guid.Empty; - private bool _forceFocusNavigation = false; - - /// - /// Gets a value indicating whether this Control currently has focus. Check both the Control's - /// window handle and the hosted Xaml window handle. If either has focus - /// then this Control currently has focus. - /// - public override bool Focused - { - get - { - if (IsHandleCreated) - { - // Get currently focused window handle and compare with Control - // and hosted Xaml content window handles - var focusHandle = SafeNativeMethods.GetFocus(); - return focusHandle == Handle || (_xamlIslandWindowHandle != IntPtr.Zero && _xamlSource.HasFocus); - } - - return false; - } - } - - /// - /// Activates the Windows Forms WindowsXamlHost Control - /// - protected override void Select(bool directed, bool forward) - { - ProcessTabKey(forward); - } - - /// - /// Processes a tab key, ensuring that Xaml has an opportunity - /// to handle the command before normal Windows Forms processing. - /// (Xaml must be notified of keys that invoke focus navigation.) - /// - /// true if the command was processed - protected override bool ProcessTabKey(bool forward) - { - // Determine if the currently focused element is the last element for the requested - // navigation direction. If the currently focused element is not the last element - // for the requested navigation direction, navigate focus to the next focusable - // element. - if (!_xamlSource.HasFocus || _forceFocusNavigation) - { - _forceFocusNavigation = false; - var reason = forward ? Windows.UI.Xaml.Hosting.XamlSourceFocusNavigationReason.First : Windows.UI.Xaml.Hosting.XamlSourceFocusNavigationReason.Last; - var request = new Windows.UI.Xaml.Hosting.XamlSourceFocusNavigationRequest(reason, default(Windows.Foundation.Rect)); - _lastFocusRequest = request.CorrelationId; - var result = _xamlSource.NavigateFocus(request); - if (result.WasFocusMoved) - { - return true; - } - - return false; - } - else - { - // Temporary Focus handling for Redstone 5 - - // Call Windows.UI.Xaml.Input.FocusManager.TryMoveFocus Next or Previous and return - Windows.UI.Xaml.Input.FocusNavigationDirection navigationDirection = - forward ? Windows.UI.Xaml.Input.FocusNavigationDirection.Next : Windows.UI.Xaml.Input.FocusNavigationDirection.Previous; - - return Windows.UI.Xaml.Input.FocusManager.TryMoveFocus(navigationDirection); - } - } - - /// - /// Responds to DesktopWindowsXamlSource TakeFocusRequested event - /// - /// DesktopWindowsXamlSource - /// DesktopWindowXamlSourceTakeFocusRequestedEventArgs - private void OnTakeFocusRequested(Windows.UI.Xaml.Hosting.DesktopWindowXamlSource sender, Windows.UI.Xaml.Hosting.DesktopWindowXamlSourceTakeFocusRequestedEventArgs args) - { - if (_lastFocusRequest == args.Request.CorrelationId) - { - // If we've arrived at this point, then focus is being move back to us - // therefore, we should complete the operation to avoid an infinite recursion - // by "Restoring" the focus back to us under a new correlationId - var newRequest = new Windows.UI.Xaml.Hosting.XamlSourceFocusNavigationRequest( - Windows.UI.Xaml.Hosting.XamlSourceFocusNavigationReason.Restore); - _xamlSource.NavigateFocus(newRequest); - _lastFocusRequest = newRequest.CorrelationId; - } - else - { - // Focus was not initiated by WindowsXamlHost. Continue processing the Focus request. - var reason = args.Request.Reason; - if (reason == Windows.UI.Xaml.Hosting.XamlSourceFocusNavigationReason.First || reason == Windows.UI.Xaml.Hosting.XamlSourceFocusNavigationReason.Last) - { - var forward = reason == Windows.UI.Xaml.Hosting.XamlSourceFocusNavigationReason.First; - _forceFocusNavigation = true; - try - { - Parent.SelectNextControl(this, forward, tabStopOnly: true, nested: false, wrap: true); - } - finally - { - _forceFocusNavigation = false; - } - } - } - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/WindowsXamlHostBase.Layout.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/WindowsXamlHostBase.Layout.cs deleted file mode 100644 index 033b20b0e5f..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/WindowsXamlHostBase.Layout.cs +++ /dev/null @@ -1,157 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Drawing; -using Microsoft.Toolkit.Forms.UI.XamlHost.Interop.Win32; - -namespace Microsoft.Toolkit.Forms.UI.XamlHost -{ - /// - /// WindowsXamlHostBase hosts UWP XAML content inside Windows Forms - /// - public partial class WindowsXamlHostBase - { - /// - /// Overrides the base class implementation of to provide - /// correct layout behavior for the hosted XAML content. - /// - /// preferred size - public override Size GetPreferredSize(Size proposedSize) - { - if (DesignMode) - { - return Size; - } - - if ((_xamlSource.Content as DpiScalingPanel).Child != null) - { - double proposedWidth = proposedSize.Width; - double proposedHeight = proposedSize.Height; - - // DockStyles will result in a constraint of 1 on the Docked axis. GetPreferredSize - // must convert this into an unconstrained value. - if (proposedSize.Height == int.MaxValue || proposedSize.Height == 1) - { - proposedHeight = double.PositiveInfinity; - } - - if (proposedSize.Width == int.MaxValue || proposedSize.Width == 1) - { - proposedWidth = double.PositiveInfinity; - } - - _xamlSource.Content.Measure(new Windows.Foundation.Size(proposedWidth, proposedHeight)); - } - - var preferredSize = Size.Empty; - if ((_xamlSource.Content as DpiScalingPanel).Child != null) - { - preferredSize = new Size((int)_xamlSource.Content.DesiredSize.Width, (int)_xamlSource.Content.DesiredSize.Height); - } - - return preferredSize; - } - - /// - /// Sets a scaling factor based on the current dpi value on the scaling panel - /// - protected void UpdateDpiScalingFactor() - { - DpiScalingPanel panel = _xamlSource.Content as DpiScalingPanel; - double dpi = 96.0f; - if (_xamlIslandWindowHandle != IntPtr.Zero) - { - uint windowDpi = SafeNativeMethods.GetDpiForWindow(_xamlIslandWindowHandle); - if (windowDpi > 0) - { - dpi = windowDpi; - } - } - - double newScalingFactor = _dpiScalingRenderTransformEnabled ? (dpi / 96.0f) : 1.0f; - - panel.SetScalingFactor(newScalingFactor); - } - - /// - /// Gets XAML content's 'DesiredSize' post-Measure. - /// - /// desired size - /// Called by event handler. - /// - private Size GetRootXamlElementDesiredSize() - { - var desiredSize = new Size((int)_xamlSource.Content.DesiredSize.Width, (int)_xamlSource.Content.DesiredSize.Height); - - return desiredSize; - } - - /// - /// Gets the default size of the control. - /// - protected override Size DefaultSize - { - get - { - // XamlContentHost's DefaultSize is 0, 0 - var defaultSize = Size.Empty; - - return defaultSize; - } - } - - /// - /// Responds to UWP XAML's 'SizeChanged' event, fired when XAML content - /// layout has changed. If 'DesiredSize' has changed, re-run - /// Windows Forms layout. - /// - protected void OnChildSizeChanged(object sender, object e) - { - if (DesignMode) - { - return; - } - - // XAML content has changed. Re-run Windows.Forms.Control Layout if parent form is - // set to AutoSize. - if (AutoSize) - { - var prefSize = GetRootXamlElementDesiredSize(); - - if (_lastXamlContentPreferredSize.Height != prefSize.Height || _lastXamlContentPreferredSize.Width != prefSize.Width) - { - _lastXamlContentPreferredSize = prefSize; - PerformLayout(); - } - } - } - - /// - /// Event handler for . If the size of the host control - /// has changed, re-run Windows Forms layout on this Control instance. - /// - protected void OnWindowXamlHostSizeChanged(object sender, EventArgs e) - { - if (DesignMode) - { - return; - } - - if (AutoSize) - { - if ((_xamlSource.Content as DpiScalingPanel).Child != null) - { - // XamlContenHost Control.Size has changed. XAML must perform an Arrange pass. - // The XAML Arrange pass will expand XAML content with 'HorizontalStretch' and - // 'VerticalStretch' properties to the bounds of the XamlContentHost Control. - var rect = new Windows.Foundation.Rect(0, 0, Width, Height); - _xamlSource.Content.Measure(new Windows.Foundation.Size(Width, Height)); - _xamlSource.Content.Arrange(rect); - PerformLayout(); - } - } - } - } -} diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/WindowsXamlHostBase.Window.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/WindowsXamlHostBase.Window.cs deleted file mode 100644 index 6fbcab8a38e..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/WindowsXamlHostBase.Window.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using Microsoft.Toolkit.Forms.UI.XamlHost.Interop.Win32; - -namespace Microsoft.Toolkit.Forms.UI.XamlHost -{ - /// - /// WindowsXamlHostBase hosts UWP XAML content inside Windows Forms - /// - public partial class WindowsXamlHostBase - { - /// - /// Sets XAML window size using dimensions of the host control - /// - private void SetDesktopWindowXamlSourceWindowPos() - { - if (_xamlIslandWindowHandle != IntPtr.Zero && Width != 0 && Height != 0) - { - if (SafeNativeMethods.SetWindowPos(_xamlIslandWindowHandle, NativeDefines.HWND_TOP, 0, 0, Width, Height, SetWindowPosFlags.SHOWWINDOW) == IntPtr.Zero) - { - throw new InvalidOperationException($"{nameof(WindowsXamlHostBase)}::{nameof(SetDesktopWindowXamlSourceWindowPos)} failed to set UWP XAML window position."); - } - } - } - } -} diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/WindowsXamlHostBase.WndProc.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/WindowsXamlHostBase.WndProc.cs deleted file mode 100644 index a9403ccf4d0..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/WindowsXamlHostBase.WndProc.cs +++ /dev/null @@ -1,132 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.ComponentModel; -using System.Drawing; -using System.Security.Permissions; -using System.Windows.Forms; -using Microsoft.Toolkit.Forms.UI.XamlHost.Interop.Win32; - -namespace Microsoft.Toolkit.Forms.UI.XamlHost -{ - /// - /// WindowsXamlHostBase hosts UWP XAML content inside Windows Forms - /// - public partial class WindowsXamlHostBase - { - /// - /// Draw a placeholder Rectangle with 'Xaml Content' in Design mode - /// - /// PaintEventArgs - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - protected override void OnPaint(PaintEventArgs e) - { - // Show 'XAML Content' with a gray Rectangle placeholder when running in the Designer - if (DesignMode) - { - var graphics = e.Graphics; - - // Gray background Rectangle - graphics.FillRectangle(new SolidBrush(Color.DarkGray), ClientRectangle); - - // 'XAML Content' text - var text1 = "XAML Content"; - using (var font1 = new Font("Arial", 12, FontStyle.Bold, GraphicsUnit.Point)) - { - var rect1 = ClientRectangle; - - var stringFormat = new StringFormat(); - stringFormat.Alignment = StringAlignment.Center; - stringFormat.LineAlignment = StringAlignment.Center; - e.Graphics.DrawString(text1, font1, Brushes.White, rect1, stringFormat); - e.Graphics.DrawRectangle(Pens.Black, rect1); - } - - return; - } - - base.OnPaint(e); - } - - /// - /// Prevent control from painting the background - /// - /// PaintEventArgs - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - protected override void OnPaintBackground(PaintEventArgs pevent) - { - // Do not draw the background - } - - /// - /// Processes Windows messages for XamlContentHost control window (not XAML window) - /// - /// message to process - protected override void WndProc(ref Message m) - { - if (DesignMode) - { - base.WndProc(ref m); - } - - switch (m.Msg) - { - // SetDesktopWindowXamlSourceWindowPos must always be called after base.WndProc - case NativeDefines.WM_MOVE: - case NativeDefines.WM_SIZE: - case NativeDefines.WM_WINDOWPOSCHANGED: - case NativeDefines.WM_WINDOWPOSCHANGING: - base.WndProc(ref m); - SetDesktopWindowXamlSourceWindowPos(); - break; - - // BUGBUG: Focus integration with Windows.UI.Xaml.Hosting.XamlSourceFocusNavigation is - // skipping over nested elements. Update or move back to Windows.Xaml.Input.FocusManager. - // WM_SETFOCUS should not be handled directly. MS Internal: DesktopWindowXamlSource.NavigateFocus - // non-directional Focus not moving Focus, not responding to keyboard input. - case NativeDefines.WM_SETFOCUS: - // BUGBUG: Work-around internal aggressive FAILFAST bug. Remove this when #19043466 or nested element support is fixed. - if (m.WParam != m.HWnd) - { - // Temporarily drop some WM_SETFOCUS messages to prevent calling Focus on Focused element. An - // unnecessary Focus operation may trigger a FAILFAST inside UWP XAML's DesktopWindowXamlSource. - return; - } - - if (UnsafeNativeMethods.IntSetFocus(_xamlIslandWindowHandle) == System.IntPtr.Zero) - { - throw new System.InvalidOperationException($"{nameof(WindowsXamlHostBase)}::{nameof(WndProc)}: Failed to SetFocus on UWP XAML window"); - } - - base.WndProc(ref m); - break; - - case NativeDefines.WM_KILLFOCUS: - // If focus is being set on the UWP XAML island window then we should prevent LostFocus by - // handling this message. - if (_xamlIslandWindowHandle == null || _xamlIslandWindowHandle != m.WParam || _xamlSource.HasFocus) - { - base.WndProc(ref m); - } - - break; - - case NativeDefines.WM_DPICHANGED_AFTERPARENT: - if (_xamlIslandWindowHandle != null) - { - UpdateDpiScalingFactor(); - PerformLayout(); - } - - break; - - default: - base.WndProc(ref m); - break; - } - } - } -} diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/WindowsXamlHostBase.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/WindowsXamlHostBase.cs deleted file mode 100644 index 07d33c8c2cd..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/WindowsXamlHostBase.cs +++ /dev/null @@ -1,225 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.ComponentModel; -using System.Drawing; -using System.Security.Permissions; -using System.Windows.Forms; -using Microsoft.Toolkit.Win32.UI.XamlHost; - -namespace Microsoft.Toolkit.Forms.UI.XamlHost -{ - /// - /// WindowsXamlHostBase hosts UWP XAML content inside Windows Forms - /// - [System.ComponentModel.DesignerCategory("code")] - public abstract partial class WindowsXamlHostBase : ContainerControl - { -#pragma warning disable SA1401 // Fields must be private - /// - /// DesktopWindowXamlSource instance - /// - protected internal readonly Windows.UI.Xaml.Hosting.DesktopWindowXamlSource _xamlSource; - - /// - /// A render transform to scale the UWP XAML content should be applied - /// - protected internal bool _dpiScalingRenderTransformEnabled = false; -#pragma warning restore SA1401 // Fields must be private - - /// - /// A reference count on the UWP XAML framework is tied to WindowsXamlManager's - /// lifetime. UWP XAML is spun up on the first WindowsXamlManager creation and - /// deinitialized when the last instance of WindowsXamlManager is destroyed. - /// - private readonly Windows.UI.Xaml.Hosting.WindowsXamlManager _windowsXamlManager; - - /// - /// UWP XAML Application instance and root UWP XamlMetadataProvider. Custom implementation required to - /// probe at runtime for custom UWP XAML type information. This must be created before - /// creating any DesktopWindowXamlSource instances if custom UWP XAML types are required. - /// - private readonly Windows.UI.Xaml.Application _application; - - /// - /// Last preferredSize returned by UWP XAML during WinForms layout pass - /// - private Size _lastXamlContentPreferredSize; - - /// - /// UWP XAML island window handle associated with this Control instance - /// - private IntPtr _xamlIslandWindowHandle = IntPtr.Zero; - - /// - /// Fired when XAML content has been updated - /// - [Browsable(true)] - [Category("UWP XAML")] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] - [Description("Fired when UWP XAML content has been updated")] - public event EventHandler ChildChanged; - - /// - /// Initializes a new instance of the class. - /// - public WindowsXamlHostBase() - { - SetStyle(ControlStyles.ContainerControl, true); - SetStyle(ControlStyles.SupportsTransparentBackColor, true); - SetStyle(ControlStyles.UserPaint, true); - SetStyle(ControlStyles.AllPaintingInWmPaint, true); - - // Must be a container control with TabStop == false to allow nested UWP XAML Focus - // BUGBUG: Uncomment when nested Focus is available - // TabStop = false; - - // Respond to size changes on this Control - SizeChanged += OnWindowXamlHostSizeChanged; - - // Windows.UI.Xaml.Application object is required for loading custom control metadata. If a custom - // Application object is not provided by the application, the host control will create one (XamlApplication). - // Instantiation of the application object must occur before creating the DesktopWindowXamlSource instance. - // If no Application object is created before DesktopWindowXamlSource is created, DestkopWindowXamlSource - // will create a generic Application object unable to load custom UWP XAML metadata. - Microsoft.Toolkit.Win32.UI.XamlHost.XamlApplication.GetOrCreateXamlApplicationInstance(ref _application); - - // Create an instance of the WindowsXamlManager. This initializes and holds a - // reference on the UWP XAML DXamlCore and must be explicitly created before - // any UWP XAML types are programmatically created. If WindowsXamlManager has - // not been created before creating DesktopWindowXamlSource, DesktopWindowXaml source - // will create an instance of WindowsXamlManager internally. (Creation is explicit - // here to illustrate how to initialize UWP XAML before initializing the DesktopWindowXamlSource.) - _windowsXamlManager = Windows.UI.Xaml.Hosting.WindowsXamlManager.InitializeForCurrentThread(); - - // Create DesktopWindowXamlSource, host for UWP XAML content - _xamlSource = new Windows.UI.Xaml.Hosting.DesktopWindowXamlSource(); - - // Hook up method for DesktopWindowXamlSource Focus handling - _xamlSource.TakeFocusRequested += this.OnTakeFocusRequested; - - // Add scaling panel as the root XAML element - _xamlSource.Content = new DpiScalingPanel(); - } - - /// - /// Gets or sets XAML content for XamlContentHost - /// - [Browsable(false)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - protected Windows.UI.Xaml.UIElement ChildInternal - { - get => (_xamlSource.Content as DpiScalingPanel).Child; - - set - { - if (!DesignMode) - { - var newFrameworkElement = value as Windows.UI.Xaml.FrameworkElement; - var oldFrameworkElement = (_xamlSource.Content as DpiScalingPanel).Child as Windows.UI.Xaml.FrameworkElement; - - if (oldFrameworkElement != null) - { - oldFrameworkElement.SizeChanged -= OnChildSizeChanged; - } - - if (newFrameworkElement != null) - { - // If XAML content has changed, check XAML size and WindowsXamlHost.AutoSize - // setting to determine if WindowsXamlHost needs to re-run layout. - newFrameworkElement.SizeChanged += OnChildSizeChanged; - } - - (_xamlSource.Content as DpiScalingPanel).Child = value; - - PerformLayout(); - - ChildChanged?.Invoke(this, new EventArgs()); - } - } - } - - /// - /// Sets the root UWP XAML element on DesktopWindowXamlSource - /// - /// A UWP XAML Framework element - protected virtual void SetContent(Windows.UI.Xaml.FrameworkElement newValue) - { - if (_xamlSource != null) - { - (_xamlSource.Content as DpiScalingPanel).Child = newValue; - } - } - - /// - /// Gets or sets a value indicating whether a render transform is added to the UWP control corresponding to the current dpi scaling factor - /// - /// The dpi scaling mode. - /// A custom render transform added to the root UWP control will be overwritten. - [ReadOnly(false)] - [Browsable(true)] - [Category("Layout")] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] - public bool DpiScalingRenderTransform - { - get => _dpiScalingRenderTransformEnabled; - - set - { - _dpiScalingRenderTransformEnabled = value; - UpdateDpiScalingFactor(); - PerformLayout(); - } - } - - /// - /// Clean up hosted UWP XAML content - /// - /// IsDisposing? - protected override void Dispose(bool disposing) - { - if (disposing) - { - SizeChanged -= OnWindowXamlHostSizeChanged; - - // Required by CA2213: _xamlSource?.Dispose() is insufficient. - if (_xamlSource != null) - { - _xamlSource.TakeFocusRequested -= OnTakeFocusRequested; - _xamlSource.Dispose(); - } - - _windowsXamlManager?.Dispose(); - } - - base.Dispose(disposing); - } - - /// - /// Raises the HandleCreated event. Assign window render target to UWP XAML content. - /// - /// EventArgs - protected override void OnHandleCreated(EventArgs e) - { - if (!DesignMode) - { - // Attach window to DesktopWindowXamSource as a render target - var desktopWindowXamlSourceNative = _xamlSource.GetInterop(); - desktopWindowXamlSourceNative.AttachToWindow(Handle); - _xamlIslandWindowHandle = desktopWindowXamlSourceNative.WindowHandle; - - // Set window style required by container control to support Focus - if (Interop.Win32.UnsafeNativeMethods.SetWindowLong(Handle, Interop.Win32.NativeDefines.GWL_EXSTYLE, Interop.Win32.NativeDefines.WS_EX_CONTROLPARENT) == 0) - { - throw new InvalidOperationException("WindowsXamlHostBase::OnHandleCreated: Failed to set WS_EX_CONTROLPARENT on control window."); - } - - UpdateDpiScalingFactor(); - } - - base.OnHandleCreated(e); - } - } -} diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Forms.WebView/App.config b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Forms.WebView/App.config deleted file mode 100644 index f492da186ae..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Forms.WebView/App.config +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Forms.WebView/Form1.Designer.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Forms.WebView/Form1.Designer.cs deleted file mode 100644 index 2f567e25352..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Forms.WebView/Form1.Designer.cs +++ /dev/null @@ -1,164 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Windows.Forms; - -namespace Microsoft.Toolkit.Sample.Forms.WebView -{ - partial class Form1 - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.button1 = new System.Windows.Forms.Button(); - this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); - this.webView1 = new Microsoft.Toolkit.Forms.UI.Controls.WebView(); - this.button2 = new System.Windows.Forms.Button(); - this.url = new System.Windows.Forms.TextBox(); - this.Go = new System.Windows.Forms.Button(); - this.tableLayoutPanel1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.webView1)).BeginInit(); - this.SuspendLayout(); - // - // button1 - // - this.button1.Dock = System.Windows.Forms.DockStyle.Fill; - this.button1.Location = new System.Drawing.Point(0, 0); - this.button1.Margin = new System.Windows.Forms.Padding(0); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(45, 46); - this.button1.TabIndex = 2; - this.button1.Text = "<"; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.button1_Click); - // - // tableLayoutPanel1 - // - this.tableLayoutPanel1.ColumnCount = 4; - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 45F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 45F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 45F)); - this.tableLayoutPanel1.Controls.Add(this.button1, 0, 0); - this.tableLayoutPanel1.Controls.Add(this.webView1, 0, 1); - this.tableLayoutPanel1.Controls.Add(this.button2, 1, 0); - this.tableLayoutPanel1.Controls.Add(this.url, 2, 0); - this.tableLayoutPanel1.Controls.Add(this.Go, 3, 0); - this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; - this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); - this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(0); - this.tableLayoutPanel1.Name = "tableLayoutPanel1"; - this.tableLayoutPanel1.RowCount = 2; - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 46F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanel1.Size = new System.Drawing.Size(1142, 886); - this.tableLayoutPanel1.TabIndex = 4; - // - // webView1 - // - this.webView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.tableLayoutPanel1.SetColumnSpan(this.webView1, 4); - this.webView1.IsPrivateNetworkClientServerCapabilityEnabled = true; - this.webView1.IsScriptNotifyAllowed = true; - this.webView1.Location = new System.Drawing.Point(3, 49); - this.webView1.MinimumSize = new System.Drawing.Size(20, 20); - this.webView1.Name = "webView1"; - this.webView1.Size = new System.Drawing.Size(1136, 834); - this.webView1.Source = new System.Uri("https://www.bing.com", System.UriKind.Absolute); - this.webView1.TabIndex = 3; - this.webView1.ContainsFullScreenElementChanged += new System.EventHandler(this.webView1_ContainsFullScreenElementChanged); - this.webView1.NavigationCompleted += new System.EventHandler(this.webView1_NavigationCompleted); - this.webView1.NavigationStarting += new System.EventHandler(this.webView1_NavigationStarting); - this.webView1.PermissionRequested += new System.EventHandler(this.webView1_PermissionRequested); - this.webView1.ScriptNotify += new System.EventHandler(this.webView1_ScriptNotify); - // - // button2 - // - this.button2.Dock = System.Windows.Forms.DockStyle.Fill; - this.button2.Location = new System.Drawing.Point(45, 0); - this.button2.Margin = new System.Windows.Forms.Padding(0); - this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(45, 46); - this.button2.TabIndex = 4; - this.button2.Text = ">"; - this.button2.UseVisualStyleBackColor = true; - this.button2.Click += new System.EventHandler(this.button2_Click); - // - // url - // - this.url.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; - this.url.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.AllUrl; - this.url.Dock = System.Windows.Forms.DockStyle.Fill; - this.url.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.url.Location = new System.Drawing.Point(90, 0); - this.url.Margin = new System.Windows.Forms.Padding(0); - this.url.Name = "url"; - this.url.Size = new System.Drawing.Size(1007, 44); - this.url.TabIndex = 5; - this.url.KeyUp += new System.Windows.Forms.KeyEventHandler(this.url_KeyUp); - // - // Go - // - this.Go.Dock = System.Windows.Forms.DockStyle.Fill; - this.Go.Location = new System.Drawing.Point(1097, 0); - this.Go.Margin = new System.Windows.Forms.Padding(0); - this.Go.Name = "Go"; - this.Go.Size = new System.Drawing.Size(45, 46); - this.Go.TabIndex = 6; - this.Go.Text = "Go"; - this.Go.UseVisualStyleBackColor = true; - this.Go.Click += new System.EventHandler(this.Go_Click); - // - // Form1 - // - this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1142, 886); - this.Controls.Add(this.tableLayoutPanel1); - this.Name = "Form1"; - this.Text = "WinForms WebView"; - this.Load += new System.EventHandler(this.OnFormLoaded); - this.tableLayoutPanel1.ResumeLayout(false); - this.tableLayoutPanel1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.webView1)).EndInit(); - this.ResumeLayout(false); - - } - - - #endregion - - private Button button1; - private TableLayoutPanel tableLayoutPanel1; - private Microsoft.Toolkit.Forms.UI.Controls.WebView webView1; - private Button button2; - private TextBox url; - private Button Go; - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Forms.WebView/Form1.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Forms.WebView/Form1.cs deleted file mode 100644 index 83a9795a713..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Forms.WebView/Form1.cs +++ /dev/null @@ -1,151 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Windows.Forms; -using Microsoft.Toolkit.Win32.UI.Controls; -using Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT; - -namespace Microsoft.Toolkit.Sample.Forms.WebView -{ - public partial class Form1 : Form - { - private bool _isFullScreen; - - private bool _processExitedAttached; - - public Form1() - { - InitializeComponent(); - } - - private void button1_Click(object sender, EventArgs e) - { - webView1?.GoBack(); - } - - private void button2_Click(object sender, EventArgs e) - { - webView1?.GoForward(); - } - - private void Go_Click(object sender, EventArgs e) - { - var result = (Uri)new WebBrowserUriTypeConverter().ConvertFromString(url.Text); - webView1.Source = result; - } - - private void OnFormLoaded(object sender, EventArgs e) - { - TryAttachProcessExitedEventHandler(); - } - - private void TryAttachProcessExitedEventHandler() - { - if (!_processExitedAttached && webView1?.Process != null) - { - webView1.Process.ProcessExited += (o, a) => - { - //WebView has encountered and error and was terminated - Close(); - }; - - _processExitedAttached = true; - } - } - - private void url_KeyUp(object sender, KeyEventArgs e) - { - if (e.KeyCode == Keys.Enter && webView1 != null) - { - var result = (Uri)new WebBrowserUriTypeConverter().ConvertFromString(url.Text); - webView1.Source = result; - } - } - - private void webView1_ContainsFullScreenElementChanged(object sender, object e) - { - void EnterFullScreen() - { - WindowState = FormWindowState.Normal; - FormBorderStyle = FormBorderStyle.None; - WindowState = FormWindowState.Maximized; - } - - void LeaveFullScreen() - { - FormBorderStyle = FormBorderStyle.Sizable; - WindowState = FormWindowState.Normal; - } - - // Toggle - _isFullScreen = !_isFullScreen; - - if (_isFullScreen) - { - EnterFullScreen(); - } - else - { - LeaveFullScreen(); - } - } - - private void webView1_NavigationCompleted(object sender, WebViewControlNavigationCompletedEventArgs e) - { - TryAttachProcessExitedEventHandler(); - url.Text = e.Uri?.ToString() ?? string.Empty; - Text = webView1.DocumentTitle; - if (!e.IsSuccess) - { - MessageBox.Show($"Could not navigate to {e.Uri}", $"Error: {e.WebErrorStatus}", - MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - - private void webView1_NavigationStarting(object sender, WebViewControlNavigationStartingEventArgs e) - { - Text = "Navigating " + e.Uri?.ToString() ?? string.Empty; - url.Text = e.Uri?.ToString() ?? string.Empty; - } - - private void webView1_PermissionRequested(object sender, WebViewControlPermissionRequestedEventArgs e) - { - if (e.PermissionRequest.State == WebViewControlPermissionState.Allow) return; - - var msg = $"Allow {e.PermissionRequest.Uri.Host} to access {e.PermissionRequest.PermissionType}?"; - - var response = MessageBox.Show(msg, "Permission Request", MessageBoxButtons.YesNo, MessageBoxIcon.Question, - MessageBoxDefaultButton.Button1); - - if (response == DialogResult.Yes) - { - if (e.PermissionRequest.State == WebViewControlPermissionState.Defer) - { - webView1.GetDeferredPermissionRequestById(e.PermissionRequest.Id)?.Allow(); - } - else - { - e.PermissionRequest.Allow(); - } - } - else - { - if (e.PermissionRequest.State == WebViewControlPermissionState.Defer) - { - webView1.GetDeferredPermissionRequestById(e.PermissionRequest.Id)?.Deny(); - } - else - { - e.PermissionRequest.Deny(); - } - } - } - - private void webView1_ScriptNotify(object sender, WebViewControlScriptNotifyEventArgs e) - { - MessageBox.Show(e.Value, e.Uri?.ToString() ?? string.Empty); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Forms.WebView/Form1.resx b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Forms.WebView/Form1.resx deleted file mode 100644 index 1af7de150c9..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Forms.WebView/Form1.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Forms.WebView/Microsoft.Toolkit.Sample.Forms.WebView.csproj b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Forms.WebView/Microsoft.Toolkit.Sample.Forms.WebView.csproj deleted file mode 100644 index d244566bb64..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Forms.WebView/Microsoft.Toolkit.Sample.Forms.WebView.csproj +++ /dev/null @@ -1,49 +0,0 @@ - - - WinExe - net462 - app.manifest - Windows Community Toolkit Controls (Sample WebView for .NET Forms) - Sample Code for Windows Community Toolkit Controls - - - - - - - - - - Form - - - Form1.cs - - - Form1.cs - - - ResXFileCodeGenerator - Resources.Designer.cs - Designer - - - True - Resources.resx - True - - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - True - Settings.settings - True - - - - - - \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Forms.WebView/Program.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Forms.WebView/Program.cs deleted file mode 100644 index fc6fd417a8c..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Forms.WebView/Program.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Windows.Forms; - -namespace Microsoft.Toolkit.Sample.Forms.WebView -{ - static class Program - { - /// - /// The main entry point for the application. - /// - [STAThread] - static void Main() - { - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new Form1()); - } - } -} diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Forms.WebView/Properties/Resources.Designer.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Forms.WebView/Properties/Resources.Designer.cs deleted file mode 100644 index 7898dca09d9..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Forms.WebView/Properties/Resources.Designer.cs +++ /dev/null @@ -1,63 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Microsoft.Toolkit.Sample.Forms.WebView.Properties { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.Toolkit.Sample.Forms.WebView.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - } -} diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Forms.WebView/Properties/Resources.resx b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Forms.WebView/Properties/Resources.resx deleted file mode 100644 index af7dbebbace..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Forms.WebView/Properties/Resources.resx +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Forms.WebView/Properties/Settings.Designer.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Forms.WebView/Properties/Settings.Designer.cs deleted file mode 100644 index 510a496bbda..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Forms.WebView/Properties/Settings.Designer.cs +++ /dev/null @@ -1,26 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Microsoft.Toolkit.Sample.Forms.WebView.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.8.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - } -} diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Forms.WebView/Properties/Settings.settings b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Forms.WebView/Properties/Settings.settings deleted file mode 100644 index 39645652af6..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Forms.WebView/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Forms.WebView/app.manifest b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Forms.WebView/app.manifest deleted file mode 100644 index 92b50ba950b..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Forms.WebView/app.manifest +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true/PM - - - - - - - - - - - - - - diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.App/App.config b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.App/App.config deleted file mode 100644 index 4188a854eef..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.App/App.config +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.App/App.xaml b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.App/App.xaml deleted file mode 100644 index 00b009a716e..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.App/App.xaml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.App/App.xaml.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.App/App.xaml.cs deleted file mode 100644 index 33d7bcb0df4..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.App/App.xaml.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using System.Configuration; -using System.Data; -using System.Linq; -using System.Threading.Tasks; -using System.Windows; - -namespace Microsoft.Toolkit.Sample.Wpf.App -{ - /// - /// Interaction logic for App.xaml - /// - public partial class App : Application - { - } -} diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.App/Assets/storelogo-sdk.png b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.App/Assets/storelogo-sdk.png deleted file mode 100644 index 5c397dea1de..00000000000 Binary files a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.App/Assets/storelogo-sdk.png and /dev/null differ diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.App/MainWindow.xaml b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.App/MainWindow.xaml deleted file mode 100644 index 3ca400264ac..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.App/MainWindow.xaml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - Ink Controls (Canvas / Toolbar) - - - - - - - - - - Samples - - - - - - - - - - MediaPlayerElement - - - - - WebView - - - - - - - - diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.App/MainWindow.xaml.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.App/MainWindow.xaml.cs deleted file mode 100644 index 211850721c4..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.App/MainWindow.xaml.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Windows; -using Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT; - -namespace Microsoft.Toolkit.Sample.Wpf.App -{ - /// - /// Interaction logic for MainWindow.xaml - /// - public partial class MainWindow : Window - { - public MainWindow() - { - InitializeComponent(); - } - - private void inkCanvas_Loaded(object sender, RoutedEventArgs e) - { - inkCanvas.InkPresenter.InputDeviceTypes = CoreInputDeviceTypes.Mouse | CoreInputDeviceTypes.Pen | CoreInputDeviceTypes.Touch; - } - - private void inkToolbar_Initialized(object sender, EventArgs e) - { - // Handle ink toolbar initialization events here - - } - - private void inkToolbar_ActiveToolChanged(object sender, object e) - { - // Handle ink toolbar active tool changed events here. - } - - } - -} diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.App/Microsoft.Toolkit.Sample.Wpf.App.csproj b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.App/Microsoft.Toolkit.Sample.Wpf.App.csproj deleted file mode 100644 index f577ed88ddd..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.App/Microsoft.Toolkit.Sample.Wpf.App.csproj +++ /dev/null @@ -1,43 +0,0 @@ - - - {45524ED2-8B5A-42E8-97A2-DCA44ECC83AA} - WinExe - net462 - app.manifest - {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - true - Windows Community Toolkit Controls (Sample Xaml Island Wrapper Controls for .NET WPF) - Sample Code for Windows Community Toolkit Controls - true - - - full - - - pdbonly - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.App/Properties/AssemblyInfo.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.App/Properties/AssemblyInfo.cs deleted file mode 100644 index 35852e083f0..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.App/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Reflection; -using System.Resources; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Windows; - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -//In order to begin building localizable applications, set -//CultureYouAreCodingWith in your .csproj file -//inside a . For example, if you are using US english -//in your source files, set the to en-US. Then uncomment -//the NeutralResourceLanguage attribute below. Update the "en-US" in -//the line below to match the UICulture setting in the project file. - -//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] - - -[assembly: ThemeInfo( - ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located - //(used if a resource is not found in the page, - // or application resource dictionaries) - ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located - //(used if a resource is not found in the page, - // app, or any theme specific resource dictionaries) -)] - diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.App/Properties/Resources.Designer.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.App/Properties/Resources.Designer.cs deleted file mode 100644 index 57b5cf1fe63..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.App/Properties/Resources.Designer.cs +++ /dev/null @@ -1,63 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Microsoft.Toolkit.Sample.Wpf.App.Properties { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.Toolkit.Sample.Wpf.App.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - } -} diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.App/Properties/Resources.resx b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.App/Properties/Resources.resx deleted file mode 100644 index af7dbebbace..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.App/Properties/Resources.resx +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.App/Properties/Settings.Designer.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.App/Properties/Settings.Designer.cs deleted file mode 100644 index 394704bd825..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.App/Properties/Settings.Designer.cs +++ /dev/null @@ -1,26 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Microsoft.Toolkit.Sample.Wpf.App.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.8.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - } -} diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.App/Properties/Settings.settings b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.App/Properties/Settings.settings deleted file mode 100644 index 033d7a5e9e2..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.App/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.App/app.manifest b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.App/app.manifest deleted file mode 100644 index 86087ce06a9..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.App/app.manifest +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - PerMonitor - true/PM - - - - - - - \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.WebView/App.config b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.WebView/App.config deleted file mode 100644 index f492da186ae..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.WebView/App.config +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.WebView/App.xaml b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.WebView/App.xaml deleted file mode 100644 index 649cd12220a..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.WebView/App.xaml +++ /dev/null @@ -1,6 +0,0 @@ - - - diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.WebView/App.xaml.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.WebView/App.xaml.cs deleted file mode 100644 index d24846cd4f4..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.WebView/App.xaml.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Windows; - -namespace Microsoft.Toolkit.Sample.Wpf.WebView -{ - /// - /// Interaction logic for App.xaml - /// - public partial class App : Application - { - } -} diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.WebView/MainWindow.xaml b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.WebView/MainWindow.xaml deleted file mode 100644 index 1b59e4b9dc7..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.WebView/MainWindow.xaml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.WebView/MainWindow.xaml.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.WebView/MainWindow.xaml.cs deleted file mode 100644 index 3abdad8a2a6..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.WebView/MainWindow.xaml.cs +++ /dev/null @@ -1,169 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Windows; -using System.Windows.Input; -using Microsoft.Toolkit.Win32.UI.Controls; -using Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT; - -namespace Microsoft.Toolkit.Sample.Wpf.WebView -{ - /// - /// Interaction logic for MainWindow.xaml - /// - public partial class MainWindow : Window - { - private bool _isFullScreen; - - private bool _processExitedAttached; - - public MainWindow() - { - InitializeComponent(); - } - - private void BrowseBack_OnCanExecute(object sender, CanExecuteRoutedEventArgs e) - { - e.CanExecute = WebView1 != null && WebView1.CanGoBack; - } - - private void BrowseBack_OnExecuted(object sender, ExecutedRoutedEventArgs e) - { - WebView1?.GoBack(); - } - - private void BrowseForward_CanExecute(object sender, CanExecuteRoutedEventArgs e) - { - e.CanExecute = WebView1 != null && WebView1.CanGoForward; - } - - private void BrowseForward_OnExecuted(object sender, ExecutedRoutedEventArgs e) - { - WebView1?.GoForward(); - } - - private void GoToPage_CanExecute(object sender, CanExecuteRoutedEventArgs e) - { - e.CanExecute = true; - } - - private void GoToPage_OnExecuted(object sender, ExecutedRoutedEventArgs e) - { - var result = (Uri)new WebBrowserUriTypeConverter().ConvertFromString(Url.Text); - WebView1.Source = result; - } - private void OnWindowLoaded(object sender, RoutedEventArgs e) - { - TryAttachProcessExitedEventHandler(); - } - - private void TryAttachProcessExitedEventHandler() - { - if (!_processExitedAttached && WebView1?.Process != null) - { - WebView1.Process.ProcessExited += (o, a) => - { - //WebView has encountered and error and was terminated - Close(); - }; - - _processExitedAttached = true; - } - } - - private void Url_OnKeyUp(object sender, KeyEventArgs e) - { - if (e.Key == Key.Enter && WebView1 != null) - { - var result = - (Uri)new WebBrowserUriTypeConverter().ConvertFromString( - Url.Text); - WebView1.Source = result; - } - } - - private void WebView1_OnContainsFullScreenElementChanged(object sender, object e) - { - void EnterFullScreen() - { - WindowState = WindowState.Normal; - ResizeMode = ResizeMode.NoResize; - WindowState = WindowState.Maximized; - } - - void LeaveFullScreen() - { - ResizeMode = ResizeMode.CanResize; - WindowState = WindowState.Normal; - } - - // Toggle - _isFullScreen = !_isFullScreen; - - if (_isFullScreen) - { - EnterFullScreen(); - } - else - { - LeaveFullScreen(); - } - } - - private void WebView1_OnNavigationCompleted(object sender, WebViewControlNavigationCompletedEventArgs e) - { - TryAttachProcessExitedEventHandler(); - Url.Text = e.Uri?.ToString() ?? string.Empty; - Title = WebView1.DocumentTitle; - if (!e.IsSuccess) - { - MessageBox.Show($"Could not navigate to {e.Uri?.ToString() ?? "NULL"}", $"Error: {e.WebErrorStatus}", MessageBoxButton.OK, MessageBoxImage.Error); - } - } - - private void WebView1_OnNavigationStarting(object sender, WebViewControlNavigationStartingEventArgs e) - { - Title = $"Navigating {e.Uri?.ToString() ?? string.Empty}"; - Url.Text = e.Uri?.ToString() ?? string.Empty; - } - - private void WebView1_OnPermissionRequested(object sender, WebViewControlPermissionRequestedEventArgs e) - { - if (e.PermissionRequest.State == WebViewControlPermissionState.Allow) return; - - var msg = $"Allow {e.PermissionRequest.Uri.Host} to access {e.PermissionRequest.PermissionType}?"; - - var response = MessageBox.Show(msg, "Permission Request", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.Yes); - - if (response == MessageBoxResult.Yes) - { - if (e.PermissionRequest.State == WebViewControlPermissionState.Defer) - { - WebView1.GetDeferredPermissionRequestById(e.PermissionRequest.Id)?.Allow(); - } - else - { - e.PermissionRequest.Allow(); - } - } - else - { - if (e.PermissionRequest.State == WebViewControlPermissionState.Defer) - { - WebView1.GetDeferredPermissionRequestById(e.PermissionRequest.Id)?.Deny(); - } - else - { - e.PermissionRequest.Deny(); - } - } - } - - private void WebView1_OnScriptNotify(object sender, WebViewControlScriptNotifyEventArgs e) - { - MessageBox.Show(e.Value, e.Uri?.ToString() ?? string.Empty); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.WebView/Microsoft.Toolkit.Sample.Wpf.WebView.csproj b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.WebView/Microsoft.Toolkit.Sample.Wpf.WebView.csproj deleted file mode 100644 index 1025518646c..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.WebView/Microsoft.Toolkit.Sample.Wpf.WebView.csproj +++ /dev/null @@ -1,40 +0,0 @@ - - - WinExe - net462 - app.manifest - {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Windows Community Toolkit Controls (Sample WebView for .NET WPF) - Sample Code for Windows Community Toolkit Controls - true - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.WebView/Properties/AssemblyInfo.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.WebView/Properties/AssemblyInfo.cs deleted file mode 100644 index 44a2ad2f75c..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.WebView/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Reflection; -using System.Windows; - - -//In order to begin building localizable applications, set -//CultureYouAreCodingWith in your .csproj file -//inside a . For example, if you are using US english -//in your source files, set the to en-US. Then uncomment -//the NeutralResourceLanguage attribute below. Update the "en-US" in -//the line below to match the UICulture setting in the project file. - -//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] - - -[assembly: ThemeInfo( - ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located - //(used if a resource is not found in the page, - // or application resource dictionaries) - ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located - //(used if a resource is not found in the page, - // app, or any theme specific resource dictionaries) -)] - diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.WebView/Properties/Resources.Designer.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.WebView/Properties/Resources.Designer.cs deleted file mode 100644 index df82d63d5f3..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.WebView/Properties/Resources.Designer.cs +++ /dev/null @@ -1,63 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Microsoft.Toolkit.Sample.Wpf.WebView.Properties { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.Toolkit.Sample.Wpf.WebView.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - } -} diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.WebView/Properties/Resources.resx b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.WebView/Properties/Resources.resx deleted file mode 100644 index af7dbebbace..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.WebView/Properties/Resources.resx +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.WebView/Properties/Settings.Designer.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.WebView/Properties/Settings.Designer.cs deleted file mode 100644 index 5d930d8f1b2..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.WebView/Properties/Settings.Designer.cs +++ /dev/null @@ -1,26 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Microsoft.Toolkit.Sample.Wpf.WebView.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.8.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - } -} diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.WebView/Properties/Settings.settings b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.WebView/Properties/Settings.settings deleted file mode 100644 index 033d7a5e9e2..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.WebView/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.WebView/app.manifest b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.WebView/app.manifest deleted file mode 100644 index 826a45a445e..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.WebView/app.manifest +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - PerMonitor - true/PM - - - - - - - \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.XamlHost/Microsoft.Toolkit.Sample.Wpf.XamlHost.csproj b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.XamlHost/Microsoft.Toolkit.Sample.Wpf.XamlHost.csproj deleted file mode 100644 index 604379d284f..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.XamlHost/Microsoft.Toolkit.Sample.Wpf.XamlHost.csproj +++ /dev/null @@ -1,34 +0,0 @@ - - - net462 - {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Windows Community Toolkit Controls (Sample Xaml Island Controls for .NET WPF) - Sample Code for Windows Community Toolkit Controls - true - - - full - - - pdbonly - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.XamlHost/Properties/AssemblyInfo.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.XamlHost/Properties/AssemblyInfo.cs deleted file mode 100644 index c5b31dbeda5..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.XamlHost/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,33 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Reflection; -using System.Resources; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Windows; - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -//In order to begin building localizable applications, set -//CultureYouAreCodingWith in your .csproj file -//inside a . For example, if you are using US english -//in your source files, set the to en-US. Then uncomment -//the NeutralResourceLanguage attribute below. Update the "en-US" in -//the line below to match the UICulture setting in the project file. - -//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] - - -[assembly:ThemeInfo( - ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located - //(used if a resource is not found in the page, - // or application resource dictionaries) - ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located - //(used if a resource is not found in the page, - // app, or any theme specific resource dictionaries) -)] diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.XamlHost/Properties/Resources.Designer.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.XamlHost/Properties/Resources.Designer.cs deleted file mode 100644 index 3bcf1c8e98c..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.XamlHost/Properties/Resources.Designer.cs +++ /dev/null @@ -1,63 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Microsoft.Toolkit.Sample.Wpf.XamlHost.Properties { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.Toolkit.Sample.Wpf.XamlHost.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - } -} diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.XamlHost/Properties/Resources.resx b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.XamlHost/Properties/Resources.resx deleted file mode 100644 index af7dbebbace..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.XamlHost/Properties/Resources.resx +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.XamlHost/Properties/Settings.Designer.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.XamlHost/Properties/Settings.Designer.cs deleted file mode 100644 index 1df6978a56a..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.XamlHost/Properties/Settings.Designer.cs +++ /dev/null @@ -1,26 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Microsoft.Toolkit.Sample.Wpf.XamlHost.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.8.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - } -} diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.XamlHost/Properties/Settings.settings b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.XamlHost/Properties/Settings.settings deleted file mode 100644 index 033d7a5e9e2..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.XamlHost/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.XamlHost/WrappedButton.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.XamlHost/WrappedButton.cs deleted file mode 100644 index bcd436845c1..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.XamlHost/WrappedButton.cs +++ /dev/null @@ -1,95 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.ComponentModel; -using System.Windows.Media; -using Microsoft.Toolkit.Win32.UI.XamlHost; -using Microsoft.Toolkit.Wpf.UI.XamlHost; - -namespace Microsoft.Toolkit.Sample.Wpf.XamlHost -{ - public class WrappedButton : WindowsXamlHostBase - { - - public WrappedButton() : base() - { - } - - protected override void OnInitialized(EventArgs e) - { - base.OnInitialized(e); - - this.ChildInternal = UWPTypeFactory.CreateXamlContentByType("Windows.UI.Xaml.Controls.Button"); - - // Make button expand to the size of its host control - global::Windows.UI.Xaml.FrameworkElement frameworkElement = this.ChildInternal as global::Windows.UI.Xaml.FrameworkElement; - frameworkElement.SizeChanged += FrameworkElement_SizeChanged; - frameworkElement.HorizontalAlignment = global::Windows.UI.Xaml.HorizontalAlignment.Stretch; - frameworkElement.VerticalAlignment = global::Windows.UI.Xaml.VerticalAlignment.Stretch; - - // Set DesktopWindowXamlSource - SetContent(); - - // Properties set in markup need to be re-applied in OnInitialized. - Background = background; - Content = content; - } - - private void FrameworkElement_SizeChanged(object sender, global::Windows.UI.Xaml.SizeChangedEventArgs e) - { - this.InvalidateMeasure(); - } - - private string background; - - [Category("UWP XAML Button")] - public string Background - { - set - { - background = value; - - // UWP XAML content is not created until base.OnInitialized - if (value != null && this.ChildInternal != null) - { - global::Windows.UI.Xaml.Controls.Button button = this.ChildInternal as global::Windows.UI.Xaml.Controls.Button; - - Color wpfColor = (Color)ColorConverter.ConvertFromString(value); - - button.Background = new global::Windows.UI.Xaml.Media.SolidColorBrush(ConvertWPFColorToUWPColor(wpfColor)); - } - - } - } - - [Category("UWP XAML Button")] - string content; - public string Content - { - get - { - return content; - } - set - { - content = value; - - // UWP XAML content is not created until base.OnInitialized - if (this.ChildInternal != null) - { - global::Windows.UI.Xaml.Controls.Button button = this.ChildInternal as global::Windows.UI.Xaml.Controls.Button; - - button.Content = value; - } - } - } - - private global::Windows.UI.Color ConvertWPFColorToUWPColor(Color wpfColor) - { - return global::Windows.UI.Color.FromArgb(wpfColor.A, wpfColor.R, wpfColor.G, wpfColor.B); - } - - } -} diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.XamlHost/WrappedRectangle.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.XamlHost/WrappedRectangle.cs deleted file mode 100644 index 47affd2f8bf..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Sample.Wpf.XamlHost/WrappedRectangle.cs +++ /dev/null @@ -1,63 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.ComponentModel; -using System.Windows.Media; -using Microsoft.Toolkit.Win32.UI.XamlHost; -using Microsoft.Toolkit.Wpf.UI.XamlHost; - -namespace Microsoft.Toolkit.Sample.Wpf.XamlHost -{ - public class WrappedRectangle : WindowsXamlHostBase - { - public WrappedRectangle() : base() - { - } - - protected override void OnInitialized(EventArgs e) - { - base.OnInitialized(e); - - // Rectangle's HorizontalAlignment and VerticalAlignment properties default to Stretch. - // The control will fill all space available in the DesktopWindowXamlSource window. - this.ChildInternal = UWPTypeFactory.CreateXamlContentByType("Windows.UI.Xaml.Shapes.Rectangle"); - - // Set DesktopWindowXamlSource - SetContent(); - - global::Windows.UI.Xaml.Shapes.Rectangle rectangle = this.ChildInternal as global::Windows.UI.Xaml.Shapes.Rectangle; - - // Properties set in markup need to be re-applied in OnInitialized - Fill = fill; - } - - private string fill; - - [Category("UWP XAML Rectangle")] - public string Fill - { - set - { - fill = value; - - // UWP XAML content is not created in base.OnInitialized - if (this.ChildInternal != null) - { - global::Windows.UI.Xaml.Shapes.Rectangle rectangle = this.ChildInternal as global::Windows.UI.Xaml.Shapes.Rectangle; - - Color wpfColor = (Color)ColorConverter.ConvertFromString(value); - - rectangle.Fill = new global::Windows.UI.Xaml.Media.SolidColorBrush(ConvertWPFColorToUWPColor(wpfColor)); - } - - } - } - - private global::Windows.UI.Color ConvertWPFColorToUWPColor(Color wpfColor) - { - return global::Windows.UI.Color.FromArgb(wpfColor.A, wpfColor.R, wpfColor.G, wpfColor.B); - } - } -} diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/GlobalSuppressions.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/GlobalSuppressions.cs deleted file mode 100644 index f5a03b225ce..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/GlobalSuppressions.cs +++ /dev/null @@ -1,62 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -// This file is used by Code Analysis to maintain SuppressMessage -// attributes that are applied to this project. -// Project-level suppressions either have no target or are given -// a specific target and scoped to a namespace, type, member, etc. -// -// To add a suppression to this file, right-click the message in the -// Code Analysis results, point to "Suppress Message", and click -// "In Suppression File". -// You do not need to add suppressions to this file manually. -#pragma warning disable SA1404 // Code analysis suppression must have justification -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "A", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#A")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "B", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#B")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "C", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#C")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "D", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#D")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "E", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#E")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "F", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#F")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "G", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#G")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "H", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#H")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "I", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#I")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "J", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#J")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "K", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#K")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "L", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#L")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "M", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#M")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "N", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#N")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "O", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#O")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "P", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#P")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Q", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#Q")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "R", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#R")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "S", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#S")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "T", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#T")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "U", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#U")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "V", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#V")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "W", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#W")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "X", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#X")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Y", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#Y")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Z", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#Z")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Thumbstick", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#GamepadLeftThumbstickButton")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Thumbstick", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#GamepadRightThumbstickButton")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Thumbstick", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#GamepadLeftThumbstickUp")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Thumbstick", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#GamepadLeftThumbstickDown")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Thumbstick", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#GamepadLeftThumbstickRight")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Thumbstick", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#GamepadLeftThumbstickLeft")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Thumbstick", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#GamepadRightThumbstickUp")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Thumbstick", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#GamepadRightThumbstickDown")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Thumbstick", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#GamepadRightThumbstickRight")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Thumbstick", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#GamepadRightThumbstickLeft")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Junja", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#Junja")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Geolocation", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.WebViewControlPermissionType.#Geolocation")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Unviewable", Scope = "type", Target = "Microsoft.Windows10.Web.Wrappers.WebViewControlUnviewableContentIdentifiedEventArgs")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Satisfiable", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.WebErrorStatus.#RequestedRangeNotSatisfiable")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1307:Accessible fields must begin with upper-case letter", Scope = "member", Target = "~F:Microsoft.Toolkit.Win32.UI.Controls.Interop.Win32.RECT.bottom")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1307:Accessible fields must begin with upper-case letter", Scope = "member", Target = "~F:Microsoft.Toolkit.Win32.UI.Controls.Interop.Win32.RECT.left")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1307:Accessible fields must begin with upper-case letter", Scope = "member", Target = "~F:Microsoft.Toolkit.Win32.UI.Controls.Interop.Win32.RECT.right")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1307:Accessible fields must begin with upper-case letter", Scope = "member", Target = "~F:Microsoft.Toolkit.Win32.UI.Controls.Interop.Win32.RECT.top")] - - - -#pragma warning restore SA1404 // Code analysis suppression must have justification \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/Win32/ExternDll.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/Win32/ExternDll.cs deleted file mode 100644 index f6e28ef660a..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/Win32/ExternDll.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.Win32 -{ - internal static class ExternDll - { - internal const string Kernel32 = "kernel32.dll"; - internal const string User32 = "user32.dll"; - internal const string Ntdll = "ntdll.dll"; - internal const string Gdi32 = "gdi32.dll"; - internal const string EdgeHtml = "edgehtml.dll"; - internal const string ShCore = "shcore.dll"; - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/Win32/Facility.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/Win32/Facility.cs deleted file mode 100644 index b099193f3bb..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/Win32/Facility.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.Win32 -{ - internal enum Facility - { - /// FACILITY_NULL - Null = 0, - - /// FACILITY_RPC - Rpc = 1, - - /// FACILITY_DISPATCH - Dispatch = 2, - - /// FACILITY_STORAGE - Storage = 3, - - /// FACILITY_ITF - Itf = 4, - - /// FACILITY_WIN32 - Win32 = 7, - - /// FACILITY_WINDOWS - Windows = 8, - - /// FACILITY_CONTROL - Control = 10, - - /// MSDN doced facility code for ESE errors. - Ese = 0xE5E, - - /// FACILITY_WINCODEC (WIC) - WinCodec = 0x898, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/Win32/HRESULT.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/Win32/HRESULT.cs deleted file mode 100644 index b355601bbae..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/Win32/HRESULT.cs +++ /dev/null @@ -1,359 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.ComponentModel; -using System.Diagnostics.CodeAnalysis; -using System.Globalization; -using System.Reflection; -using System.Runtime.InteropServices; -using System.Security; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.Win32 -{ - /// Wrapper for HRESULT status codes. - [StructLayout(LayoutKind.Explicit)] - internal struct HRESULT - { - [FieldOffset(0)] - private readonly uint _value; - - // NOTE: These public static field declarations are automatically - // picked up by ToString through reflection. - - /// S_OK - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "May only be used in DEBUG builds")] - public static readonly HRESULT S_OK = new HRESULT(0x00000000); - - /// S_FALSE - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "May only be used in DEBUG builds")] - public static readonly HRESULT S_FALSE = new HRESULT(0x00000001); - - /// E_PENDING - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "May only be used in DEBUG builds")] - public static readonly HRESULT E_PENDING = new HRESULT(0x8000000A); - - /// E_NOTIMPL - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "May only be used in DEBUG builds")] - public static readonly HRESULT E_NOTIMPL = new HRESULT(0x80004001); - - /// E_NOINTERFACE - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "May only be used in DEBUG builds")] - public static readonly HRESULT E_NOINTERFACE = new HRESULT(0x80004002); - - /// E_POINTER - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "May only be used in DEBUG builds")] - public static readonly HRESULT E_POINTER = new HRESULT(0x80004003); - - /// E_ABORT - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "May only be used in DEBUG builds")] - public static readonly HRESULT E_ABORT = new HRESULT(0x80004004); - - /// E_FAIL - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "May only be used in DEBUG builds")] - public static readonly HRESULT E_FAIL = new HRESULT(0x80004005); - - /// E_UNEXPECTED - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "May only be used in DEBUG builds")] - public static readonly HRESULT E_UNEXPECTED = new HRESULT(0x8000FFFF); - - /// STG_E_INVALIDFUNCTION - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "May only be used in DEBUG builds")] - public static readonly HRESULT STG_E_INVALIDFUNCTION = new HRESULT(0x80030001); - - /// REGDB_E_CLASSNOTREG - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "May only be used in DEBUG builds")] - public static readonly HRESULT REGDB_E_CLASSNOTREG = new HRESULT(0x80040154); - - /// DESTS_E_NO_MATCHING_ASSOC_HANDLER. Win7 internal error code for Jump Lists. - /// There is no Assoc Handler for the given item registered by the specified application. - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "May only be used in DEBUG builds")] - public static readonly HRESULT DESTS_E_NO_MATCHING_ASSOC_HANDLER = new HRESULT(0x80040F03); - - /// DESTS_E_NORECDOCS. Win7 internal error code for Jump Lists. - /// The given item is excluded from the recent docs folder by the NoRecDocs bit on its registration. - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "May only be used in DEBUG builds")] - public static readonly HRESULT DESTS_E_NORECDOCS = new HRESULT(0x80040F04); - - /// DESTS_E_NOTALLCLEARED. Win7 internal error code for Jump Lists. - /// Not all of the items were successfully cleared - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "May only be used in DEBUG builds")] - public static readonly HRESULT DESTS_E_NOTALLCLEARED = new HRESULT(0x80040F05); - - /// E_ACCESSDENIED - /// Win32Error ERROR_ACCESS_DENIED. - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "May only be used in DEBUG builds")] - public static readonly HRESULT E_ACCESSDENIED = new HRESULT(0x80070005); - - /// E_OUTOFMEMORY - /// Win32Error ERROR_OUTOFMEMORY. - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "May only be used in DEBUG builds")] - public static readonly HRESULT E_OUTOFMEMORY = new HRESULT(0x8007000E); - - /// E_INVALIDARG - /// Win32Error ERROR_INVALID_PARAMETER. - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "May only be used in DEBUG builds")] - public static readonly HRESULT E_INVALIDARG = new HRESULT(0x80070057); - - /// INTSAFE_E_ARITHMETIC_OVERFLOW - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "May only be used in DEBUG builds")] - public static readonly HRESULT INTSAFE_E_ARITHMETIC_OVERFLOW = new HRESULT(0x80070216); - - /// COR_E_OBJECTDISPOSED - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "May only be used in DEBUG builds")] - public static readonly HRESULT COR_E_OBJECTDISPOSED = new HRESULT(0x80131622); - - /// WC_E_GREATERTHAN - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "May only be used in DEBUG builds")] - public static readonly HRESULT WC_E_GREATERTHAN = new HRESULT(0xC00CEE23); - - /// WC_E_SYNTAX - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "May only be used in DEBUG builds")] - public static readonly HRESULT WC_E_SYNTAX = new HRESULT(0xC00CEE2D); - - /// - /// Initializes a new instance of the struct. - /// - /// containing HRESULT. - public HRESULT(uint i) - { - _value = i; - } - - public static HRESULT Make(bool severe, Facility facility, int code) - { - // #define MAKE_HRESULT(sev,fac,code) \ - // ((HRESULT) (((unsigned long)(sev)<<31) | ((unsigned long)(fac)<<16) | ((unsigned long)(code))) ) - - // Severity has 1 bit reserved. - // bitness is enforced by the boolean parameter. - - // Facility has 11 bits reserved (different than SCODES, which have 4 bits reserved) - // MSDN documentation incorrectly uses 12 bits for the ESE facility (e5e), so go ahead and let that one slide. - // And WIC also ignores it the documented size... - Verify.Implies((int)facility != (int)((int)facility & 0x1FF), facility == Facility.Ese || facility == Facility.WinCodec); - - // Code has 4 bits reserved. - Verify.AreEqual(code, code & 0xFFFF); - - return new HRESULT((uint)((severe ? 1 << 31 : 0) | ((int)facility << 16) | code)); - } - - /// - /// Gets HRESULT_FACILITY - /// - public Facility Facility - { - get - { - return GetFacility((int)_value); - } - } - - public static Facility GetFacility(int errorCode) - { - // #define HRESULT_FACILITY(hr) (((hr) >> 16) & 0x1fff) - return (Facility)((errorCode >> 16) & 0x1fff); - } - - /// - /// Gets HRESULT_CODE - /// - public int Code - { - get - { - return GetCode((int)_value); - } - } - - public static int GetCode(int error) - { - // #define HRESULT_CODE(hr) ((hr) & 0xFFFF) - return (int)(error & 0xFFFF); - } - - /// - /// Get a string representation of this HRESULT. - /// - /// Name of HRESULT - public override string ToString() - { - // Use reflection to try to name this HRESULT. - // This is expensive, but if someone's ever printing HRESULT strings then - // I think it's a fair guess that they're not in a performance critical area - // (e.g. printing exception strings). - // This is less error prone than trying to keep the list in the function. - // To properly add an HRESULT's name to the ToString table, just add the HRESULT - // like all the others above. - // - // CONSIDER: This data is static. It could be cached - // after first usage for fast lookup since the keys are unique. - foreach (var publicStaticField in typeof(HRESULT).GetFields(BindingFlags.Static | BindingFlags.Public)) - { - if (publicStaticField.FieldType == typeof(HRESULT)) - { - var hr = (HRESULT)publicStaticField.GetValue(null); - if (hr == this) - { - return publicStaticField.Name; - } - } - } - - // Try Win32 error codes also - if (Facility == Facility.Win32) - { - foreach (var publicStaticField in typeof(Win32Error).GetFields(BindingFlags.Static | BindingFlags.Public)) - { - if (publicStaticField.FieldType == typeof(Win32Error)) - { - var error = (Win32Error)publicStaticField.GetValue(null); - if ((HRESULT)error == this) - { - return "HRESULT_FROM_WIN32(" + publicStaticField.Name + ")"; - } - } - } - } - - // If there's no good name for this HRESULT, - // return the string as readable hex (0x########) format. - return string.Format(CultureInfo.InvariantCulture, "0x{0:X8}", _value); - } - - public override bool Equals(object obj) - { - try - { - return ((HRESULT)obj)._value == _value; - } - catch (InvalidCastException) - { - return false; - } - } - - public override int GetHashCode() - { - return _value.GetHashCode(); - } - - public static bool operator ==(HRESULT hrLeft, HRESULT hrRight) - { - return hrLeft._value == hrRight._value; - } - - public static bool operator !=(HRESULT hrLeft, HRESULT hrRight) - { - return !(hrLeft == hrRight); - } - - public bool Succeeded - { - get { return (int)_value >= 0; } - } - - public bool Failed - { - get { return (int)_value < 0; } - } - - /// - /// Convert the result of Win32 GetLastError() into a raised exception. - /// - [SecurityCritical] - public static void ThrowLastError() - { - ((HRESULT)Win32Error.GetLastError()).ThrowIfFailed(); - - // Only expecting to call this when we're expecting a failed GetLastError() - Verify.Fail(); - } - - // Critical: P-Invoke - [SecurityCritical] - [SuppressMessage( - "Microsoft.Usage", - "CA2201:DoNotRaiseReservedExceptionTypes", - Justification = "Only recreating Exceptions that were already raised.")] - [SuppressMessage( - "Microsoft.Globalization", - "CA1303:DoNotPassLiteralsAsLocalizedParameters", - Justification ="For DEBUG only")] - public void ThrowIfFailed(string message = null) - { - if (Failed) - { - if (string.IsNullOrEmpty(message)) - { - message = ToString(); - } -#if DEBUG - else - { - message += " (" + ToString() + ")"; - } -#endif - - // Wow. Reflection in a throw call. Later on this may turn out to have been a bad idea. - // If you're throwing an exception I assume it's OK for me to take some time to give it back. - // I want to convert the HRESULT to a more appropriate exception type than COMException. - // Marshal.ThrowExceptionForHR does this for me, but the general call uses GetErrorInfo - // if it's set, and then ignores the HRESULT that I've provided. This makes it so this - // call works the first time but you get burned on the second. To avoid this, I use - // the overload that explicitly ignores the IErrorInfo. - // In addition, the function doesn't allow me to set the Message unless I go through - // the process of implementing an IErrorInfo and then use that. There's no stock - // implementations of IErrorInfo available and I don't think it's worth the maintenance - // overhead of doing it, nor would it have significant value over this approach. - var e = NativeMethods.GetExceptionForHR((int)_value); - Verify.IsNotNull(e); - - // ArgumentNullException doesn't have the right constructor parameters, - // (nor does Win32Exception...) - // but E_POINTER gets mapped to NullReferenceException, - // so I don't think it will ever matter. - Verify.IsFalse(e is ArgumentNullException); - - // If we're not getting anything better than a COMException from Marshal, - // then at least check the facility and attempt to do better ourselves. - if (e.GetType() == typeof(COMException)) - { - switch (Facility) - { - case Facility.Win32: - e = CreateWin32Exception(Code, message); - break; - - default: - e = new COMException(message, (int)_value); - break; - } - } - else - { - var cons = e.GetType().GetConstructor(new[] { typeof(string) }); - if (cons != null) - { - e = cons.Invoke(new object[] { message }) as Exception; - Verify.IsNotNull(e); - } - } - - throw e; - } - } - - [SecuritySafeCritical] - [SuppressMessage( - "Microsoft.Security", - "CA2136:TransparencyAnnotationsShouldNotConflict", - Justification = "Calls safe overload of Win32Exception ctor that explicitly sets the error code and message.")] - private static Exception CreateWin32Exception(int code, string message) - { - return new Win32Exception(code, message); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/Win32/NativeMethods.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/Win32/NativeMethods.cs deleted file mode 100644 index 567a37ee95c..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/Win32/NativeMethods.cs +++ /dev/null @@ -1,226 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Diagnostics.CodeAnalysis; -using System.Runtime.InteropServices; -using System.Runtime.Versioning; -using System.Security; -using System.Text; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.Win32 -{ - // Some native methods are shimmed through public versions that handle converting failures into thrown exceptions. - internal static class NativeMethods - { - public const int LOGPIXELSX = 88; - public const int LOGPIXELSY = 90; - - public const int DPI_AWARENESS_CONTEXT_UNAWARE = -1; - public const int DPI_AWARENESS_CONTEXT_SYSTEM_AWARE = -2; - public const int DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE = -3; - public const int DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 = -4; - -#pragma warning disable SA1401 // Fields must be private - public static HandleRef NullHandleRef = new HandleRef(null, IntPtr.Zero); -#pragma warning restore SA1401 // Fields must be private - - // Critical: P-Invoke - // Available in Windows 10 version RS1 and above. - [SecurityCritical] - [DllImport(ExternDll.User32)] - [ResourceExposure(ResourceScope.None)] - public static extern bool AreDpiAwarenessContextsEqual(int dpiContextA, int dpiContextB); - - // Critical: P-Invoke - // Available in Windows 10 version RS1 and above. - [SecurityCritical] - [DllImport(ExternDll.User32)] - [ResourceExposure(ResourceScope.None)] - public static extern int GetThreadDpiAwarenessContext(); - - // Critical: P-Invoke - // for Windows 10 version RS2 and above - [SecurityCritical] - [DllImport(ExternDll.User32, SetLastError = true)] - [ResourceExposure(ResourceScope.None)] - public static extern bool SetProcessDpiAwarenessContext(int dpiFlag); - - [SecurityCritical] - [DllImport(ExternDll.User32, ExactSpelling = true, CharSet = CharSet.Auto)] - public static extern bool IsChild(HandleRef parent, HandleRef child); - - [SecurityCritical] - [DllImport(ExternDll.Ntdll, SetLastError = true, EntryPoint = "RtlGetVersion")] - private static extern bool _RtlGetVersion(ref OSVERSIONINFOEX versionInfo); - - [SecurityCritical] - public static OSVERSIONINFOEX RtlGetVersion() - { - var osVersionInfo = new OSVERSIONINFOEX { OSVersionInfoSize = Marshal.SizeOf(typeof(OSVERSIONINFOEX)) }; - _RtlGetVersion(ref osVersionInfo); - var err = Win32Error.GetLastError(); - if (!err.Equals(Win32Error.ERROR_SUCCESS)) - { - if (osVersionInfo.MajorVersion == 0) - { - err.ToHRESULT().ThrowIfFailed(); - } - } - - return osVersionInfo; - } - - // Enables the mouse to act as a pointer input device and send WM_POINTER messages. - [SecurityCritical] // P-Invokes - [DllImport(ExternDll.User32, SetLastError = true, EntryPoint = "EnableMouseInPointer")] - [return: MarshalAs(UnmanagedType.Bool)] - private static extern bool _EnableMouseInPointer(bool fEnable); - - [SecurityCritical] - public static bool EnableMouseInPointer(bool enable) - { - // NOTE: This is available on Windows 8 or later only - var ret = _EnableMouseInPointer(enable); - if (!ret) - { - HRESULT.ThrowLastError(); - } - - return ret; - } - - // Critical: This calls into Marshal.GetExceptionForHR which is critical - // it populates the exception object from data stored in a per thread IErrorInfo - // the IErrorInfo may have security sensitive information like file paths stored in it - // TreatAsSafe: Uses overload of GetExceptionForHR that omits IErrorInfo information from exception message - [SecuritySafeCritical] - internal static Exception GetExceptionForHR(int hr) - { - return Marshal.GetExceptionForHR(hr, new IntPtr(-1)); - } - - // Critical : P-Invokes - [SecurityCritical] - [DllImport(ExternDll.User32, SetLastError = true, CharSet = CharSet.Unicode, EntryPoint = "CreateWindowExW")] - private static extern IntPtr _CreateWindowEx( - WS_EX dwExStyle, - [MarshalAs(UnmanagedType.LPWStr)] string lpClassName, - [MarshalAs(UnmanagedType.LPWStr)] string lpWindowName, - WS dwStyle, - int x, - int y, - int nWidth, - int nHeight, - IntPtr hWndParent, - IntPtr hMenu, - IntPtr hInstance, - IntPtr lpParam); - - // Critical : Calls critical method - [SecurityCritical] - public static IntPtr CreateWindowEx( - WS_EX dwExStyle, - string lpClassName, - string lpWindowName, - WS dwStyle, - int x, - int y, - int nWidth, - int nHeight, - IntPtr hWndParent, - IntPtr hMenu, - IntPtr hInstance, - IntPtr lpParam) - { - var ret = _CreateWindowEx(dwExStyle, lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam); - if (ret == IntPtr.Zero) - { - HRESULT.ThrowLastError(); - } - - return ret; - } - - // Critical : Calls critical method - [SecurityCritical] - public static IntPtr CreateWindow(string className, WS styles, int x, int y, int width, int height, IntPtr parentWindow) - { - return CreateWindowEx( - 0, - className, - string.Empty, - styles, - x, - y, - width, - height, - parentWindow, - IntPtr.Zero, - Marshal.GetHINSTANCE(typeof(NativeMethods).Module), - IntPtr.Zero); - } - - // Critical : P-Invokes - [SecurityCritical] - [DllImport(ExternDll.User32, SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool DestroyWindow(IntPtr hwnd); - - // Critical : P-Invokes - [SecurityCritical] - [DllImport(ExternDll.User32)] - [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool IsWindow(IntPtr hwnd); - - // Critical : P-Invokes - [SecurityCritical] - [DllImport(ExternDll.Kernel32, EntryPoint = "GetModuleFileName", CharSet = CharSet.Unicode, SetLastError = true)] - private static extern int _GetModuleFileName(IntPtr hModule, StringBuilder lpFilename, int nSize); - - // Critical : Calls critical method - [SecurityCritical] - public static string GetModuleFileName(IntPtr hModule) - { - var buffer = new StringBuilder((int)Win32Value.MAX_PATH); - while (true) - { - var size = _GetModuleFileName(hModule, buffer, buffer.Capacity); - if (size == 0) - { - HRESULT.ThrowLastError(); - } - - // GetModuleFileName returns nSize when it's truncated but does NOT set the last error. - // MSDN documentation says this has changed in Windows 2000+. - if (size == buffer.Capacity) - { - // Enlarge the buffer and try again. - buffer.EnsureCapacity(buffer.Capacity * 2); - continue; - } - - return buffer.ToString(); - } - } - - // Critical : P-Invokes - [SecurityCritical] - [DllImport(ExternDll.Kernel32, EntryPoint = "GetModuleHandleW", CharSet = CharSet.Unicode, SetLastError = true)] - private static extern IntPtr _GetModuleHandle([MarshalAs(UnmanagedType.LPWStr)] string lpModuleName); - - // Critical : Calls critical method - [SecurityCritical] - public static IntPtr GetModuleHandle(string lpModuleName) - { - var retPtr = _GetModuleHandle(lpModuleName); - if (retPtr == IntPtr.Zero) - { - HRESULT.ThrowLastError(); - } - - return retPtr; - } - } -} diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/Win32/OSVERSIONINFOEX.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/Win32/OSVERSIONINFOEX.cs deleted file mode 100644 index d91516028aa..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/Win32/OSVERSIONINFOEX.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Runtime.InteropServices; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.Win32 -{ - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] - internal struct OSVERSIONINFOEX - { - // The OSVersionInfoSize field must be set to Marshal.SizeOf(typeof(OSVERSIONINFOEX)) - internal int OSVersionInfoSize; - internal int MajorVersion; - internal int MinorVersion; - internal int BuildNumber; - internal int PlatformId; - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] - internal string CSDVersion; - internal ushort ServicePackMajor; - internal ushort ServicePackMinor; - internal short SuiteMask; - internal ProductType ProductType; - internal byte Reserved; - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/Win32/PROCESS_DPI_AWARENESS.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/Win32/PROCESS_DPI_AWARENESS.cs deleted file mode 100644 index e983d36a547..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/Win32/PROCESS_DPI_AWARENESS.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.Win32 -{ - /// - /// Identifies dots per inch (dpi) awareness values. - /// - internal enum PROCESS_DPI_AWARENESS - { - PROCESS_DPI_UNINITIALIZED = -1, - - /// - /// DPI unaware. This app does not scale for DPI changes and is always assumed to have a scale factor of 100% (96 DPI). It will be automatically scaled by the system on any other DPI setting. - /// - PROCESS_DPI_UNAWARE = 0, - - /// - /// System DPI aware. This app does not scale for DPI changes. It will query for the DPI once and use that value for the lifetime of the app. If the DPI changes, the app will not adjust to the new DPI value. It will be automatically scaled up or down by the system when the DPI changes from the system value. - /// - PROCESS_SYSTEM_DPI_AWARE = 1, - - /// - /// Per monitor DPI aware. This app checks for the DPI when it is created and adjusts the scale factor whenever the DPI changes. These applications are not automatically scaled by the system. - /// - PROCESS_PER_MONITOR_DPI_AWARE = 2 - } -} diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/Win32/ProductType.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/Win32/ProductType.cs deleted file mode 100644 index 24740f3631e..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/Win32/ProductType.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.Win32 -{ - internal enum ProductType : byte - { - /// - /// The operating system is Windows 10, Windows 8, Windows 7, Windows Vista, Windows XP Professional, Windows XP Home Edition, or Windows 2000 Professional - /// - VER_NT_WORKSTATION = 0x0000001, - - /// - /// The system is a domain controller and the operating system is Windows Server 2016, Windows Server 2012, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, or Windows 2000 Server - /// - VER_NT_DOMAIN_CONTROLLER = 0x0000002, - - /// - /// The operating system is Windows Server 2016, Windows Server 2012, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, or Windows 2000 Server. - /// - /// - /// Note that a server that is also a domain controller is reported as , not - /// - VER_NT_SERVER = 0x0000003 - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/Win32/RECT.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/Win32/RECT.cs deleted file mode 100644 index 2fae05ed924..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/Win32/RECT.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Drawing; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.Win32 -{ - internal struct RECT - { - public int bottom; - public int left; - public int right; - public int top; - - public RECT(int left, int top, int right, int bottom) - { - this.left = left; - this.top = top; - this.right = right; - this.bottom = bottom; - } - - public RECT(Rectangle r) - { - this.left = r.Left; - this.top = r.Top; - this.right = r.Right; - this.bottom = r.Bottom; - } - - public Size Size - { - get - { - return new Size(this.right - this.left, this.bottom - this.top); - } - } - - public static RECT FromXYWH(int x, int y, int width, int height) - { - return new RECT(x, y, x + width, y + height); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/Win32/UnsafeNativeMethods.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/Win32/UnsafeNativeMethods.cs deleted file mode 100644 index 4fccba1f402..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/Win32/UnsafeNativeMethods.cs +++ /dev/null @@ -1,61 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.ComponentModel; -using System.Runtime.InteropServices; -using System.Security; -using System.Text; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.Win32 -{ - internal static class UnsafeNativeMethods - { - // Critical: P-Invokes - - // Critical: This code elevates to unmanaged code permission - [SecurityCritical] - [SuppressUnmanagedCodeSecurity] - [DllImport(ExternDll.Kernel32, EntryPoint = "GetModuleFileName", CharSet = CharSet.Unicode, SetLastError = true)] - private static extern int IntGetModuleFileName(HandleRef hModule, StringBuilder buffer, int length); - - // Critical: This code elevates to unmanaged code permission by calling into IntGetModuleFileName - [SecurityCritical] - internal static string GetModuleFileName(HandleRef hModule) - { - // .Net is currently far behind Windows with regard to supporting paths longer than MAX_PATH. - // At one point it was tested trying to load UNC paths longer than MAX_PATH and mscorlib threw - // FileIOExceptions before WPF was even on the stack. - // All the same, we still want to have this grow-and-retry logic because the CLR can be hosted - // in a native application. Callers bothering to use this rather than Assembly based reflection - // are likely doing so because of (at least the potential for) the returned name referring to a - // native module. - var buffer = new StringBuilder((int)Win32Value.MAX_PATH); - while (true) - { - var size = IntGetModuleFileName(hModule, buffer, buffer.Capacity); - if (size == 0) - { - throw new Win32Exception(); - } - - // GetModuleFileName returns nSize when it's truncated but does NOT set the last error. - // MSDN documentation says this has changed in Windows 2000+. - if (size == buffer.Capacity) - { - // Enlarge the buffer and try again. - buffer.EnsureCapacity(buffer.Capacity * 2); - continue; - } - - return buffer.ToString(); - } - } - - // Critical: P-Invokes - [SecurityCritical] - [DllImport(ExternDll.User32, ExactSpelling = true, CharSet = CharSet.Auto)] - public static extern IntPtr GetFocus(); - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/Win32/WM.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/Win32/WM.cs deleted file mode 100644 index 8beccd7a76f..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/Win32/WM.cs +++ /dev/null @@ -1,168 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.Win32 -{ - /// - /// Window message values, WM_* - /// - internal enum WM - { - NULL = 0x0000, - CREATE = 0x0001, - DESTROY = 0x0002, - MOVE = 0x0003, - SIZE = 0x0005, - ACTIVATE = 0x0006, - SETFOCUS = 0x0007, - KILLFOCUS = 0x0008, - ENABLE = 0x000A, - SETREDRAW = 0x000B, - SETTEXT = 0x000C, - GETTEXT = 0x000D, - GETTEXTLENGTH = 0x000E, - PAINT = 0x000F, - CLOSE = 0x0010, - QUERYENDSESSION = 0x0011, - QUIT = 0x0012, - QUERYOPEN = 0x0013, - ERASEBKGND = 0x0014, - SYSCOLORCHANGE = 0x0015, - SHOWWINDOW = 0x0018, - CTLCOLOR = 0x0019, - WININICHANGE = 0x001A, - SETTINGCHANGE = 0x001A, - ACTIVATEAPP = 0x001C, - SETCURSOR = 0x0020, - MOUSEACTIVATE = 0x0021, - CHILDACTIVATE = 0x0022, - QUEUESYNC = 0x0023, - GETMINMAXINFO = 0x0024, - - WINDOWPOSCHANGING = 0x0046, - WINDOWPOSCHANGED = 0x0047, - - CONTEXTMENU = 0x007B, - STYLECHANGING = 0x007C, - STYLECHANGED = 0x007D, - DISPLAYCHANGE = 0x007E, - GETICON = 0x007F, - SETICON = 0x0080, - NCCREATE = 0x0081, - NCDESTROY = 0x0082, - NCCALCSIZE = 0x0083, - NCHITTEST = 0x0084, - NCPAINT = 0x0085, - NCACTIVATE = 0x0086, - GETDLGCODE = 0x0087, - SYNCPAINT = 0x0088, - NCMOUSEMOVE = 0x00A0, - NCLBUTTONDOWN = 0x00A1, - NCLBUTTONUP = 0x00A2, - NCLBUTTONDBLCLK = 0x00A3, - NCRBUTTONDOWN = 0x00A4, - NCRBUTTONUP = 0x00A5, - NCRBUTTONDBLCLK = 0x00A6, - NCMBUTTONDOWN = 0x00A7, - NCMBUTTONUP = 0x00A8, - NCMBUTTONDBLCLK = 0x00A9, - - KEYDOWN = 0x0100, - KEYUP = 0x0101, - CHAR = 0x0102, - - SYSKEYDOWN = 0x0104, - SYSKEYUP = 0x0105, - SYSCHAR = 0x0106, - SYSDEADCHAR = 0x0107, - COMMAND = 0x0111, - SYSCOMMAND = 0x0112, - - MOUSEMOVE = 0x0200, - LBUTTONDOWN = 0x0201, - LBUTTONUP = 0x0202, - LBUTTONDBLCLK = 0x0203, - RBUTTONDOWN = 0x0204, - RBUTTONUP = 0x0205, - RBUTTONDBLCLK = 0x0206, - MBUTTONDOWN = 0x0207, - MBUTTONUP = 0x0208, - MBUTTONDBLCLK = 0x0209, - MOUSEWHEEL = 0x020A, - XBUTTONDOWN = 0x020B, - XBUTTONUP = 0x020C, - XBUTTONDBLCLK = 0x020D, - MOUSEHWHEEL = 0x020E, - PARENTNOTIFY = 0x0210, - - CAPTURECHANGED = 0x0215, - POWERBROADCAST = 0x0218, - DEVICECHANGE = 0x0219, - - ENTERSIZEMOVE = 0x0231, - EXITSIZEMOVE = 0x0232, - - IME_SETCONTEXT = 0x0281, - IME_NOTIFY = 0x0282, - IME_CONTROL = 0x0283, - IME_COMPOSITIONFULL = 0x0284, - IME_SELECT = 0x0285, - IME_CHAR = 0x0286, - IME_REQUEST = 0x0288, - IME_KEYDOWN = 0x0290, - IME_KEYUP = 0x0291, - - NCMOUSELEAVE = 0x02A2, - - TABLET_DEFBASE = 0x02C0, - - // WM_TABLET_MAXOFFSET = 0x20, - TABLET_ADDED = TABLET_DEFBASE + 8, - TABLET_DELETED = TABLET_DEFBASE + 9, - TABLET_FLICK = TABLET_DEFBASE + 11, - TABLET_QUERYSYSTEMGESTURESTATUS = TABLET_DEFBASE + 12, - - DPICHANGED_AFTERPARENT = 0x02E3, - - CUT = 0x0300, - COPY = 0x0301, - PASTE = 0x0302, - CLEAR = 0x0303, - UNDO = 0x0304, - RENDERFORMAT = 0x0305, - RENDERALLFORMATS = 0x0306, - DESTROYCLIPBOARD = 0x0307, - DRAWCLIPBOARD = 0x0308, - PAINTCLIPBOARD = 0x0309, - VSCROLLCLIPBOARD = 0x030A, - SIZECLIPBOARD = 0x030B, - ASKCBFORMATNAME = 0x030C, - CHANGECBCHAIN = 0x030D, - HSCROLLCLIPBOARD = 0x030E, - QUERYNEWPALETTE = 0x030F, - PALETTEISCHANGING = 0x0310, - PALETTECHANGED = 0x0311, - HOTKEY = 0x0312, - PRINT = 0x0317, - PRINTCLIENT = 0x0318, - APPCOMMAND = 0x0319, - THEMECHANGED = 0x031A, - - DWMCOMPOSITIONCHANGED = 0x031E, - DWMNCRENDERINGCHANGED = 0x031F, - DWMCOLORIZATIONCOLORCHANGED = 0x0320, - DWMWINDOWMAXIMIZEDCHANGE = 0x0321, - - GETTITLEBARINFOEX = 0x033F, - DWMSENDICONICTHUMBNAIL = 0x0323, - DWMSENDICONICLIVEPREVIEWBITMAP = 0x0326, - - USER = 0x0400, - - // This is the hard-coded message value used by WinForms for Shell_NotifyIcon. - // It's relatively safe to reuse. - TRAYMOUSEMESSAGE = 0x800, // WM_USER + 1024 - APP = 0x8000, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/Win32/WS.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/Win32/WS.cs deleted file mode 100644 index a4842a65700..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/Win32/WS.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.Win32 -{ - /// - /// WindowStyle values, WS_* - /// - [Flags] - internal enum WS : uint - { - OVERLAPPED = 0x00000000, - POPUP = 0x80000000, - CHILD = 0x40000000, - MINIMIZE = 0x20000000, - VISIBLE = 0x10000000, - DISABLED = 0x08000000, - CLIPSIBLINGS = 0x04000000, - CLIPCHILDREN = 0x02000000, - MAXIMIZE = 0x01000000, - BORDER = 0x00800000, - DLGFRAME = 0x00400000, - VSCROLL = 0x00200000, - HSCROLL = 0x00100000, - SYSMENU = 0x00080000, - THICKFRAME = 0x00040000, - GROUP = 0x00020000, - TABSTOP = 0x00010000, - - MINIMIZEBOX = 0x00020000, - MAXIMIZEBOX = 0x00010000, - - CAPTION = BORDER | DLGFRAME, - TILED = OVERLAPPED, - ICONIC = MINIMIZE, - SIZEBOX = THICKFRAME, - TILEDWINDOW = OVERLAPPEDWINDOW, - - OVERLAPPEDWINDOW = OVERLAPPED | CAPTION | SYSMENU | THICKFRAME | MINIMIZEBOX | MAXIMIZEBOX, - POPUPWINDOW = POPUP | BORDER | SYSMENU, - CHILDWINDOW = CHILD, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/Win32/WS_EX.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/Win32/WS_EX.cs deleted file mode 100644 index 6bcdb55e865..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/Win32/WS_EX.cs +++ /dev/null @@ -1,43 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.Win32 -{ - /// - /// Window style extended values, WS_EX_* - /// - [Flags] - internal enum WS_EX : uint - { - None = 0, - DLGMODALFRAME = 0x00000001, - NOPARENTNOTIFY = 0x00000004, - TOPMOST = 0x00000008, - ACCEPTFILES = 0x00000010, - TRANSPARENT = 0x00000020, - MDICHILD = 0x00000040, - TOOLWINDOW = 0x00000080, - WINDOWEDGE = 0x00000100, - CLIENTEDGE = 0x00000200, - CONTEXTHELP = 0x00000400, - RIGHT = 0x00001000, - LEFT = 0x00000000, - RTLREADING = 0x00002000, - LTRREADING = 0x00000000, - LEFTSCROLLBAR = 0x00004000, - RIGHTSCROLLBAR = 0x00000000, - CONTROLPARENT = 0x00010000, - STATICEDGE = 0x00020000, - APPWINDOW = 0x00040000, - LAYERED = 0x00080000, - NOINHERITLAYOUT = 0x00100000, // Disable inheritance of mirroring by children - LAYOUTRTL = 0x00400000, // Right to left mirroring - COMPOSITED = 0x02000000, - NOACTIVATE = 0x08000000, - OVERLAPPEDWINDOW = WINDOWEDGE | CLIENTEDGE, - PALETTEWINDOW = WINDOWEDGE | TOOLWINDOW | TOPMOST, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/Win32/Win32Error.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/Win32/Win32Error.cs deleted file mode 100644 index 6e75a6384bb..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/Win32/Win32Error.cs +++ /dev/null @@ -1,188 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Diagnostics.CodeAnalysis; -using System.Runtime.InteropServices; -using System.Security; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.Win32 -{ - /// - /// Wrapper for common Win32 status codes. - /// - [StructLayout(LayoutKind.Explicit)] - internal struct Win32Error - { - [FieldOffset(0)] - private readonly int _value; - - // NOTE: These public static field declarations are automatically - // picked up by (HRESULT's) ToString through reflection. - - /// The operation completed successfully. - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "May be used in DEBUG")] - public static readonly Win32Error ERROR_SUCCESS = new Win32Error(0); - - /// Incorrect function. - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "May be used in DEBUG")] - public static readonly Win32Error ERROR_INVALID_FUNCTION = new Win32Error(1); - - /// The system cannot find the file specified. - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "May be used in DEBUG")] - public static readonly Win32Error ERROR_FILE_NOT_FOUND = new Win32Error(2); - - /// The system cannot find the path specified. - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "May be used in DEBUG")] - public static readonly Win32Error ERROR_PATH_NOT_FOUND = new Win32Error(3); - - /// The system cannot open the file. - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "May be used in DEBUG")] - public static readonly Win32Error ERROR_TOO_MANY_OPEN_FILES = new Win32Error(4); - - /// Access is denied. - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "May be used in DEBUG")] - public static readonly Win32Error ERROR_ACCESS_DENIED = new Win32Error(5); - - /// The handle is invalid. - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "May be used in DEBUG")] - public static readonly Win32Error ERROR_INVALID_HANDLE = new Win32Error(6); - - /// Not enough storage is available to complete this operation. - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "May be used in DEBUG")] - public static readonly Win32Error ERROR_OUTOFMEMORY = new Win32Error(14); - - /// There are no more files. - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "May be used in DEBUG")] - public static readonly Win32Error ERROR_NO_MORE_FILES = new Win32Error(18); - - /// The process cannot access the file because it is being used by another process. - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "May be used in DEBUG")] - public static readonly Win32Error ERROR_SHARING_VIOLATION = new Win32Error(32); - - /// The parameter is incorrect. - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "May be used in DEBUG")] - public static readonly Win32Error ERROR_INVALID_PARAMETER = new Win32Error(87); - - /// The data area passed to a system call is too small. - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "May be used in DEBUG")] - public static readonly Win32Error ERROR_INSUFFICIENT_BUFFER = new Win32Error(122); - - /// Cannot nest calls to LoadModule. - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "May be used in DEBUG")] - public static readonly Win32Error ERROR_NESTING_NOT_ALLOWED = new Win32Error(215); - - /// Illegal operation attempted on a registry key that has been marked for deletion. - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "May be used in DEBUG")] - public static readonly Win32Error ERROR_KEY_DELETED = new Win32Error(1018); - - /// Element not found. - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "May be used in DEBUG")] - public static readonly Win32Error ERROR_NOT_FOUND = new Win32Error(1168); - - /// There was no match for the specified key in the index. - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "May be used in DEBUG")] - public static readonly Win32Error ERROR_NO_MATCH = new Win32Error(1169); - - /// An invalid device was specified. - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "May be used in DEBUG")] - public static readonly Win32Error ERROR_BAD_DEVICE = new Win32Error(1200); - - /// The operation was canceled by the user. - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "May be used in DEBUG")] - public static readonly Win32Error ERROR_CANCELLED = new Win32Error(1223); - - /// Not all privileges or groups references are assigned to the caller - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "May be used in DEBUG")] - public static readonly Win32Error ERROR_NOT_ALL_ASSIGNED = new Win32Error(1300); - - /// The window class was already registered. - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "May be used in DEBUG")] - public static readonly Win32Error ERROR_CLASS_ALREADY_EXISTS = new Win32Error(1410); - - /// The specified datatype is invalid. - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "May be used in DEBUG")] - public static readonly Win32Error ERROR_INVALID_DATATYPE = new Win32Error(1804); - - /// - /// Initializes a new instance of the struct. - /// - /// The integer value of the error. - public Win32Error(int i) - { - _value = i; - } - - /// Performs HRESULT_FROM_WIN32 conversion. - /// The Win32 error being converted to an HRESULT. - /// The equivalent HRESULT value. - public static explicit operator HRESULT(Win32Error error) - { - // #define __HRESULT_FROM_WIN32(x) - // ((HRESULT)(x) <= 0 ? ((HRESULT)(x)) : ((HRESULT) (((x) & 0x0000FFFF) | (FACILITY_WIN32 << 16) | 0x80000000))) - if (error._value <= 0) - { - return new HRESULT((uint)error._value); - } - - return HRESULT.Make(true, Facility.Win32, error._value & 0x0000FFFF); - } - - /// Performs the equivalent of Win32's GetLastError() - /// A Win32Error instance with the result of the native GetLastError - [SecurityCritical] - public static Win32Error GetLastError() - { - return new Win32Error(Marshal.GetLastWin32Error()); - } - - // Method version of the cast operation - - /// Performs HRESULT_FROM_WIN32 conversion. - /// The equivalent HRESULT value. - public HRESULT ToHRESULT() - { - return (HRESULT)this; - } - - public override bool Equals(object obj) - { - try - { - return ((Win32Error)obj)._value == _value; - } - catch (InvalidCastException) - { - return false; - } - } - - public override int GetHashCode() - { - return _value.GetHashCode(); - } - - /// - /// Compare two Win32 error codes for equality. - /// - /// The first error code to compare. - /// The second error code to compare. - /// Whether the two error codes are the same. - public static bool operator ==(Win32Error errLeft, Win32Error errRight) - { - return errLeft._value == errRight._value; - } - - /// - /// Compare two Win32 error codes for inequality. - /// - /// The first error code to compare. - /// The second error code to compare. - /// Whether the two error codes are not the same. - public static bool operator !=(Win32Error errLeft, Win32Error errRight) - { - return !(errLeft == errRight); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/Win32/Win32Value.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/Win32/Win32Value.cs deleted file mode 100644 index c8eaa6a930b..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/Win32/Win32Value.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.Win32 -{ - internal static class Win32Value - { - public const uint MAX_PATH = 260; - public const uint INFOTIPSIZE = 1024; - public const uint TRUE = 1; - public const uint FALSE = 0; - public const uint Sizeof_WCHAR = 2; - public const uint SizeofChar = 1; - public const uint SizeofBool = 4; - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/AltitudeReferenceSystem.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/AltitudeReferenceSystem.cs deleted file mode 100644 index bcb3c31acb2..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/AltitudeReferenceSystem.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public enum AltitudeReferenceSystem - { - Unspecified = 0, - Terrain = 1, - Ellipsoid = 2, - Geoid = 3, - Surface = 4, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/AnimationPropertyInfo.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/AnimationPropertyInfo.cs deleted file mode 100644 index a52d23b2f20..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/AnimationPropertyInfo.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class AnimationPropertyInfo - { - private Windows.UI.Composition.AnimationPropertyInfo UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public AnimationPropertyInfo(Windows.UI.Composition.AnimationPropertyInfo instance) - { - this.UwpInstance = instance; - } - - /// - /// Gets or sets - /// - public Windows.UI.Composition.AnimationPropertyAccessMode AccessMode - { - get => UwpInstance.AccessMode; - set => UwpInstance.AccessMode = value; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator AnimationPropertyInfo( - Windows.UI.Composition.AnimationPropertyInfo args) - { - return FromAnimationPropertyInfo(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static AnimationPropertyInfo FromAnimationPropertyInfo(Windows.UI.Composition.AnimationPropertyInfo args) - { - return new AnimationPropertyInfo(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/ApiInformationExtensions.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/ApiInformationExtensions.cs deleted file mode 100644 index a21e8c4d326..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/ApiInformationExtensions.cs +++ /dev/null @@ -1,107 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using Windows.Foundation.Metadata; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - // .NET applications use a concept of Union WinMD, which is the union of all known types that exist in the Windows SDK - // that correspond to the MaxVersionTested setting of the app. If you're running the app on a down-level platform, - // ApiInformation will tell you the API doesn't exist, but .NET can still JIT methods based on the Union WinMD and - // perform some reflection tasks. If you actually try to call the API you will get a MissingMethodException at runtime - // because the API doesn't really exist. - // A different problem can occur if you include a higher-versioned .NET library inside a lower-versioned app and try to run - // it on the higher-versioned build of the OS. In this case, ApiInformation will succeed because the type exists in the - // system metadata, but .NET will throw a MissingMethodException at runtime because the type didn't exist in the Union WinMD - // used to build the app. - public static class ApiInformationExtensions - { - public static void ExecuteIfEventPresent(string typeName, string eventName, Action action) - { - if (ApiInformation.IsEventPresent(typeName, eventName)) - { - try - { - action(); - } - catch (MissingMethodException) - { - } - } - } - - public static void ExecuteIfMethodPresent(string typeName, string methodName, Action action) - { - if (ApiInformation.IsMethodPresent(typeName, methodName)) - { - try - { - action(); - } - catch (MissingMethodException) - { - } - } - } - - public static void ExecuteIfMethodPresent(string typeName, string methodName, uint inputParameterCount, Action action) - { - if (ApiInformation.IsMethodPresent(typeName, methodName, inputParameterCount)) - { - try - { - action(); - } - catch (MissingMethodException) - { - } - } - } - - public static void ExecuteIfPropertyPresent(string typeName, string propertyName, Action action) - { - if (ApiInformation.IsPropertyPresent(typeName, propertyName)) - { - try - { - action(); - } - catch (MissingMethodException) - { - } - } - } - - public static T ExecuteIfPropertyPresent(string typeName, string propertyName, Func action) - { - if (ApiInformation.IsPropertyPresent(typeName, propertyName)) - { - try - { - return action(); - } - catch (MissingMethodException) - { - } - } - - return default(T); - } - - public static void ExecuteIfTypePresent(string typeName, Action action) - { - if (ApiInformation.IsTypePresent(typeName)) - { - try - { - action(); - } - catch (MissingMethodException) - { - } - } - } - } -} diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/BackgroundSizing.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/BackgroundSizing.cs deleted file mode 100644 index 72203e5573b..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/BackgroundSizing.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public enum BackgroundSizing - { - InnerBorderEdge = 0, - OuterBorderEdge = 1, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/BindingBase.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/BindingBase.cs deleted file mode 100644 index 01fcbb6526f..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/BindingBase.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class BindingBase - { - private Windows.UI.Xaml.Data.BindingBase UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public BindingBase(Windows.UI.Xaml.Data.BindingBase instance) - { - UwpInstance = instance; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator BindingBase( - Windows.UI.Xaml.Data.BindingBase args) - { - return FromBindingBase(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static BindingBase FromBindingBase(Windows.UI.Xaml.Data.BindingBase args) - { - return new BindingBase(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/BindingExpression.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/BindingExpression.cs deleted file mode 100644 index cc2e4561f0b..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/BindingExpression.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class BindingExpression - { - private Windows.UI.Xaml.Data.BindingExpression UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public BindingExpression(Windows.UI.Xaml.Data.BindingExpression instance) - { - UwpInstance = instance; - } - - /// - /// Gets - /// - public object DataItem - { - get => UwpInstance.DataItem; - } - - /// - /// Gets - /// - public Windows.UI.Xaml.Data.Binding ParentBinding - { - get => UwpInstance.ParentBinding; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator BindingExpression( - Windows.UI.Xaml.Data.BindingExpression args) - { - return FromBindingExpression(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static BindingExpression FromBindingExpression(Windows.UI.Xaml.Data.BindingExpression args) - { - return new BindingExpression(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/BringIntoViewOptions.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/BringIntoViewOptions.cs deleted file mode 100644 index a1d2333d941..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/BringIntoViewOptions.cs +++ /dev/null @@ -1,98 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class BringIntoViewOptions - { - private Windows.UI.Xaml.BringIntoViewOptions UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public BringIntoViewOptions(Windows.UI.Xaml.BringIntoViewOptions instance) - { - UwpInstance = instance; - } - - /// - /// Gets or sets - /// - public Windows.Foundation.Rect? TargetRect - { - get => UwpInstance.TargetRect; - set => UwpInstance.TargetRect = value; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool AnimationDesired - { - get => UwpInstance.AnimationDesired; - set => UwpInstance.AnimationDesired = value; - } - - /// - /// Gets or sets - /// - public double VerticalOffset - { - get => UwpInstance.VerticalOffset; - set => UwpInstance.VerticalOffset = value; - } - - /// - /// Gets or sets - /// - public double VerticalAlignmentRatio - { - get => UwpInstance.VerticalAlignmentRatio; - set => UwpInstance.VerticalAlignmentRatio = value; - } - - /// - /// Gets or sets - /// - public double HorizontalOffset - { - get => UwpInstance.HorizontalOffset; - set => UwpInstance.HorizontalOffset = value; - } - - /// - /// Gets or sets - /// - public double HorizontalAlignmentRatio - { - get => UwpInstance.HorizontalAlignmentRatio; - set => UwpInstance.HorizontalAlignmentRatio = value; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator BringIntoViewOptions( - Windows.UI.Xaml.BringIntoViewOptions args) - { - return FromBringIntoViewOptions(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static BringIntoViewOptions FromBringIntoViewOptions(Windows.UI.Xaml.BringIntoViewOptions args) - { - return new BringIntoViewOptions(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/Brush.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/Brush.cs deleted file mode 100644 index eadfb9bde48..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/Brush.cs +++ /dev/null @@ -1,74 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class Brush - { - private Windows.UI.Xaml.Media.Brush UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public Brush(Windows.UI.Xaml.Media.Brush instance) - { - // REVIEW: Guard for NULL - UwpInstance = instance; - } - - /// - /// Gets or sets - /// - public Transform Transform - { - get => UwpInstance.Transform; - set => UwpInstance.Transform = value.UwpInstance; - } - - /// - /// Gets or sets - /// - public Transform RelativeTransform - { - get => UwpInstance.RelativeTransform; - - // REVIEW: value could be null - set => UwpInstance.RelativeTransform = value.UwpInstance; - } - - /// - /// Gets or sets - /// - public double Opacity - { - get => UwpInstance.Opacity; - set => UwpInstance.Opacity = value; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator Brush( - Windows.UI.Xaml.Media.Brush args) - { - return FromBrush(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static Brush FromBrush(Windows.UI.Xaml.Media.Brush args) - { - return new Brush(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/BrushTransition.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/BrushTransition.cs deleted file mode 100644 index a1b72e6a5d9..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/BrushTransition.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class BrushTransition - { - private Windows.UI.Xaml.BrushTransition UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public BrushTransition(Windows.UI.Xaml.BrushTransition instance) - { - UwpInstance = instance; - } - - /// - /// Gets or sets - /// - public System.TimeSpan Duration - { - get => UwpInstance.Duration; - set => UwpInstance.Duration = value; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator BrushTransition( - Windows.UI.Xaml.BrushTransition args) - { - return FromBrushTransition(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static BrushTransition FromBrushTransition(Windows.UI.Xaml.BrushTransition args) - { - return new BrushTransition(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/CacheMode.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/CacheMode.cs deleted file mode 100644 index 1375053c121..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/CacheMode.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class CacheMode - { - private Windows.UI.Xaml.Media.CacheMode UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public CacheMode(Windows.UI.Xaml.Media.CacheMode instance) - { - this.UwpInstance = instance; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator CacheMode( - Windows.UI.Xaml.Media.CacheMode args) - { - return FromCacheMode(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static CacheMode FromCacheMode(Windows.UI.Xaml.Media.CacheMode args) - { - return new CacheMode(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/ClickMode.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/ClickMode.cs deleted file mode 100644 index a25d02b4d66..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/ClickMode.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public enum ClickMode - { - Release = 0, - Press = 1, - Hover = 2, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/ColumnDefinitionCollection.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/ColumnDefinitionCollection.cs deleted file mode 100644 index 3069b4f0f13..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/ColumnDefinitionCollection.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class ColumnDefinitionCollection - { - private Windows.UI.Xaml.Controls.ColumnDefinitionCollection UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public ColumnDefinitionCollection(Windows.UI.Xaml.Controls.ColumnDefinitionCollection instance) - { - this.UwpInstance = instance; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator ColumnDefinitionCollection( - Windows.UI.Xaml.Controls.ColumnDefinitionCollection args) - { - return FromColumnDefinitionCollection(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static ColumnDefinitionCollection FromColumnDefinitionCollection(Windows.UI.Xaml.Controls.ColumnDefinitionCollection args) - { - return new ColumnDefinitionCollection(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/ControlTemplate.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/ControlTemplate.cs deleted file mode 100644 index c19128cac51..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/ControlTemplate.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class ControlTemplate - { - private Windows.UI.Xaml.Controls.ControlTemplate UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public ControlTemplate(Windows.UI.Xaml.Controls.ControlTemplate instance) - { - this.UwpInstance = instance; - } - - /// - /// Gets or sets - /// - public System.Type TargetType - { - get => UwpInstance.TargetType; - set => UwpInstance.TargetType = value; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator ControlTemplate( - Windows.UI.Xaml.Controls.ControlTemplate args) - { - return FromControlTemplate(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static ControlTemplate FromControlTemplate(Windows.UI.Xaml.Controls.ControlTemplate args) - { - return new ControlTemplate(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/CoreAcceleratorKeyEventType.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/CoreAcceleratorKeyEventType.cs deleted file mode 100644 index 5eca99963ad..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/CoreAcceleratorKeyEventType.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// Specifies the set of possible accelerator key events that can invoke a callback. - /// Copy from to avoid requirement to link Windows.winmd - /// -#pragma warning disable 1591 - public enum CoreAcceleratorKeyEventType - { - KeyDown, - KeyUp, - Character, - DeadCharacter, - SystemKeyDown, - SystemKeyUp, - SystemCharacter, - SystemDeadCharacter, - UnicodeCharacter, - } -#pragma warning restore 1591 -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/CoreDispatcher.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/CoreDispatcher.cs deleted file mode 100644 index f82c4b99001..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/CoreDispatcher.cs +++ /dev/null @@ -1,61 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class CoreDispatcher - { - private Windows.UI.Core.CoreDispatcher UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public CoreDispatcher(Windows.UI.Core.CoreDispatcher instance) - { - this.UwpInstance = instance; - } - - /// - /// Gets a value indicating whether - /// - public bool HasThreadAccess - { - get => UwpInstance.HasThreadAccess; - } - - /// - /// Gets or sets - /// - public Windows.UI.Core.CoreDispatcherPriority CurrentPriority - { - get => UwpInstance.CurrentPriority; - set => UwpInstance.CurrentPriority = value; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator CoreDispatcher( - Windows.UI.Core.CoreDispatcher args) - { - return FromCoreDispatcher(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static CoreDispatcher FromCoreDispatcher(Windows.UI.Core.CoreDispatcher args) - { - return new CoreDispatcher(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/CoreIndependentInputSource.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/CoreIndependentInputSource.cs deleted file mode 100644 index ac937ad0f4c..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/CoreIndependentInputSource.cs +++ /dev/null @@ -1,94 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class CoreIndependentInputSource - { - private Windows.UI.Core.CoreIndependentInputSource UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public CoreIndependentInputSource(Windows.UI.Core.CoreIndependentInputSource instance) - { - this.UwpInstance = instance; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool IsInputEnabled - { - get => UwpInstance.IsInputEnabled; - set => UwpInstance.IsInputEnabled = value; - } - - /// - /// Gets - /// - public CoreDispatcher Dispatcher - { - get => UwpInstance.Dispatcher; - } - - /// - /// Gets or sets - /// - public Windows.UI.Core.CoreCursor PointerCursor - { - get => UwpInstance.PointerCursor; - set => UwpInstance.PointerCursor = value; - } - - /// - /// Gets a value indicating whether - /// - public bool HasCapture - { - get => UwpInstance.HasCapture; - } - - /// - /// Gets - /// - public Windows.Foundation.Point PointerPosition - { - get => UwpInstance.PointerPosition; - } - - /// - /// Gets - /// - public Windows.System.DispatcherQueue DispatcherQueue - { - get => UwpInstance.DispatcherQueue; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator CoreIndependentInputSource( - Windows.UI.Core.CoreIndependentInputSource args) - { - return FromCoreIndependentInputSource(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static CoreIndependentInputSource FromCoreIndependentInputSource(Windows.UI.Core.CoreIndependentInputSource args) - { - return new CoreIndependentInputSource(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/CoreInputDeviceTypes.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/CoreInputDeviceTypes.cs deleted file mode 100644 index 41b9b47b8e1..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/CoreInputDeviceTypes.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - [Flags] - public enum CoreInputDeviceTypes : uint - { - None = 0, - Touch = 1, - Pen = 2, - Mouse = 4, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/DataTemplate.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/DataTemplate.cs deleted file mode 100644 index a8416951542..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/DataTemplate.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class DataTemplate - { - private Windows.UI.Xaml.DataTemplate UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public DataTemplate(Windows.UI.Xaml.DataTemplate instance) - { - this.UwpInstance = instance; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator DataTemplate( - Windows.UI.Xaml.DataTemplate args) - { - return FromDataTemplate(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static DataTemplate FromDataTemplate(Windows.UI.Xaml.DataTemplate args) - { - return new DataTemplate(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/DataTemplateSelector.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/DataTemplateSelector.cs deleted file mode 100644 index a3277deef89..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/DataTemplateSelector.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class DataTemplateSelector - { - private Windows.UI.Xaml.Controls.DataTemplateSelector UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public DataTemplateSelector(Windows.UI.Xaml.Controls.DataTemplateSelector instance) - { - this.UwpInstance = instance; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator DataTemplateSelector( - Windows.UI.Xaml.Controls.DataTemplateSelector args) - { - return FromDataTemplateSelector(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static DataTemplateSelector FromDataTemplateSelector(Windows.UI.Xaml.Controls.DataTemplateSelector args) - { - return new DataTemplateSelector(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/DependencyPropertyChangedCallback.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/DependencyPropertyChangedCallback.cs deleted file mode 100644 index 794301789b8..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/DependencyPropertyChangedCallback.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class DependencyPropertyChangedCallback - { - private Windows.UI.Xaml.DependencyPropertyChangedCallback UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public DependencyPropertyChangedCallback(Windows.UI.Xaml.DependencyPropertyChangedCallback instance) - { - this.UwpInstance = instance; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator DependencyPropertyChangedCallback( - Windows.UI.Xaml.DependencyPropertyChangedCallback args) - { - return FromDependencyPropertyChangedCallback(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static DependencyPropertyChangedCallback FromDependencyPropertyChangedCallback(Windows.UI.Xaml.DependencyPropertyChangedCallback args) - { - return new DependencyPropertyChangedCallback(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/ElementCompositeMode.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/ElementCompositeMode.cs deleted file mode 100644 index 4477768273b..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/ElementCompositeMode.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public enum ElementCompositeMode - { - Inherit = 0, - SourceOver = 1, - MinBlend = 2, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/ElementHighContrastAdjustment.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/ElementHighContrastAdjustment.cs deleted file mode 100644 index f44d32ee025..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/ElementHighContrastAdjustment.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - [Flags] - public enum ElementHighContrastAdjustment : uint - { - None = 0, - Application = 2147483648, - Auto = 4294967295, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/ElementSoundMode.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/ElementSoundMode.cs deleted file mode 100644 index e3e18b8363f..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/ElementSoundMode.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public enum ElementSoundMode - { - Default = 0, - FocusOnly = 1, - Off = 2, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/ElementTheme.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/ElementTheme.cs deleted file mode 100644 index ac77a2263c0..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/ElementTheme.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public enum ElementTheme - { - Default = 0, - Light = 1, - Dark = 2, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/EventRegistrationToken.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/EventRegistrationToken.cs deleted file mode 100644 index 07ac7184f1e..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/EventRegistrationToken.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class EventRegistrationToken - { - private System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public EventRegistrationToken(System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken instance) - { - this.UwpInstance = instance; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator EventRegistrationToken( - System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken args) - { - return FromEventRegistrationToken(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static EventRegistrationToken FromEventRegistrationToken(System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken args) - { - return new EventRegistrationToken(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/FlowDirection.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/FlowDirection.cs deleted file mode 100644 index 13e60a31f64..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/FlowDirection.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public enum FlowDirection - { - LeftToRight = 0, - RightToLeft = 1, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/FlyoutBase.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/FlyoutBase.cs deleted file mode 100644 index 6bc86e04cfb..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/FlyoutBase.cs +++ /dev/null @@ -1,140 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class FlyoutBase - { - private Windows.UI.Xaml.Controls.Primitives.FlyoutBase UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public FlyoutBase(Windows.UI.Xaml.Controls.Primitives.FlyoutBase instance) - { - this.UwpInstance = instance; - } - - /// - /// Gets or sets - /// - public Windows.UI.Xaml.Controls.Primitives.FlyoutPlacementMode Placement - { - get => UwpInstance.Placement; - set => UwpInstance.Placement = value; - } - - /// - /// Gets or sets - /// - public Windows.UI.Xaml.Controls.LightDismissOverlayMode LightDismissOverlayMode - { - get => UwpInstance.LightDismissOverlayMode; - set => UwpInstance.LightDismissOverlayMode = value; - } - - /// - /// Gets or sets - /// - public ElementSoundMode ElementSoundMode - { - get => (ElementSoundMode)(int)UwpInstance.ElementSoundMode; - set => UwpInstance.ElementSoundMode = (Windows.UI.Xaml.ElementSoundMode)(int)value; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool AllowFocusWhenDisabled - { - get => UwpInstance.AllowFocusWhenDisabled; - set => UwpInstance.AllowFocusWhenDisabled = value; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool AllowFocusOnInteraction - { - get => UwpInstance.AllowFocusOnInteraction; - set => UwpInstance.AllowFocusOnInteraction = value; - } - - /// - /// Gets - /// - public Windows.UI.Xaml.FrameworkElement Target - { - get => UwpInstance.Target; - } - - /// - /// Gets or sets - /// - public Windows.UI.Xaml.DependencyObject OverlayInputPassThroughElement - { - get => UwpInstance.OverlayInputPassThroughElement; - set => UwpInstance.OverlayInputPassThroughElement = value; - } - - /// - /// Gets or sets - /// - public Windows.UI.Xaml.Controls.Primitives.FlyoutShowMode ShowMode - { - get => UwpInstance.ShowMode; - set => UwpInstance.ShowMode = value; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool AreOpenCloseAnimationsEnabled - { - get => UwpInstance.AreOpenCloseAnimationsEnabled; - set => UwpInstance.AreOpenCloseAnimationsEnabled = value; - } - - /// - /// Gets a value indicating whether - /// - public bool InputDevicePrefersPrimaryCommands - { - get => UwpInstance.InputDevicePrefersPrimaryCommands; - } - - /// - /// Gets a value indicating whether - /// - public bool IsOpen - { - get => UwpInstance.IsOpen; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator FlyoutBase( - Windows.UI.Xaml.Controls.Primitives.FlyoutBase args) - { - return FromFlyoutBase(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static FlyoutBase FromFlyoutBase(Windows.UI.Xaml.Controls.Primitives.FlyoutBase args) - { - return new FlyoutBase(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/FocusState.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/FocusState.cs deleted file mode 100644 index cc74ae72a69..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/FocusState.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public enum FocusState - { - Unfocused = 0, - Pointer = 1, - Keyboard = 2, - Programmatic = 3, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/FontFamily.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/FontFamily.cs deleted file mode 100644 index 58d8c7c2e42..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/FontFamily.cs +++ /dev/null @@ -1,52 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class FontFamily - { - private Windows.UI.Xaml.Media.FontFamily UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public FontFamily(Windows.UI.Xaml.Media.FontFamily instance) - { - this.UwpInstance = instance; - } - - /// - /// Gets - /// - public string Source - { - get => UwpInstance.Source; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator FontFamily( - Windows.UI.Xaml.Media.FontFamily args) - { - return FromFontFamily(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static FontFamily FromFontFamily(Windows.UI.Xaml.Media.FontFamily args) - { - return new FontFamily(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/FontStretch.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/FontStretch.cs deleted file mode 100644 index 4d42e7dd89f..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/FontStretch.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public enum FontStretch - { - Undefined = 0, - UltraCondensed = 1, - ExtraCondensed = 2, - Condensed = 3, - SemiCondensed = 4, - Normal = 5, - SemiExpanded = 6, - Expanded = 7, - ExtraExpanded = 8, - UltraExpanded = 9, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/FontStyle.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/FontStyle.cs deleted file mode 100644 index bbb05a33e90..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/FontStyle.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public enum FontStyle - { - Normal = 0, - Oblique = 1, - Italic = 2, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/FontWeight.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/FontWeight.cs deleted file mode 100644 index db9c78a310d..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/FontWeight.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class FontWeight - { - private Windows.UI.Text.FontWeight UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public FontWeight(Windows.UI.Text.FontWeight instance) - { - this.UwpInstance = instance; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator FontWeight( - Windows.UI.Text.FontWeight args) - { - return FromFontWeight(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static FontWeight FromFontWeight(Windows.UI.Text.FontWeight args) - { - return new FontWeight(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/GeneralTransform.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/GeneralTransform.cs deleted file mode 100644 index 8b4d0ab4620..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/GeneralTransform.cs +++ /dev/null @@ -1,52 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class GeneralTransform - { - private Windows.UI.Xaml.Media.GeneralTransform UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public GeneralTransform(Windows.UI.Xaml.Media.GeneralTransform instance) - { - this.UwpInstance = instance; - } - - /// - /// Gets - /// - public GeneralTransform Inverse - { - get => UwpInstance.Inverse; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator GeneralTransform( - Windows.UI.Xaml.Media.GeneralTransform args) - { - return FromGeneralTransform(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static GeneralTransform FromGeneralTransform(Windows.UI.Xaml.Media.GeneralTransform args) - { - return new GeneralTransform(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/GeoboundingBox.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/GeoboundingBox.cs deleted file mode 100644 index f3706752190..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/GeoboundingBox.cs +++ /dev/null @@ -1,108 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class GeoboundingBox - { - private Windows.Devices.Geolocation.GeoboundingBox UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public GeoboundingBox(Windows.Devices.Geolocation.GeoboundingBox instance) - { - this.UwpInstance = instance; - } - - /// - /// Gets - /// - public Windows.Devices.Geolocation.BasicGeoposition Center - { - get => UwpInstance.Center; - } - - /// - /// Gets - /// - public double MaxAltitude - { - get => UwpInstance.MaxAltitude; - } - - /// - /// Gets - /// - public double MinAltitude - { - get => UwpInstance.MinAltitude; - } - - /// - /// Gets - /// - public Windows.Devices.Geolocation.BasicGeoposition NorthwestCorner - { - get => UwpInstance.NorthwestCorner; - } - - /// - /// Gets - /// - public Windows.Devices.Geolocation.BasicGeoposition SoutheastCorner - { - get => UwpInstance.SoutheastCorner; - } - - /// - /// Gets - /// - public Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT.AltitudeReferenceSystem AltitudeReferenceSystem - { - get => (Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT.AltitudeReferenceSystem)(int)UwpInstance.AltitudeReferenceSystem; - } - - /// - /// Gets - /// - public Windows.Devices.Geolocation.GeoshapeType GeoshapeType - { - get => UwpInstance.GeoshapeType; - } - - /// - /// Gets - /// - public uint SpatialReferenceId - { - get => UwpInstance.SpatialReferenceId; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator GeoboundingBox( - Windows.Devices.Geolocation.GeoboundingBox args) - { - return FromGeoboundingBox(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static GeoboundingBox FromGeoboundingBox(Windows.Devices.Geolocation.GeoboundingBox args) - { - return new GeoboundingBox(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/Geopath.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/Geopath.cs deleted file mode 100644 index 084b788f5d4..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/Geopath.cs +++ /dev/null @@ -1,76 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class Geopath - { - private Windows.Devices.Geolocation.Geopath UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public Geopath(Windows.Devices.Geolocation.Geopath instance) - { - this.UwpInstance = instance; - } - - /// - /// Gets - /// - public System.Collections.Generic.IReadOnlyList Positions - { - get => UwpInstance.Positions; - } - - /// - /// Gets - /// - public Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT.AltitudeReferenceSystem AltitudeReferenceSystem - { - get => (Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT.AltitudeReferenceSystem)(int)UwpInstance.AltitudeReferenceSystem; - } - - /// - /// Gets - /// - public Windows.Devices.Geolocation.GeoshapeType GeoshapeType - { - get => UwpInstance.GeoshapeType; - } - - /// - /// Gets - /// - public uint SpatialReferenceId - { - get => UwpInstance.SpatialReferenceId; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator Geopath( - Windows.Devices.Geolocation.Geopath args) - { - return FromGeopath(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static Geopath FromGeopath(Windows.Devices.Geolocation.Geopath args) - { - return new Geopath(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/Geopoint.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/Geopoint.cs deleted file mode 100644 index c6bfee6a256..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/Geopoint.cs +++ /dev/null @@ -1,85 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using Windows.Devices.Geolocation; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class Geopoint - { - private BasicGeoposition basicGeoposition; - - internal Windows.Devices.Geolocation.Geopoint UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public Geopoint(Windows.Devices.Geolocation.Geopoint instance) - { - this.UwpInstance = instance; - } - - public Geopoint(BasicGeoposition basicGeoposition) - { - this.basicGeoposition = basicGeoposition; - } - - /// - /// Gets - /// - public Windows.Devices.Geolocation.BasicGeoposition Position - { - get => UwpInstance.Position; - } - - /// - /// Gets - /// - public Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT.AltitudeReferenceSystem AltitudeReferenceSystem - { - get => (Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT.AltitudeReferenceSystem)(int)UwpInstance.AltitudeReferenceSystem; - } - - /// - /// Gets - /// - public Windows.Devices.Geolocation.GeoshapeType GeoshapeType - { - get => UwpInstance.GeoshapeType; - } - - /// - /// Gets - /// - public uint SpatialReferenceId - { - get => UwpInstance.SpatialReferenceId; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator Geopoint( - Windows.Devices.Geolocation.Geopoint args) - { - return FromGeopoint(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static Geopoint FromGeopoint(Windows.Devices.Geolocation.Geopoint args) - { - return new Geopoint(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/HorizontalAlignment.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/HorizontalAlignment.cs deleted file mode 100644 index d2aaa091e64..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/HorizontalAlignment.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public enum HorizontalAlignment - { - Left = 0, - Center = 1, - Right = 2, - Stretch = 3, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/ImageSource.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/ImageSource.cs deleted file mode 100644 index 10afff5aeb7..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/ImageSource.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class ImageSource - { - private Windows.UI.Xaml.Media.ImageSource UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public ImageSource(Windows.UI.Xaml.Media.ImageSource instance) - { - this.UwpInstance = instance; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator ImageSource( - Windows.UI.Xaml.Media.ImageSource args) - { - return FromImageSource(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static ImageSource FromImageSource(Windows.UI.Xaml.Media.ImageSource args) - { - return new ImageSource(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkDrawingAttributes.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkDrawingAttributes.cs deleted file mode 100644 index 2d0493e0707..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkDrawingAttributes.cs +++ /dev/null @@ -1,142 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class InkDrawingAttributes - { - private Windows.UI.Input.Inking.InkDrawingAttributes UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public InkDrawingAttributes(Windows.UI.Input.Inking.InkDrawingAttributes instance) - { - this.UwpInstance = instance; - } - - /// - /// Gets or sets - /// - public Windows.Foundation.Size Size - { - get => UwpInstance.Size; - set => UwpInstance.Size = value; - } - - /// - /// Gets or sets - /// - public Windows.UI.Input.Inking.PenTipShape PenTip - { - get => UwpInstance.PenTip; - set => UwpInstance.PenTip = value; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool IgnorePressure - { - get => UwpInstance.IgnorePressure; - set => UwpInstance.IgnorePressure = value; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool FitToCurve - { - get => UwpInstance.FitToCurve; - set => UwpInstance.FitToCurve = value; - } - - /// - /// Gets or sets - /// - public Windows.UI.Color Color - { - get => UwpInstance.Color; - set => UwpInstance.Color = value; - } - - /* - /// - /// Gets or sets - /// - public System.Numerics.Matrix3x2 PenTipTransform - { - get => UwpInstance.PenTipTransform; - set => UwpInstance.PenTipTransform = value; - } - */ - - /// - /// Gets or sets a value indicating whether - /// - public bool DrawAsHighlighter - { - get => UwpInstance.DrawAsHighlighter; - set => UwpInstance.DrawAsHighlighter = value; - } - - /// - /// Gets - /// - public Windows.UI.Input.Inking.InkDrawingAttributesKind Kind - { - get => UwpInstance.Kind; - } - - /// - /// Gets - /// - public Windows.UI.Input.Inking.InkDrawingAttributesPencilProperties PencilProperties - { - get => UwpInstance.PencilProperties; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool IgnoreTilt - { - get => UwpInstance.IgnoreTilt; - set => UwpInstance.IgnoreTilt = value; - } - - /// - /// Gets - /// - public Windows.UI.Input.Inking.InkModelerAttributes ModelerAttributes - { - get => UwpInstance.ModelerAttributes; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator InkDrawingAttributes( - Windows.UI.Input.Inking.InkDrawingAttributes args) - { - return FromInkDrawingAttributes(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static InkDrawingAttributes FromInkDrawingAttributes(Windows.UI.Input.Inking.InkDrawingAttributes args) - { - return new InkDrawingAttributes(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkHighContrastAdjustment.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkHighContrastAdjustment.cs deleted file mode 100644 index 84b28de34cf..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkHighContrastAdjustment.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public enum InkHighContrastAdjustment - { - UseSystemColorsWhenNecessary = 0, - UseSystemColors = 1, - UseOriginalColors = 2, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkInputConfiguration.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkInputConfiguration.cs deleted file mode 100644 index 58b8a03cfe7..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkInputConfiguration.cs +++ /dev/null @@ -1,62 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class InkInputConfiguration - { - private Windows.UI.Input.Inking.InkInputConfiguration uwpInstance; - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public InkInputConfiguration(Windows.UI.Input.Inking.InkInputConfiguration instance) - { - this.uwpInstance = instance; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool IsPrimaryBarrelButtonInputEnabled - { - get => uwpInstance.IsPrimaryBarrelButtonInputEnabled; - set => uwpInstance.IsPrimaryBarrelButtonInputEnabled = value; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool IsEraserInputEnabled - { - get => uwpInstance.IsEraserInputEnabled; - set => uwpInstance.IsEraserInputEnabled = value; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator InkInputConfiguration( - Windows.UI.Input.Inking.InkInputConfiguration args) - { - return FromInkInputConfiguration(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static InkInputConfiguration FromInkInputConfiguration(Windows.UI.Input.Inking.InkInputConfiguration args) - { - return new InkInputConfiguration(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkInputProcessingConfiguration.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkInputProcessingConfiguration.cs deleted file mode 100644 index 8b2d4140aeb..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkInputProcessingConfiguration.cs +++ /dev/null @@ -1,62 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class InkInputProcessingConfiguration - { - private Windows.UI.Input.Inking.InkInputProcessingConfiguration uwpInstance; - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public InkInputProcessingConfiguration(Windows.UI.Input.Inking.InkInputProcessingConfiguration instance) - { - this.uwpInstance = instance; - } - - /// - /// Gets or sets - /// - public Windows.UI.Input.Inking.InkInputRightDragAction RightDragAction - { - get => uwpInstance.RightDragAction; - set => uwpInstance.RightDragAction = value; - } - - /// - /// Gets or sets - /// - public Windows.UI.Input.Inking.InkInputProcessingMode Mode - { - get => uwpInstance.Mode; - set => uwpInstance.Mode = value; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator InkInputProcessingConfiguration( - Windows.UI.Input.Inking.InkInputProcessingConfiguration args) - { - return FromInkInputProcessingConfiguration(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static InkInputProcessingConfiguration FromInkInputProcessingConfiguration(Windows.UI.Input.Inking.InkInputProcessingConfiguration args) - { - return new InkInputProcessingConfiguration(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkPresenter.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkPresenter.cs deleted file mode 100644 index f879137bce5..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkPresenter.cs +++ /dev/null @@ -1,112 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class InkPresenter - { - private Windows.UI.Input.Inking.InkPresenter UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public InkPresenter(Windows.UI.Input.Inking.InkPresenter instance) - { - this.UwpInstance = instance; - } - - /// - /// Gets or sets - /// - public Windows.UI.Input.Inking.InkStrokeContainer StrokeContainer - { - get => UwpInstance.StrokeContainer; - set => UwpInstance.StrokeContainer = value; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool IsInputEnabled - { - get => UwpInstance.IsInputEnabled; - set => UwpInstance.IsInputEnabled = value; - } - - /// - /// Gets or sets - /// - public CoreInputDeviceTypes InputDeviceTypes - { - get => (CoreInputDeviceTypes)(uint)UwpInstance.InputDeviceTypes; - set => UwpInstance.InputDeviceTypes = (Windows.UI.Core.CoreInputDeviceTypes)(uint)value; - } - - /// - /// Gets - /// - public Windows.UI.Input.Inking.InkInputProcessingConfiguration InputProcessingConfiguration - { - get => UwpInstance.InputProcessingConfiguration; - } - - /// - /// Gets - /// - public Windows.UI.Input.Inking.InkStrokeInput StrokeInput - { - get => UwpInstance.StrokeInput; - } - - /// - /// Gets - /// - public Windows.UI.Input.Inking.InkUnprocessedInput UnprocessedInput - { - get => UwpInstance.UnprocessedInput; - } - - /// - /// Gets or sets - /// - public Windows.UI.Input.Inking.InkHighContrastAdjustment HighContrastAdjustment - { - get => UwpInstance.HighContrastAdjustment; - set => UwpInstance.HighContrastAdjustment = value; - } - - /// - /// Gets - /// - public Windows.UI.Input.Inking.InkInputConfiguration InputConfiguration - { - get => UwpInstance.InputConfiguration; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator InkPresenter( - Windows.UI.Input.Inking.InkPresenter args) - { - return FromInkPresenter(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static InkPresenter FromInkPresenter(Windows.UI.Input.Inking.InkPresenter args) - { - return new InkPresenter(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkPresenterPredefinedConfiguration.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkPresenterPredefinedConfiguration.cs deleted file mode 100644 index ee63563c3ea..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkPresenterPredefinedConfiguration.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public enum InkPresenterPredefinedConfiguration - { - SimpleSinglePointer = 0, - SimpleMultiplePointer = 1, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkPresenterProtractor.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkPresenterProtractor.cs deleted file mode 100644 index ab921ab0993..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkPresenterProtractor.cs +++ /dev/null @@ -1,153 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class InkPresenterProtractor - { - private Windows.UI.Input.Inking.InkPresenterProtractor UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public InkPresenterProtractor(Windows.UI.Input.Inking.InkPresenterProtractor instance) - { - this.UwpInstance = instance; - } - - /// - /// Gets or sets - /// - public double Radius - { - get => UwpInstance.Radius; - set => UwpInstance.Radius = value; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool IsResizable - { - get => UwpInstance.IsResizable; - set => UwpInstance.IsResizable = value; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool IsCenterMarkerVisible - { - get => UwpInstance.IsCenterMarkerVisible; - set => UwpInstance.IsCenterMarkerVisible = value; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool IsAngleReadoutVisible - { - get => UwpInstance.IsAngleReadoutVisible; - set => UwpInstance.IsAngleReadoutVisible = value; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool AreTickMarksVisible - { - get => UwpInstance.AreTickMarksVisible; - set => UwpInstance.AreTickMarksVisible = value; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool AreRaysVisible - { - get => UwpInstance.AreRaysVisible; - set => UwpInstance.AreRaysVisible = value; - } - - /// - /// Gets or sets - /// - public Windows.UI.Color AccentColor - { - get => UwpInstance.AccentColor; - set => UwpInstance.AccentColor = value; - } - - /* - /// - /// Gets or sets - /// - public System.Numerics.Matrix3x2 Transform - { - get => UwpInstance.Transform; - set => UwpInstance.Transform = value; - } - */ - - /// - /// Gets or sets a value indicating whether - /// - public bool IsVisible - { - get => UwpInstance.IsVisible; - set => UwpInstance.IsVisible = value; - } - - /// - /// Gets or sets - /// - public Windows.UI.Color ForegroundColor - { - get => UwpInstance.ForegroundColor; - set => UwpInstance.ForegroundColor = value; - } - - /// - /// Gets or sets - /// - public Windows.UI.Color BackgroundColor - { - get => UwpInstance.BackgroundColor; - set => UwpInstance.BackgroundColor = value; - } - - /// - /// Gets - /// - public Windows.UI.Input.Inking.InkPresenterStencilKind Kind - { - get => UwpInstance.Kind; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator InkPresenterProtractor( - Windows.UI.Input.Inking.InkPresenterProtractor args) - { - return FromInkPresenterProtractor(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static InkPresenterProtractor FromInkPresenterProtractor(Windows.UI.Input.Inking.InkPresenterProtractor args) - { - return new InkPresenterProtractor(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkPresenterRuler.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkPresenterRuler.cs deleted file mode 100644 index 78eedabffce..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkPresenterRuler.cs +++ /dev/null @@ -1,126 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class InkPresenterRuler - { - private Windows.UI.Input.Inking.InkPresenterRuler UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public InkPresenterRuler(Windows.UI.Input.Inking.InkPresenterRuler instance) - { - this.UwpInstance = instance; - } - - /// - /// Gets or sets - /// - public double Width - { - get => UwpInstance.Width; - set => UwpInstance.Width = value; - } - - /// - /// Gets or sets - /// - public double Length - { - get => UwpInstance.Length; - set => UwpInstance.Length = value; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool IsCompassVisible - { - get => UwpInstance.IsCompassVisible; - set => UwpInstance.IsCompassVisible = value; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool AreTickMarksVisible - { - get => UwpInstance.AreTickMarksVisible; - set => UwpInstance.AreTickMarksVisible = value; - } - - /* - /// - /// Gets or sets - /// - public System.Numerics.Matrix3x2 Transform - { - get => UwpInstance.Transform; - set => UwpInstance.Transform = value; - } - */ - - /// - /// Gets or sets a value indicating whether - /// - public bool IsVisible - { - get => UwpInstance.IsVisible; - set => UwpInstance.IsVisible = value; - } - - /// - /// Gets or sets - /// - public Windows.UI.Color ForegroundColor - { - get => UwpInstance.ForegroundColor; - set => UwpInstance.ForegroundColor = value; - } - - /// - /// Gets or sets - /// - public Windows.UI.Color BackgroundColor - { - get => UwpInstance.BackgroundColor; - set => UwpInstance.BackgroundColor = value; - } - - /// - /// Gets - /// - public Windows.UI.Input.Inking.InkPresenterStencilKind Kind - { - get => UwpInstance.Kind; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator InkPresenterRuler( - Windows.UI.Input.Inking.InkPresenterRuler args) - { - return FromInkPresenterRuler(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static InkPresenterRuler FromInkPresenterRuler(Windows.UI.Input.Inking.InkPresenterRuler args) - { - return new InkPresenterRuler(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkStrokeContainer.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkStrokeContainer.cs deleted file mode 100644 index 9f0ba46afcf..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkStrokeContainer.cs +++ /dev/null @@ -1,52 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class InkStrokeContainer - { - private Windows.UI.Input.Inking.InkStrokeContainer uwpInstance; - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public InkStrokeContainer(Windows.UI.Input.Inking.InkStrokeContainer instance) - { - this.uwpInstance = instance; - } - - /// - /// Gets - /// - public Windows.Foundation.Rect BoundingRect - { - get => uwpInstance.BoundingRect; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator InkStrokeContainer( - Windows.UI.Input.Inking.InkStrokeContainer args) - { - return FromInkStrokeContainer(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static InkStrokeContainer FromInkStrokeContainer(Windows.UI.Input.Inking.InkStrokeContainer args) - { - return new InkStrokeContainer(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkStrokeInput.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkStrokeInput.cs deleted file mode 100644 index 62a7548044d..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkStrokeInput.cs +++ /dev/null @@ -1,52 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class InkStrokeInput - { - private Windows.UI.Input.Inking.InkStrokeInput uwpInstance; - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public InkStrokeInput(Windows.UI.Input.Inking.InkStrokeInput instance) - { - this.uwpInstance = instance; - } - - /// - /// Gets - /// - public Windows.UI.Input.Inking.InkPresenter InkPresenter - { - get => uwpInstance.InkPresenter; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator InkStrokeInput( - Windows.UI.Input.Inking.InkStrokeInput args) - { - return FromInkStrokeInput(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static InkStrokeInput FromInkStrokeInput(Windows.UI.Input.Inking.InkStrokeInput args) - { - return new InkStrokeInput(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkSynchronizer.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkSynchronizer.cs deleted file mode 100644 index 1ebc75712f1..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkSynchronizer.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class InkSynchronizer - { - private Windows.UI.Input.Inking.InkSynchronizer uwpInstance; - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public InkSynchronizer(Windows.UI.Input.Inking.InkSynchronizer instance) - { - this.uwpInstance = instance; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator InkSynchronizer( - Windows.UI.Input.Inking.InkSynchronizer args) - { - return FromInkSynchronizer(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static InkSynchronizer FromInkSynchronizer(Windows.UI.Input.Inking.InkSynchronizer args) - { - return new InkSynchronizer(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkToolbarButtonFlyoutPlacement.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkToolbarButtonFlyoutPlacement.cs deleted file mode 100644 index c268a51fc81..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkToolbarButtonFlyoutPlacement.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public enum InkToolbarButtonFlyoutPlacement - { - Auto = 0, - Top = 1, - Bottom = 2, - Left = 3, - Right = 4, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkToolbarCustomPen.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkToolbarCustomPen.cs deleted file mode 100644 index b3511f71706..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkToolbarCustomPen.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class InkToolbarCustomPen - { - private Windows.UI.Xaml.Controls.InkToolbarCustomPen UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public InkToolbarCustomPen(Windows.UI.Xaml.Controls.InkToolbarCustomPen instance) - { - this.UwpInstance = instance; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator InkToolbarCustomPen( - Windows.UI.Xaml.Controls.InkToolbarCustomPen args) - { - return FromInkToolbarCustomPen(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static InkToolbarCustomPen FromInkToolbarCustomPen(Windows.UI.Xaml.Controls.InkToolbarCustomPen args) - { - return new InkToolbarCustomPen(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkToolbarInitialControls.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkToolbarInitialControls.cs deleted file mode 100644 index bd493b10ade..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkToolbarInitialControls.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public enum InkToolbarInitialControls - { - All = 0, - None = 1, - PensOnly = 2, - AllExceptPens = 3, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkToolbarMenuKind.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkToolbarMenuKind.cs deleted file mode 100644 index 274e0817cf1..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkToolbarMenuKind.cs +++ /dev/null @@ -1,14 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public enum InkToolbarMenuKind - { - Stencil = 0, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkToolbarStencilKind.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkToolbarStencilKind.cs deleted file mode 100644 index 90af4910329..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkToolbarStencilKind.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public enum InkToolbarStencilKind - { - Ruler = 0, - Protractor = 1, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkToolbarToggle.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkToolbarToggle.cs deleted file mode 100644 index e5571f479c8..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkToolbarToggle.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public enum InkToolbarToggle - { - Ruler = 0, - Custom = 1, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkToolbarTool.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkToolbarTool.cs deleted file mode 100644 index 65aebb7fb3e..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkToolbarTool.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public enum InkToolbarTool - { - BallpointPen = 0, - Pencil = 1, - Highlighter = 2, - Eraser = 3, - CustomPen = 4, - CustomTool = 5, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkUnprocessedInput.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkUnprocessedInput.cs deleted file mode 100644 index ceee8b9c99c..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/InkUnprocessedInput.cs +++ /dev/null @@ -1,52 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class InkUnprocessedInput - { - private Windows.UI.Input.Inking.InkUnprocessedInput uwpInstance; - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public InkUnprocessedInput(Windows.UI.Input.Inking.InkUnprocessedInput instance) - { - this.uwpInstance = instance; - } - - /// - /// Gets - /// - public Windows.UI.Input.Inking.InkPresenter InkPresenter - { - get => uwpInstance.InkPresenter; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator InkUnprocessedInput( - Windows.UI.Input.Inking.InkUnprocessedInput args) - { - return FromInkUnprocessedInput(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static InkUnprocessedInput FromInkUnprocessedInput(Windows.UI.Input.Inking.InkUnprocessedInput args) - { - return new InkUnprocessedInput(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/KeyTipPlacementMode.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/KeyTipPlacementMode.cs deleted file mode 100644 index 0383952ca9d..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/KeyTipPlacementMode.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public enum KeyTipPlacementMode - { - Auto = 0, - Bottom = 1, - Top = 2, - Left = 3, - Right = 4, - Center = 5, - Hidden = 6, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/KeyboardAcceleratorPlacementMode.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/KeyboardAcceleratorPlacementMode.cs deleted file mode 100644 index 0125e37cd2f..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/KeyboardAcceleratorPlacementMode.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public enum KeyboardAcceleratorPlacementMode - { - Auto = 0, - Hidden = 1, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/KeyboardNavigationMode.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/KeyboardNavigationMode.cs deleted file mode 100644 index a0eccd19d1b..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/KeyboardNavigationMode.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public enum KeyboardNavigationModex - { - Local = 0, - Cycle = 1, - Once = 2, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/ManipulationModes.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/ManipulationModes.cs deleted file mode 100644 index 5c15e1c9d3c..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/ManipulationModes.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - [Flags] - public enum ManipulationModes : uint - { - None = 0, - TranslateX = 1, - TranslateY = 2, - TranslateRailsX = 4, - TranslateRailsY = 8, - Rotate = 16, - Scale = 32, - TranslateInertia = 64, - RotateInertia = 128, - ScaleInertia = 256, - All = 65535, - System = 65536, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MapAnimationKind.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MapAnimationKind.cs deleted file mode 100644 index 102d2f6daff..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MapAnimationKind.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public enum MapAnimationKind - { - Default = 0, - None = 1, - Linear = 2, - Bow = 3, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MapCamera.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MapCamera.cs deleted file mode 100644 index ca963a9763b..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MapCamera.cs +++ /dev/null @@ -1,89 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class MapCamera - { - private Windows.UI.Xaml.Controls.Maps.MapCamera UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public MapCamera(Windows.UI.Xaml.Controls.Maps.MapCamera instance) - { - this.UwpInstance = instance; - } - - /// - /// Gets or sets - /// - public double Roll - { - get => UwpInstance.Roll; - set => UwpInstance.Roll = value; - } - - /// - /// Gets or sets - /// - public double Pitch - { - get => UwpInstance.Pitch; - set => UwpInstance.Pitch = value; - } - - /// - /// Gets or sets - /// - public Geopoint Location - { - get => UwpInstance.Location; - set => UwpInstance.Location = value.UwpInstance; - } - - /// - /// Gets or sets - /// - public double Heading - { - get => UwpInstance.Heading; - set => UwpInstance.Heading = value; - } - - /// - /// Gets or sets - /// - public double FieldOfView - { - get => UwpInstance.FieldOfView; - set => UwpInstance.FieldOfView = value; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator MapCamera( - Windows.UI.Xaml.Controls.Maps.MapCamera args) - { - return FromMapCamera(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static MapCamera FromMapCamera(Windows.UI.Xaml.Controls.Maps.MapCamera args) - { - return new MapCamera(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MapCameraChangeReason.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MapCameraChangeReason.cs deleted file mode 100644 index 75826d12610..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MapCameraChangeReason.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public enum MapCameraChangeReason - { - System = 0, - UserInteraction = 1, - Programmatic = 2, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MapColorScheme.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MapColorScheme.cs deleted file mode 100644 index 1b0885703db..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MapColorScheme.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public enum MapColorScheme - { - Light = 0, - Dark = 1, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MapCustomExperience.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MapCustomExperience.cs deleted file mode 100644 index e893bb7766d..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MapCustomExperience.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class MapCustomExperience - { - private Windows.UI.Xaml.Controls.Maps.MapCustomExperience UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public MapCustomExperience(Windows.UI.Xaml.Controls.Maps.MapCustomExperience instance) - { - this.UwpInstance = instance; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator MapCustomExperience( - Windows.UI.Xaml.Controls.Maps.MapCustomExperience args) - { - return FromMapCustomExperience(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static MapCustomExperience FromMapCustomExperience(Windows.UI.Xaml.Controls.Maps.MapCustomExperience args) - { - return new MapCustomExperience(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MapElement.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MapElement.cs deleted file mode 100644 index 13a9f77ca35..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MapElement.cs +++ /dev/null @@ -1,107 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class MapElement - { - private Windows.UI.Xaml.Controls.Maps.MapElement UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public MapElement(Windows.UI.Xaml.Controls.Maps.MapElement instance) - { - this.UwpInstance = instance; - } - - /// - /// Gets or sets - /// - public int ZIndex - { - get => UwpInstance.ZIndex; - set => UwpInstance.ZIndex = value; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool Visible - { - get => UwpInstance.Visible; - set => UwpInstance.Visible = value; - } - - /// - /// Gets or sets - /// - public int MapTabIndex - { - get => UwpInstance.MapTabIndex; - set => UwpInstance.MapTabIndex = value; - } - - /// - /// Gets or sets - /// - public object Tag - { - get => UwpInstance.Tag; - set => UwpInstance.Tag = value; - } - - /// - /// Gets or sets - /// - public string MapStyleSheetEntryState - { - get => UwpInstance.MapStyleSheetEntryState; - set => UwpInstance.MapStyleSheetEntryState = value; - } - - /// - /// Gets or sets - /// - public string MapStyleSheetEntry - { - get => UwpInstance.MapStyleSheetEntry; - set => UwpInstance.MapStyleSheetEntry = value; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool IsEnabled - { - get => UwpInstance.IsEnabled; - set => UwpInstance.IsEnabled = value; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator MapElement( - Windows.UI.Xaml.Controls.Maps.MapElement args) - { - return FromMapElement(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static MapElement FromMapElement(Windows.UI.Xaml.Controls.Maps.MapElement args) - { - return new MapElement(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MapInteractionMode.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MapInteractionMode.cs deleted file mode 100644 index 19bf7903155..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MapInteractionMode.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public enum MapInteractionMode - { - Auto = 0, - Disabled = 1, - GestureOnly = 2, - PointerAndKeyboard = 2, - ControlOnly = 3, - GestureAndControl = 4, - PointerKeyboardAndControl = 4, - PointerOnly = 5, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MapLoadingStatus.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MapLoadingStatus.cs deleted file mode 100644 index c51a9efac53..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MapLoadingStatus.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public enum MapLoadingStatus - { - Loading = 0, - Loaded = 1, - DataUnavailable = 2, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MapPanInteractionMode.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MapPanInteractionMode.cs deleted file mode 100644 index efdc3372856..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MapPanInteractionMode.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public enum MapPanInteractionMode - { - Auto = 0, - Disabled = 1, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MapProjection.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MapProjection.cs deleted file mode 100644 index 66db92e13a7..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MapProjection.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public enum MapProjection - { - WebMercator = 0, - Globe = 1, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MapScene.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MapScene.cs deleted file mode 100644 index 48c819cd1d5..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MapScene.cs +++ /dev/null @@ -1,52 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class MapScene - { - private Windows.UI.Xaml.Controls.Maps.MapScene UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public MapScene(Windows.UI.Xaml.Controls.Maps.MapScene instance) - { - this.UwpInstance = instance; - } - - /// - /// Gets - /// - public MapCamera TargetCamera - { - get => UwpInstance.TargetCamera; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator MapScene( - Windows.UI.Xaml.Controls.Maps.MapScene args) - { - return FromMapScene(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static MapScene FromMapScene(Windows.UI.Xaml.Controls.Maps.MapScene args) - { - return new MapScene(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MapStyle.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MapStyle.cs deleted file mode 100644 index 5e4c916ea2a..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MapStyle.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public enum MapStyle - { - None = 0, - Road = 1, - Aerial = 2, - AerialWithRoads = 3, - Terrain = 4, - Aerial3D = 5, - Aerial3DWithRoads = 6, - Custom = 7, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MapStyleSheet.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MapStyleSheet.cs deleted file mode 100644 index fb3989cefaa..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MapStyleSheet.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class MapStyleSheet - { - private Windows.UI.Xaml.Controls.Maps.MapStyleSheet UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public MapStyleSheet(Windows.UI.Xaml.Controls.Maps.MapStyleSheet instance) - { - this.UwpInstance = instance; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator MapStyleSheet( - Windows.UI.Xaml.Controls.Maps.MapStyleSheet args) - { - return FromMapStyleSheet(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static MapStyleSheet FromMapStyleSheet(Windows.UI.Xaml.Controls.Maps.MapStyleSheet args) - { - return new MapStyleSheet(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MapVisibleRegionKind.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MapVisibleRegionKind.cs deleted file mode 100644 index b124278a91a..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MapVisibleRegionKind.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public enum MapVisibleRegionKind - { - Near = 0, - Full = 1, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MapWatermarkMode.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MapWatermarkMode.cs deleted file mode 100644 index 63c54ba45e6..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MapWatermarkMode.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public enum MapWatermarkMode - { - Automatic = 0, - On = 1, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/Matrix4x4.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/Matrix4x4.cs deleted file mode 100644 index b70dd5b3bbe..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/Matrix4x4.cs +++ /dev/null @@ -1,63 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class Matrix4x4 - { - private System.Numerics.Matrix4x4 UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public Matrix4x4(System.Numerics.Matrix4x4 instance) - { - this.UwpInstance = instance; - } - - /// - /// Gets a value indicating whether - /// - public bool IsIdentity - { - get => UwpInstance.IsIdentity; - } - - /* - /// - /// Gets or sets - /// - public System.Numerics.Vector3 Translation - { - get => UwpInstance.Translation; - set => UwpInstance.Translation = value; - } - */ - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator Matrix4x4( - System.Numerics.Matrix4x4 args) - { - return FromMatrix4x4(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static Matrix4x4 FromMatrix4x4(System.Numerics.Matrix4x4 args) - { - return new Matrix4x4(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MediaPlayer.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MediaPlayer.cs deleted file mode 100644 index e705945a56c..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MediaPlayer.cs +++ /dev/null @@ -1,297 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class MediaPlayer - { - internal Windows.Media.Playback.MediaPlayer UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public MediaPlayer(Windows.Media.Playback.MediaPlayer instance) - { - this.UwpInstance = instance; - } - - /// - /// Gets or sets - /// - public double Volume - { - get => UwpInstance.Volume; - set => UwpInstance.Volume = value; - } - - /* OBSOLETE - /// - /// Gets or sets - /// - public System.TimeSpan Position - { - get => UwpInstance.Position; - set => UwpInstance.Position = value; - } - - /// - /// Gets or sets - /// - public double PlaybackRate - { - get => UwpInstance.PlaybackRate; - set => UwpInstance.PlaybackRate = value; - } - */ - - /// - /// Gets or sets a value indicating whether - /// - public bool IsLoopingEnabled - { - get => UwpInstance.IsLoopingEnabled; - set => UwpInstance.IsLoopingEnabled = value; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool IsMuted - { - get => UwpInstance.IsMuted; - set => UwpInstance.IsMuted = value; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool AutoPlay - { - get => UwpInstance.AutoPlay; - set => UwpInstance.AutoPlay = value; - } - - /* OBSOLETE - /// - /// Gets - /// - public Windows.Media.Playback.MediaPlayerState CurrentState - { - get => UwpInstance.CurrentState; - } - - /// - /// Gets - /// - public System.TimeSpan NaturalDuration - { - get => UwpInstance.NaturalDuration; - } - - /// - /// Gets - /// - public Windows.Media.Playback.PlaybackMediaMarkerSequence PlaybackMediaMarkers - { - get => UwpInstance.PlaybackMediaMarkers; - } - - /// - /// Gets a value indicating whether - /// - public bool IsProtected - { - get => UwpInstance.IsProtected; - } - - /// - /// Gets - /// - public double BufferingProgress - { - get => UwpInstance.BufferingProgress; - } - - /// - /// Gets a value indicating whether - /// - public bool CanPause - { - get => UwpInstance.CanPause; - } - - /// - /// Gets a value indicating whether - /// - public bool CanSeek - { - get => UwpInstance.CanSeek; - } - */ - - /// - /// Gets or sets - /// - public Windows.Media.Playback.MediaPlayerAudioDeviceType AudioDeviceType - { - get => UwpInstance.AudioDeviceType; - set => UwpInstance.AudioDeviceType = value; - } - - /// - /// Gets or sets - /// - public Windows.Media.Playback.MediaPlayerAudioCategory AudioCategory - { - get => UwpInstance.AudioCategory; - set => UwpInstance.AudioCategory = value; - } - - /// - /// Gets - /// - public Windows.Media.SystemMediaTransportControls SystemMediaTransportControls - { - get => UwpInstance.SystemMediaTransportControls; - } - - /// - /// Gets or sets - /// - public System.TimeSpan TimelineControllerPositionOffset - { - get => UwpInstance.TimelineControllerPositionOffset; - set => UwpInstance.TimelineControllerPositionOffset = value; - } - - /// - /// Gets or sets - /// - public Windows.Media.MediaTimelineController TimelineController - { - get => UwpInstance.TimelineController; - set => UwpInstance.TimelineController = value; - } - - /// - /// Gets or sets - /// - public Windows.Media.Playback.StereoscopicVideoRenderMode StereoscopicVideoRenderMode - { - get => UwpInstance.StereoscopicVideoRenderMode; - set => UwpInstance.StereoscopicVideoRenderMode = value; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool RealTimePlayback - { - get => UwpInstance.RealTimePlayback; - set => UwpInstance.RealTimePlayback = value; - } - - /// - /// Gets or sets - /// - public Windows.Devices.Enumeration.DeviceInformation AudioDevice - { - get => UwpInstance.AudioDevice; - set => UwpInstance.AudioDevice = value; - } - - /// - /// Gets or sets - /// - public double AudioBalance - { - get => UwpInstance.AudioBalance; - set => UwpInstance.AudioBalance = value; - } - - /// - /// Gets - /// - public Windows.Media.Playback.MediaPlaybackCommandManager CommandManager - { - get => UwpInstance.CommandManager; - } - - /// - /// Gets - /// - public Windows.Media.Playback.MediaBreakManager BreakManager - { - get => UwpInstance.BreakManager; - } - - /// - /// Gets - /// - public Windows.Media.Playback.MediaPlaybackSession PlaybackSession - { - get => UwpInstance.PlaybackSession; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool IsVideoFrameServerEnabled - { - get => UwpInstance.IsVideoFrameServerEnabled; - set => UwpInstance.IsVideoFrameServerEnabled = value; - } - - /// - /// Gets - /// - public Windows.Media.Audio.AudioStateMonitor AudioStateMonitor - { - get => UwpInstance.AudioStateMonitor; - } - - /// - /// Gets or sets - /// - public Windows.Media.Protection.MediaProtectionManager ProtectionManager - { - get => UwpInstance.ProtectionManager; - set => UwpInstance.ProtectionManager = value; - } - - /// - /// Gets or sets - /// - public Windows.Media.Playback.IMediaPlaybackSource Source - { - get => UwpInstance.Source; - set => UwpInstance.Source = value; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator MediaPlayer( - Windows.Media.Playback.MediaPlayer args) - { - return FromMediaPlayer(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static MediaPlayer FromMediaPlayer(Windows.Media.Playback.MediaPlayer args) - { - return new MediaPlayer(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MediaTransportControls.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MediaTransportControls.cs deleted file mode 100644 index ae3826ed082..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/MediaTransportControls.cs +++ /dev/null @@ -1,305 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class MediaTransportControls - { - internal Windows.UI.Xaml.Controls.MediaTransportControls UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public MediaTransportControls(Windows.UI.Xaml.Controls.MediaTransportControls instance) - { - this.UwpInstance = instance; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool IsZoomEnabled - { - get => UwpInstance.IsZoomEnabled; - set => UwpInstance.IsZoomEnabled = value; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool IsZoomButtonVisible - { - get => UwpInstance.IsZoomButtonVisible; - set => UwpInstance.IsZoomButtonVisible = value; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool IsVolumeEnabled - { - get => UwpInstance.IsVolumeEnabled; - set => UwpInstance.IsVolumeEnabled = value; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool IsVolumeButtonVisible - { - get => UwpInstance.IsVolumeButtonVisible; - set => UwpInstance.IsVolumeButtonVisible = value; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool IsStopEnabled - { - get => UwpInstance.IsStopEnabled; - set => UwpInstance.IsStopEnabled = value; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool IsStopButtonVisible - { - get => UwpInstance.IsStopButtonVisible; - set => UwpInstance.IsStopButtonVisible = value; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool IsSeekEnabled - { - get => UwpInstance.IsSeekEnabled; - set => UwpInstance.IsSeekEnabled = value; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool IsSeekBarVisible - { - get => UwpInstance.IsSeekBarVisible; - set => UwpInstance.IsSeekBarVisible = value; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool IsPlaybackRateEnabled - { - get => UwpInstance.IsPlaybackRateEnabled; - set => UwpInstance.IsPlaybackRateEnabled = value; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool IsPlaybackRateButtonVisible - { - get => UwpInstance.IsPlaybackRateButtonVisible; - set => UwpInstance.IsPlaybackRateButtonVisible = value; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool IsFullWindowEnabled - { - get => UwpInstance.IsFullWindowEnabled; - set => UwpInstance.IsFullWindowEnabled = value; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool IsFullWindowButtonVisible - { - get => UwpInstance.IsFullWindowButtonVisible; - set => UwpInstance.IsFullWindowButtonVisible = value; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool IsFastRewindEnabled - { - get => UwpInstance.IsFastRewindEnabled; - set => UwpInstance.IsFastRewindEnabled = value; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool IsFastRewindButtonVisible - { - get => UwpInstance.IsFastRewindButtonVisible; - set => UwpInstance.IsFastRewindButtonVisible = value; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool IsFastForwardEnabled - { - get => UwpInstance.IsFastForwardEnabled; - set => UwpInstance.IsFastForwardEnabled = value; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool IsFastForwardButtonVisible - { - get => UwpInstance.IsFastForwardButtonVisible; - set => UwpInstance.IsFastForwardButtonVisible = value; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool IsCompact - { - get => UwpInstance.IsCompact; - set => UwpInstance.IsCompact = value; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool IsSkipForwardEnabled - { - get => UwpInstance.IsSkipForwardEnabled; - set => UwpInstance.IsSkipForwardEnabled = value; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool IsSkipForwardButtonVisible - { - get => UwpInstance.IsSkipForwardButtonVisible; - set => UwpInstance.IsSkipForwardButtonVisible = value; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool IsSkipBackwardEnabled - { - get => UwpInstance.IsSkipBackwardEnabled; - set => UwpInstance.IsSkipBackwardEnabled = value; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool IsSkipBackwardButtonVisible - { - get => UwpInstance.IsSkipBackwardButtonVisible; - set => UwpInstance.IsSkipBackwardButtonVisible = value; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool IsPreviousTrackButtonVisible - { - get => UwpInstance.IsPreviousTrackButtonVisible; - set => UwpInstance.IsPreviousTrackButtonVisible = value; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool IsNextTrackButtonVisible - { - get => UwpInstance.IsNextTrackButtonVisible; - set => UwpInstance.IsNextTrackButtonVisible = value; - } - - /// - /// Gets or sets - /// - public Windows.UI.Xaml.Media.FastPlayFallbackBehaviour FastPlayFallbackBehaviour - { - get => UwpInstance.FastPlayFallbackBehaviour; - set => UwpInstance.FastPlayFallbackBehaviour = value; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool ShowAndHideAutomatically - { - get => UwpInstance.ShowAndHideAutomatically; - set => UwpInstance.ShowAndHideAutomatically = value; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool IsRepeatEnabled - { - get => UwpInstance.IsRepeatEnabled; - set => UwpInstance.IsRepeatEnabled = value; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool IsRepeatButtonVisible - { - get => UwpInstance.IsRepeatButtonVisible; - set => UwpInstance.IsRepeatButtonVisible = value; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool IsCompactOverlayEnabled - { - get => UwpInstance.IsCompactOverlayEnabled; - set => UwpInstance.IsCompactOverlayEnabled = value; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool IsCompactOverlayButtonVisible - { - get => UwpInstance.IsCompactOverlayButtonVisible; - set => UwpInstance.IsCompactOverlayButtonVisible = value; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator MediaTransportControls( - Windows.UI.Xaml.Controls.MediaTransportControls args) - { - return FromMediaTransportControls(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static MediaTransportControls FromMediaTransportControls(Windows.UI.Xaml.Controls.MediaTransportControls args) - { - return new MediaTransportControls(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/Orientation.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/Orientation.cs deleted file mode 100644 index 404bd294875..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/Orientation.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public enum Orientation - { - Vertical = 0, - Horizontal = 1, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/Pointer.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/Pointer.cs deleted file mode 100644 index d370c360cd2..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/Pointer.cs +++ /dev/null @@ -1,76 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class Pointer - { - private Windows.UI.Xaml.Input.Pointer UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public Pointer(Windows.UI.Xaml.Input.Pointer instance) - { - this.UwpInstance = instance; - } - - /// - /// Gets a value indicating whether - /// - public bool IsInContact - { - get => UwpInstance.IsInContact; - } - - /// - /// Gets a value indicating whether - /// - public bool IsInRange - { - get => UwpInstance.IsInRange; - } - - /// - /// Gets - /// - public Windows.Devices.Input.PointerDeviceType PointerDeviceType - { - get => UwpInstance.PointerDeviceType; - } - - /// - /// Gets - /// - public uint PointerId - { - get => UwpInstance.PointerId; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator Pointer( - Windows.UI.Xaml.Input.Pointer args) - { - return FromPointer(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static Pointer FromPointer(Windows.UI.Xaml.Input.Pointer args) - { - return new Pointer(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/PointerPoint.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/PointerPoint.cs deleted file mode 100644 index 263bc1ab03c..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/PointerPoint.cs +++ /dev/null @@ -1,108 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class PointerPoint - { - private Windows.UI.Input.PointerPoint UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public PointerPoint(Windows.UI.Input.PointerPoint instance) - { - this.UwpInstance = instance; - } - - /// - /// Gets - /// - public uint FrameId - { - get => UwpInstance.FrameId; - } - - /// - /// Gets a value indicating whether - /// - public bool IsInContact - { - get => UwpInstance.IsInContact; - } - - /// - /// Gets - /// - public Windows.Devices.Input.PointerDevice PointerDevice - { - get => UwpInstance.PointerDevice; - } - - /// - /// Gets - /// - public uint PointerId - { - get => UwpInstance.PointerId; - } - - /// - /// Gets - /// - public Windows.Foundation.Point Position - { - get => UwpInstance.Position; - } - - /// - /// Gets - /// - public Windows.UI.Input.PointerPointProperties Properties - { - get => UwpInstance.Properties; - } - - /// - /// Gets - /// - public Windows.Foundation.Point RawPosition - { - get => UwpInstance.RawPosition; - } - - /// - /// Gets - /// - public ulong Timestamp - { - get => UwpInstance.Timestamp; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator PointerPoint( - Windows.UI.Input.PointerPoint args) - { - return FromPointerPoint(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static PointerPoint FromPointerPoint(Windows.UI.Input.PointerPoint args) - { - return new PointerPoint(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/ProcessKeyboardAcceleratorEventArgs.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/ProcessKeyboardAcceleratorEventArgs.cs deleted file mode 100644 index 0e6f13d6ee3..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/ProcessKeyboardAcceleratorEventArgs.cs +++ /dev/null @@ -1,69 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class ProcessKeyboardAcceleratorEventArgs - { - private Windows.UI.Xaml.Input.ProcessKeyboardAcceleratorEventArgs UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public ProcessKeyboardAcceleratorEventArgs(Windows.UI.Xaml.Input.ProcessKeyboardAcceleratorEventArgs instance) - { - this.UwpInstance = instance; - } - - /// - /// Gets or sets a value indicating whether - /// - public bool Handled - { - get => UwpInstance.Handled; - set => UwpInstance.Handled = value; - } - - /// - /// Gets - /// - public Windows.System.VirtualKey Key - { - get => UwpInstance.Key; - } - - /// - /// Gets - /// - public Windows.System.VirtualKeyModifiers Modifiers - { - get => UwpInstance.Modifiers; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator ProcessKeyboardAcceleratorEventArgs( - Windows.UI.Xaml.Input.ProcessKeyboardAcceleratorEventArgs args) - { - return FromProcessKeyboardAcceleratorEventArgs(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static ProcessKeyboardAcceleratorEventArgs FromProcessKeyboardAcceleratorEventArgs(Windows.UI.Xaml.Input.ProcessKeyboardAcceleratorEventArgs args) - { - return new ProcessKeyboardAcceleratorEventArgs(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/Projection.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/Projection.cs deleted file mode 100644 index dcb7b1d4f6f..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/Projection.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class Projection - { - private Windows.UI.Xaml.Media.Projection UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public Projection(Windows.UI.Xaml.Media.Projection instance) - { - this.UwpInstance = instance; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator Projection( - Windows.UI.Xaml.Media.Projection args) - { - return FromProjection(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static Projection FromProjection(Windows.UI.Xaml.Media.Projection args) - { - return new Projection(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/RectangleGeometry.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/RectangleGeometry.cs deleted file mode 100644 index cf395959fb0..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/RectangleGeometry.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class RectangleGeometry - { - private Windows.UI.Xaml.Media.RectangleGeometry UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public RectangleGeometry(Windows.UI.Xaml.Media.RectangleGeometry instance) - { - this.UwpInstance = instance; - } - - /// - /// Gets or sets - /// - public Windows.Foundation.Rect Rect - { - get => UwpInstance.Rect; - set => UwpInstance.Rect = value; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator RectangleGeometry( - Windows.UI.Xaml.Media.RectangleGeometry args) - { - return FromRectangleGeometry(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static RectangleGeometry FromRectangleGeometry(Windows.UI.Xaml.Media.RectangleGeometry args) - { - return new RectangleGeometry(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/RequiresPointer.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/RequiresPointer.cs deleted file mode 100644 index c76bd7066e5..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/RequiresPointer.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public enum RequiresPointer - { - Never = 0, - WhenEngaged = 1, - WhenFocused = 2, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/ResourceDictionary.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/ResourceDictionary.cs deleted file mode 100644 index 653e907c3a3..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/ResourceDictionary.cs +++ /dev/null @@ -1,71 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Linq; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class ResourceDictionary - { - private Windows.UI.Xaml.ResourceDictionary UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public ResourceDictionary(Windows.UI.Xaml.ResourceDictionary instance) - { - this.UwpInstance = instance; - } - - /// - /// Gets or sets - /// - public System.Uri Source - { - get => UwpInstance.Source; - set => UwpInstance.Source = value; - } - - /// - /// Gets - /// - public System.Collections.Generic.IList MergedDictionaries - { - get => UwpInstance.MergedDictionaries.Cast().ToList(); - } - - /// - /// Gets - /// - public System.Collections.Generic.IDictionary ThemeDictionaries - { - get => UwpInstance.ThemeDictionaries; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator ResourceDictionary( - Windows.UI.Xaml.ResourceDictionary args) - { - return FromResourceDictionary(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static ResourceDictionary FromResourceDictionary(Windows.UI.Xaml.ResourceDictionary args) - { - return new ResourceDictionary(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/RoutedEvent.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/RoutedEvent.cs deleted file mode 100644 index 3e8c50da627..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/RoutedEvent.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class RoutedEvent - { - private Windows.UI.Xaml.RoutedEvent UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public RoutedEvent(Windows.UI.Xaml.RoutedEvent instance) - { - this.UwpInstance = instance; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator RoutedEvent( - Windows.UI.Xaml.RoutedEvent args) - { - return FromRoutedEvent(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static RoutedEvent FromRoutedEvent(Windows.UI.Xaml.RoutedEvent args) - { - return new RoutedEvent(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/RowDefinitionCollection.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/RowDefinitionCollection.cs deleted file mode 100644 index efec28467d7..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/RowDefinitionCollection.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class RowDefinitionCollection - { - private Windows.UI.Xaml.Controls.RowDefinitionCollection UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public RowDefinitionCollection(Windows.UI.Xaml.Controls.RowDefinitionCollection instance) - { - this.UwpInstance = instance; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator RowDefinitionCollection( - Windows.UI.Xaml.Controls.RowDefinitionCollection args) - { - return FromRowDefinitionCollection(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static RowDefinitionCollection FromRowDefinitionCollection(Windows.UI.Xaml.Controls.RowDefinitionCollection args) - { - return new RowDefinitionCollection(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/ScalarTransition.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/ScalarTransition.cs deleted file mode 100644 index 938b1f69bd5..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/ScalarTransition.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class ScalarTransition - { - private Windows.UI.Xaml.ScalarTransition UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public ScalarTransition(Windows.UI.Xaml.ScalarTransition instance) - { - this.UwpInstance = instance; - } - - /// - /// Gets or sets - /// - public System.TimeSpan Duration - { - get => UwpInstance.Duration; - set => UwpInstance.Duration = value; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator ScalarTransition( - Windows.UI.Xaml.ScalarTransition args) - { - return FromScalarTransition(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static ScalarTransition FromScalarTransition(Windows.UI.Xaml.ScalarTransition args) - { - return new ScalarTransition(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/Stretch.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/Stretch.cs deleted file mode 100644 index 9a581705e3c..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/Stretch.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public enum Stretch - { - None = 0, - Fill = 1, - Uniform = 2, - UniformToFill = 3, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/Transform.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/Transform.cs deleted file mode 100644 index d24c20106b5..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/Transform.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class Transform - { - internal Windows.UI.Xaml.Media.Transform UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public Transform(Windows.UI.Xaml.Media.Transform instance) - { - this.UwpInstance = instance; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator Transform( - Windows.UI.Xaml.Media.Transform args) - { - return FromTransform(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static Transform FromTransform(Windows.UI.Xaml.Media.Transform args) - { - return new Transform(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/Transform3D.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/Transform3D.cs deleted file mode 100644 index f839daebd5e..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/Transform3D.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class Transform3D - { - private Windows.UI.Xaml.Media.Media3D.Transform3D UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public Transform3D(Windows.UI.Xaml.Media.Media3D.Transform3D instance) - { - this.UwpInstance = instance; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator Transform3D( - Windows.UI.Xaml.Media.Media3D.Transform3D args) - { - return FromTransform3D(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static Transform3D FromTransform3D(Windows.UI.Xaml.Media.Media3D.Transform3D args) - { - return new Transform3D(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/TransitionCollection.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/TransitionCollection.cs deleted file mode 100644 index f7be5b46b69..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/TransitionCollection.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class TransitionCollection - { - private Windows.UI.Xaml.Media.Animation.TransitionCollection UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public TransitionCollection(Windows.UI.Xaml.Media.Animation.TransitionCollection instance) - { - this.UwpInstance = instance; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator TransitionCollection( - Windows.UI.Xaml.Media.Animation.TransitionCollection args) - { - return FromTransitionCollection(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static TransitionCollection FromTransitionCollection(Windows.UI.Xaml.Media.Animation.TransitionCollection args) - { - return new TransitionCollection(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/TriggerCollection.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/TriggerCollection.cs deleted file mode 100644 index e08d6e8ac1b..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/TriggerCollection.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class TriggerCollection - { - private Windows.UI.Xaml.TriggerCollection UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public TriggerCollection(Windows.UI.Xaml.TriggerCollection instance) - { - this.UwpInstance = instance; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator TriggerCollection( - Windows.UI.Xaml.TriggerCollection args) - { - return FromTriggerCollection(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static TriggerCollection FromTriggerCollection(Windows.UI.Xaml.TriggerCollection args) - { - return new TriggerCollection(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/UIElementCollection.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/UIElementCollection.cs deleted file mode 100644 index 539ca9111d3..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/UIElementCollection.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class UIElementCollection - { - private Windows.UI.Xaml.Controls.UIElementCollection UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public UIElementCollection(Windows.UI.Xaml.Controls.UIElementCollection instance) - { - this.UwpInstance = instance; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator UIElementCollection( - Windows.UI.Xaml.Controls.UIElementCollection args) - { - return FromUIElementCollection(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static UIElementCollection FromUIElementCollection(Windows.UI.Xaml.Controls.UIElementCollection args) - { - return new UIElementCollection(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/Vector3Transition.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/Vector3Transition.cs deleted file mode 100644 index b886f93ff40..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/Vector3Transition.cs +++ /dev/null @@ -1,62 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public class Vector3Transition - { - private Windows.UI.Xaml.Vector3Transition UwpInstance { get; } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public Vector3Transition(Windows.UI.Xaml.Vector3Transition instance) - { - this.UwpInstance = instance; - } - - /// - /// Gets or sets - /// - public System.TimeSpan Duration - { - get => UwpInstance.Duration; - set => UwpInstance.Duration = value; - } - - /// - /// Gets or sets - /// - public Windows.UI.Xaml.Vector3TransitionComponents Components - { - get => UwpInstance.Components; - set => UwpInstance.Components = value; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator Vector3Transition( - Windows.UI.Xaml.Vector3Transition args) - { - return FromVector3Transition(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static Vector3Transition FromVector3Transition(Windows.UI.Xaml.Vector3Transition args) - { - return new Vector3Transition(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/VerticalAlignment.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/VerticalAlignment.cs deleted file mode 100644 index 245757360a4..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/VerticalAlignment.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public enum VerticalAlignment - { - Top = 0, - Center = 1, - Bottom = 2, - Stretch = 3, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/VirtualKey.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/VirtualKey.cs deleted file mode 100644 index e83d7104eac..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/VirtualKey.cs +++ /dev/null @@ -1,224 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// Specifies the values for each virtual key. - /// Copy from to avoid requirement to link Windows.winmd - /// -#pragma warning disable 1591 -#pragma warning disable SA1404 // Code analysis suppression must have justification - public enum VirtualKey - { - None = 0, - LeftButton = 1, - RightButton = 2, - Cancel = 3, - MiddleButton = 4, - XButton1 = 5, - XButton2 = 6, - Back = 8, - Tab = 9, - Clear = 12, - Enter = 13, - Shift = 16, - Control = 17, - Menu = 18, - Pause = 19, - CapitalLock = 20, - Hangul = 21, - Kana = 21, - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Junja")] - Junja = 23, - Final = 24, - Hanja = 25, - Kanji = 25, - Escape = 27, - Convert = 28, - NonConvert = 29, - Accept = 30, - ModeChange = 31, - Space = 32, - PageUp = 33, - PageDown = 34, - End = 35, - Home = 36, - Left = 37, - Up = 38, - Right = 39, - Down = 40, - Select = 41, - Print = 42, - Execute = 43, - Snapshot = 44, - Insert = 45, - Delete = 46, - Help = 47, - Number0 = 48, - Number1 = 49, - Number2 = 50, - Number3 = 51, - Number4 = 52, - Number5 = 53, - Number6 = 54, - Number7 = 55, - Number8 = 56, - Number9 = 57, - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "A")] - A = 65, - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "B")] - B = 66, - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "C")] - C = 67, - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "D")] - D = 68, - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "E")] - E = 69, - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "F")] - F = 70, - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "G")] - G = 71, - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "H")] - H = 72, - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "I")] - I = 73, - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "J")] - J = 74, - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "K")] - K = 75, - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "L")] - L = 76, - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "M")] - M = 77, - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "N")] - N = 78, - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "O")] - O = 79, - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "P")] - P = 80, - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Q")] - Q = 81, - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "R")] - R = 82, - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "S")] - S = 83, - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "T")] - T = 84, - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "U")] - U = 85, - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "V")] - V = 86, - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "W")] - W = 87, - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "X")] - X = 88, - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Y")] - Y = 89, - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Z")] - Z = 90, - LeftWindows = 91, - RightWindows = 92, - Application = 93, - Sleep = 95, - NumberPad0 = 96, - NumberPad1 = 97, - NumberPad2 = 98, - NumberPad3 = 99, - NumberPad4 = 100, - NumberPad5 = 101, - NumberPad6 = 102, - NumberPad7 = 103, - NumberPad8 = 104, - NumberPad9 = 105, - Multiply = 106, - Add = 107, - Separator = 108, - Subtract = 109, - Decimal = 110, - Divide = 111, - F1 = 112, - F2 = 113, - F3 = 114, - F4 = 115, - F5 = 116, - F6 = 117, - F7 = 118, - F8 = 119, - F9 = 120, - F10 = 121, - F11 = 122, - F12 = 123, - F13 = 124, - F14 = 125, - F15 = 126, - F16 = 127, - F17 = 128, - F18 = 129, - F19 = 130, - F20 = 131, - F21 = 132, - F22 = 133, - F23 = 134, - F24 = 135, - NavigationView = 136, - NavigationMenu = 137, - NavigationUp = 138, - NavigationDown = 139, - NavigationLeft = 140, - NavigationRight = 141, - NavigationAccept = 142, - NavigationCancel = 143, - NumberKeyLock = 144, - Scroll = 145, - LeftShift = 160, - RightShift = 161, - LeftControl = 162, - RightControl = 163, - LeftMenu = 164, - RightMenu = 165, - GoBack = 166, - GoForward = 167, - Refresh = 168, - Stop = 169, - Search = 170, - Favorites = 171, - GoHome = 172, - GamepadA = 195, - GamepadB = 196, - GamepadX = 197, - GamepadY = 198, - GamepadRightShoulder = 199, - GamepadLeftShoulder = 200, - GamepadLeftTrigger = 201, - GamepadRightTrigger = 202, - GamepadDPadUp = 203, - GamepadDPadDown = 204, - GamepadDPadLeft = 205, - GamepadDPadRight = 206, - GamepadMenu = 207, - GamepadView = 208, - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Thumbstick")] - GamepadLeftThumbstickButton = 209, - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Thumbstick")] - GamepadRightThumbstickButton = 210, - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Thumbstick")] - GamepadLeftThumbstickUp = 211, - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Thumbstick")] - GamepadLeftThumbstickDown = 212, - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Thumbstick")] - GamepadLeftThumbstickRight = 213, - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Thumbstick")] - GamepadLeftThumbstickLeft = 214, - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Thumbstick")] - GamepadRightThumbstickUp = 215, - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Thumbstick")] - GamepadRightThumbstickDown = 216, - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Thumbstick")] - GamepadRightThumbstickRight = 217, - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Thumbstick")] - GamepadRightThumbstickLeft = 218, - } -#pragma warning restore SA1404 // Code analysis suppression must have justification -#pragma warning restore 1591 -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/Visibility.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/Visibility.cs deleted file mode 100644 index 121b340f728..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/Visibility.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public enum Visibility - { - Visible = 0, - Collapsed = 1, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/XYFocusKeyboardNavigationMode.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/XYFocusKeyboardNavigationMode.cs deleted file mode 100644 index beb99733868..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/XYFocusKeyboardNavigationMode.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public enum XYFocusKeyboardNavigationMode - { - Auto = 0, - Enabled = 1, - Disabled = 2, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/XYFocusNavigationStrategy.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/XYFocusNavigationStrategy.cs deleted file mode 100644 index 389668413b2..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Interop/WinRT/XYFocusNavigationStrategy.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// - /// - public enum XYFocusNavigationStrategy - { - Auto = 0, - Projection = 1, - NavigationDirectionDistance = 2, - RectilinearDistance = 3, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Verify.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Verify.cs deleted file mode 100644 index f19373b91db..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.Controls/Verify.cs +++ /dev/null @@ -1,300 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Reflection; -using System.Threading; - -namespace Microsoft.Toolkit.Win32.UI.Controls -{ - [DebuggerStepThrough] - [DebuggerNonUserCode] - internal static class Verify - { - // Conditional to use more aggressive fail-fast behaviors when debugging -#if DEV_DEBUG - private const bool AggressiveFailFast = true; -#else - private const bool AggressiveFailFast = false; -#endif - - /// - /// Verifies that two generic type data are equal. The assertion fails if they are not. - /// - /// The generic type to compare for equality. - /// The first generic type data to compare. This is is the expected value. - /// The second generic type data to compare. This is the actual value. - /// This breaks into the debugger in the case of a failed assertion. - [Conditional("DEBUG")] - internal static void AreEqual(T expected, T actual) - { -#pragma warning disable RECS0017 // Possible compare of value type with 'null' - if (expected == null) -#pragma warning restore RECS0017 // Possible compare of value type with 'null' - { - // Two nulls are considered equal, regardless of type semantics. -#pragma warning disable RECS0017 // Possible compare of value type with 'null' - if (actual != null && !actual.Equals(expected)) -#pragma warning restore RECS0017 // Possible compare of value type with 'null' - { - Break(); - } - } - else if (!expected.Equals(actual)) - { - Break(); - } - } - - /// - /// This line should never be executed. The assertion always fails. - /// - /// This breaks into the debugger in the case of a failed assertion. - [Conditional("DEBUG")] - internal static void Fail() => Fail(null); - - /// - /// This line should never be executed. The assertion always fails. - /// - /// The message to display if this function is executed. - /// This breaks into the debugger in the case of a failed assertion. - [Conditional("DEBUG")] - internal static void Fail(string message) => Break(message); - - /// - /// Verifies that if the specified condition is true, then so is the result. - /// The assertion fails if the condition is true but the result is false. - /// - /// if set to true [condition]. - /// - /// A second Boolean statement. If the first was true then so must this be. - /// If the first statement was false then the value of this is ignored. - /// - /// This breaks into the debugger in the case of a failed assertion. - [Conditional("DEBUG")] - internal static void Implies(bool condition, bool result) - { - if (condition && !result) - { - Break(); - } - } - - /// - /// Verify the current thread's apartment state is what's expected. The assertion fails if it isn't - /// - /// - /// The expected apartment state for the current thread. - /// - /// This breaks into the debugger in the case of a failed assertion. - [Conditional("DEBUG")] - internal static void IsApartmentState(ApartmentState expectedState) - { - if (Thread.CurrentThread.GetApartmentState() != expectedState) - { - Break(); - } - } - - /// - /// Verifies that the specified condition is false. The assertion fails if it is true. - /// - /// The expression that should be false. - /// This breaks into the debugger in the case of a failed assertion. - [Conditional("DEBUG")] - internal static void IsFalse(bool condition) - { - IsFalse(condition, null); - } - - /// - /// Verifies that the specified condition is false. The assertion fails if it is true. - /// - /// The expression that should be false. - /// The message to display if the condition is true. - /// This breaks into the debugger in the case of a failed assertion. - [Conditional("DEBUG")] - internal static void IsFalse(bool condition, string message) - { - if (condition) - { - Break(message); - } - } - - /// - /// Verifies that a string has content. I.e. it is not null and it is not empty. - /// - /// The string to verify. - [Conditional("DEBUG")] - internal static void IsNeitherNullNorEmpty(string value) => IsFalse(string.IsNullOrEmpty(value)); - - /// - /// Verifies that a string has content. I.e. it is not null and it is not purely whitespace. - /// - /// The string to verify. - [Conditional("DEBUG")] - internal static void IsNeitherNullNorWhitespace(string value) => IsFalse(string.IsNullOrWhiteSpace(value)); - - /// - /// Verifies the specified value is not null. The assertion fails if it is. - /// - /// The generic reference type. - /// The value to check for nullness. - /// This breaks into the debugger in the case of a failed assertion. - [Conditional("DEBUG")] - internal static void IsNotNull(T value) - where T : class - { - if (value == null) - { - Break(); - } - } - - /// - /// Verifies that the specified object is null. The assertion fails if it is not. - /// - /// The type of item to verify. - /// The item to verify is null. - [Conditional("DEBUG")] - internal static void IsNull(T item) - where T : class - { - if (item != null) - { - Break(); - } - } - - /// - /// Verifies that the specified condition is true. The assertion fails if it is not. - /// - /// A condition that is expected to be true. - /// This breaks into the debugger in the case of a failed assertion. - [Conditional("DEBUG")] - internal static void IsTrue(bool condition) => IsTrue(condition, null); - - /// - /// Verifies that the specified condition is true. The assertion fails if it is not. - /// - /// A condition that is expected to be true. - /// The message to write in case the condition is false. - /// This breaks into the debugger in the case of a failed assertion. - [Conditional("DEBUG")] - internal static void IsTrue(bool condition, string message) - { - if (!condition) - { - Break(message); - } - } - - [Conditional("DEBUG")] - private static void Break(string message = null) - { - // If we're running under a unit test, do some additional checking - // Since this method can only be called in DEBUG builds, the additional - // cost of enumerating assemblies or walking the stack is forgivable - if (IsRunningInUnitTest) - { - if (Debugger.IsAttached) - { - // Since a debugger is attached use the existing behavior - _Break(message); - } - else - { - throw new InvalidOperationException(message ?? "Code encountered a BREAK condition and cannot continue. Review stack for more information."); - } - } - else - { - _Break(message); - } - } - - [Conditional("DEBUG")] -#pragma warning disable SA1300 // Element must begin with upper-case letter - private static void _Break(string message) -#pragma warning restore SA1300 // Element must begin with upper-case letter - { -#pragma warning disable RECS0110 // Condition is set by DEV_DEBUG compile constant - if (AggressiveFailFast) -#pragma warning restore RECS0110 // Condition is set by DEV_DEBUG compile constant - { -#pragma warning disable 162 - if (!string.IsNullOrEmpty(message)) - { - Debug.WriteLine(message); - } - - Debugger.Break(); -#pragma warning restore 162 - } - else -#pragma warning disable 162 - { - Debug.Assert(false, message); - } -#pragma warning restore 162 - } - - private static readonly HashSet UnitTestAttributes = new HashSet - { - "Microsoft.VisualStudio.TestTools.UnitTesting.TestClassAttribute" - }; - - private static readonly HashSet UnitTestFrameworks = new HashSet - { - "Microsoft.VisualStudio.QualityTools.UnitTestFramework", - "Microsoft.VisualStudio.TestPlatform.TestFramework" - }; - - private static bool IsRunningInUnitTest - { - get - { - // Check if the current AppDomain has loaded a unit test assembly - bool AppDomainHasUnitTestAssembly() - { - return AppDomain - .CurrentDomain - .GetAssemblies() - .Any(AssemblyIsUnitTestFramework); - } - - bool AssemblyIsUnitTestFramework(Assembly a) - { - foreach (var f in UnitTestFrameworks) - { - if (a.FullName.StartsWith(f, StringComparison.OrdinalIgnoreCase)) - { - return true; - } - } - - return false; - } - - // Walk the stack and determine if any type has a known attribute for unit tests - bool TypeHasUnitTestAttribute() - { - return new StackTrace() - .GetFrames() - .Any(f => f - .GetMethod() - .DeclaringType - .GetCustomAttributes(false) - .Any(x => UnitTestAttributes.Contains(x.GetType().FullName))); - } - - return AppDomainHasUnitTestAssembly() || TypeHasUnitTestAttribute(); - } - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.XamlHost/DesktopWindowXamlSourceExtensions.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.XamlHost/DesktopWindowXamlSourceExtensions.cs deleted file mode 100644 index c7bcbe2ae79..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.XamlHost/DesktopWindowXamlSourceExtensions.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Runtime.InteropServices; - -namespace Microsoft.Toolkit.Win32.UI.XamlHost -{ - /// - /// COM wrapper required to access native-only methods on - /// - public static class DesktopWindowXamlSourceExtensions - { - /// - /// Gets the interface from a instance. - /// - /// The DesktopWindowXamlSource instance to get the interface from - /// interface pointer - /// - /// This interface is the only way to set DesktopWindowXamlSource's target window for rendering. - /// - public static IDesktopWindowXamlSourceNative GetInterop(this Windows.UI.Xaml.Hosting.DesktopWindowXamlSource desktopWindowXamlSource) - { - var win32XamlSourceIntPtr = Marshal.GetIUnknownForObject(desktopWindowXamlSource); - try - { - var win32XamlSource = Marshal.GetTypedObjectForIUnknown(win32XamlSourceIntPtr, typeof(IDesktopWindowXamlSourceNative)) as IDesktopWindowXamlSourceNative; - return win32XamlSource; - } - finally - { - Marshal.Release(win32XamlSourceIntPtr); - win32XamlSourceIntPtr = IntPtr.Zero; - } - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.XamlHost/IDesktopWindowXamlSourceNative.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.XamlHost/IDesktopWindowXamlSourceNative.cs deleted file mode 100644 index c5fdbb130d0..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.XamlHost/IDesktopWindowXamlSourceNative.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Runtime.InteropServices; - -namespace Microsoft.Toolkit.Win32.UI.XamlHost -{ - /// - /// Enables access to native methods on DesktopWindowXamlSourceNative - /// - /// - /// Includes the method used to set the window handle of the instance. - /// - [ComImport] - [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] - [Guid("3cbcf1bf-2f76-4e9c-96ab-e84b37972554")] - public interface IDesktopWindowXamlSourceNative - { - /// - /// Attaches the to a window using a window handle. - /// - /// pointer to parent Wnd - /// - /// The associated window will be used to parent UWP XAML visuals, appearing - /// as UWP XAML's logical render target. - /// - void AttachToWindow(IntPtr parentWnd); - - /// - /// Gets the handle associated with the instance. - /// - IntPtr WindowHandle { get; } - } -} diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.XamlHost/MetadataProviderDiscovery.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.XamlHost/MetadataProviderDiscovery.cs deleted file mode 100644 index 603fda154b8..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.XamlHost/MetadataProviderDiscovery.cs +++ /dev/null @@ -1,171 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Reflection; -using Windows.UI.Xaml.Markup; - -namespace Microsoft.Toolkit.Win32.UI.XamlHost -{ - /// - /// MetadataProviderDiscovery is responsible for loading all metadata providers for custom UWP XAML - /// types. In this implementation, reflection is used at runtime to probe for metadata providers in - /// the working directory, allowing any type that includes metadata (compiled in to a .NET framework - /// assembly) to be used without explicit metadata handling by the application developer. This - /// internal class will be amended or removed when additional type loading support is available. - /// - internal static class MetadataProviderDiscovery - { - /// - /// Probes working directory for all available metadata providers - /// - /// Types to ignore - /// List of UWP XAML metadata providers - internal static List DiscoverMetadataProviders(List filteredTypes) - { - // List of discovered UWP XAML metadata providers - var metadataProviders = new List(); - - // Get all assemblies loaded in app domain and placed side-by-side from all DLL and EXE - var loadedAssemblies = GetAssemblies(); - var uniqueAssemblies = new HashSet(loadedAssemblies, EqualityComparerFactory.CreateComparer( - a => a.GetName().FullName.GetHashCode(), - (a, b) => a.GetName().FullName.Equals(b.GetName().FullName, StringComparison.OrdinalIgnoreCase))); - - // Load all types loadable from the assembly, ignoring any types that could not be resolved due to an issue in the dependency chain - foreach (var assembly in uniqueAssemblies) - { - try - { - LoadTypesFromAssembly(assembly, ref metadataProviders, ref filteredTypes); - } - catch (FileLoadException) - { - // These exceptions are expected - } - } - - return metadataProviders; - } - - private static IEnumerable GetAssemblies() - { - yield return Assembly.GetExecutingAssembly(); - - // Get assemblies already loaded in the current app domain - foreach (var a in AppDomain.CurrentDomain.GetAssemblies()) - { - yield return a; - } - - // Reflection-based runtime metadata probing - var currentDirectory = new FileInfo(typeof(MetadataProviderDiscovery).Assembly.Location).Directory; - - foreach (var file in currentDirectory.GetFiles("*.dll").Union(currentDirectory.GetFiles("*.exe"))) - { - Assembly a = null; - - try - { - a = Assembly.LoadFrom(file.FullName); - } - catch (FileLoadException) - { - // These exceptions are expected - } - catch (BadImageFormatException) - { - // DLL is not loadable by CLR (e.g. Native) - } - - if (a != null) - { - yield return a; - } - } - } - - /// - /// Loads all types from the specified assembly and caches metadata providers - /// - /// Target assembly to load types from - /// List of metadata providers - /// List of types to ignore - private static void LoadTypesFromAssembly(Assembly assembly, ref List metadataProviders, ref List filteredTypes) - { - // Load types inside the executing assembly - foreach (var type in GetLoadableTypes(assembly)) - { - if (filteredTypes.Contains(type)) - { - continue; - } - - // TODO: More type checking here - // Not interface, not abstract, not generic, etc. - if (typeof(IXamlMetadataProvider).IsAssignableFrom(type)) - { - var provider = (IXamlMetadataProvider)Activator.CreateInstance(type); - metadataProviders.Add(provider); - } - } - } - - // Algorithm from StackOverflow answer here: - // http://stackoverflow.com/questions/7889228/how-to-prevent-reflectiontypeloadexception-when-calling-assembly-gettypes - private static IEnumerable GetLoadableTypes(Assembly assembly) - { - if (assembly == null) - { - throw new ArgumentNullException(nameof(assembly)); - } - - try - { - return assembly.DefinedTypes.Select(t => t.AsType()); - } - catch (ReflectionTypeLoadException ex) - { - return ex.Types.Where(t => t != null); - } - } - - private static class EqualityComparerFactory - { - private class MyComparer : IEqualityComparer - { - private readonly Func _getHashCodeFunc; - private readonly Func _equalsFunc; - - public MyComparer(Func getHashCodeFunc, Func equalsFunc) - { - _getHashCodeFunc = getHashCodeFunc; - _equalsFunc = equalsFunc; - } - - public bool Equals(T x, T y) => _equalsFunc(x, y); - - public int GetHashCode(T obj) => _getHashCodeFunc(obj); - } - - public static IEqualityComparer CreateComparer(Func getHashCodeFunc, Func equalsFunc) - { - if (getHashCodeFunc == null) - { - throw new ArgumentNullException(nameof(getHashCodeFunc)); - } - - if (equalsFunc == null) - { - throw new ArgumentNullException(nameof(equalsFunc)); - } - - return new MyComparer(getHashCodeFunc, equalsFunc); - } - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.XamlHost/UWPTypeFactory.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.XamlHost/UWPTypeFactory.cs deleted file mode 100644 index 93814f93c38..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.XamlHost/UWPTypeFactory.cs +++ /dev/null @@ -1,76 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; - -namespace Microsoft.Toolkit.Win32.UI.XamlHost -{ - public static class UWPTypeFactory - { - /// - /// Creates UWP XAML type instance from WinRT type name - /// UWP XAML type name should be specified as: namespace.class - /// ex: MyClassLibrary.MyCustomType - /// ex: Windows.UI.Xaml.Shapes.Rectangle - /// ex: Windows.UI.Xaml.Controls.Button - /// - /// UWP XAML type name - /// Condition. - /// Instance of UWP XAML type described by xamlTypeName string - public static Windows.UI.Xaml.FrameworkElement CreateXamlContentByType(string xamlTypeName) - { - Windows.UI.Xaml.Markup.IXamlType xamlType = null; - Type systemType = null; - - // If a root metadata provider has been defined on the application object, - // use it to probe for custom UWP XAML type metadata. If the root metadata - // provider has not been implemented on the current application object, assume - // the caller wants a built-in UWP XAML type, not a custom UWP XAML type. - var xamlRootMetadataProvider = Windows.UI.Xaml.Application.Current as Windows.UI.Xaml.Markup.IXamlMetadataProvider; - if (xamlRootMetadataProvider != null) - { - xamlType = xamlRootMetadataProvider.GetXamlType(xamlTypeName); - } - - systemType = FindBuiltInType(xamlTypeName); - - if (systemType != null) - { - // Create built-in UWP XAML type - return (Windows.UI.Xaml.FrameworkElement)Activator.CreateInstance(systemType); - } - - if (xamlType != null) - { - // Create custom UWP XAML type - return (Windows.UI.Xaml.FrameworkElement)xamlType.ActivateInstance(); - } - - throw new InvalidOperationException("Microsoft.Windows.Interop.UWPTypeFactory: Could not create type: " + xamlTypeName); - } - - /// - /// Searches for a built-in type by iterating through all types in - /// all assemblies loaded in the current AppDomain - /// - /// Full type name, with namespace, without assembly - /// If found, ; otherwise, null.. - private static Type FindBuiltInType(string typeName) - { - var currentAppDomain = AppDomain.CurrentDomain; - var appDomainLoadedAssemblies = currentAppDomain.GetAssemblies(); - - foreach (var loadedAssembly in appDomainLoadedAssemblies) - { - var currentType = loadedAssembly.GetType(typeName); - if (currentType != null) - { - return currentType; - } - } - - return null; - } - } -} diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.XamlHost/XamlApplication.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.XamlHost/XamlApplication.cs deleted file mode 100644 index 8e84d31deb1..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.UI.XamlHost/XamlApplication.cs +++ /dev/null @@ -1,124 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; - -namespace Microsoft.Toolkit.Win32.UI.XamlHost -{ - /// - /// XamlApplication is a custom that implements . The - /// metadata provider implemented on the application is known as the 'root metadata provider'. This provider - /// has the responsibility of loading all other metadata for custom UWP XAML types. In this implementation, - /// reflection is used at runtime to probe for metadata providers in the working directory, allowing any - /// type that includes metadata (compiled in to a .NET framework assembly) to be used without explicit - /// metadata handling by the developer. - /// - internal class XamlApplication : Windows.UI.Xaml.Application, Windows.UI.Xaml.Markup.IXamlMetadataProvider - { - private static readonly List FilteredTypes = new List - { - typeof(XamlApplication), - typeof(Windows.UI.Xaml.Markup.IXamlMetadataProvider) - }; - - // Metadata provider identified by the root metadata provider - private List _metadataProviders = null; - - /// - /// Gets XAML interface from all cached metadata providers for the . - /// - /// Type of requested type - /// IXamlType interface or null if type is not found - public Windows.UI.Xaml.Markup.IXamlType GetXamlType(Type type) - { - EnsureMetadataProviders(); - - foreach (var provider in _metadataProviders) - { - var result = provider.GetXamlType(type); - if (result != null) - { - return result; - } - } - - return null; - } - - /// - /// Gets XAML IXamlType interface from all cached metadata providers by full type name - /// - /// Full name of requested type - /// if found; otherwise, null. - public Windows.UI.Xaml.Markup.IXamlType GetXamlType(string fullName) - { - EnsureMetadataProviders(); - - foreach (var provider in _metadataProviders) - { - var result = provider.GetXamlType(fullName); - if (result != null) - { - return result; - } - } - - return null; - } - - /// - /// Gets all XAML namespace definitions from metadata providers - /// - /// Array of namespace definitions - public Windows.UI.Xaml.Markup.XmlnsDefinition[] GetXmlnsDefinitions() - { - EnsureMetadataProviders(); - - var definitions = new List(); - foreach (var provider in _metadataProviders) - { - definitions.AddRange(provider.GetXmlnsDefinitions()); - } - - return definitions.ToArray(); - } - - /// - /// Probes file system for UWP XAML metadata providers - /// - private void EnsureMetadataProviders() - { - if (_metadataProviders == null) - { - _metadataProviders = MetadataProviderDiscovery.DiscoverMetadataProviders(FilteredTypes); - } - } - - /// - /// Gets and returns the current UWP XAML Application instance in a reference parameter. - /// If the current XAML Application instance has not been created for the process (is null), - /// a new instance is created and returned. - /// - internal static void GetOrCreateXamlApplicationInstance(ref Windows.UI.Xaml.Application application) - { - // Instantiation of the application object must occur before creating the DesktopWindowXamlSource instance. - // DesktopWindowXamlSource will create a generic Application object unable to load custom UWP XAML metadata. - if (application == null) - { - try - { - // Windows.UI.Xaml.Application.Current may throw if DXamlCore has not been initialized. - // Treat the exception as an uninitialized Windows.UI.Xaml.Application condition. - application = Windows.UI.Xaml.Application.Current; - } - catch - { - // Create a custom UWP XAML Application object that implements reflection-based XAML metadata probing. - application = new XamlApplication(); - } - } - } - } -} diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.sln b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.sln deleted file mode 100644 index 9d4d09868eb..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.sln +++ /dev/null @@ -1,116 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27703.2018 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{9AFF2EBF-08DA-44C1-AC09-187561FF1147}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{B8A39E8C-1B73-4A95-BB26-E92D39B7A932}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "XamlHost", "XamlHost", "{E3B3FB12-67C0-404C-BA3F-08E65BCC682C}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WebView", "WebView", "{C0C8A97B-5921-465A-880C-3D5098872295}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitTests.WebView.Shared", "Tests\UnitTests.WebView.Shared\UnitTests.WebView.Shared.csproj", "{B220BE88-944E-45D1-9248-6FAEF53868A3}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitTests.WebView.WinForms", "Tests\UnitTests.WebView.WinForms\UnitTests.WebView.WinForms.csproj", "{10129749-7761-49B8-96B9-94BC833BA60B}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitTests.WebView.WPF", "Tests\UnitTests.WebView.WPF\UnitTests.WebView.WPF.csproj", "{2E49400E-B114-4FAE-B743-6CB57B500E31}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Toolkit.Forms.UI.XamlHost", "Microsoft.Toolkit.Forms.UI.XamlHost\Microsoft.Toolkit.Forms.UI.XamlHost.csproj", "{B4911490-D52E-4CF2-BD14-BA487BDF2240}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Toolkit.Wpf.UI.XamlHost", "Microsoft.Toolkit.Wpf.UI.XamlHost\Microsoft.Toolkit.Wpf.UI.XamlHost.csproj", "{8861D7E9-A7C5-4174-8FCE-3DCDF33C318B}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Toolkit.Forms.UI.Controls", "Microsoft.Toolkit.Forms.UI.Controls\Microsoft.Toolkit.Forms.UI.Controls.csproj", "{9B054ABA-B5B4-42F4-8E29-97DCCF79C726}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Toolkit.Sample.Forms.WebView", "Microsoft.Toolkit.Sample.Forms.WebView\Microsoft.Toolkit.Sample.Forms.WebView.csproj", "{D103E448-64B1-407C-B09E-7C61AF9F2740}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Toolkit.Sample.Wpf.WebView", "Microsoft.Toolkit.Sample.Wpf.WebView\Microsoft.Toolkit.Sample.Wpf.WebView.csproj", "{2FE9AA6A-BD27-438F-9941-221033E4A1DD}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Toolkit.Sample.Wpf.XamlHost", "Microsoft.Toolkit.Sample.Wpf.XamlHost\Microsoft.Toolkit.Sample.Wpf.XamlHost.csproj", "{88C95EC5-6A53-4BA2-A885-24B23566C175}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Toolkit.Sample.Wpf.App", "Microsoft.Toolkit.Sample.Wpf.App\Microsoft.Toolkit.Sample.Wpf.App.csproj", "{45524ED2-8B5A-42E8-97A2-DCA44ECC83AA}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{78966152-2550-4FA3-BDAC-CBEB078E739F}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Toolkit.Wpf.UI.Controls", "Microsoft.Toolkit.Wpf.UI.Controls\Microsoft.Toolkit.Wpf.UI.Controls.csproj", "{B131E361-78CE-489B-B2C4-130C5FEB70F4}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Toolkit.Forms.UI.Controls.WebView", "Microsoft.Toolkit.Forms.UI.Controls.WebView\Microsoft.Toolkit.Forms.UI.Controls.WebView.csproj", "{A6F9DAE8-8CDC-4693-83E7-C9C59D1477FE}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Toolkit.Wpf.UI.Controls.WebView", "Microsoft.Toolkit.Wpf.UI.Controls.WebView\Microsoft.Toolkit.Wpf.UI.Controls.WebView.csproj", "{F8393C4E-4501-4CC2-8767-ABFE3AD1C0FB}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {B220BE88-944E-45D1-9248-6FAEF53868A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B220BE88-944E-45D1-9248-6FAEF53868A3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B220BE88-944E-45D1-9248-6FAEF53868A3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {10129749-7761-49B8-96B9-94BC833BA60B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {10129749-7761-49B8-96B9-94BC833BA60B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {10129749-7761-49B8-96B9-94BC833BA60B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2E49400E-B114-4FAE-B743-6CB57B500E31}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2E49400E-B114-4FAE-B743-6CB57B500E31}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2E49400E-B114-4FAE-B743-6CB57B500E31}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B4911490-D52E-4CF2-BD14-BA487BDF2240}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B4911490-D52E-4CF2-BD14-BA487BDF2240}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B4911490-D52E-4CF2-BD14-BA487BDF2240}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B4911490-D52E-4CF2-BD14-BA487BDF2240}.Release|Any CPU.Build.0 = Release|Any CPU - {8861D7E9-A7C5-4174-8FCE-3DCDF33C318B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8861D7E9-A7C5-4174-8FCE-3DCDF33C318B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8861D7E9-A7C5-4174-8FCE-3DCDF33C318B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8861D7E9-A7C5-4174-8FCE-3DCDF33C318B}.Release|Any CPU.Build.0 = Release|Any CPU - {9B054ABA-B5B4-42F4-8E29-97DCCF79C726}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9B054ABA-B5B4-42F4-8E29-97DCCF79C726}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9B054ABA-B5B4-42F4-8E29-97DCCF79C726}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9B054ABA-B5B4-42F4-8E29-97DCCF79C726}.Release|Any CPU.Build.0 = Release|Any CPU - {D103E448-64B1-407C-B09E-7C61AF9F2740}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D103E448-64B1-407C-B09E-7C61AF9F2740}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D103E448-64B1-407C-B09E-7C61AF9F2740}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2FE9AA6A-BD27-438F-9941-221033E4A1DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2FE9AA6A-BD27-438F-9941-221033E4A1DD}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2FE9AA6A-BD27-438F-9941-221033E4A1DD}.Release|Any CPU.ActiveCfg = Release|Any CPU - {88C95EC5-6A53-4BA2-A885-24B23566C175}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {88C95EC5-6A53-4BA2-A885-24B23566C175}.Debug|Any CPU.Build.0 = Debug|Any CPU - {88C95EC5-6A53-4BA2-A885-24B23566C175}.Release|Any CPU.ActiveCfg = Release|Any CPU - {45524ED2-8B5A-42E8-97A2-DCA44ECC83AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {45524ED2-8B5A-42E8-97A2-DCA44ECC83AA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {45524ED2-8B5A-42E8-97A2-DCA44ECC83AA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B131E361-78CE-489B-B2C4-130C5FEB70F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B131E361-78CE-489B-B2C4-130C5FEB70F4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B131E361-78CE-489B-B2C4-130C5FEB70F4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B131E361-78CE-489B-B2C4-130C5FEB70F4}.Release|Any CPU.Build.0 = Release|Any CPU - {A6F9DAE8-8CDC-4693-83E7-C9C59D1477FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A6F9DAE8-8CDC-4693-83E7-C9C59D1477FE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A6F9DAE8-8CDC-4693-83E7-C9C59D1477FE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A6F9DAE8-8CDC-4693-83E7-C9C59D1477FE}.Release|Any CPU.Build.0 = Release|Any CPU - {F8393C4E-4501-4CC2-8767-ABFE3AD1C0FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F8393C4E-4501-4CC2-8767-ABFE3AD1C0FB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F8393C4E-4501-4CC2-8767-ABFE3AD1C0FB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F8393C4E-4501-4CC2-8767-ABFE3AD1C0FB}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {9AFF2EBF-08DA-44C1-AC09-187561FF1147} = {C0C8A97B-5921-465A-880C-3D5098872295} - {B8A39E8C-1B73-4A95-BB26-E92D39B7A932} = {C0C8A97B-5921-465A-880C-3D5098872295} - {B220BE88-944E-45D1-9248-6FAEF53868A3} = {9AFF2EBF-08DA-44C1-AC09-187561FF1147} - {10129749-7761-49B8-96B9-94BC833BA60B} = {9AFF2EBF-08DA-44C1-AC09-187561FF1147} - {2E49400E-B114-4FAE-B743-6CB57B500E31} = {9AFF2EBF-08DA-44C1-AC09-187561FF1147} - {B4911490-D52E-4CF2-BD14-BA487BDF2240} = {E3B3FB12-67C0-404C-BA3F-08E65BCC682C} - {8861D7E9-A7C5-4174-8FCE-3DCDF33C318B} = {E3B3FB12-67C0-404C-BA3F-08E65BCC682C} - {D103E448-64B1-407C-B09E-7C61AF9F2740} = {B8A39E8C-1B73-4A95-BB26-E92D39B7A932} - {2FE9AA6A-BD27-438F-9941-221033E4A1DD} = {B8A39E8C-1B73-4A95-BB26-E92D39B7A932} - {88C95EC5-6A53-4BA2-A885-24B23566C175} = {78966152-2550-4FA3-BDAC-CBEB078E739F} - {45524ED2-8B5A-42E8-97A2-DCA44ECC83AA} = {78966152-2550-4FA3-BDAC-CBEB078E739F} - {78966152-2550-4FA3-BDAC-CBEB078E739F} = {E3B3FB12-67C0-404C-BA3F-08E65BCC682C} - {A6F9DAE8-8CDC-4693-83E7-C9C59D1477FE} = {C0C8A97B-5921-465A-880C-3D5098872295} - {F8393C4E-4501-4CC2-8767-ABFE3AD1C0FB} = {C0C8A97B-5921-465A-880C-3D5098872295} - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {AFDF3CA9-FBAD-4C80-A08A-7B69D21D561E} - EndGlobalSection -EndGlobal diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls.WebView/DispatcherExtensions.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls.WebView/DispatcherExtensions.cs deleted file mode 100644 index b3f97b11a20..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls.WebView/DispatcherExtensions.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Diagnostics; -using System.Windows.Threading; - -namespace Microsoft.Toolkit.Wpf.UI.Controls -{ - /// - /// Provides additional functionality to the object. - /// - internal static class DispatcherExtensions - { - /// - /// Pushes an empty at . - /// - /// A instance. - /// The of the idle frame. - /// - /// No frame is pushed if the is null, is true, or is true. - /// - [DebuggerStepThrough] - internal static void DoEvents(this Dispatcher dispatcher, DispatcherPriority priority = DispatcherPriority.ContextIdle) - { - object ExitFrame(object arg) - { - ((DispatcherFrame)arg).Continue = false; - return null; - } - - // Check if we have a valid dispatcher - if (dispatcher != null - && !dispatcher.HasShutdownStarted - && !dispatcher.HasShutdownFinished) - { - // Set the priority to ContextIdle to force the queue to flush higher priority events - var frame = new DispatcherFrame(); - dispatcher.BeginInvoke( - priority, - new DispatcherOperationCallback(ExitFrame), - frame); - Dispatcher.PushFrame(frame); - } - } - } -} diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls.WebView/IWebViewCompatibleAdapter.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls.WebView/IWebViewCompatibleAdapter.cs deleted file mode 100644 index 8dc4ac6a44e..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls.WebView/IWebViewCompatibleAdapter.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Windows; -using Microsoft.Toolkit.UI.Controls; - -namespace Microsoft.Toolkit.Wpf.UI.Controls -{ - public interface IWebViewCompatibleAdapter : IWebViewCompatible - { - FrameworkElement View { get; } - - void Initialize(); - } -} diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls.WebView/Microsoft.Toolkit.Wpf.UI.Controls.WebView.csproj b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls.WebView/Microsoft.Toolkit.Wpf.UI.Controls.WebView.csproj deleted file mode 100644 index 429d96a669e..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls.WebView/Microsoft.Toolkit.Wpf.UI.Controls.WebView.csproj +++ /dev/null @@ -1,63 +0,0 @@ - - - - net462 - Microsoft.Toolkit.Wpf.UI.Controls - Microsoft.Toolkit.Wpf.UI.Controls.WebView - true - - Windows Community Toolkit WPF WebView Control - This library provides XAML controls for WPF WebView. It is part of the Windows Community Toolkit. - WebView Win32 WPF XAML - - $(DefineConstants);WPF - - 10.0.17134.0 - - - - $(DefineConstants);DEV_DEBUG;DEBUG_LAYOUT - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - $(WINDIR)\Microsoft.NET\Framework\v4.0.30319\System.Runtime.WindowsRuntime.dll - - - - - - - diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls.WebView/Properties/AssemblyInfo.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls.WebView/Properties/AssemblyInfo.cs deleted file mode 100644 index 9d9fff27852..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls.WebView/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Resources; -using System.Runtime.InteropServices; - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -[assembly: NeutralResourcesLanguage("en-US")] \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls.WebView/TaskExtensions.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls.WebView/TaskExtensions.cs deleted file mode 100644 index d02726770d9..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls.WebView/TaskExtensions.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Windows.Threading; - -namespace System.Threading.Tasks -{ - /// - /// Contains extensions to process a task within a nested Windows Presentation Foundation (WPF) message loop - /// - internal static partial class TaskExtensions - { - public static T WaitWithNestedMessageLoop(this Task task, Dispatcher dispatcher) - { - // Check if we have a valid dispatcher - if (dispatcher != null - && !dispatcher.HasShutdownStarted - && !dispatcher.HasShutdownFinished) - { - // Set the priority to ContextIdle to force the queue to flush higher priority events - var frame = new DispatcherFrame(); - task.ContinueWith(_ => frame.Continue = false, TaskScheduler.Default); - Dispatcher.PushFrame(frame); - } - - return task.Result; - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls.WebView/VisualStudioToolsManifest.xml b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls.WebView/VisualStudioToolsManifest.xml deleted file mode 100644 index 07c468d7e73..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls.WebView/VisualStudioToolsManifest.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls.WebView/WebBaseCompatibilityAdapter.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls.WebView/WebBaseCompatibilityAdapter.cs deleted file mode 100644 index a7aeddae66c..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls.WebView/WebBaseCompatibilityAdapter.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Windows; -using System.Windows.Data; -using Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT; - -namespace Microsoft.Toolkit.Wpf.UI.Controls -{ - internal abstract class WebBaseCompatibilityAdapter : DependencyObject, IWebViewCompatibleAdapter - { - public abstract event EventHandler ContentLoading; - - public abstract event EventHandler NavigationCompleted; - - public abstract event EventHandler NavigationStarting; - - public static DependencyProperty SourceProperty { get; } = DependencyProperty.Register(nameof(Source), typeof(Uri), typeof(WebBaseCompatibilityAdapter)); - - public abstract bool CanGoBack { get; } - - public abstract bool CanGoForward { get; } - - public abstract Uri Source { get; set; } - - public abstract FrameworkElement View { get; } - - public abstract bool GoBack(); - - public abstract bool GoForward(); - - public abstract void Initialize(); - - public abstract string InvokeScript(string scriptName); - - public abstract void Navigate(Uri url); - - public abstract void Navigate(string url); - - public abstract void Refresh(); - - public abstract void Stop(); - - protected void Bind(string propertyName, DependencyProperty wpfProperty, DependencyObject source) - { - var binder = new Binding() - { - Source = source, - Path = new PropertyPath(propertyName), - Mode = BindingMode.TwoWay - }; - BindingOperations.SetBinding(this, wpfProperty, binder); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls.WebView/WebBrowserCompatibilityAdapter.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls.WebView/WebBrowserCompatibilityAdapter.cs deleted file mode 100644 index 014355d77e1..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls.WebView/WebBrowserCompatibilityAdapter.cs +++ /dev/null @@ -1,126 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Navigation; -using Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT; - -namespace Microsoft.Toolkit.Wpf.UI.Controls -{ - internal sealed class WebBrowserCompatibilityAdapter : WebBaseCompatibilityAdapter, IDisposable - { - private WebBrowser _browser; - - private void OnBrowserNavigated(object sender, NavigationEventArgs e) - { - NavigationCompleted?.Invoke(sender, e); - } - - private void OnBrowserNavigating(object sender, NavigatingCancelEventArgs e) - { - NavigationStarting?.Invoke(sender, e); - ContentLoading?.Invoke(sender, e); - } - - public WebBrowserCompatibilityAdapter() - { - _browser = new WebBrowser(); - } - - public override Uri Source - { - get => _browser?.Source; - set - { - if (_browser != null) - { - _browser.Source = value; - } - } - } - - public override bool CanGoBack => _browser?.CanGoBack ?? false; - - public override bool CanGoForward => _browser?.CanGoForward ?? false; - - public override FrameworkElement View => _browser; - - /// - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - ~WebBrowserCompatibilityAdapter() - { - Dispose(false); - } - - public override event EventHandler NavigationStarting; - - public override event EventHandler ContentLoading; - - public override event EventHandler NavigationCompleted; - - public override bool GoBack() - { - _browser?.GoBack(); - return true; - } - - public override bool GoForward() - { - _browser?.GoForward(); - return true; - } - - public override string InvokeScript(string scriptName) - { - return _browser?.InvokeScript(scriptName)?.ToString(); - } - - public override void Navigate(Uri url) - { - _browser?.Navigate(url); - } - - public override void Navigate(string url) - { - _browser?.Navigate(url); - } - - public override void Refresh() - { - _browser?.Refresh(); - } - - public override void Stop() - { - // REVIEW: Not supported? Would need to track navigation state internally and invoke cancel on navigating - } - - public override void Initialize() - { - _browser.Navigating += OnBrowserNavigating; - _browser.LoadCompleted += OnBrowserNavigated; - Bind(nameof(Source), SourceProperty, _browser); - } - - private void Dispose(bool disposing) - { - if (disposing) - { - if (_browser != null) - { - _browser.Dispose(); - } - - _browser = null; - } - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls.WebView/WebView.Dispatch.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls.WebView/WebView.Dispatch.cs deleted file mode 100644 index d1d17127f1f..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls.WebView/WebView.Dispatch.cs +++ /dev/null @@ -1,121 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Diagnostics; -using System.Windows; -using System.Windows.Threading; -using Microsoft.Toolkit.Win32.UI.Controls; - -namespace Microsoft.Toolkit.Wpf.UI.Controls -{ - /// - /// Contains dispatcher code - /// - public sealed partial class WebView - { - private const int InitializationBlockingTime = 200; - - /// - /// Dispatches a blank frame to allow dispatcher queue to flush. If WebViewControl is not initialized, waits for control - /// to be loaded by subscribing to Loaded event. Once loaded finishes blocking until control is initialized, then - /// dispatches a message to perform the - /// - /// The callback to perform after loaded - /// - /// This exists to - /// - private void InvokeAfterInitializing(Action callback) - { - if (callback == null) - { - throw new ArgumentNullException(nameof(callback)); - } - - // Fast path: if the control is already initialized call the callback directly - if (WebViewControlInitialized) - { - callback(); - } - - // Slower path: control is already loaded, but web view is not initialized - else if (IsLoaded) - { - // Block until the web view initialization is completed on the dispatcher - InvokeAfterInitializing(); - callback(); - } - - // Slow path: wait for Loaded event and re-enter - else - { - void OnLoaded(object o, RoutedEventArgs e) - { - // This fires early in the cycle. - // Unwire the event - Loaded -= OnLoaded; - - // And re-enter the method. IsLoaded will be true - InvokeAfterInitializing(callback); - } - - // Wait for Loaded event to fire, meaning WPF has created most of what is needed for HwndHost to proceed - Loaded += OnLoaded; - } - } - - /// - /// Dispatches a blank frame to allow dispatcher queue to flush. If WebViewControl is not initialized, waits for control - /// to be loaded by subscribing to Loaded event. Once loaded finishes blocking until control is initialized, then - /// dispatches a message to perform the - /// - /// The callback to perform after loaded - /// - /// This exists to - /// - /// The type of the return value. - /// The result of - /// Occurs when the callback cannot be completed because the control is not yet loaded. - private T InvokeAfterInitializing(Func callback) - { - if (callback == null) - { - throw new ArgumentNullException(nameof(callback)); - } - - // Fast path: if the control is already initialized call the callback directly - if (WebViewControlInitialized) - { - return callback(); - } - - // Slightly slower path: control is already loaded, but web view not initialized - if (IsLoaded) - { - // Block until the web view initialization is completed on the dispatcher - InvokeAfterInitializing(); - return callback(); - } - - // Not possible: we would need to wait for loaded event - // but may be called early enough in the lifetime where the dispatcher thread is the UI thread - // such as after InitializeComponents in MainWindow - throw new InvalidOperationException(DesignerUI.E_WEBVIEW_CANNOT_INVOKE_BEFORE_INIT); - } - - /// - /// Dispatches empty frames to Dispatcher queue while web view is initializing to keep UI responsive - /// - /// - [DebuggerStepThrough] - private void InvokeAfterInitializing(DispatcherPriority priority = DispatcherPriority.ContextIdle) - { - do - { - Dispatcher.CurrentDispatcher.DoEvents(priority); - } - while (!_initializationComplete.WaitOne(InitializationBlockingTime)); - } - } -} diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls.WebView/WebView.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls.WebView/WebView.cs deleted file mode 100644 index 7c14da4c52b..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls.WebView/WebView.cs +++ /dev/null @@ -1,1227 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.ComponentModel; -using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; -using System.IO; -using System.Net.Http; -using System.Runtime.InteropServices; -using System.Security; -using System.Threading; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Threading; -using Microsoft.Toolkit.UI.Controls; -using Microsoft.Toolkit.Win32.UI.Controls; -using Microsoft.Toolkit.Win32.UI.Controls.Interop; -using Microsoft.Toolkit.Win32.UI.Controls.Interop.Win32; -using Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT; -using Point = Windows.Foundation.Point; -using Size = Windows.Foundation.Size; - -/* - -Overview of Keyboard Input Routing for IWebViewControl - -The window hosting IWebViewControl receives regular alphanumeric keyboard input via its WndProc, and whoever is running the message loop -calls DispatchMessage() after any preprocessing and special routing, and the message gets to the WndProc of the window with focus. "Accelerator" -keys need to be passed to the IWebViewControl via TranslateAccelerator() - -However, due to the way the window is hosted out of process, we are not able to intercept those messages. As such we have no support to handle -tabbing in or out of the IWebBrowserControl window. - -NOTE: Depending on how the control is hosted, input messages flow different - - */ - -namespace Microsoft.Toolkit.Wpf.UI.Controls -{ - /// - /// This class is an implementation of for WPF. This class cannot be inherited. - /// - /// - /// - [ToolboxItem(true)] - [DesignTimeVisible(true)] - public sealed partial class WebView : WebViewHost, IWebView, IWebViewCompatible - { - private static readonly DependencyProperty EnterpriseIdProperty = DependencyProperty.Register( - nameof(EnterpriseId), - typeof(string), - typeof(WebView), - new PropertyMetadata(WebViewDefaults.EnterpriseId, PropertyChangedCallback)); - - private static readonly Hashtable InvalidatorMap = new Hashtable(); - - private static readonly DependencyProperty IsIndexedDBEnabledProperty = DependencyProperty.Register( - nameof(IsIndexedDBEnabled), - typeof(bool), - typeof(WebView), - new PropertyMetadata(WebViewDefaults.IsIndexedDBEnabled, PropertyChangedCallback)); - - private static readonly DependencyProperty IsJavaScriptEnabledProperty = DependencyProperty.Register( - nameof(IsJavaScriptEnabled), - typeof(bool), - typeof(WebView), - new PropertyMetadata(WebViewDefaults.IsJavaScriptEnabled, PropertyChangedCallback)); - - private static readonly DependencyProperty IsPrivateNetworkClientServerCapabilityEnabledProperty = DependencyProperty.Register( - nameof(IsPrivateNetworkClientServerCapabilityEnabled), - typeof(bool), - typeof(WebView), - new PropertyMetadata(WebViewDefaults.IsPrivateNetworkEnabled, PropertyChangedCallback)); - - private static readonly DependencyProperty IsScriptNotifyAllowedProperty = DependencyProperty.Register( - nameof(IsScriptNotifyAllowed), - typeof(bool), - typeof(WebView), - new PropertyMetadata(WebViewDefaults.IsScriptNotifyEnabled, PropertyChangedCallback)); - - private static readonly bool IsWebPermissionRestricted = !Security.CallerAndAppDomainHaveUnrestrictedWebBrowserPermission(); - - private static readonly DependencyProperty SourceProperty = DependencyProperty.Register( - nameof(Source), - typeof(Uri), - typeof(WebView), - new FrameworkPropertyMetadata(WebViewDefaults.AboutBlankUri, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault | FrameworkPropertyMetadataOptions.Journal, PropertyChangedCallback)); - - private WebViewControlProcess _process; - - private volatile WebViewControlHost _webViewControl; - - // Initialization flag for ISupportInitialize - private InitializationState _initializationState = InitializationState.Uninitialized; - - private ManualResetEvent _initializationComplete; - - [SecuritySafeCritical] - [SuppressMessage("Microsoft.Design", "CA1065", Justification = "Exceptions thrown to fail as fast as possible.")] - static WebView() - { -#pragma warning disable 1065 - if (IsWebPermissionRestricted) - { - // Could be hosted in non-IE browser (e.g. Firefox) as an Internet-zone XBAP - // Could also be a standalone ClickOnce application - - // Either way, we don't currently support this - throw new NotSupportedException(DesignerUI.E_WEB_PERMISSION_RESTRICTED); - } - - // ClickOnce uses AppLaunch.exe to host partial-trust applications -#pragma warning disable SA1129 // Do not use default value type constructor - var hostProcessName = Path.GetFileName(UnsafeNativeMethods.GetModuleFileName(new HandleRef())); -#pragma warning restore SA1129 // Do not use default value type constructor - if (string.Compare(hostProcessName, "AppLaunch.exe", StringComparison.OrdinalIgnoreCase) == 0) - { - // Not currently supported - throw new NotSupportedException(DesignerUI.E_CLICKONCE_PARTIAL_TRUST); - } - - // Haven't tested with MTA - Verify.IsApartmentState(ApartmentState.STA); - - // TODO: Assign Feature Control Keys - - // We use this map to lookup which invalidator method to call when the parent's properties change - InvalidatorMap[VisibilityProperty] = new PropertyInvalidator(OnVisibilityInvalidated); - InvalidatorMap[IsEnabledProperty] = new PropertyInvalidator(OnIsEnabledInvalidated); -#pragma warning restore 1065 - } - - private bool WebViewInitialized => _initializationState == InitializationState.IsInitialized; - - private bool WebViewInitializing => _initializationState == InitializationState.IsInitializing; - - private bool WebViewControlInitialized => _webViewControl != null && WebViewInitialized; - - /// - /// Initializes a new instance of the class. - /// - [SecurityCritical] - public WebView() - { - // TODO: Check whether browser is disabled - // TODO: Handle case (OnLoad) for handling POPUP windows - _initializationComplete = new ManualResetEvent(false); - } - - [SecurityCritical] - public WebView(WebViewControlProcess process) - : this() - { - _process = process; - } - - internal WebView(WebViewControlHost webViewControl) - : this() - { - _webViewControl = webViewControl ?? throw new ArgumentNullException(nameof(webViewControl)); - _process = webViewControl.Process; - } - - /// - /// Starts the initialization process for this element. - /// - /// - /// May occur if the element is already initialized or is already initializing. - /// - /// - public override void BeginInit() - { - if (WebViewInitialized) - { - // Cannot initialize WebView since it is already completely initialized - throw new InvalidOperationException(DesignerUI.E_WEBVIEW_ALREADY_INITIALIZED); - } - - if (WebViewInitializing) - { - // Cannot initialize WebView since it is already being initialized - throw new InvalidOperationException(DesignerUI.E_WEBVIEW_ALREADY_INITIALIZING); - } - - _initializationState = InitializationState.IsInitializing; - - base.BeginInit(); - } - - /// - /// Indicates that the initialization process for the element is complete. - /// - /// May occur when is not previously called. - /// - public override void EndInit() - { - if (!WebViewInitializing) - { - // Cannot complete WebView initialization that is not being initialized - throw new InvalidOperationException(DesignerUI.E_WEBVIEW_NOT_INITIALIZING); - } - - base.EndInit(); - } - - // Ensures this class is initialized. Initialization involves using ISupportInitialize methods - private void EnsureInitialized() - { - // If not already initialized and not already initializing - if (!WebViewInitialized && !WebViewInitializing) - { - BeginInit(); - EndInit(); - } - } - - private delegate void PropertyInvalidator(WebView webViewHost); - - /// - public event EventHandler AcceleratorKeyPressed = (sender, args) => { }; - - /// - [SuppressMessage("Microsoft.Design", "CA1009:DeclareEventHandlersCorrectly", Justification = "Event does not provide argument deriving from EventArgs")] - [StringResourceCategory(Constants.CategoryAction)] - [StringResourceDescription(Constants.DescriptionWebViewContainsFullScreenElement)] - public event EventHandler ContainsFullScreenElementChanged = (sender, args) => { }; - - /// - [StringResourceCategory(Constants.CategoryAction)] - [StringResourceDescription(Constants.DescriptionWebViewContentLoading)] - public event EventHandler ContentLoading = (sender, args) => { }; - - /// - [StringResourceCategory(Constants.CategoryAction)] - [StringResourceDescription(Constants.DescriptionWebViewDomContentLoaded)] - public event EventHandler DOMContentLoaded = (sender, args) => { }; - - /// - [StringResourceCategory(Constants.CategoryAction)] - [StringResourceDescription(Constants.DescriptionWebViewFrameContentLoading)] - public event EventHandler FrameContentLoading = (sender, args) => { }; - - /// - [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "DOM", Justification = "Name is the same as the WinRT type")] - [StringResourceCategory(Constants.CategoryAction)] - [StringResourceDescription(Constants.DescriptionWebViewFrameDomContentLoaded)] - public event EventHandler FrameDOMContentLoaded = (sender, args) => { }; - - /// - [StringResourceCategory(Constants.CategoryAction)] - [StringResourceDescription(Constants.DescriptionWebViewFrameNavigationCompleted)] - public event EventHandler FrameNavigationCompleted = (sender, args) => { }; - - /// - [StringResourceCategory(Constants.CategoryAction)] - [StringResourceDescription(Constants.DescriptionWebViewFrameNavigationStarting)] - public event EventHandler FrameNavigationStarting = (sender, args) => { }; - - /// - [StringResourceCategory(Constants.CategoryAction)] - [StringResourceDescription(Constants.DescriptionWebViewLongRunningScriptDetected)] - public event EventHandler LongRunningScriptDetected = (sender, args) => { }; - - /// - [StringResourceCategory(Constants.CategoryAction)] - [StringResourceDescription(Constants.DescriptionWebViewMoveFocusRequested)] - public event EventHandler MoveFocusRequested = (sender, args) => { }; - - /// - [StringResourceCategory(Constants.CategoryAction)] - [StringResourceDescription(Constants.DescriptionWebViewNavigationCompleted)] - public event EventHandler NavigationCompleted = (sender, args) => { }; - - /// - [StringResourceCategory(Constants.CategoryAction)] - [StringResourceDescription(Constants.DescriptionWebViewNavigationStarting)] - public event EventHandler NavigationStarting = (sender, args) => { }; - - /// - [StringResourceCategory(Constants.CategoryAction)] - [StringResourceDescription(Constants.DescriptionWebViewNewWindowRequested)] - public event EventHandler NewWindowRequested = (sender, args) => { }; - - /// - [StringResourceCategory(Constants.CategoryAction)] - [StringResourceDescription(Constants.DescriptionWebViewPermissionRequested)] - public event EventHandler PermissionRequested = (sender, args) => { }; - - /// - [StringResourceCategory(Constants.CategoryAction)] - [StringResourceDescription(Constants.DescriptionWebViewScriptNotify)] - public event EventHandler ScriptNotify = (sender, args) => { }; - - /// - [SuppressMessage("Microsoft.Design", "CA1009:DeclareEventHandlersCorrectly", Justification = "WinRT type signature does not have argument that inherits from EventArgs")] - [StringResourceCategory(Constants.CategoryAction)] - [StringResourceDescription(Constants.DescriptionWebViewUnsafeContentWarningDisplaying)] - public event EventHandler UnsafeContentWarningDisplaying = (sender, args) => { }; - - /// - [StringResourceCategory(Constants.CategoryAction)] - [StringResourceDescription(Constants.DescriptionWebViewUnsupportedUriSchemeIdentified)] - public event EventHandler UnsupportedUriSchemeIdentified = (sender, args) => { }; - - /// - [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Unviewable", Justification = "Unviewable is in WinRT type")] - public event EventHandler UnviewableContentIdentified = (sender, args) => { }; - - /// - /// Gets a value indicating whether is supported in this environment. - /// - /// if this instance is supported; otherwise, . - public static bool IsSupported => WebViewControlHost.IsSupported; - - /// - public bool CanGoBack - { - get - { - VerifyAccess(); - Verify.IsNotNull(_webViewControl); - return _webViewControl?.CanGoBack ?? false; - } - } - - /// - public bool CanGoForward - { - get - { - VerifyAccess(); - Verify.IsNotNull(_webViewControl); - return _webViewControl?.CanGoForward ?? false; - } - } - - /// - public bool ContainsFullScreenElement - { - get - { - VerifyAccess(); - Verify.IsNotNull(_webViewControl); - return _webViewControl?.ContainsFullScreenElement ?? false; - } - } - - /// - public string DocumentTitle - { - get - { - VerifyAccess(); - Verify.IsNotNull(_webViewControl); - return _webViewControl?.DocumentTitle ?? string.Empty; - } - } - - /// - [StringResourceCategory(Constants.CategoryBehavior)] - [DefaultValue(WebViewDefaults.EnterpriseId)] - public string EnterpriseId - { - get => (string)GetValue(EnterpriseIdProperty); - set => SetValue(EnterpriseIdProperty, value); - } - - /// - [StringResourceCategory(Constants.CategoryBehavior)] - [DefaultValue(WebViewDefaults.IsIndexedDBEnabled)] - public bool IsIndexedDBEnabled - { - get => (bool)GetValue(IsIndexedDBEnabledProperty); - set => SetValue(IsIndexedDBEnabledProperty, value); - } - - /// - [StringResourceCategory(Constants.CategoryBehavior)] - [DefaultValue(WebViewDefaults.IsJavaScriptEnabled)] - public bool IsJavaScriptEnabled - { - get => (bool)GetValue(IsJavaScriptEnabledProperty); - set => SetValue(IsJavaScriptEnabledProperty, value); - } - - /// - [StringResourceCategory(Constants.CategoryBehavior)] - [DefaultValue(WebViewDefaults.IsPrivateNetworkEnabled)] - public bool IsPrivateNetworkClientServerCapabilityEnabled - { - get => (bool)GetValue(IsPrivateNetworkClientServerCapabilityEnabledProperty); - set => SetValue(IsPrivateNetworkClientServerCapabilityEnabledProperty, value); - } - - /// - [StringResourceCategory(Constants.CategoryBehavior)] - [DefaultValue(WebViewDefaults.IsScriptNotifyEnabled)] - public bool IsScriptNotifyAllowed - { - get => (bool)GetValue(IsScriptNotifyAllowedProperty); - set => SetValue(IsScriptNotifyAllowedProperty, value); - } - - /// - /// Gets or sets a value indicating whether this instance is web view visible. - /// - /// if this instance is web view visible; otherwise, . - [Browsable(false)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public bool IsWebViewVisible - { - get - { - VerifyAccess(); - Verify.IsNotNull(_webViewControl); - return _webViewControl?.IsVisible ?? false; - } - - set - { - Verify.IsNotNull(_webViewControl); - - if (_webViewControl != null) - { - _webViewControl.IsVisible = value; - } - } - } - - /// - [Browsable(false)] - public WebViewControlProcess Process - { - get - { - VerifyAccess(); - - // NOTE: Not really in the spirit of a Property - // Caller may need to share process, which case they will hand the - // Loaded event then attempt to use this property, which will return - // null if we do not wait for initialization - return InvokeAfterInitializing(() => - { - // Test code should never run into a null WebViewControl - Verify.IsNotNull(_webViewControl); - - // In production if a caller invokes the property before the - // control is properly initialized, just return null - return _webViewControl?.Process; - }); - } - } - - /// - [Browsable(false)] - public WebViewControlSettings Settings - { - get - { - VerifyAccess(); - - // Test code should never run into a null WebViewControl - Verify.IsNotNull(_webViewControl); - - // In production if a caller invokes the property before the - // control is properly initialized, just return null - return _webViewControl?.Settings; - } - } - - /// - public Uri Source - { - get - { - VerifyAccess(); - return _initializationState == InitializationState.IsInitialized - ? _webViewControl?.Source - : (Uri)GetValue(SourceProperty); - } - - set - { - VerifyAccess(); - SetValue(SourceProperty, value); - - if (_initializationState == InitializationState.IsInitialized) - { - Navigate(value); - } - } - } - - /// - [Browsable(false)] - public Version Version - { - get - { - VerifyAccess(); - - // Test code should never run into a null WebViewControl - Verify.IsNotNull(_webViewControl); - - // In production if a caller invokes the property before the - // control is properly initialized, just return null - return _webViewControl?.Version; - } - } - - /// - [Obsolete("This item has been depreciated and will be removed in a future version. Use AddInitializeScript(string script) instead.", false)] - public void AddPreLoadedScript(string script) => AddInitializeScript(script); - - /// - public void AddInitializeScript(string script) - { - VerifyAccess(); - - InvokeAfterInitializing(() => - { - Verify.IsNotNull(_webViewControl); - _webViewControl?.AddInitializeScript(script); - }); - } - - /// - public override void Close() - { - // TODO: Guard IsDisposed - UnsubscribeEvents(); - _webViewControl?.Close(); - _webViewControl?.Dispose(); - - _webViewControl = null; - _process = null; - } - - protected override void Dispose(bool disposing) - { - base.Dispose(disposing); - _initializationComplete.Dispose(); - } - - /// - public WebViewControlDeferredPermissionRequest GetDeferredPermissionRequestById(uint id) - { - VerifyAccess(); - - return InvokeAfterInitializing(() => - { - Verify.IsNotNull(_webViewControl); - return _webViewControl?.GetDeferredPermissionRequestById(id); - }); - } - - /// - public bool GoBack() - { - VerifyAccess(); - - return InvokeAfterInitializing(() => - { - Verify.IsNotNull(_webViewControl); - return _webViewControl?.GoBack() ?? false; - }); - } - - /// - public bool GoForward() - { - VerifyAccess(); - - return InvokeAfterInitializing(() => - { - Verify.IsNotNull(_webViewControl); - return _webViewControl?.GoForward() ?? false; - }); - } - - /// - public string InvokeScript(string scriptName) => InvokeScript(scriptName, null); - - /// - public string InvokeScript(string scriptName, params string[] arguments) => InvokeScript(scriptName, (IEnumerable)arguments); - - /// - public string InvokeScript(string scriptName, IEnumerable arguments) - { - VerifyAccess(); - - return InvokeAfterInitializing(() => - { - Verify.IsNotNull(_webViewControl); - - // WebViewControlHost ends up calling InvokeScriptAsync anyway - // The problem we have is that InvokeScript could be called from a UI thread and waiting for an async result that could lead to deadlock - return InvokeScriptAsync(scriptName, arguments).WaitWithNestedMessageLoop(Dispatcher.CurrentDispatcher); - }); - } - - /// - public Task InvokeScriptAsync(string scriptName) - { - VerifyAccess(); - - return InvokeAfterInitializing(() => - { - Verify.IsNotNull(_webViewControl); - return _webViewControl?.InvokeScriptAsync(scriptName); - }); - } - - /// - public Task InvokeScriptAsync(string scriptName, params string[] arguments) - { - VerifyAccess(); - - return InvokeAfterInitializing(() => - { - Verify.IsNotNull(_webViewControl); - return _webViewControl?.InvokeScriptAsync(scriptName, arguments); - }); - } - - /// - public Task InvokeScriptAsync(string scriptName, IEnumerable arguments) - { - VerifyAccess(); - - return InvokeAfterInitializing(() => - { - Verify.IsNotNull(_webViewControl); - return _webViewControl?.InvokeScriptAsync(scriptName, arguments); - }); - } - - /// - public void MoveFocus(WebViewControlMoveFocusReason reason) - { - VerifyAccess(); - InvokeAfterInitializing(() => - { - Verify.IsNotNull(_webViewControl); - _webViewControl?.MoveFocus(reason); - }); - } - - /// - public void Navigate(string source) - { - Navigate(UriHelper.StringToUri(source)); - } - - /// - public void Navigate(Uri source) - { - VerifyAccess(); - - // TODO: Support for pack:// - do - { - Dispatcher.CurrentDispatcher.DoEvents(); - } - while (!_initializationComplete.WaitOne(InitializationBlockingTime)); - - Verify.IsNotNull(_webViewControl); - _webViewControl.Navigate(source); - } - - /// - public void Navigate( - Uri requestUri, - HttpMethod httpMethod, - string content = null, - IEnumerable> headers = null) - { - VerifyAccess(); - - InvokeAfterInitializing(() => - { - Verify.IsNotNull(_webViewControl); - _webViewControl.Navigate(requestUri, httpMethod, content, headers); - }); - } - - /// - [Obsolete("Use NavigateToLocalStreamUri(Uri, IUriToStreamResolver) instead")] - public void NavigateToLocal(string relativePath) - { - VerifyAccess(); - - InvokeAfterInitializing(() => - { - Verify.IsNotNull(_webViewControl); - _webViewControl.NavigateToLocal(relativePath); - }); - } - - /// - public void NavigateToLocalStreamUri(Uri relativePath, IUriToStreamResolver streamResolver) - { - VerifyAccess(); - - InvokeAfterInitializing(() => - { - Verify.IsNotNull(_webViewControl); - _webViewControl.NavigateToLocalStreamUri(relativePath, streamResolver); - }); - } - - /// - public void NavigateToString(string text) - { - VerifyAccess(); - - InvokeAfterInitializing(() => - { - Verify.IsNotNull(_webViewControl); - _webViewControl.NavigateToString(text); - }); - } - - /// - public void Refresh() - { - VerifyAccess(); - InvokeAfterInitializing(() => - { - Verify.IsNotNull(_webViewControl); - _webViewControl?.Refresh(); - }); - } - - /// - public void Stop() - { - VerifyAccess(); - InvokeAfterInitializing(() => - { - Verify.IsNotNull(_webViewControl); - _webViewControl?.Stop(); - }); - } - - /// - protected override void Initialize() - { - OSVersionHelper.ThrowIfBeforeWindows10April2018(); - - DpiHelper.SetPerMonitorDpiAwareness(); - - Verify.AreEqual(_initializationState, InitializationState.IsInitializing); - - Dispatcher.InvokeAsync( - async () => - { - if (_process == null) - { - var privateNetworkEnabled = !Dispatcher.CheckAccess() - ? Dispatcher.Invoke(() => IsPrivateNetworkClientServerCapabilityEnabled) - : IsPrivateNetworkClientServerCapabilityEnabled; - var enterpriseId = !Dispatcher.CheckAccess() - ? Dispatcher.Invoke(() => EnterpriseId) - : EnterpriseId; - - _process = new WebViewControlProcess(new WebViewControlProcessOptions - { - PrivateNetworkClientServerCapability = privateNetworkEnabled - ? WebViewControlProcessCapabilityState.Enabled - : WebViewControlProcessCapabilityState.Disabled, - EnterpriseId = enterpriseId - }); - } - - Verify.IsNotNull(_process); - - if (_webViewControl == null) - { - var handle = ChildWindow.Handle; - var bounds = new Windows.Foundation.Rect(0, 0, RenderSize.Width * DpiScale.DpiScaleX, RenderSize.Height * DpiScale.DpiScaleY); - - _webViewControl = await _process.CreateWebViewControlHostAsync(handle, bounds).ConfigureAwait(false); - } - - Verify.IsNotNull(_webViewControl); - - if (!Dispatcher.CheckAccess()) - { - Dispatcher.Invoke(() => UpdateSize(RenderSize)); - } - else - { - UpdateSize(RenderSize); - } - - DestroyWindowCore(ChildWindow); - - SubscribeEvents(); - _webViewControl.IsVisible = true; - - Uri source; - bool javaScriptEnabled; - bool indexDBEnabled; - bool scriptNotifyAllowed; - if (!Dispatcher.CheckAccess()) - { - source = Dispatcher.Invoke(() => Source); - javaScriptEnabled = Dispatcher.Invoke(() => IsJavaScriptEnabled); - indexDBEnabled = Dispatcher.Invoke(() => IsIndexedDBEnabled); - scriptNotifyAllowed = Dispatcher.Invoke(() => IsScriptNotifyAllowed); - } - else - { - source = Source; - javaScriptEnabled = IsJavaScriptEnabled; - indexDBEnabled = IsIndexedDBEnabled; - scriptNotifyAllowed = IsScriptNotifyAllowed; - } - - _webViewControl.Settings.IsJavaScriptEnabled = javaScriptEnabled; - _webViewControl.Settings.IsIndexedDBEnabled = indexDBEnabled; - _webViewControl.Settings.IsScriptNotifyAllowed = scriptNotifyAllowed; - - // This will cause a navigate, make last property set - _webViewControl.Source = source; - - _initializationState = InitializationState.IsInitialized; - _initializationComplete.Set(); - }, - DispatcherPriority.Send); - } - - /// - /// Invoked whenever the effective value of any dependency property on this has been updated. The specific dependency property that changed is reported in the arguments parameter. Overrides . - /// - /// The event data that describes the property that changed, as well as old and new values. - /// - protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e) - { - base.OnPropertyChanged(e); - - var property = e.Property; - - // Look up the property in our map and call the appropriate method to push down - // the changed value to the hosted control - if (property != null && InvalidatorMap.ContainsKey(property)) - { - var invalidator = (PropertyInvalidator)InvalidatorMap[property]; - Verify.IsNotNull(invalidator); - invalidator(this); - } - } - - /// - protected override void UpdateBounds(Rect bounds) - { - UpdateBounds(bounds.X, bounds.Y, bounds.Width, bounds.Height); - } - - private static void OnIsEnabledInvalidated(WebView webView) - { - Verify.IsNotNull(webView); - Verify.IsNotNull(webView._webViewControl); - if (webView?._webViewControl != null) - { - // TODO: Is there an equivalent for Win32WebViewHost? - } - } - - private static void OnVisibilityInvalidated(WebView webView) - { - Verify.IsNotNull(webView); - Verify.IsNotNull(webView._webViewControl); - - if (webView?._webViewControl != null) - { - switch (webView.Visibility) - { - case System.Windows.Visibility.Visible: - webView._webViewControl.IsVisible = true; - break; - - case System.Windows.Visibility.Hidden: - webView._webViewControl.IsVisible = false; - break; - - case System.Windows.Visibility.Collapsed: - webView._webViewControl.IsVisible = false; - - // TODO: Update bounds to set PreferredSize? - break; - } - } - } - - private static void PropertyChangedCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs) - { - if (dependencyObject is WebView wv) - { - // Web View may not be initialized when setting dependency properties - // Dependency properties may be set in XAML, which would cause entry here; however, - // control is initialized asynchronously and may not be completed as of yet. The settings - // are then read by initialization and state transferred - if (dependencyPropertyChangedEventArgs.Property.Name == nameof(IsIndexedDBEnabled)) - { - if (wv.WebViewControlInitialized) - { - wv._webViewControl.Settings.IsIndexedDBEnabled = - (bool)dependencyPropertyChangedEventArgs.NewValue; - } - } - else if (dependencyPropertyChangedEventArgs.Property.Name == nameof(IsJavaScriptEnabled)) - { - if (wv.WebViewControlInitialized) - { - wv._webViewControl.Settings.IsJavaScriptEnabled = - (bool)dependencyPropertyChangedEventArgs.NewValue; - } - } - else if (dependencyPropertyChangedEventArgs.Property.Name == nameof(IsScriptNotifyAllowed)) - { - if (wv.WebViewControlInitialized) - { - wv._webViewControl.Settings.IsScriptNotifyAllowed = - (bool)dependencyPropertyChangedEventArgs.NewValue; - } - } - else if (dependencyPropertyChangedEventArgs.Property.Name == nameof(IsPrivateNetworkClientServerCapabilityEnabled)) - { - if (wv.WebViewControlInitialized) - { - throw new InvalidOperationException(DesignerUI.E_CANNOT_CHANGE_AFTER_INIT); - } - } - else if (dependencyPropertyChangedEventArgs.Property.Name == nameof(EnterpriseId)) - { - if (wv.WebViewControlInitialized) - { - throw new InvalidOperationException(DesignerUI.E_CANNOT_CHANGE_AFTER_INIT); - } - } - } - } - - private void OnAcceleratorKeyPressed(object sender, WebViewControlAcceleratorKeyPressedEventArgs args) - { - var handler = AcceleratorKeyPressed; - if (handler != null) - { - handler(this, args); - } - } - - private void OnContainsFullScreenElementChanged(object sender, object args) - { - var handler = ContainsFullScreenElementChanged; - if (handler != null) - { - handler(this, args); - } - } - - private void OnContentLoading(object sender, WebViewControlContentLoadingEventArgs args) - { - var handler = ContentLoading; - if (handler != null) - { - handler(this, args); - } - } - - private void OnDOMContentLoaded(object sender, WebViewControlDOMContentLoadedEventArgs args) - { - var handler = DOMContentLoaded; - if (handler != null) - { - handler(this, args); - } - } - - private void OnFrameContentLoading(object sender, WebViewControlContentLoadingEventArgs args) - { - var handler = FrameContentLoading; - if (handler != null) - { - handler(this, args); - } - } - - private void OnFrameDOMContentLoaded(object sender, WebViewControlDOMContentLoadedEventArgs args) - { - var handler = FrameDOMContentLoaded; - if (handler != null) - { - handler(this, args); - } - } - - private void OnFrameNavigationCompleted(object sender, WebViewControlNavigationCompletedEventArgs args) - { - var handler = FrameNavigationCompleted; - if (handler != null) - { - handler(this, args); - } - } - - private void OnFrameNavigationStarting(object sender, WebViewControlNavigationStartingEventArgs args) - { - var handler = FrameNavigationStarting; - if (handler != null) - { - handler(this, args); - } - } - - private void OnGotFocus(object sender, object args) - { - OnGotFocus(new RoutedEventArgs(GotFocusEvent)); - } - - private void OnLongRunningScriptDetected(object sender, WebViewControlLongRunningScriptDetectedEventArgs args) - { - var handler = LongRunningScriptDetected; - if (handler != null) - { - handler(this, args); - } - } - - private void OnLostFocus(object sender, object args) - { - OnLostFocus(new RoutedEventArgs(GotFocusEvent)); - } - - private void OnMoveFocusRequested(object sender, WebViewControlMoveFocusRequestedEventArgs args) - { - var handler = MoveFocusRequested; - if (handler != null) - { - handler(this, args); - } - } - - private void OnNavigationCompleted(object sender, WebViewControlNavigationCompletedEventArgs args) - { - VerifyAccess(); - Dispatcher.Invoke( - () => { SetCurrentValue(SourceProperty, args.Uri); }, - DispatcherPriority.DataBind); - - // We could have used - // if (NavigationCompleted != null) NavigationCompleted(this, args); - // However, if there is a subscriber and the moment the null check and the call to - // the event handler by the method is invoked, the subscriber may unsubscribe - // (e.g. on a different thread) and cause a NullReferenceException. - // To work around this create a temporally local variable to store the reference and check that - var handler = NavigationCompleted; - if (handler != null) - { - handler(this, args); - } - } - - private void OnNavigationStarting(object sender, WebViewControlNavigationStartingEventArgs args) - { - VerifyAccess(); - - var handler = NavigationStarting; - if (handler != null) - { - handler(this, args); - } - } - - private void OnNewWindowRequested(object sender, WebViewControlNewWindowRequestedEventArgs args) - { - var handler = NewWindowRequested; - if (handler != null) - { - handler(this, args); - } - } - - private void OnPermissionRequested(object sender, WebViewControlPermissionRequestedEventArgs args) - { - var handler = PermissionRequested; - if (handler != null) - { - handler(this, args); - } - } - - private void OnScriptNotify(object sender, WebViewControlScriptNotifyEventArgs args) - { - var handler = ScriptNotify; - if (handler != null) - { - handler(this, args); - } - } - - private void OnUnsafeContentWarningDisplaying(object sender, object args) - { - var handler = UnsafeContentWarningDisplaying; - if (handler != null) - { - handler(this, args); - } - } - - private void OnUnsupportedUriSchemeIdentified(object sender, WebViewControlUnsupportedUriSchemeIdentifiedEventArgs args) - { - var handler = UnsupportedUriSchemeIdentified; - if (handler != null) - { - handler(this, args); - } - } - - private void OnUnviewableContentIdentified(object sender, WebViewControlUnviewableContentIdentifiedEventArgs args) - { - var handler = UnviewableContentIdentified; - if (handler != null) - { - handler(this, args); - } - } - - private void SubscribeEvents() - { - Verify.IsNotNull(_webViewControl); - if (_webViewControl == null) - { - return; - } - - _webViewControl.AcceleratorKeyPressed += OnAcceleratorKeyPressed; - _webViewControl.ContainsFullScreenElementChanged += OnContainsFullScreenElementChanged; - _webViewControl.ContentLoading += OnContentLoading; - _webViewControl.DOMContentLoaded += OnDOMContentLoaded; - _webViewControl.FrameContentLoading += OnFrameContentLoading; - _webViewControl.FrameDOMContentLoaded += OnFrameDOMContentLoaded; - _webViewControl.FrameNavigationCompleted += OnFrameNavigationCompleted; - _webViewControl.FrameNavigationStarting += OnFrameNavigationStarting; - _webViewControl.GotFocus += OnGotFocus; - _webViewControl.LongRunningScriptDetected += OnLongRunningScriptDetected; - _webViewControl.LostFocus += OnLostFocus; - _webViewControl.MoveFocusRequested += OnMoveFocusRequested; - _webViewControl.NavigationCompleted += OnNavigationCompleted; - _webViewControl.NavigationStarting += OnNavigationStarting; - _webViewControl.NewWindowRequested += OnNewWindowRequested; - _webViewControl.PermissionRequested += OnPermissionRequested; - _webViewControl.ScriptNotify += OnScriptNotify; - _webViewControl.UnsafeContentWarningDisplaying += OnUnsafeContentWarningDisplaying; - _webViewControl.UnsupportedUriSchemeIdentified += OnUnsupportedUriSchemeIdentified; - _webViewControl.UnviewableContentIdentified += OnUnviewableContentIdentified; - } - - private void UnsubscribeEvents() - { - Verify.IsNotNull(_webViewControl); - if (_webViewControl == null) - { - return; - } - - _webViewControl.AcceleratorKeyPressed -= OnAcceleratorKeyPressed; - _webViewControl.ContainsFullScreenElementChanged -= OnContainsFullScreenElementChanged; - _webViewControl.ContentLoading -= OnContentLoading; - _webViewControl.DOMContentLoaded -= OnDOMContentLoaded; - _webViewControl.FrameContentLoading -= OnFrameContentLoading; - _webViewControl.FrameDOMContentLoaded -= OnFrameDOMContentLoaded; - _webViewControl.FrameNavigationCompleted -= OnFrameNavigationCompleted; - _webViewControl.FrameNavigationStarting -= OnFrameNavigationStarting; - _webViewControl.GotFocus -= OnGotFocus; - _webViewControl.LongRunningScriptDetected -= OnLongRunningScriptDetected; - _webViewControl.LostFocus -= OnLostFocus; - _webViewControl.MoveFocusRequested -= OnMoveFocusRequested; - _webViewControl.NavigationCompleted -= OnNavigationCompleted; - _webViewControl.NavigationStarting -= OnNavigationStarting; - _webViewControl.NewWindowRequested -= OnNewWindowRequested; - _webViewControl.PermissionRequested -= OnPermissionRequested; - _webViewControl.ScriptNotify -= OnScriptNotify; - _webViewControl.UnsafeContentWarningDisplaying -= OnUnsafeContentWarningDisplaying; - _webViewControl.UnsupportedUriSchemeIdentified -= OnUnsupportedUriSchemeIdentified; - _webViewControl.UnviewableContentIdentified -= OnUnviewableContentIdentified; - } - - private void UpdateBounds(double x, double y, double width, double height) - { -#if DEBUG_LAYOUT - Debug.WriteLine($"{Name}::{nameof(UpdateBounds)}"); - Debug.Indent(); - Debug.WriteLine($"oldBounds={{x={x:F0} y={y:F0} width={width:F0} height={height:F0}}}"); -#endif - - // Update bounds here to ensure correct draw position - width *= DpiScale.DpiScaleX; - height *= DpiScale.DpiScaleY; - - // HACK: looks like the vertical pos is counted twice, giving a gap - y = 0; - -#if DEBUG_LAYOUT - Debug.WriteLine($"newBounds={{x={x:F0} y={y:F0} width={width:F0} height={height:F0}}}"); -#endif - if (WebViewControlInitialized) - { - var rect = new Windows.Foundation.Rect( - new Point(x, y), - new Size(width, height)); - - _webViewControl?.UpdateBounds(rect); - } - -#if DEBUG_LAYOUT - Debug.Unindent(); -#endif - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls.WebView/WebViewCompatibilityAdapter.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls.WebView/WebViewCompatibilityAdapter.cs deleted file mode 100644 index 82b4b2ad286..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls.WebView/WebViewCompatibilityAdapter.cs +++ /dev/null @@ -1,126 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Windows; -using Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT; - -namespace Microsoft.Toolkit.Wpf.UI.Controls -{ - internal sealed class WebViewCompatibilityAdapter : WebBaseCompatibilityAdapter, IDisposable - { - private WebView _webView; - - public WebViewCompatibilityAdapter() - { - _webView = new WebView(); - } - - public override Uri Source - { - get => _webView?.Source; - set - { - if (_webView != null) - { - _webView.Source = value; - } - } - } - - public override FrameworkElement View => _webView; - - public override bool CanGoBack => _webView.CanGoBack; - - public override bool CanGoForward => _webView.CanGoForward; - - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - ~WebViewCompatibilityAdapter() - { - Dispose(false); - } - - public override event EventHandler NavigationStarting - { - add - { - _webView.NavigationStarting += value; - _webView.FrameNavigationStarting += value; - } - - remove - { - _webView.NavigationStarting -= value; - _webView.FrameNavigationStarting -= value; - } - } - - public override event EventHandler ContentLoading - { - add - { - _webView.ContentLoading += value; - _webView.FrameContentLoading += value; - } - - remove - { - _webView.ContentLoading -= value; - _webView.FrameContentLoading -= value; - } - } - - public override event EventHandler NavigationCompleted - { - add - { - _webView.NavigationCompleted += value; - _webView.FrameNavigationCompleted += value; - } - - remove - { - _webView.NavigationCompleted -= value; - _webView.FrameNavigationCompleted -= value; - } - } - - public override bool GoBack() => _webView?.GoBack() ?? false; - - public override bool GoForward() => _webView?.GoForward() ?? false; - - public override string InvokeScript(string scriptName) => _webView?.InvokeScript(scriptName); - - public override void Navigate(Uri url) => _webView?.Navigate(url); - - public override void Navigate(string url) => _webView?.Navigate(url); - - public override void Refresh() => _webView?.Refresh(); - - public override void Stop() => _webView?.Stop(); - - public override void Initialize() - { - Bind(nameof(Source), SourceProperty, _webView); - } - - private void Dispose(bool disposing) - { - if (disposing) - { - if (_webView != null) - { - _webView.Dispose(); - } - - _webView = null; - } - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls.WebView/WebViewCompatible.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls.WebView/WebViewCompatible.cs deleted file mode 100644 index 788ac43ca82..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls.WebView/WebViewCompatible.cs +++ /dev/null @@ -1,99 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using Microsoft.Toolkit.UI.Controls; -using Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT; - -namespace Microsoft.Toolkit.Wpf.UI.Controls -{ - public class WebViewCompatible : UserControl, IWebViewCompatible, IDisposable - { - public static DependencyProperty SourceProperty { get; } = DependencyProperty.Register(nameof(Source), typeof(Uri), typeof(WebViewCompatible)); - - public WebViewCompatible() - : base() - { - if (WebViewControlHost.IsSupported) - { - _implementation = new WebViewCompatibilityAdapter(); - } - else - { - _implementation = new WebBrowserCompatibilityAdapter(); - } - - _implementation.Initialize(); - - AddChild(_implementation.View); - _implementation.View.BeginInit(); - _implementation.View.EndInit(); - var binder = new Binding() - { - Source = _implementation, - Path = new PropertyPath(nameof(Source)), - Mode = BindingMode.TwoWay - }; - BindingOperations.SetBinding(this, SourceProperty, binder); - } - - ~WebViewCompatible() - { - Dispose(false); - } - - public static bool IsLegacy { get; } = !WebViewControlHost.IsSupported; - - private IWebViewCompatibleAdapter _implementation; - - public Uri Source { get => (Uri)GetValue(SourceProperty); set => SetValue(SourceProperty, value); } - - public bool CanGoBack => _implementation.CanGoBack; - - public bool CanGoForward => _implementation.CanGoForward; - - public FrameworkElement View { get => _implementation.View; } - - public event EventHandler NavigationStarting { add => _implementation.NavigationStarting += value; remove => _implementation.NavigationStarting -= value; } - - public event EventHandler ContentLoading { add => _implementation.ContentLoading += value; remove => _implementation.ContentLoading -= value; } - - public event EventHandler NavigationCompleted { add => _implementation.NavigationCompleted += value; remove => _implementation.NavigationCompleted -= value; } - - public bool GoBack() => _implementation.GoBack(); - - public bool GoForward() => _implementation.GoForward(); - - public void Navigate(Uri url) => _implementation.Navigate(url); - - public void Navigate(string url) => _implementation.Navigate(url); - - public void Refresh() => _implementation.Refresh(); - - public void Stop() => _implementation.Stop(); - - public string InvokeScript(string scriptName) => _implementation.InvokeScript(scriptName); - - public void Dispose() - { - Dispose(true); - - GC.SuppressFinalize(this); - } - - protected virtual void Dispose(bool isDisposing) - { - if (isDisposing) - { - if (_implementation is IDisposable disposable) - { - disposable.Dispose(); - } - } - } - } -} diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls.WebView/WebViewControlProcessExtensions.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls.WebView/WebViewControlProcessExtensions.cs deleted file mode 100644 index fcf98f25692..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls.WebView/WebViewControlProcessExtensions.cs +++ /dev/null @@ -1,192 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Security; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Interop; -using System.Windows.Media; -using Microsoft.Toolkit.Win32.UI.Controls; -using Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT; - -namespace Microsoft.Toolkit.Wpf.UI.Controls -{ - /// - /// Extends the funcionality of for WPF. - /// - internal static class WebViewControlProcessExtensions - { - /// - /// Creates a within the context of . - /// - /// An instance of . - /// The host window handle. - /// A containing numerical values that represent the location and size of the control. - /// An instance. - /// - /// is equal to , or - /// is . - /// - internal static IWebView CreateWebView( - this WebViewControlProcess process, - IntPtr hostWindowHandle, - Rect bounds) - { - if (process is null) - { - throw new ArgumentNullException(nameof(process)); - } - - if (hostWindowHandle == IntPtr.Zero) - { - throw new ArgumentNullException(nameof(hostWindowHandle)); - } - - return new WebView(process.CreateWebViewControlHost(hostWindowHandle, bounds)); - } - - /// - /// Creates a within the context of using the to create a HWND and within the specified . - /// - /// An instance of . - /// A instance in which to create a HWND. - /// A containing numerical values that represent the location and size of the control. - /// An instance. - internal static IWebView CreateWebView(this WebViewControlProcess process, Visual visual, Rect bounds) - { - return visual.Dispatcher.Invoke(() => process.CreateWebViewAsync(visual, bounds).GetAwaiter().GetResult()); - } - - /// - /// Creates a within the context of using the to create a HWND. - /// - /// An instance of . - /// A instance in which to create a HWND. - /// An instance. - /// - /// The bounds to draw the are determined by the height and width of the . - /// - /// - internal static IWebView CreateWebView(this WebViewControlProcess process, Visual visual) - { - return visual.Dispatcher.Invoke(() => process.CreateWebViewAsync(visual).GetAwaiter().GetResult()); - } - - /// - /// Creates a within the context of . - /// - /// An instance of . - /// The host window handle. - /// A containing numerical values that represent the location and size of the control. - /// An instance. - /// - /// is equal to , or - /// is . - /// - internal static async Task CreateWebViewAsync( - this WebViewControlProcess process, - IntPtr hostWindowHandle, - Rect bounds) - { - if (process is null) - { - throw new ArgumentNullException(nameof(process)); - } - - if (hostWindowHandle == IntPtr.Zero) - { - throw new ArgumentNullException(nameof(hostWindowHandle)); - } - - return new WebView(await process.CreateWebViewControlHostAsync(hostWindowHandle, bounds).ConfigureAwait(false)); - } - - /// - /// Creates a within the context of using the to create a HWND and within the specified . - /// - /// An instance of . - /// A instance in which to create a HWND. - /// A containing numerical values that represent the location and size of the control. - /// An asynchronous operation that completes with a . - internal static async Task CreateWebViewAsync(this WebViewControlProcess process, Visual visual, Rect bounds) - { - HwndSource sourceHwnd; - if (!visual.Dispatcher.CheckAccess()) - { - sourceHwnd = visual.Dispatcher.Invoke(() => (HwndSource)PresentationSource.FromVisual(visual)); - } - else - { - sourceHwnd = (HwndSource)PresentationSource.FromVisual(visual); - } - - Verify.IsNotNull(sourceHwnd); - - var webViewControlHost = await process.CreateWebViewControlHostAsync(sourceHwnd?.Handle ?? IntPtr.Zero, bounds); - - return !visual.Dispatcher.CheckAccess() - ? visual.Dispatcher.Invoke(() => new WebView(webViewControlHost)) - : new WebView(webViewControlHost); - } - - /// - /// Creates a within the context of using the to create a HWND. - /// - /// An instance of . - /// A instance in which to create a HWND. - /// An asynchronous operation that completes with a . - /// - /// The bounds to draw the are determined by the height and width of the . - /// - /// - internal static Task CreateWebViewAsync(this WebViewControlProcess process, Visual visual) - { - double width; - double height; - - if (!visual.Dispatcher.CheckAccess()) - { - width = visual.Dispatcher.Invoke(() => (double)visual.GetValue(FrameworkElement.ActualWidthProperty)); - height = visual.Dispatcher.Invoke(() => (double)visual.GetValue(FrameworkElement.ActualHeightProperty)); - } - else - { - width = (double)visual.GetValue(FrameworkElement.ActualWidthProperty); - height = (double)visual.GetValue(FrameworkElement.ActualHeightProperty); - } - - return process.CreateWebViewAsync(visual, new Rect(new Size(height, width))); - } - - [SecuritySafeCritical] - internal static WebViewControlHost CreateWebViewControlHost( - this WebViewControlProcess process, - IntPtr hostWindowHandle, - Rect bounds) - { - Verify.IsNotNull(process); - Verify.IsFalse(hostWindowHandle == IntPtr.Zero); - - var rect = new Windows.Foundation.Rect(bounds.X, bounds.Y, bounds.Width, bounds.Height); - return process - .CreateWebViewControlHostAsync(hostWindowHandle, rect) - .GetAwaiter() - .GetResult(); - } - - [SecuritySafeCritical] - internal static Task CreateWebViewControlHostAsync( - this WebViewControlProcess process, - IntPtr hostWindowHandle, - Rect bounds) - { - Verify.IsNotNull(process); - Verify.IsFalse(hostWindowHandle == IntPtr.Zero); - - var rect = new Windows.Foundation.Rect(bounds.X, bounds.Y, bounds.Width, bounds.Height); - return process.CreateWebViewControlHostAsync(hostWindowHandle, rect); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls.WebView/WebViewHost.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls.WebView/WebViewHost.cs deleted file mode 100644 index 70421441b78..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls.WebView/WebViewHost.cs +++ /dev/null @@ -1,261 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.ComponentModel; -using System.Diagnostics; -using System.Runtime.InteropServices; -using System.Security; -using System.Security.Permissions; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Input; -using System.Windows.Interop; -using System.Windows.Media; -using Microsoft.Toolkit.Win32.UI.Controls; -using Microsoft.Toolkit.Win32.UI.Controls.Interop; -using Microsoft.Toolkit.Win32.UI.Controls.Interop.Win32; - -namespace Microsoft.Toolkit.Wpf.UI.Controls -{ - /// - /// The class hosts a inside of a WPF tree - /// - /// Requires unmanaged code permissions - [SecurityPermission(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)] - [ToolboxItem(false)] - [DesignTimeVisible(false)] - public abstract class WebViewHost : HwndHost - { - static WebViewHost() - { - // register for access keys - EventManager.RegisterClassHandler(typeof(WebViewHost), AccessKeyManager.AccessKeyPressedEvent, new AccessKeyPressedEventHandler(OnAccessKeyPressed)); - - Control.IsTabStopProperty.OverrideMetadata(typeof(WebViewHost), new FrameworkPropertyMetadata(true)); - - FocusableProperty.OverrideMetadata(typeof(WebViewHost), new FrameworkPropertyMetadata(true)); - - KeyboardNavigation.TabNavigationProperty.OverrideMetadata(typeof(WebViewHost), new FrameworkPropertyMetadata(KeyboardNavigationMode.Once)); - } - - /// - /// Initializes a new instance of the class. - /// - protected WebViewHost() - { - DpiHelper.SetPerMonitorDpiAwareness(); - DpiScale = VisualTreeHelper.GetDpi(this); - - DpiChanged += OnDpiChanged; - SizeChanged += OnSizeChanged; - -#if DEBUG_FOCUS - GotFocus += (o, e) => { Debug.WriteLine($"GotFocus"); }; - GotKeyboardFocus += (o, e) => { Debug.WriteLine("GotKeyboardFocus"); }; - LostFocus += (o, e) => { Debug.WriteLine($"LostFocus"); }; - LostKeyboardFocus += (o, e) => { Debug.WriteLine("LostKeyboardFocus"); }; - KeyUp += (o, e) => - { - Debug.WriteLine($"KeyUp: Key: {e.Key}, SystemKey: {e.SystemKey}"); - }; -#endif - } - - /// - /// Gets the child window. - /// - /// The child window created during . - protected HandleRef ChildWindow { get; private set; } - - /// - /// Gets the DPI information for which the is measured and rendered. - /// - protected DpiScale DpiScale { get; private set; } - - /// - /// Gets the current DPI for this control - /// - /// - [Obsolete("This property is obsolete and will be removed in a future version. Use DpiScale instead.")] - protected int DeviceDpi => (int)DpiScale.PixelsPerInchX; - - /// - /// Gets a value indicating whether scaling is required for the current DPI. - /// - /// if scaling is required; otherwise, . - [Obsolete("This property is obsolete and will be removed in a future version.")] - protected bool IsScalingRequired => DpiScale.DpiScaleX != 1 || DpiScale.DpiScaleY != 1; - - /// - /// Gets the parent handle. - /// - /// The passed in to . - protected HandleRef ParentHandle { get; private set; } - - /// - /// Closes the . - /// - /// - public abstract void Close(); - - /// - /// When overridden in a derived class, creates the window to be hosted. - /// - /// The window handle of the parent window. - /// The handle to the child Win32 window to create. - /// - protected override HandleRef BuildWindowCore(HandleRef hwndParent) - { - ParentHandle = hwndParent; - NativeMethods.EnableMouseInPointer(true); - - if (ChildWindow.Handle == IntPtr.Zero) - { - // Create a simple STATIC HWND - var windowHandle = NativeMethods.CreateWindow( - "Static", - WS.CHILD | WS.VISIBLE | WS.CLIPCHILDREN, - 0, - 0, - 0, - 0, - hwndParent.Handle); - Verify.IsTrue(windowHandle != IntPtr.Zero, "Could not create child window"); - - ChildWindow = new HandleRef(null, windowHandle); - } - - Initialize(); - - return ChildWindow; - } - - /// - /// Destroys the hosted window. - /// - /// A structure that contains the window handle. - protected override void DestroyWindowCore(HandleRef hwnd) - { - NativeMethods.DestroyWindow(hwnd.Handle); - } - - /// - /// Immediately frees any system resources that the might hold. - /// - /// Set to if called from an explicit disposer and otherwise. - protected override void Dispose(bool disposing) - { - try - { - if (disposing) - { - Close(); - DpiChanged -= OnDpiChanged; - SizeChanged -= OnSizeChanged; - } - } - finally - { - base.Dispose(disposing); - } - } - - /// - /// Initializes this instance. - /// - protected abstract void Initialize(); - - /// - /// Processes keyboard input at the keydown message level. - /// - /// The message and associated data. Do not modify this structure. It is passed by reference for performance reasons only. - /// Modifier keys. - /// Always returns . - [SecurityCritical] - [UIPermission(SecurityAction.LinkDemand, Unrestricted = true)] - protected override bool TranslateAcceleratorCore(ref MSG msg, ModifierKeys modifiers) - { - Debug.WriteLine($"HWND: {msg.hwnd}, msg: {msg.message}, wParam: {msg.wParam}, lParam: {msg.lParam}"); - - // TODO: Convert to Win32.WM - // If TAB key was pressed - if (msg.message == 0x0100 && msg.wParam.ToInt32() == 0x09) - { - // Handle case for SHIFT+TAB - // Otherwise, TAB - } - - return base.TranslateAcceleratorCore(ref msg, modifiers); - } - - /// - /// Updates the location and size of . - /// - /// A containing numerical values that represent the location and size of the control. - protected abstract void UpdateBounds(Rect bounds); - - /// - /// Updates the size of the using the current visual offset for location. - /// - /// A containing numerical values that represent the size of the control. - protected virtual void UpdateSize(Size size) - { - var rect = new Rect( - VisualOffset.X, - VisualOffset.Y, - size.Width, - size.Height); - UpdateBounds(rect); - } - - /// - /// When overridden in a derived class, accesses the window process (handle) of the hosted child window. - /// - /// The window handle of the hosted window. - /// The message to act upon. - /// Information that may be relevant to handling the message. This is typically used to store small pieces of information, such as flags. - /// Information that may be relevant to handling the message. This is typically used to reference an object. - /// Whether events resulting should be marked handled. - /// The window handle of the child window. - protected override IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) - { - Debug.WriteLine($"HWND: {hwnd}, msg: {msg} (0x{msg:x4}), wParam: {wParam}, lParam: {lParam}"); - - switch (msg) - { - // WM_DPICHANGED - // WM_DPICHANGED_BEFOREPARENT - // WM_DPICHANGED_AFTERPARENT - default: - return base.WndProc(hwnd, msg, wParam, lParam, ref handled); - } - } - - private static void OnAccessKeyPressed(object sender, AccessKeyPressedEventArgs args) - { - if (args.Handled || args.Scope != null || args.Target != null) - { - return; - } - - args.Target = (UIElement)sender; - } - - private void OnDpiChanged(object o, DpiChangedEventArgs e) - { -#if DEBUG_LAYOUT - Debug.WriteLine("Old DPI: ({0}, {1}), New DPI: ({2}, {3})", e.OldDpi.DpiScaleX, e.OldDpi.DpiScaleY, e.NewDpi.DpiScaleX, e.NewDpi.DpiScaleY); -#endif - Verify.AreEqual(DpiScale.PixelsPerInchX, e.OldDpi.PixelsPerInchX); - Verify.AreEqual(DpiScale.PixelsPerInchY, e.OldDpi.PixelsPerInchY); - DpiScale = e.NewDpi; - } - - private void OnSizeChanged(object o, SizeChangedEventArgs e) - { - UpdateSize(e.NewSize); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/DependencyObjectCollection.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/DependencyObjectCollection.cs deleted file mode 100644 index f11d392c50f..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/DependencyObjectCollection.cs +++ /dev/null @@ -1,92 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Windows; -using System.Windows.Markup; -using Windows.Foundation.Collections; - -namespace Microsoft.Toolkit.Wpf.UI.Controls -{ - [ContentWrapper(typeof(DependencyObject))] - public class DependencyObjectCollection : DependencyObject, IObservableVector - { - public event VectorChangedEventHandler VectorChanged; - - private readonly IObservableVector _underlyingCollection; - - internal DependencyObjectCollection(IObservableVector underlying) - { - _underlyingCollection = underlying; - VectorChanged -= null; - } - - private void OnVectorChanged() - { - VectorChanged?.Invoke(null, null); - } - - public int IndexOf(DependencyObject item) - { - throw new NotImplementedException(); - } - - public void Insert(int index, DependencyObject item) - { - throw new NotImplementedException(); - } - - public void RemoveAt(int index) - { - throw new NotImplementedException(); - } - - public DependencyObject this[int index] - { - get => throw new NotSupportedException(); - set => throw new NotSupportedException(); - } - - public void Add(DependencyObject item) - { - throw new NotImplementedException(); - } - - public void Clear() - { - throw new NotImplementedException(); - } - - public bool Contains(DependencyObject item) - { - throw new NotImplementedException(); - } - - public void CopyTo(DependencyObject[] array, int arrayIndex) - { - throw new NotImplementedException(); - } - - public bool Remove(DependencyObject item) - { - throw new NotImplementedException(); - } - - public int Count => throw new NotSupportedException(); - - public bool IsReadOnly => throw new NotSupportedException(); - - public IEnumerator GetEnumerator() - { - throw new NotImplementedException(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - throw new NotImplementedException(); - } - } -} diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/InkCanvas/InkCanvas.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/InkCanvas/InkCanvas.cs deleted file mode 100644 index 123cdb3759d..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/InkCanvas/InkCanvas.cs +++ /dev/null @@ -1,64 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT; - -namespace Microsoft.Toolkit.Wpf.UI.Controls -{ - /// - /// Wpf-enabled wrapper for - /// - public class InkCanvas : WindowsXamlHostBaseExt - { - protected Windows.UI.Xaml.Controls.InkCanvas UwpControl => ChildInternal as Windows.UI.Xaml.Controls.InkCanvas; - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public InkCanvas() - : this(typeof(Windows.UI.Xaml.Controls.InkCanvas).FullName) - { - } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for . - /// - protected InkCanvas(string typeName) - : base(typeName) - { - } - - /// - protected override void OnInitialized(EventArgs e) - { - // Bind dependency properties across controls - // properties of FrameworkElement - Bind(nameof(Style), StyleProperty, Windows.UI.Xaml.Controls.InkCanvas.StyleProperty); - Bind(nameof(MaxHeight), MaxHeightProperty, Windows.UI.Xaml.Controls.InkCanvas.MaxHeightProperty); - Bind(nameof(FlowDirection), FlowDirectionProperty, Windows.UI.Xaml.Controls.InkCanvas.FlowDirectionProperty); - Bind(nameof(Margin), MarginProperty, Windows.UI.Xaml.Controls.InkCanvas.MarginProperty); - Bind(nameof(HorizontalAlignment), HorizontalAlignmentProperty, Windows.UI.Xaml.Controls.InkCanvas.HorizontalAlignmentProperty); - Bind(nameof(VerticalAlignment), VerticalAlignmentProperty, Windows.UI.Xaml.Controls.InkCanvas.VerticalAlignmentProperty); - Bind(nameof(MinHeight), MinHeightProperty, Windows.UI.Xaml.Controls.InkCanvas.MinHeightProperty); - Bind(nameof(Height), HeightProperty, Windows.UI.Xaml.Controls.InkCanvas.HeightProperty); - Bind(nameof(MinWidth), MinWidthProperty, Windows.UI.Xaml.Controls.InkCanvas.MinWidthProperty); - Bind(nameof(MaxWidth), MaxWidthProperty, Windows.UI.Xaml.Controls.InkCanvas.MaxWidthProperty); - Bind(nameof(UseLayoutRounding), UseLayoutRoundingProperty, Windows.UI.Xaml.Controls.InkCanvas.UseLayoutRoundingProperty); - Bind(nameof(Name), NameProperty, Windows.UI.Xaml.Controls.InkCanvas.NameProperty); - Bind(nameof(Tag), TagProperty, Windows.UI.Xaml.Controls.InkCanvas.TagProperty); - Bind(nameof(DataContext), DataContextProperty, Windows.UI.Xaml.Controls.InkCanvas.DataContextProperty); - Bind(nameof(Width), WidthProperty, Windows.UI.Xaml.Controls.InkCanvas.WidthProperty); - - base.OnInitialized(e); - } - - /// - /// Gets - /// - public InkPresenter InkPresenter => UwpControl.InkPresenter; - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/InkCanvas/InkRecognitionResult.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/InkCanvas/InkRecognitionResult.cs deleted file mode 100644 index 94185b686cf..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/InkCanvas/InkRecognitionResult.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Collections.Generic; -using System.Linq; -using System.Windows; -using Windows.UI.Input.Inking; - -namespace Microsoft.Toolkit.Win32.UI.Controls.WPF -{ - public class InkRecognitionResult - { - private readonly global::Windows.UI.Input.Inking.InkRecognitionResult uwpInstance; - - public InkRecognitionResult(global::Windows.UI.Input.Inking.InkRecognitionResult instance) - { - this.uwpInstance = instance; - } - - public IReadOnlyList GetTextCandidates() => uwpInstance.GetTextCandidates(); - - public IReadOnlyList GetStrokes() => uwpInstance.GetStrokes().Cast().ToList(); - - public Rect BoundingRect { get => uwpInstance.BoundingRect.ToWpf(); } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator InkRecognitionResult( - global::Windows.UI.Input.Inking.InkRecognitionResult args) - { - return FromInkRecognitionResult(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static InkRecognitionResult FromInkRecognitionResult(global::Windows.UI.Input.Inking.InkRecognitionResult args) - { - return new InkRecognitionResult(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/InkToolbar/InkToolbar.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/InkToolbar/InkToolbar.cs deleted file mode 100644 index d8f5d063b39..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/InkToolbar/InkToolbar.cs +++ /dev/null @@ -1,290 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.ObjectModel; -using System.ComponentModel; -using System.Linq; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Markup; -using Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT; - -namespace Microsoft.Toolkit.Wpf.UI.Controls -{ - /// - /// Wpf-enabled wrapper for - /// - [ContentProperty(nameof(Children))] - public class InkToolbar : WindowsXamlHostBaseExt - { - internal Windows.UI.Xaml.Controls.InkToolbar UwpControl => ChildInternal as Windows.UI.Xaml.Controls.InkToolbar; - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public InkToolbar() - : this(typeof(Windows.UI.Xaml.Controls.InkToolbar).FullName) - { - } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for . - /// - protected InkToolbar(string typeName) - : base(typeName) - { - Visibility = System.Windows.Visibility.Collapsed; // supports a workaround for a bug: InkToolbar won't initialize if it's not initially collapsed. - Children = new ObservableCollection(); - } - - /// - protected override void OnInitialized(EventArgs e) - { - // Bind dependency properties across controls - // properties of FrameworkElement - Bind(nameof(Style), StyleProperty, Windows.UI.Xaml.Controls.InkToolbar.StyleProperty); - Bind(nameof(MaxHeight), MaxHeightProperty, Windows.UI.Xaml.Controls.InkToolbar.MaxHeightProperty); - Bind(nameof(FlowDirection), FlowDirectionProperty, Windows.UI.Xaml.Controls.InkToolbar.FlowDirectionProperty); - Bind(nameof(Margin), MarginProperty, Windows.UI.Xaml.Controls.InkToolbar.MarginProperty); - Bind(nameof(HorizontalAlignment), HorizontalAlignmentProperty, Windows.UI.Xaml.Controls.InkToolbar.HorizontalAlignmentProperty); - Bind(nameof(VerticalAlignment), VerticalAlignmentProperty, Windows.UI.Xaml.Controls.InkToolbar.VerticalAlignmentProperty); - Bind(nameof(MinHeight), MinHeightProperty, Windows.UI.Xaml.Controls.InkToolbar.MinHeightProperty); - Bind(nameof(Height), HeightProperty, Windows.UI.Xaml.Controls.InkToolbar.HeightProperty); - Bind(nameof(MinWidth), MinWidthProperty, Windows.UI.Xaml.Controls.InkToolbar.MinWidthProperty); - Bind(nameof(MaxWidth), MaxWidthProperty, Windows.UI.Xaml.Controls.InkToolbar.MaxWidthProperty); - Bind(nameof(UseLayoutRounding), UseLayoutRoundingProperty, Windows.UI.Xaml.Controls.InkToolbar.UseLayoutRoundingProperty); - Bind(nameof(Name), NameProperty, Windows.UI.Xaml.Controls.InkToolbar.NameProperty); - Bind(nameof(Tag), TagProperty, Windows.UI.Xaml.Controls.InkToolbar.TagProperty); - Bind(nameof(DataContext), DataContextProperty, Windows.UI.Xaml.Controls.InkToolbar.DataContextProperty); - Bind(nameof(Width), WidthProperty, Windows.UI.Xaml.Controls.InkToolbar.WidthProperty); - - // InkToolbar specific properties - Bind(nameof(TargetInkCanvas), TargetInkCanvasProperty, Windows.UI.Xaml.Controls.InkToolbar.TargetInkCanvasProperty, new WindowsXamlHostWrapperConverter()); - Bind(nameof(IsRulerButtonChecked), IsRulerButtonCheckedProperty, Windows.UI.Xaml.Controls.InkToolbar.IsRulerButtonCheckedProperty); - Bind(nameof(InitialControls), InitialControlsProperty, Windows.UI.Xaml.Controls.InkToolbar.InitialControlsProperty, new WindowsXamlHostWrapperConverter()); - Bind(nameof(ActiveTool), ActiveToolProperty, Windows.UI.Xaml.Controls.InkToolbar.ActiveToolProperty, new WindowsXamlHostWrapperConverter()); - Bind(nameof(InkDrawingAttributes), InkDrawingAttributesProperty, Windows.UI.Xaml.Controls.InkToolbar.InkDrawingAttributesProperty, new WindowsXamlHostWrapperConverter()); - Bind(nameof(Orientation), OrientationProperty, Windows.UI.Xaml.Controls.InkToolbar.OrientationProperty, new WindowsXamlHostWrapperConverter()); - Bind(nameof(IsStencilButtonChecked), IsStencilButtonCheckedProperty, Windows.UI.Xaml.Controls.InkToolbar.IsStencilButtonCheckedProperty); - Bind(nameof(ButtonFlyoutPlacement), ButtonFlyoutPlacementProperty, Windows.UI.Xaml.Controls.InkToolbar.ButtonFlyoutPlacementProperty, new WindowsXamlHostWrapperConverter()); - - Children.OfType().ToList().ForEach(RelocateChildToUwpControl); - - UwpControl.ActiveToolChanged += OnActiveToolChanged; - UwpControl.EraseAllClicked += OnEraseAllClicked; - UwpControl.InkDrawingAttributesChanged += OnInkDrawingAttributesChanged; - UwpControl.IsRulerButtonCheckedChanged += OnIsRulerButtonCheckedChanged; - UwpControl.IsStencilButtonCheckedChanged += OnIsStencilButtonCheckedChanged; - UwpControl.Loaded += OnUwpControlLoaded; - base.OnInitialized(e); - } - - /// - /// supports a workaround for a bug: InkToolbar won't initialize if it's not initially collapsed, so we update visibility on it's loaded event. - /// - /// event sender - /// event parameters - private void OnUwpControlLoaded(object sender, Windows.UI.Xaml.RoutedEventArgs e) - { - Visibility = System.Windows.Visibility.Visible; - UwpControl.Loaded -= OnUwpControlLoaded; - } - - private void RelocateChildToUwpControl(WindowsXamlHostBaseExt obj) - { - if (obj.GetUwpInternalObject() is Windows.UI.Xaml.UIElement child) - { - UwpControl.Children.Add(child); - } - } - - /// - /// Gets - /// - public static DependencyProperty ActiveToolProperty { get; } = DependencyProperty.Register(nameof(ActiveTool), typeof(WindowsXamlHostBaseExt), typeof(InkToolbar)); - - /// - /// Gets - /// - public static DependencyProperty InitialControlsProperty { get; } = DependencyProperty.Register(nameof(InitialControls), typeof(InkToolbarInitialControls), typeof(InkToolbar)); - - /// - /// Gets - /// - public static DependencyProperty InkDrawingAttributesProperty { get; } = DependencyProperty.Register(nameof(InkDrawingAttributes), typeof(InkDrawingAttributes), typeof(InkToolbar)); - - /// - /// Gets - /// - public static DependencyProperty IsRulerButtonCheckedProperty { get; } = DependencyProperty.Register(nameof(IsRulerButtonChecked), typeof(bool), typeof(InkToolbar)); - - /// - /// Gets - /// - public static DependencyProperty TargetInkCanvasProperty { get; } = DependencyProperty.Register(nameof(TargetInkCanvas), typeof(InkCanvas), typeof(InkToolbar)); - - /// - /// Gets - /// - public static DependencyProperty ButtonFlyoutPlacementProperty { get; } = DependencyProperty.Register(nameof(ButtonFlyoutPlacement), typeof(InkToolbarButtonFlyoutPlacement), typeof(InkToolbar)); - - /// - /// Gets - /// - public static DependencyProperty IsStencilButtonCheckedProperty { get; } = DependencyProperty.Register(nameof(IsStencilButtonChecked), typeof(bool), typeof(InkToolbar)); - - /// - /// Gets - /// - public static DependencyProperty OrientationProperty { get; } = DependencyProperty.Register(nameof(Orientation), typeof(Orientation), typeof(InkToolbar)); - - /// - /// - /// - /// WindowsXamlHostBaseExt - public WindowsXamlHostBaseExt GetToolButton(InkToolbarTool tool) => UwpControl.GetToolButton((Windows.UI.Xaml.Controls.InkToolbarTool)(int)tool).GetWrapper(); - - /// - /// - /// - /// InkToolbarToggleButton - public InkToolbarToggleButton GetToggleButton(InkToolbarToggle tool) => (InkToolbarToggleButton)UwpControl.GetToggleButton((Windows.UI.Xaml.Controls.InkToolbarToggle)(int)tool).GetWrapper(); - - /// - /// - /// - /// InkToolbarMenuButton - public InkToolbarMenuButton GetMenuButton(InkToolbarMenuKind menu) => (InkToolbarMenuButton)UwpControl.GetMenuButton((Windows.UI.Xaml.Controls.InkToolbarMenuKind)(int)menu).GetWrapper(); - - /// - /// Gets or sets - /// - public InkCanvas TargetInkCanvas - { - get => (InkCanvas)GetValue(TargetInkCanvasProperty); - set => SetValue(TargetInkCanvasProperty, value); - } - - /// - /// Gets or sets a value indicating whether - /// - public bool IsRulerButtonChecked - { - get => (bool)GetValue(IsRulerButtonCheckedProperty); - set => SetValue(IsRulerButtonCheckedProperty, value); - } - - /// - /// Gets or sets - /// - public InkToolbarInitialControls InitialControls - { - get => (InkToolbarInitialControls)GetValue(InitialControlsProperty); - set => SetValue(InitialControlsProperty, value); - } - - /// - /// Gets or sets - /// - public WindowsXamlHostBaseExt ActiveTool - { - get => (WindowsXamlHostBaseExt)GetValue(ActiveToolProperty); - set => SetValue(ActiveToolProperty, value); - } - - /// - /// Gets - /// - public InkDrawingAttributes InkDrawingAttributes - { - get => (InkDrawingAttributes)GetValue(InkDrawingAttributesProperty); - } - - /// - /// Gets or sets - /// - public Orientation Orientation - { - get => (Orientation)GetValue(OrientationProperty); - set => SetValue(OrientationProperty, value); - } - - /// - /// Gets or sets a value indicating whether - /// - public bool IsStencilButtonChecked - { - get => (bool)GetValue(IsStencilButtonCheckedProperty); - set => SetValue(IsStencilButtonCheckedProperty, value); - } - - /// - /// Gets or sets - /// - public InkToolbarButtonFlyoutPlacement ButtonFlyoutPlacement - { - get => (InkToolbarButtonFlyoutPlacement)GetValue(ButtonFlyoutPlacementProperty); - set => SetValue(ButtonFlyoutPlacementProperty, value); - } - - /// - /// - /// - public event EventHandler ActiveToolChanged = (sender, args) => { }; - - private void OnActiveToolChanged(Windows.UI.Xaml.Controls.InkToolbar sender, object args) - { - ActiveToolChanged?.Invoke(this, args); - } - - /// - /// - /// - public event EventHandler EraseAllClicked = (sender, args) => { }; - - private void OnEraseAllClicked(Windows.UI.Xaml.Controls.InkToolbar sender, object args) - { - EraseAllClicked?.Invoke(this, args); - } - - /// - /// - /// - public event EventHandler InkDrawingAttributesChanged = (sender, args) => { }; - - private void OnInkDrawingAttributesChanged(Windows.UI.Xaml.Controls.InkToolbar sender, object args) - { - InkDrawingAttributesChanged?.Invoke(this, args); - } - - /// - /// - /// - public event EventHandler IsRulerButtonCheckedChanged = (sender, args) => { }; - - private void OnIsRulerButtonCheckedChanged(Windows.UI.Xaml.Controls.InkToolbar sender, object args) - { - IsRulerButtonCheckedChanged?.Invoke(this, args); - } - - /// - /// - /// - public event EventHandler IsStencilButtonCheckedChanged = (sender, args) => { }; - - private void OnIsStencilButtonCheckedChanged(Windows.UI.Xaml.Controls.InkToolbar sender, Windows.UI.Xaml.Controls.InkToolbarIsStencilButtonCheckedChangedEventArgs args) - { - IsStencilButtonCheckedChanged?.Invoke(this, args); - } - - [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] - public ObservableCollection Children - { - get; set; - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/InkToolbar/InkToolbarCustomPenButton.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/InkToolbar/InkToolbarCustomPenButton.cs deleted file mode 100644 index ab5adfd9e82..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/InkToolbar/InkToolbarCustomPenButton.cs +++ /dev/null @@ -1,104 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Windows; -using Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT; - -namespace Microsoft.Toolkit.Wpf.UI.Controls -{ - /// - /// Wpf-enabled wrapper for - /// - public class InkToolbarCustomPenButton : WindowsXamlHostBaseExt - { - internal Windows.UI.Xaml.Controls.InkToolbarCustomPenButton UwpControl => ChildInternal as Windows.UI.Xaml.Controls.InkToolbarCustomPenButton; - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public InkToolbarCustomPenButton() - : this(typeof(Windows.UI.Xaml.Controls.InkToolbarCustomPenButton).FullName) - { - } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for . - /// - protected InkToolbarCustomPenButton(string typeName) - : base(typeName) - { - } - - /// - protected override void SetContent() - { - if (VisualParent is InkToolbar parent) - { - if (parent.GetUwpInternalObject() is Windows.UI.Xaml.Controls.InkToolbar toolbar) - { - toolbar.Children.Add(UwpControl); - } - } - } - - /// - protected override void OnInitialized(EventArgs e) - { - // Bind dependency properties across controls - // properties of FrameworkElement - Bind(nameof(Style), StyleProperty, Windows.UI.Xaml.Controls.InkToolbarCustomPenButton.StyleProperty); - Bind(nameof(MaxHeight), MaxHeightProperty, Windows.UI.Xaml.Controls.InkToolbarCustomPenButton.MaxHeightProperty); - Bind(nameof(FlowDirection), FlowDirectionProperty, Windows.UI.Xaml.Controls.InkToolbarCustomPenButton.FlowDirectionProperty); - Bind(nameof(Margin), MarginProperty, Windows.UI.Xaml.Controls.InkToolbarCustomPenButton.MarginProperty); - Bind(nameof(HorizontalAlignment), HorizontalAlignmentProperty, Windows.UI.Xaml.Controls.InkToolbarCustomPenButton.HorizontalAlignmentProperty); - Bind(nameof(VerticalAlignment), VerticalAlignmentProperty, Windows.UI.Xaml.Controls.InkToolbarCustomPenButton.VerticalAlignmentProperty); - Bind(nameof(MinHeight), MinHeightProperty, Windows.UI.Xaml.Controls.InkToolbarCustomPenButton.MinHeightProperty); - Bind(nameof(Height), HeightProperty, Windows.UI.Xaml.Controls.InkToolbarCustomPenButton.HeightProperty); - Bind(nameof(MinWidth), MinWidthProperty, Windows.UI.Xaml.Controls.InkToolbarCustomPenButton.MinWidthProperty); - Bind(nameof(MaxWidth), MaxWidthProperty, Windows.UI.Xaml.Controls.InkToolbarCustomPenButton.MaxWidthProperty); - Bind(nameof(UseLayoutRounding), UseLayoutRoundingProperty, Windows.UI.Xaml.Controls.InkToolbarCustomPenButton.UseLayoutRoundingProperty); - Bind(nameof(Name), NameProperty, Windows.UI.Xaml.Controls.InkToolbarCustomPenButton.NameProperty); - Bind(nameof(Tag), TagProperty, Windows.UI.Xaml.Controls.InkToolbarCustomPenButton.TagProperty); - Bind(nameof(DataContext), DataContextProperty, Windows.UI.Xaml.Controls.InkToolbarCustomPenButton.DataContextProperty); - Bind(nameof(Width), WidthProperty, Windows.UI.Xaml.Controls.InkToolbarCustomPenButton.WidthProperty); - - // InkToolbarCustomPenButton specific properties - Bind(nameof(CustomPen), CustomPenProperty, Windows.UI.Xaml.Controls.InkToolbarCustomPenButton.CustomPenProperty, new WindowsXamlHostWrapperConverter()); - Bind(nameof(ConfigurationContent), ConfigurationContentProperty, Windows.UI.Xaml.Controls.InkToolbarCustomPenButton.ConfigurationContentProperty); - - base.OnInitialized(e); - } - - /// - /// Gets - /// - public static DependencyProperty ConfigurationContentProperty { get; } = DependencyProperty.Register(nameof(ConfigurationContent), typeof(Windows.UI.Xaml.UIElement), typeof(InkToolbarCustomPenButton)); - - /// - /// Gets - /// - public static DependencyProperty CustomPenProperty { get; } = DependencyProperty.Register(nameof(CustomPen), typeof(InkToolbarCustomPen), typeof(InkToolbarCustomPenButton)); - - /// - /// Gets or sets - /// - public InkToolbarCustomPen CustomPen - { - get => (InkToolbarCustomPen)GetValue(CustomPenProperty); - set => SetValue(CustomPenProperty, value); - } - - /// - /// Gets or sets - /// - public Windows.UI.Xaml.UIElement ConfigurationContent - { - get => (Windows.UI.Xaml.UIElement)GetValue(ConfigurationContentProperty); - set => SetValue(ConfigurationContentProperty, value); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/InkToolbar/InkToolbarCustomToolButton.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/InkToolbar/InkToolbarCustomToolButton.cs deleted file mode 100644 index ce48be2ebe4..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/InkToolbar/InkToolbarCustomToolButton.cs +++ /dev/null @@ -1,82 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Windows; - -namespace Microsoft.Toolkit.Wpf.UI.Controls -{ - /// - /// Wpf-enabled wrapper for - /// - public class InkToolbarCustomToolButton : WindowsXamlHostBaseExt - { - internal Windows.UI.Xaml.Controls.InkToolbarCustomToolButton UwpControl => ChildInternal as Windows.UI.Xaml.Controls.InkToolbarCustomToolButton; - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public InkToolbarCustomToolButton() - : this(typeof(Windows.UI.Xaml.Controls.InkToolbarCustomToolButton).FullName) - { - } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for . - /// - protected InkToolbarCustomToolButton(string typeName) - : base(typeName) - { - } - - /// - protected override void SetContent() - { - // intentionally empty - } - - /// - protected override void OnInitialized(EventArgs e) - { - // Bind dependency properties across controls - // properties of FrameworkElement - Bind(nameof(Style), StyleProperty, Windows.UI.Xaml.Controls.InkToolbarCustomToolButton.StyleProperty); - Bind(nameof(MaxHeight), MaxHeightProperty, Windows.UI.Xaml.Controls.InkToolbarCustomToolButton.MaxHeightProperty); - Bind(nameof(FlowDirection), FlowDirectionProperty, Windows.UI.Xaml.Controls.InkToolbarCustomToolButton.FlowDirectionProperty); - Bind(nameof(Margin), MarginProperty, Windows.UI.Xaml.Controls.InkToolbarCustomToolButton.MarginProperty); - Bind(nameof(HorizontalAlignment), HorizontalAlignmentProperty, Windows.UI.Xaml.Controls.InkToolbarCustomToolButton.HorizontalAlignmentProperty); - Bind(nameof(VerticalAlignment), VerticalAlignmentProperty, Windows.UI.Xaml.Controls.InkToolbarCustomToolButton.VerticalAlignmentProperty); - Bind(nameof(MinHeight), MinHeightProperty, Windows.UI.Xaml.Controls.InkToolbarCustomToolButton.MinHeightProperty); - Bind(nameof(Height), HeightProperty, Windows.UI.Xaml.Controls.InkToolbarCustomToolButton.HeightProperty); - Bind(nameof(MinWidth), MinWidthProperty, Windows.UI.Xaml.Controls.InkToolbarCustomToolButton.MinWidthProperty); - Bind(nameof(MaxWidth), MaxWidthProperty, Windows.UI.Xaml.Controls.InkToolbarCustomToolButton.MaxWidthProperty); - Bind(nameof(UseLayoutRounding), UseLayoutRoundingProperty, Windows.UI.Xaml.Controls.InkToolbarCustomToolButton.UseLayoutRoundingProperty); - Bind(nameof(Name), NameProperty, Windows.UI.Xaml.Controls.InkToolbarCustomToolButton.NameProperty); - Bind(nameof(Tag), TagProperty, Windows.UI.Xaml.Controls.InkToolbarCustomToolButton.TagProperty); - Bind(nameof(DataContext), DataContextProperty, Windows.UI.Xaml.Controls.InkToolbarCustomToolButton.DataContextProperty); - Bind(nameof(Width), WidthProperty, Windows.UI.Xaml.Controls.InkToolbarCustomToolButton.WidthProperty); - - // InkToolbarCustomToolButton specific properties - /* Bind(nameof(ConfigurationContent), ConfigurationContentProperty, Windows.UI.Xaml.Controls.InkToolbarCustomToolButton.ConfigurationContentProperty); */ - - base.OnInitialized(e); - } - - /// - /// Gets - /// - public static DependencyProperty ConfigurationContentProperty { get; } = DependencyProperty.Register(nameof(ConfigurationContent), typeof(UIElement), typeof(InkToolbarCustomToolButton)); - - /// - /// Gets or sets - /// - public UIElement ConfigurationContent - { - get => (UIElement)GetValue(ConfigurationContentProperty); - set => SetValue(ConfigurationContentProperty, value); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/InkToolbar/InkToolbarIsStencilButtonCheckedChangedEventArgs.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/InkToolbar/InkToolbarIsStencilButtonCheckedChangedEventArgs.cs deleted file mode 100644 index 523ad94e7d3..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/InkToolbar/InkToolbarIsStencilButtonCheckedChangedEventArgs.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; - -namespace Microsoft.Toolkit.Wpf.UI.Controls -{ - /// - /// Provides data for events. This class cannot be inherited. - /// - /// Copy from to avoid requirement to link Windows.winmd - /// - public sealed class InkToolbarIsStencilButtonCheckedChangedEventArgs : EventArgs - { - private readonly Windows.UI.Xaml.Controls.InkToolbarIsStencilButtonCheckedChangedEventArgs _args; - - internal InkToolbarIsStencilButtonCheckedChangedEventArgs(Windows.UI.Xaml.Controls.InkToolbarIsStencilButtonCheckedChangedEventArgs args) - { - _args = args; - } - - public InkToolbarStencilButton StencilButton => (InkToolbarStencilButton)_args.StencilButton.GetWrapper(); - - public Win32.UI.Controls.Interop.WinRT.InkToolbarStencilKind StencilKind => (Win32.UI.Controls.Interop.WinRT.InkToolbarStencilKind)_args.StencilKind; - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator InkToolbarIsStencilButtonCheckedChangedEventArgs( - Windows.UI.Xaml.Controls.InkToolbarIsStencilButtonCheckedChangedEventArgs args) - { - return FromInkToolbarIsStencilButtonCheckedChangedEventArgs(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static InkToolbarIsStencilButtonCheckedChangedEventArgs FromInkToolbarIsStencilButtonCheckedChangedEventArgs(Windows.UI.Xaml.Controls.InkToolbarIsStencilButtonCheckedChangedEventArgs args) - { - return new InkToolbarIsStencilButtonCheckedChangedEventArgs(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/InkToolbar/InkToolbarMenuButton.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/InkToolbar/InkToolbarMenuButton.cs deleted file mode 100644 index 1b5bf78dc84..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/InkToolbar/InkToolbarMenuButton.cs +++ /dev/null @@ -1,88 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Windows; -using Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT; - -namespace Microsoft.Toolkit.Wpf.UI.Controls -{ - /// - /// Wpf-enabled wrapper for - /// - public class InkToolbarMenuButton : WindowsXamlHostBaseExt - { - internal Windows.UI.Xaml.Controls.InkToolbarMenuButton UwpControl => ChildInternal as Windows.UI.Xaml.Controls.InkToolbarMenuButton; - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public InkToolbarMenuButton() - : this(typeof(Windows.UI.Xaml.Controls.InkToolbarMenuButton).FullName) - { - } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for . - /// - protected InkToolbarMenuButton(string typeName) - : base(typeName) - { - } - - /// - protected override void SetContent() - { - // intentionally empty - } - - /// - protected override void OnInitialized(EventArgs e) - { - // Bind dependency properties across controls - // properties of FrameworkElement - Bind(nameof(Style), StyleProperty, Windows.UI.Xaml.Controls.InkToolbarMenuButton.StyleProperty); - Bind(nameof(MaxHeight), MaxHeightProperty, Windows.UI.Xaml.Controls.InkToolbarMenuButton.MaxHeightProperty); - Bind(nameof(FlowDirection), FlowDirectionProperty, Windows.UI.Xaml.Controls.InkToolbarMenuButton.FlowDirectionProperty); - Bind(nameof(Margin), MarginProperty, Windows.UI.Xaml.Controls.InkToolbarMenuButton.MarginProperty); - Bind(nameof(HorizontalAlignment), HorizontalAlignmentProperty, Windows.UI.Xaml.Controls.InkToolbarMenuButton.HorizontalAlignmentProperty); - Bind(nameof(VerticalAlignment), VerticalAlignmentProperty, Windows.UI.Xaml.Controls.InkToolbarMenuButton.VerticalAlignmentProperty); - Bind(nameof(MinHeight), MinHeightProperty, Windows.UI.Xaml.Controls.InkToolbarMenuButton.MinHeightProperty); - Bind(nameof(Height), HeightProperty, Windows.UI.Xaml.Controls.InkToolbarMenuButton.HeightProperty); - Bind(nameof(MinWidth), MinWidthProperty, Windows.UI.Xaml.Controls.InkToolbarMenuButton.MinWidthProperty); - Bind(nameof(MaxWidth), MaxWidthProperty, Windows.UI.Xaml.Controls.InkToolbarMenuButton.MaxWidthProperty); - Bind(nameof(UseLayoutRounding), UseLayoutRoundingProperty, Windows.UI.Xaml.Controls.InkToolbarMenuButton.UseLayoutRoundingProperty); - Bind(nameof(Name), NameProperty, Windows.UI.Xaml.Controls.InkToolbarMenuButton.NameProperty); - Bind(nameof(Tag), TagProperty, Windows.UI.Xaml.Controls.InkToolbarMenuButton.TagProperty); - Bind(nameof(DataContext), DataContextProperty, Windows.UI.Xaml.Controls.InkToolbarMenuButton.DataContextProperty); - Bind(nameof(Width), WidthProperty, Windows.UI.Xaml.Controls.InkToolbarMenuButton.WidthProperty); - - // InkToolbarMenuButton specific properties - Bind(nameof(IsExtensionGlyphShown), IsExtensionGlyphShownProperty, Windows.UI.Xaml.Controls.InkToolbarMenuButton.IsExtensionGlyphShownProperty); - - base.OnInitialized(e); - } - - /// - /// Gets - /// - public static DependencyProperty IsExtensionGlyphShownProperty { get; } = DependencyProperty.Register(nameof(IsExtensionGlyphShown), typeof(bool), typeof(InkToolbarMenuButton)); - - /// - /// Gets or sets a value indicating whether - /// - public bool IsExtensionGlyphShown - { - get => (bool)GetValue(IsExtensionGlyphShownProperty); - set => SetValue(IsExtensionGlyphShownProperty, value); - } - - /// - /// Gets - /// - public InkToolbarMenuKind MenuKind => (InkToolbarMenuKind)UwpControl.MenuKind; - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/InkToolbar/InkToolbarPenButton.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/InkToolbar/InkToolbarPenButton.cs deleted file mode 100644 index 13d0bf5304f..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/InkToolbar/InkToolbarPenButton.cs +++ /dev/null @@ -1,154 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Windows; -using Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT; - -namespace Microsoft.Toolkit.Wpf.UI.Controls -{ - /// - /// Wpf-enabled wrapper for - /// - public class InkToolbarPenButton : WindowsXamlHostBaseExt - { - internal Windows.UI.Xaml.Controls.InkToolbarPenButton UwpControl => ChildInternal as Windows.UI.Xaml.Controls.InkToolbarPenButton; - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public InkToolbarPenButton() - : this(typeof(Windows.UI.Xaml.Controls.InkToolbarPenButton).FullName) - { - } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for . - /// - protected InkToolbarPenButton(string typeName) - : base(typeName) - { - } - - /// - protected override void SetContent() - { - // intentionally empty - } - - /// - protected override void OnInitialized(EventArgs e) - { - // Bind dependency properties across controls - // properties of FrameworkElement - Bind(nameof(Style), StyleProperty, Windows.UI.Xaml.Controls.InkToolbarPenButton.StyleProperty); - Bind(nameof(MaxHeight), MaxHeightProperty, Windows.UI.Xaml.Controls.InkToolbarPenButton.MaxHeightProperty); - Bind(nameof(FlowDirection), FlowDirectionProperty, Windows.UI.Xaml.Controls.InkToolbarPenButton.FlowDirectionProperty); - Bind(nameof(Margin), MarginProperty, Windows.UI.Xaml.Controls.InkToolbarPenButton.MarginProperty); - Bind(nameof(HorizontalAlignment), HorizontalAlignmentProperty, Windows.UI.Xaml.Controls.InkToolbarPenButton.HorizontalAlignmentProperty); - Bind(nameof(VerticalAlignment), VerticalAlignmentProperty, Windows.UI.Xaml.Controls.InkToolbarPenButton.VerticalAlignmentProperty); - Bind(nameof(MinHeight), MinHeightProperty, Windows.UI.Xaml.Controls.InkToolbarPenButton.MinHeightProperty); - Bind(nameof(Height), HeightProperty, Windows.UI.Xaml.Controls.InkToolbarPenButton.HeightProperty); - Bind(nameof(MinWidth), MinWidthProperty, Windows.UI.Xaml.Controls.InkToolbarPenButton.MinWidthProperty); - Bind(nameof(MaxWidth), MaxWidthProperty, Windows.UI.Xaml.Controls.InkToolbarPenButton.MaxWidthProperty); - Bind(nameof(UseLayoutRounding), UseLayoutRoundingProperty, Windows.UI.Xaml.Controls.InkToolbarPenButton.UseLayoutRoundingProperty); - Bind(nameof(Name), NameProperty, Windows.UI.Xaml.Controls.InkToolbarPenButton.NameProperty); - Bind(nameof(Tag), TagProperty, Windows.UI.Xaml.Controls.InkToolbarPenButton.TagProperty); - Bind(nameof(DataContext), DataContextProperty, Windows.UI.Xaml.Controls.InkToolbarPenButton.DataContextProperty); - Bind(nameof(Width), WidthProperty, Windows.UI.Xaml.Controls.InkToolbarPenButton.WidthProperty); - - // InkToolbarPenButton specific properties - Bind(nameof(SelectedStrokeWidth), SelectedStrokeWidthProperty, Windows.UI.Xaml.Controls.InkToolbarPenButton.SelectedStrokeWidthProperty); - Bind(nameof(SelectedBrushIndex), SelectedBrushIndexProperty, Windows.UI.Xaml.Controls.InkToolbarPenButton.SelectedBrushIndexProperty); - Bind(nameof(Palette), PaletteProperty, Windows.UI.Xaml.Controls.InkToolbarPenButton.PaletteProperty); - Bind(nameof(MinStrokeWidth), MinStrokeWidthProperty, Windows.UI.Xaml.Controls.InkToolbarPenButton.MinStrokeWidthProperty); - Bind(nameof(MaxStrokeWidth), MaxStrokeWidthProperty, Windows.UI.Xaml.Controls.InkToolbarPenButton.MaxStrokeWidthProperty); - Bind(nameof(SelectedBrush), SelectedBrushProperty, Windows.UI.Xaml.Controls.InkToolbarPenButton.SelectedBrushProperty, new WindowsXamlHostWrapperConverter()); - - base.OnInitialized(e); - } - - /// - /// Gets - /// - public static DependencyProperty MaxStrokeWidthProperty { get; } = DependencyProperty.Register(nameof(MaxStrokeWidth), typeof(double), typeof(InkToolbarPenButton)); - - /// - /// Gets - /// - public static DependencyProperty MinStrokeWidthProperty { get; } = DependencyProperty.Register(nameof(MinStrokeWidth), typeof(double), typeof(InkToolbarPenButton)); - - /// - /// Gets - /// - public static DependencyProperty PaletteProperty { get; } = DependencyProperty.Register(nameof(Palette), typeof(System.Collections.Generic.IList), typeof(InkToolbarPenButton)); - - /// - /// Gets - /// - public static DependencyProperty SelectedBrushIndexProperty { get; } = DependencyProperty.Register(nameof(SelectedBrushIndex), typeof(int), typeof(InkToolbarPenButton)); - - /// - /// Gets - /// - public static DependencyProperty SelectedBrushProperty { get; } = DependencyProperty.Register(nameof(SelectedBrush), typeof(Brush), typeof(InkToolbarPenButton)); - - /// - /// Gets - /// - public static DependencyProperty SelectedStrokeWidthProperty { get; } = DependencyProperty.Register(nameof(SelectedStrokeWidth), typeof(double), typeof(InkToolbarPenButton)); - - /// - /// Gets or sets - /// - public double SelectedStrokeWidth - { - get => (double)GetValue(SelectedStrokeWidthProperty); - set => SetValue(SelectedStrokeWidthProperty, value); - } - - /// - /// Gets or sets - /// - public int SelectedBrushIndex - { - get => (int)GetValue(SelectedBrushIndexProperty); - set => SetValue(SelectedBrushIndexProperty, value); - } - - /// - /// Gets or sets - /// - public System.Collections.Generic.IList Palette - { - get => (System.Collections.Generic.IList)GetValue(PaletteProperty); - set => SetValue(PaletteProperty, value); - } - - /// - /// Gets or sets - /// - public double MinStrokeWidth - { - get => (double)GetValue(MinStrokeWidthProperty); - set => SetValue(MinStrokeWidthProperty, value); - } - - /// - /// Gets or sets - /// - public double MaxStrokeWidth - { - get => (double)GetValue(MaxStrokeWidthProperty); - set => SetValue(MaxStrokeWidthProperty, value); - } - - /// - /// Gets - /// - public Brush SelectedBrush => (Brush)GetValue(SelectedBrushProperty); - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/InkToolbar/InkToolbarStencilButton.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/InkToolbar/InkToolbarStencilButton.cs deleted file mode 100644 index 6eed7d9f27a..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/InkToolbar/InkToolbarStencilButton.cs +++ /dev/null @@ -1,138 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Windows; -using Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT; - -namespace Microsoft.Toolkit.Wpf.UI.Controls -{ - /// - /// Wpf-enabled wrapper for - /// - public class InkToolbarStencilButton : WindowsXamlHostBaseExt - { - internal Windows.UI.Xaml.Controls.InkToolbarStencilButton UwpControl => ChildInternal as Windows.UI.Xaml.Controls.InkToolbarStencilButton; - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public InkToolbarStencilButton() - : this(typeof(Windows.UI.Xaml.Controls.InkToolbarStencilButton).FullName) - { - } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for . - /// - protected InkToolbarStencilButton(string typeName) - : base(typeName) - { - } - - /// - protected override void SetContent() - { - // intentionally empty - } - - /// - protected override void OnInitialized(EventArgs e) - { - // Bind dependency properties across controls - // properties of FrameworkElement - Bind(nameof(Style), StyleProperty, Windows.UI.Xaml.Controls.InkToolbarStencilButton.StyleProperty); - Bind(nameof(MaxHeight), MaxHeightProperty, Windows.UI.Xaml.Controls.InkToolbarStencilButton.MaxHeightProperty); - Bind(nameof(FlowDirection), FlowDirectionProperty, Windows.UI.Xaml.Controls.InkToolbarStencilButton.FlowDirectionProperty); - Bind(nameof(Margin), MarginProperty, Windows.UI.Xaml.Controls.InkToolbarStencilButton.MarginProperty); - Bind(nameof(HorizontalAlignment), HorizontalAlignmentProperty, Windows.UI.Xaml.Controls.InkToolbarStencilButton.HorizontalAlignmentProperty); - Bind(nameof(VerticalAlignment), VerticalAlignmentProperty, Windows.UI.Xaml.Controls.InkToolbarStencilButton.VerticalAlignmentProperty); - Bind(nameof(MinHeight), MinHeightProperty, Windows.UI.Xaml.Controls.InkToolbarStencilButton.MinHeightProperty); - Bind(nameof(Height), HeightProperty, Windows.UI.Xaml.Controls.InkToolbarStencilButton.HeightProperty); - Bind(nameof(MinWidth), MinWidthProperty, Windows.UI.Xaml.Controls.InkToolbarStencilButton.MinWidthProperty); - Bind(nameof(MaxWidth), MaxWidthProperty, Windows.UI.Xaml.Controls.InkToolbarStencilButton.MaxWidthProperty); - Bind(nameof(UseLayoutRounding), UseLayoutRoundingProperty, Windows.UI.Xaml.Controls.InkToolbarStencilButton.UseLayoutRoundingProperty); - Bind(nameof(Name), NameProperty, Windows.UI.Xaml.Controls.InkToolbarStencilButton.NameProperty); - Bind(nameof(Tag), TagProperty, Windows.UI.Xaml.Controls.InkToolbarStencilButton.TagProperty); - Bind(nameof(DataContext), DataContextProperty, Windows.UI.Xaml.Controls.InkToolbarStencilButton.DataContextProperty); - Bind(nameof(Width), WidthProperty, Windows.UI.Xaml.Controls.InkToolbarStencilButton.WidthProperty); - - // InkToolbarStencilButton specific properties - Bind(nameof(SelectedStencil), SelectedStencilProperty, Windows.UI.Xaml.Controls.InkToolbarStencilButton.SelectedStencilProperty, new WindowsXamlHostWrapperConverter()); - Bind(nameof(IsRulerItemVisible), IsRulerItemVisibleProperty, Windows.UI.Xaml.Controls.InkToolbarStencilButton.IsRulerItemVisibleProperty); - Bind(nameof(IsProtractorItemVisible), IsProtractorItemVisibleProperty, Windows.UI.Xaml.Controls.InkToolbarStencilButton.IsProtractorItemVisibleProperty); - Bind(nameof(Protractor), ProtractorProperty, Windows.UI.Xaml.Controls.InkToolbarStencilButton.ProtractorProperty, new WindowsXamlHostWrapperConverter()); - Bind(nameof(Ruler), RulerProperty, Windows.UI.Xaml.Controls.InkToolbarStencilButton.RulerProperty, new WindowsXamlHostWrapperConverter()); - - base.OnInitialized(e); - } - - /// - /// Gets - /// - public static DependencyProperty IsProtractorItemVisibleProperty { get; } = DependencyProperty.Register(nameof(IsProtractorItemVisible), typeof(bool), typeof(InkToolbarStencilButton)); - - /// - /// Gets - /// - public static DependencyProperty IsRulerItemVisibleProperty { get; } = DependencyProperty.Register(nameof(IsRulerItemVisible), typeof(bool), typeof(InkToolbarStencilButton)); - - /// - /// Gets - /// - public static DependencyProperty ProtractorProperty { get; } = DependencyProperty.Register(nameof(Protractor), typeof(InkPresenterProtractor), typeof(InkToolbarStencilButton)); - - /// - /// Gets - /// - public static DependencyProperty RulerProperty { get; } = DependencyProperty.Register(nameof(Ruler), typeof(InkPresenterRuler), typeof(InkToolbarStencilButton)); - - /// - /// Gets - /// - public static DependencyProperty SelectedStencilProperty { get; } = DependencyProperty.Register(nameof(SelectedStencil), typeof(InkToolbarStencilKind), typeof(InkToolbarStencilButton)); - - /// - /// Gets or sets - /// - public InkToolbarStencilKind SelectedStencil - { - get => (InkToolbarStencilKind)GetValue(SelectedStencilProperty); - set => SetValue(SelectedStencilProperty, value); - } - - /// - /// Gets or sets a value indicating whether - /// - public bool IsRulerItemVisible - { - get => (bool)GetValue(IsRulerItemVisibleProperty); - set => SetValue(IsRulerItemVisibleProperty, value); - } - - /// - /// Gets or sets a value indicating whether - /// - public bool IsProtractorItemVisible - { - get => (bool)GetValue(IsProtractorItemVisibleProperty); - set => SetValue(IsProtractorItemVisibleProperty, value); - } - - /// - /// Gets - /// - public InkPresenterProtractor Protractor - { - get => (InkPresenterProtractor)GetValue(ProtractorProperty); - } - - /// - /// Gets - /// - public InkPresenterRuler Ruler => (InkPresenterRuler)GetValue(RulerProperty); - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/InkToolbar/InkToolbarToggleButton.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/InkToolbar/InkToolbarToggleButton.cs deleted file mode 100644 index 9bf1e8720b4..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/InkToolbar/InkToolbarToggleButton.cs +++ /dev/null @@ -1,70 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT; - -namespace Microsoft.Toolkit.Wpf.UI.Controls -{ - /// - /// Wpf-enabled wrapper for - /// - public class InkToolbarToggleButton : WindowsXamlHostBaseExt - { - internal Windows.UI.Xaml.Controls.InkToolbarToggleButton UwpControl => ChildInternal as Windows.UI.Xaml.Controls.InkToolbarToggleButton; - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public InkToolbarToggleButton() - : this(typeof(Windows.UI.Xaml.Controls.InkToolbarToggleButton).FullName) - { - } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for . - /// - protected InkToolbarToggleButton(string typeName) - : base(typeName) - { - } - - /// - protected override void SetContent() - { - // intentionally empty - } - - /// - protected override void OnInitialized(EventArgs e) - { - // Bind dependency properties across controls - // properties of FrameworkElement - Bind(nameof(Style), StyleProperty, Windows.UI.Xaml.Controls.InkToolbarToggleButton.StyleProperty); - Bind(nameof(MaxHeight), MaxHeightProperty, Windows.UI.Xaml.Controls.InkToolbarToggleButton.MaxHeightProperty); - Bind(nameof(FlowDirection), FlowDirectionProperty, Windows.UI.Xaml.Controls.InkToolbarToggleButton.FlowDirectionProperty); - Bind(nameof(Margin), MarginProperty, Windows.UI.Xaml.Controls.InkToolbarToggleButton.MarginProperty); - Bind(nameof(HorizontalAlignment), HorizontalAlignmentProperty, Windows.UI.Xaml.Controls.InkToolbarToggleButton.HorizontalAlignmentProperty); - Bind(nameof(VerticalAlignment), VerticalAlignmentProperty, Windows.UI.Xaml.Controls.InkToolbarToggleButton.VerticalAlignmentProperty); - Bind(nameof(MinHeight), MinHeightProperty, Windows.UI.Xaml.Controls.InkToolbarToggleButton.MinHeightProperty); - Bind(nameof(Height), HeightProperty, Windows.UI.Xaml.Controls.InkToolbarToggleButton.HeightProperty); - Bind(nameof(MinWidth), MinWidthProperty, Windows.UI.Xaml.Controls.InkToolbarToggleButton.MinWidthProperty); - Bind(nameof(MaxWidth), MaxWidthProperty, Windows.UI.Xaml.Controls.InkToolbarToggleButton.MaxWidthProperty); - Bind(nameof(UseLayoutRounding), UseLayoutRoundingProperty, Windows.UI.Xaml.Controls.InkToolbarToggleButton.UseLayoutRoundingProperty); - Bind(nameof(Name), NameProperty, Windows.UI.Xaml.Controls.InkToolbarToggleButton.NameProperty); - Bind(nameof(Tag), TagProperty, Windows.UI.Xaml.Controls.InkToolbarToggleButton.TagProperty); - Bind(nameof(DataContext), DataContextProperty, Windows.UI.Xaml.Controls.InkToolbarToggleButton.DataContextProperty); - Bind(nameof(Width), WidthProperty, Windows.UI.Xaml.Controls.InkToolbarToggleButton.WidthProperty); - - base.OnInitialized(e); - } - - /// - /// Gets - /// - public InkToolbarToggle ToggleKind => (InkToolbarToggle)UwpControl.ToggleKind; - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/InkToolbar/InkToolbarToolButton.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/InkToolbar/InkToolbarToolButton.cs deleted file mode 100644 index 64e8160b0cb..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/InkToolbar/InkToolbarToolButton.cs +++ /dev/null @@ -1,88 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Windows; -using Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT; - -namespace Microsoft.Toolkit.Wpf.UI.Controls -{ - /// - /// Wpf-enabled wrapper for - /// - public class InkToolbarToolButton : WindowsXamlHostBaseExt - { - internal Windows.UI.Xaml.Controls.InkToolbarToolButton UwpControl => ChildInternal as Windows.UI.Xaml.Controls.InkToolbarToolButton; - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public InkToolbarToolButton() - : this(typeof(Windows.UI.Xaml.Controls.InkToolbarToolButton).FullName) - { - } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for . - /// - protected InkToolbarToolButton(string typeName) - : base(typeName) - { - } - - /// - protected override void SetContent() - { - // intentionally empty - } - - /// - protected override void OnInitialized(EventArgs e) - { - // Bind dependency properties across controls - // properties of FrameworkElement - Bind(nameof(Style), StyleProperty, Windows.UI.Xaml.Controls.InkToolbarToolButton.StyleProperty); - Bind(nameof(MaxHeight), MaxHeightProperty, Windows.UI.Xaml.Controls.InkToolbarToolButton.MaxHeightProperty); - Bind(nameof(FlowDirection), FlowDirectionProperty, Windows.UI.Xaml.Controls.InkToolbarToolButton.FlowDirectionProperty); - Bind(nameof(Margin), MarginProperty, Windows.UI.Xaml.Controls.InkToolbarToolButton.MarginProperty); - Bind(nameof(HorizontalAlignment), HorizontalAlignmentProperty, Windows.UI.Xaml.Controls.InkToolbarToolButton.HorizontalAlignmentProperty); - Bind(nameof(VerticalAlignment), VerticalAlignmentProperty, Windows.UI.Xaml.Controls.InkToolbarToolButton.VerticalAlignmentProperty); - Bind(nameof(MinHeight), MinHeightProperty, Windows.UI.Xaml.Controls.InkToolbarToolButton.MinHeightProperty); - Bind(nameof(Height), HeightProperty, Windows.UI.Xaml.Controls.InkToolbarToolButton.HeightProperty); - Bind(nameof(MinWidth), MinWidthProperty, Windows.UI.Xaml.Controls.InkToolbarToolButton.MinWidthProperty); - Bind(nameof(MaxWidth), MaxWidthProperty, Windows.UI.Xaml.Controls.InkToolbarToolButton.MaxWidthProperty); - Bind(nameof(UseLayoutRounding), UseLayoutRoundingProperty, Windows.UI.Xaml.Controls.InkToolbarToolButton.UseLayoutRoundingProperty); - Bind(nameof(Name), NameProperty, Windows.UI.Xaml.Controls.InkToolbarToolButton.NameProperty); - Bind(nameof(Tag), TagProperty, Windows.UI.Xaml.Controls.InkToolbarToolButton.TagProperty); - Bind(nameof(DataContext), DataContextProperty, Windows.UI.Xaml.Controls.InkToolbarToolButton.DataContextProperty); - Bind(nameof(Width), WidthProperty, Windows.UI.Xaml.Controls.InkToolbarToolButton.WidthProperty); - - // InkToolbarToolButton specific properties - Bind(nameof(IsExtensionGlyphShown), IsExtensionGlyphShownProperty, Windows.UI.Xaml.Controls.InkToolbarToolButton.IsExtensionGlyphShownProperty); - - base.OnInitialized(e); - } - - /// - /// Gets - /// - public static DependencyProperty IsExtensionGlyphShownProperty { get; } = DependencyProperty.Register(nameof(IsExtensionGlyphShown), typeof(bool), typeof(InkToolbarToolButton)); - - /// - /// Gets or sets a value indicating whether - /// - public bool IsExtensionGlyphShown - { - get => (bool)GetValue(IsExtensionGlyphShownProperty); - set => SetValue(IsExtensionGlyphShownProperty, value); - } - - /// - /// Gets - /// - public InkToolbarTool ToolKind => (InkToolbarTool)UwpControl.ToolKind; - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/InternalConversionExtensions.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/InternalConversionExtensions.cs deleted file mode 100644 index ad1bbda5834..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/InternalConversionExtensions.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Windows; - -namespace Microsoft.Toolkit.Wpf.UI.Controls -{ - internal static class InternalConversionExtensions - { - public static Rect ToWpf(this Windows.Foundation.Rect uwp) - { - return new Rect(uwp.X, uwp.Y, uwp.Width, uwp.Height); - } - - public static Windows.Foundation.Point ToUwp(this Point wpf) - { - return new Windows.Foundation.Point(wpf.X, wpf.Y); - } - } -} diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/MediaPlayerElement/MediaPlayerElement.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/MediaPlayerElement/MediaPlayerElement.cs deleted file mode 100644 index f79a528e5e7..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/MediaPlayerElement/MediaPlayerElement.cs +++ /dev/null @@ -1,183 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Windows; -using Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT; - -namespace Microsoft.Toolkit.Wpf.UI.Controls -{ - /// - /// Wpf-enabled wrapper for - /// - public class MediaPlayerElement : WindowsXamlHostBaseExt - { - internal Windows.UI.Xaml.Controls.MediaPlayerElement UwpControl => ChildInternal as Windows.UI.Xaml.Controls.MediaPlayerElement; - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for - /// - public MediaPlayerElement() - : this(typeof(Windows.UI.Xaml.Controls.MediaPlayerElement).FullName) - { - } - - /// - /// Initializes a new instance of the class, a - /// Wpf-enabled wrapper for . - /// - protected MediaPlayerElement(string typeName) - : base(typeName) - { - } - - /// - protected override void OnInitialized(EventArgs e) - { - // Bind dependency properties across controls - // properties of FrameworkElement - Bind(nameof(Style), StyleProperty, Windows.UI.Xaml.Controls.MediaPlayerElement.StyleProperty); - Bind(nameof(MaxHeight), MaxHeightProperty, Windows.UI.Xaml.Controls.MediaPlayerElement.MaxHeightProperty); - Bind(nameof(FlowDirection), FlowDirectionProperty, Windows.UI.Xaml.Controls.MediaPlayerElement.FlowDirectionProperty); - Bind(nameof(Margin), MarginProperty, Windows.UI.Xaml.Controls.MediaPlayerElement.MarginProperty); - Bind(nameof(HorizontalAlignment), HorizontalAlignmentProperty, Windows.UI.Xaml.Controls.MediaPlayerElement.HorizontalAlignmentProperty); - Bind(nameof(VerticalAlignment), VerticalAlignmentProperty, Windows.UI.Xaml.Controls.MediaPlayerElement.VerticalAlignmentProperty); - Bind(nameof(MinHeight), MinHeightProperty, Windows.UI.Xaml.Controls.MediaPlayerElement.MinHeightProperty); - Bind(nameof(Height), HeightProperty, Windows.UI.Xaml.Controls.MediaPlayerElement.HeightProperty); - Bind(nameof(MinWidth), MinWidthProperty, Windows.UI.Xaml.Controls.MediaPlayerElement.MinWidthProperty); - Bind(nameof(MaxWidth), MaxWidthProperty, Windows.UI.Xaml.Controls.MediaPlayerElement.MaxWidthProperty); - Bind(nameof(UseLayoutRounding), UseLayoutRoundingProperty, Windows.UI.Xaml.Controls.MediaPlayerElement.UseLayoutRoundingProperty); - Bind(nameof(Name), NameProperty, Windows.UI.Xaml.Controls.MediaPlayerElement.NameProperty); - Bind(nameof(Tag), TagProperty, Windows.UI.Xaml.Controls.MediaPlayerElement.TagProperty); - Bind(nameof(DataContext), DataContextProperty, Windows.UI.Xaml.Controls.MediaPlayerElement.DataContextProperty); - Bind(nameof(Width), WidthProperty, Windows.UI.Xaml.Controls.MediaPlayerElement.WidthProperty); - - // MediaPlayerElement specific properties - Bind(nameof(Stretch), StretchProperty, Windows.UI.Xaml.Controls.MediaPlayerElement.StretchProperty); - Bind(nameof(Source), SourceProperty, Windows.UI.Xaml.Controls.MediaPlayerElement.SourceProperty, new MediaSourceConverter()); - Bind(nameof(PosterSource), PosterSourceProperty, Windows.UI.Xaml.Controls.MediaPlayerElement.PosterSourceProperty); - Bind(nameof(IsFullWindow), IsFullWindowProperty, Windows.UI.Xaml.Controls.MediaPlayerElement.IsFullWindowProperty); - Bind(nameof(AutoPlay), AutoPlayProperty, Windows.UI.Xaml.Controls.MediaPlayerElement.AutoPlayProperty); - Bind(nameof(AreTransportControlsEnabled), AreTransportControlsEnabledProperty, Windows.UI.Xaml.Controls.MediaPlayerElement.AreTransportControlsEnabledProperty); - Bind(nameof(MediaPlayer), MediaPlayerProperty, Windows.UI.Xaml.Controls.MediaPlayerElement.MediaPlayerProperty, null, System.ComponentModel.BindingDirection.OneWay); - - // Full-screen not supported yet. - UwpControl.TransportControls.IsFullWindowButtonVisible = false; - - base.OnInitialized(e); - } - - /// - /// Gets - /// - public static DependencyProperty AreTransportControlsEnabledProperty { get; } = DependencyProperty.Register(nameof(AreTransportControlsEnabled), typeof(bool), typeof(MediaPlayerElement)); - - /// - /// Gets - /// - public static DependencyProperty AutoPlayProperty { get; } = DependencyProperty.Register(nameof(AutoPlay), typeof(bool), typeof(MediaPlayerElement)); - - /// - /// Gets - /// - public static DependencyProperty IsFullWindowProperty { get; } = DependencyProperty.Register(nameof(IsFullWindow), typeof(bool), typeof(MediaPlayerElement)); - - /// - /// Gets - /// - public static DependencyProperty MediaPlayerProperty { get; } = DependencyProperty.Register(nameof(MediaPlayer), typeof(MediaPlayer), typeof(MediaPlayerElement)); - - /// - /// Gets - /// - public static DependencyProperty PosterSourceProperty { get; } = DependencyProperty.Register(nameof(PosterSource), typeof(ImageSource), typeof(MediaPlayerElement)); - - /// - /// Gets - /// - public static DependencyProperty SourceProperty { get; } = DependencyProperty.Register(nameof(Source), typeof(string), typeof(MediaPlayerElement)); - - /// - /// Gets - /// - public static DependencyProperty StretchProperty { get; } = DependencyProperty.Register(nameof(Stretch), typeof(Stretch), typeof(MediaPlayerElement)); - - /// - /// - /// - public void SetMediaPlayer(MediaPlayer mediaPlayer) => UwpControl.SetMediaPlayer(mediaPlayer.UwpInstance); - - /// - /// Gets or sets - /// - public MediaTransportControls TransportControls - { - get => UwpControl.TransportControls; - set => UwpControl.TransportControls = value.UwpInstance; - } - - /// - /// Gets or sets - /// - public Stretch Stretch - { - get => (Stretch)GetValue(StretchProperty); - set => SetValue(StretchProperty, value); - } - - /// - /// Gets or sets - /// - public string Source - { - get => (string)GetValue(SourceProperty); - set => SetValue(SourceProperty, value); - } - - /// - /// Gets or sets - /// - public ImageSource PosterSource - { - get => (ImageSource)GetValue(PosterSourceProperty); - set => SetValue(PosterSourceProperty, value); - } - - /// - /// Gets or sets a value indicating whether - /// - public bool IsFullWindow - { - get => (bool)GetValue(IsFullWindowProperty); - set => SetValue(IsFullWindowProperty, value); - } - - /// - /// Gets or sets a value indicating whether - /// - public bool AutoPlay - { - get => (bool)GetValue(AutoPlayProperty); - set => SetValue(AutoPlayProperty, value); - } - - /// - /// Gets or sets a value indicating whether - /// - public bool AreTransportControlsEnabled - { - get => (bool)GetValue(AreTransportControlsEnabledProperty); - set => SetValue(AreTransportControlsEnabledProperty, value); - } - - /// - /// Gets - /// - public MediaPlayer MediaPlayer - { - get => (MediaPlayer)GetValue(MediaPlayerProperty); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/MediaPlayerElement/MediaSourceConverter.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/MediaPlayerElement/MediaSourceConverter.cs deleted file mode 100644 index 7572400fa20..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/MediaPlayerElement/MediaSourceConverter.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Globalization; -using System.Windows.Data; -using Windows.Media.Core; - -namespace Microsoft.Toolkit.Wpf.UI.Controls -{ - /// - /// Dual interface IValueConverter, converts a uri string to UWP MediaSource and back on behalf of both WPF and UWP bindings. - /// - internal class MediaSourceConverter : IValueConverter, Windows.UI.Xaml.Data.IValueConverter - { - object IValueConverter.Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - if (value == null) - { - return null; - } - - return ((MediaSource)value).Uri.ToString(); - } - - object IValueConverter.ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw new NotImplementedException(); - } - - object Windows.UI.Xaml.Data.IValueConverter.Convert(object value, Type targetType, object parameter, string language) - { - if (value == null) - { - return null; - } - - // REVIEW: Possible null assignment and uncaught exception - return MediaSource.CreateFromUri(new Uri(value as string)); - } - - object Windows.UI.Xaml.Data.IValueConverter.ConvertBack(object value, Type targetType, object parameter, string language) - { - throw new NotImplementedException(); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/Microsoft.Toolkit.Wpf.UI.Controls.csproj b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/Microsoft.Toolkit.Wpf.UI.Controls.csproj deleted file mode 100644 index d8714daf66a..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/Microsoft.Toolkit.Wpf.UI.Controls.csproj +++ /dev/null @@ -1,100 +0,0 @@ - - - - net462 - Microsoft.Toolkit.Wpf.UI.Controls - Microsoft.Toolkit.Wpf.UI.Controls - true - - Windows Community Toolkit WPF Controls - This library provides XAML controls for WPF. It is part of the Windows Community Toolkit. - Win32 WPF UWP XAML - - $(DefineConstants);WPF - - - 10.0.17692.0 - - - - TRACE;DEBUG;CODE_ANALYSIS;NET47;DEV_DEBUG;DEBUG_LAYOUT - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - $(WINDIR)\Microsoft.NET\Framework\v4.0.30319\System.Runtime.WindowsRuntime.dll - - - - - - DesignerUI.resx - True - True - - - - - - DesignerUI.Designer.cs - ResXFileCodeGenerator - - - - - - - - - - - diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/Properties/AssemblyInfo.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/Properties/AssemblyInfo.cs deleted file mode 100644 index fe98d490529..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Resources; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Security; - -[assembly: ComVisible(false)] -[assembly: NeutralResourcesLanguage("en-US")] - -// Dependencies - -// Common -[assembly: Dependency("System", LoadHint.Always)] -[assembly: Dependency("System.Core", LoadHint.Always)] -[assembly: Dependency("System.Xml", LoadHint.Always)] - -// WPF -[assembly: Dependency("PresentationFramework", LoadHint.Sometimes)] -[assembly: Dependency("PresentationCore", LoadHint.Sometimes)] -[assembly: Dependency("WindowsBase", LoadHint.Sometimes)] -[assembly: Dependency("System.Xaml", LoadHint.Sometimes)] -[assembly: Dependency("System.Configuration", LoadHint.Sometimes)] -[assembly: Dependency("PresentationFramework.Aero2", LoadHint.Sometimes)] -[assembly: Dependency("Windows.Foundation.winmd", LoadHint.Sometimes)] -[assembly: Dependency("Windows.Web.winmd", LoadHint.Sometimes)] -[assembly: Dependency("System.Runtime.InteropServices.WindowsRuntime", LoadHint.Sometimes)] -[assembly: Dependency("System.Runtime.Serialization", LoadHint.Sometimes)] -[assembly: Dependency("SMDiagnostics", LoadHint.Sometimes)] -[assembly: Dependency("System.ServiceModel.Internals", LoadHint.Sometimes)] -[assembly: Dependency("System.Runtime.WindowsRuntime", LoadHint.Sometimes)] -[assembly: Dependency("UIAutomationProvider", LoadHint.Sometimes)] -[assembly: Dependency("System.Windows.Forms", LoadHint.Sometimes)] -[assembly: Dependency("System.Drawing", LoadHint.Sometimes)] -[assembly: Dependency("System.Runtime", LoadHint.Sometimes)] -[assembly: Dependency("Windows.Globalization.winmd", LoadHint.Sometimes)] -[assembly: Dependency("Windows.Storage.winmd", LoadHint.Sometimes)] - -[assembly: SecurityRules(SecurityRuleSet.Level2)] -#if ALLOW_PARTIALLY_TRUSTED_CALLERS -[assembly: System.Security.AllowPartiallyTrustedCallers] -#endif diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/Properties/launchSettings.json b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/Properties/launchSettings.json deleted file mode 100644 index e7afb357485..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/Properties/launchSettings.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "profiles": { - "Microsoft.Toolkit.Win32.UI.Controls": { - "commandName": "Executable", - "executablePath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\IDE\\devenv.exe" - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/UwpUIElementExtensions.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/UwpUIElementExtensions.cs deleted file mode 100644 index 49cc65601ac..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/UwpUIElementExtensions.cs +++ /dev/null @@ -1,25 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Wpf.UI.Controls -{ - /// - /// Extensions for use with UWP UIElement objects wrapped by the WindowsXamlHostBaseExt - /// - public static class UwpUIElementExtensions - { - private static Windows.UI.Xaml.DependencyProperty WrapperProperty { get; } = - Windows.UI.Xaml.DependencyProperty.RegisterAttached("Wrapper", typeof(System.Windows.UIElement), typeof(WindowsXamlHostBaseExt), new Windows.UI.Xaml.PropertyMetadata(null)); - - public static WindowsXamlHostBaseExt GetWrapper(this Windows.UI.Xaml.UIElement element) - { - return (WindowsXamlHostBaseExt)element.GetValue(WrapperProperty); - } - - public static void SetWrapper(this Windows.UI.Xaml.UIElement element, WindowsXamlHostBaseExt wrapper) - { - element.SetValue(WrapperProperty, wrapper); - } - } -} diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/VisualStudioToolsManifest.xml b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/VisualStudioToolsManifest.xml deleted file mode 100644 index 079e08e1f51..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/VisualStudioToolsManifest.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/WindowsXamlHostBaseExt.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/WindowsXamlHostBaseExt.cs deleted file mode 100644 index 64bc5aa6706..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/WindowsXamlHostBaseExt.cs +++ /dev/null @@ -1,62 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.ComponentModel; -using System.Windows; -using System.Windows.Data; -using Microsoft.Toolkit.Win32.UI.XamlHost; -using Microsoft.Toolkit.Wpf.UI.XamlHost; - -namespace Microsoft.Toolkit.Wpf.UI.Controls -{ - /// - public class WindowsXamlHostBaseExt : WindowsXamlHostBase - { - public WindowsXamlHostBaseExt(string typeName) - { - ChildInternal = UWPTypeFactory.CreateXamlContentByType(typeName); - ChildInternal.SetWrapper(this); - } - - /// - protected override void OnInitialized(EventArgs e) - { - base.OnInitialized(e); - - SetContent(); - } - - /// - /// Binds this wrapper object's exposed WPF DependencyProperty with the wrapped UWP object's DependencyProperty - /// for what effectively works as a regular one- or two-way binding. - /// - /// the registered name of the dependency property - /// the DependencyProperty of the wrapper - /// the related DependencyProperty of the UWP control - /// a converter, if one's needed - /// indicates that the binding should be one or two directional. If one way, the Uwp control is only updated from the wrapper. - public void Bind(string propertyName, DependencyProperty wpfProperty, Windows.UI.Xaml.DependencyProperty uwpProperty, object converter = null, BindingDirection direction = BindingDirection.TwoWay) - { - if (direction == BindingDirection.TwoWay) - { - var binder = new Windows.UI.Xaml.Data.Binding() - { - Source = this, - Path = new Windows.UI.Xaml.PropertyPath(propertyName), - Converter = (Windows.UI.Xaml.Data.IValueConverter)converter - }; - Windows.UI.Xaml.Data.BindingOperations.SetBinding(ChildInternal, uwpProperty, binder); - } - - var rebinder = new Binding() - { - Source = ChildInternal, - Path = new PropertyPath(propertyName), - Converter = (IValueConverter)converter - }; - BindingOperations.SetBinding(this, wpfProperty, rebinder); - } - } -} diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/WindowsXamlHostWrapperConverter.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/WindowsXamlHostWrapperConverter.cs deleted file mode 100644 index a538e76e1a7..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.Controls/WindowsXamlHostWrapperConverter.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Globalization; -using System.Windows.Data; -using Microsoft.Toolkit.Win32.UI.Interop; -using Microsoft.Toolkit.Wpf.UI.XamlHost; -using Windows.UI.Xaml; -using uwpXaml = Windows.UI.Xaml; - -namespace Microsoft.Toolkit.Wpf.UI.Controls -{ - /// - /// Dual interface ( and ), assumes that the conversion is between a and its wrapped and attempts to return the correct instance of each. - /// - internal class WindowsXamlHostWrapperConverter : IValueConverter, Windows.UI.Xaml.Data.IValueConverter - { - object IValueConverter.Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - return (value as uwpXaml.UIElement)?.GetWrapper(); - } - - object IValueConverter.ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw new NotImplementedException(); - } - - object Windows.UI.Xaml.Data.IValueConverter.Convert(object value, Type targetType, object parameter, string language) - { - return (value as WindowsXamlHostBase)?.GetUwpInternalObject(); - } - - object Windows.UI.Xaml.Data.IValueConverter.ConvertBack(object value, Type targetType, object parameter, string language) - { - throw new NotImplementedException(); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.XamlHost/Microsoft.Toolkit.Wpf.UI.XamlHost.csproj b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.XamlHost/Microsoft.Toolkit.Wpf.UI.XamlHost.csproj deleted file mode 100644 index 17742545c4b..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.XamlHost/Microsoft.Toolkit.Wpf.UI.XamlHost.csproj +++ /dev/null @@ -1,67 +0,0 @@ - - - - net462 - Microsoft.Toolkit.Wpf.UI.XamlHost - Microsoft.Toolkit.Wpf.UI.XamlHost - true - - Windows Community Toolkit XAMLHost for WPF - This library provides XAML islands helpers for WPF. It is part of the Windows Community Toolkit. - XAML Islands Win32 WPF XAMLHost - Microsoft.Toolkit.Wpf.UI.XamlHost - - - 10.0.17692.0 - - - - - - - - - - - - $(WINDIR)\Microsoft.NET\Framework\v4.0.30319\System.Runtime.WindowsRuntime.dll - - - $(WINDIR)\Microsoft.NET\Framework\v4.0.30319\System.Runtime.WindowsRuntime.UI.Xaml.dll - - - 4.0 - - - - - - - - - True - True - Resources.resx - - - True - Settings.settings - True - - - ResXFileCodeGenerator - Resources.Designer.cs - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - - - - - - \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.XamlHost/Properties/AssemblyInfo.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.XamlHost/Properties/AssemblyInfo.cs deleted file mode 100644 index 59d02ecfba0..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.XamlHost/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,9 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Resources; -using System.Runtime.InteropServices; - -[assembly: ComVisible(false)] -[assembly: NeutralResourcesLanguage("en-US")] \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.XamlHost/Properties/Resources.Designer.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.XamlHost/Properties/Resources.Designer.cs deleted file mode 100644 index f8f324f40cf..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.XamlHost/Properties/Resources.Designer.cs +++ /dev/null @@ -1,63 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Microsoft.Toolkit.Wpf.UI.XamlHost.Properties { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.Toolkit.Wpf.UI.XamlHost.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - } -} diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.XamlHost/Properties/Resources.resx b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.XamlHost/Properties/Resources.resx deleted file mode 100644 index af7dbebbace..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.XamlHost/Properties/Resources.resx +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.XamlHost/Properties/Settings.Designer.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.XamlHost/Properties/Settings.Designer.cs deleted file mode 100644 index 14415d7f1f5..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.XamlHost/Properties/Settings.Designer.cs +++ /dev/null @@ -1,26 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Microsoft.Toolkit.Win32.UI.Interop.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.7.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - } -} diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.XamlHost/Properties/Settings.settings b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.XamlHost/Properties/Settings.settings deleted file mode 100644 index 033d7a5e9e2..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.XamlHost/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.XamlHost/VisualStudioToolsManifest.xml b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.XamlHost/VisualStudioToolsManifest.xml deleted file mode 100644 index fe07b8778fc..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.XamlHost/VisualStudioToolsManifest.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.XamlHost/WindowsXamlHost.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.XamlHost/WindowsXamlHost.cs deleted file mode 100644 index c96399a2e92..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.XamlHost/WindowsXamlHost.cs +++ /dev/null @@ -1,107 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.ComponentModel; -using System.Runtime.InteropServices; -using System.Windows; -using Microsoft.Toolkit.Win32.UI.XamlHost; - -namespace Microsoft.Toolkit.Wpf.UI.XamlHost -{ - /// - /// WindowsXamlHost control hosts UWP XAML content inside the Windows Presentation Foundation - /// - public class WindowsXamlHost : WindowsXamlHostBase - { - /// - /// Gets XAML Content by type name - /// - public static DependencyProperty InitialTypeNameProperty { get; } = DependencyProperty.Register("InitialTypeName", typeof(string), typeof(WindowsXamlHost)); - - /// - /// Gets or sets XAML Content by type name - /// - /// XamlClassLibrary.MyUserControl - /// - /// Content creation is deferred until after the parent hwnd has been created. - /// - [Browsable(true)] - [Category("XAML")] - public string InitialTypeName - { - get => (string)GetValue(InitialTypeNameProperty); - - set => SetValue(InitialTypeNameProperty, value); - } - - /// - /// Gets or sets the root UWP XAML element displayed in the WPF control instance. - /// - /// This UWP XAML element is the root element of the wrapped DesktopWindowXamlSource. - [Browsable(true)] - public Windows.UI.Xaml.UIElement Child - { - get => ChildInternal; - - set => ChildInternal = value; - } - - /// - /// Creates object, wrapped instance; creates and - /// sets root UWP XAML element on DesktopWindowXamlSource. - /// - /// Parent window handle - /// Handle to XAML window - protected override HandleRef BuildWindowCore(HandleRef hwndParent) - { - // Create and set initial root UWP XAML content - if (!string.IsNullOrEmpty(InitialTypeName) && Child == null) - { - Child = UWPTypeFactory.CreateXamlContentByType(InitialTypeName); - - var frameworkElement = Child as Windows.UI.Xaml.FrameworkElement; - - // Default to stretch : UWP XAML content will conform to the size of WindowsXamlHost - if (frameworkElement != null) - { - frameworkElement.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Stretch; - frameworkElement.VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Stretch; - } - } - - return base.BuildWindowCore(hwndParent); - } - - /// - protected override void Dispose(bool disposing) - { - if (disposing && !IsDisposed) - { - if (Child is Windows.UI.Xaml.FrameworkElement frameworkElement) - { - frameworkElement.SizeChanged -= XamlContentSizeChanged; - } - - base.Dispose(disposing); - } - } - - protected override System.IntPtr WndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) - { - const int WM_GETOBJECT = 0x003D; - switch (msg) - { - // We don't want HwndHost to handle the WM_GETOBJECT. - // Instead we want to let the HwndIslandSite's WndProc get it - // So return handled = false and don't let the base class do - // anything on that message. - case WM_GETOBJECT: - handled = false; - return System.IntPtr.Zero; - } - - return base.WndProc(hwnd, msg, wParam, lParam, ref handled); - } - } -} diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.XamlHost/WindowsXamlHostBase.Focus.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.XamlHost/WindowsXamlHostBase.Focus.cs deleted file mode 100644 index f53602e438c..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.XamlHost/WindowsXamlHostBase.Focus.cs +++ /dev/null @@ -1,152 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using System.Windows; - -namespace Microsoft.Toolkit.Wpf.UI.XamlHost -{ - /// - /// Focus and Keyboard handling for Focus integration with UWP XAML - /// - public partial class WindowsXamlHostBase - { - /// - /// Dictionary that maps WPF (host framework) FocusNavigationDirection to UWP XAML XxamlSourceFocusNavigationReason - /// - private static readonly Dictionary - MapDirectionToReason = - new Dictionary - { - { System.Windows.Input.FocusNavigationDirection.Next, Windows.UI.Xaml.Hosting.XamlSourceFocusNavigationReason.First }, - { System.Windows.Input.FocusNavigationDirection.First, Windows.UI.Xaml.Hosting.XamlSourceFocusNavigationReason.First }, - { System.Windows.Input.FocusNavigationDirection.Previous, Windows.UI.Xaml.Hosting.XamlSourceFocusNavigationReason.Last }, - { System.Windows.Input.FocusNavigationDirection.Last, Windows.UI.Xaml.Hosting.XamlSourceFocusNavigationReason.Last }, - { System.Windows.Input.FocusNavigationDirection.Up, Windows.UI.Xaml.Hosting.XamlSourceFocusNavigationReason.Up }, - { System.Windows.Input.FocusNavigationDirection.Down, Windows.UI.Xaml.Hosting.XamlSourceFocusNavigationReason.Down }, - { System.Windows.Input.FocusNavigationDirection.Left, Windows.UI.Xaml.Hosting.XamlSourceFocusNavigationReason.Left }, - { System.Windows.Input.FocusNavigationDirection.Right, Windows.UI.Xaml.Hosting.XamlSourceFocusNavigationReason.Right }, - }; - - /// - /// Dictionary that maps UWP XAML XamlSourceFocusNavigationReason to WPF (host framework) FocusNavigationDirection - /// - private static readonly Dictionary - MapReasonToDirection = - new Dictionary() - { - { Windows.UI.Xaml.Hosting.XamlSourceFocusNavigationReason.First, System.Windows.Input.FocusNavigationDirection.Next }, - { Windows.UI.Xaml.Hosting.XamlSourceFocusNavigationReason.Last, System.Windows.Input.FocusNavigationDirection.Previous }, - { Windows.UI.Xaml.Hosting.XamlSourceFocusNavigationReason.Up, System.Windows.Input.FocusNavigationDirection.Up }, - { Windows.UI.Xaml.Hosting.XamlSourceFocusNavigationReason.Down, System.Windows.Input.FocusNavigationDirection.Down }, - { Windows.UI.Xaml.Hosting.XamlSourceFocusNavigationReason.Left, System.Windows.Input.FocusNavigationDirection.Left }, - { Windows.UI.Xaml.Hosting.XamlSourceFocusNavigationReason.Right, System.Windows.Input.FocusNavigationDirection.Right }, - }; - - /// - /// Last Focus Request GUID to uniquely identify Focus operations, primarily used with error callbacks - /// - private Guid _lastFocusRequest = Guid.Empty; - - /// - /// Override for OnGotFocus that passes NavigateFocus on to the DesktopXamlSource instance - /// - /// RoutedEventArgs - protected override void OnGotFocus(RoutedEventArgs e) - { - base.OnGotFocus(e); - - if (!_xamlSource.HasFocus) - { - _xamlSource.NavigateFocus( - new Windows.UI.Xaml.Hosting.XamlSourceFocusNavigationRequest( - Windows.UI.Xaml.Hosting.XamlSourceFocusNavigationReason.Programmatic)); - } - } - - /// - /// Process Tab from host framework - /// - /// that contains requested navigation direction - /// Did handle tab - protected override bool TabIntoCore(System.Windows.Input.TraversalRequest request) - { - // Bug 17544829: Focus is wrong if the previous element is in a different FocusScope than the WindowsXamlHost element. - var focusedElement = System.Windows.Input.FocusManager.GetFocusedElement( - System.Windows.Input.FocusManager.GetFocusScope(this)) as FrameworkElement; - - var origin = BoundsRelativeTo(focusedElement, this); - var reason = MapDirectionToReason[request.FocusNavigationDirection]; - if (_lastFocusRequest == Guid.Empty) - { - _lastFocusRequest = Guid.NewGuid(); - } - - var sourceFocusNavigationRequest = new Windows.UI.Xaml.Hosting.XamlSourceFocusNavigationRequest(reason, origin, _lastFocusRequest); - try - { - var result = _xamlSource.NavigateFocus(sourceFocusNavigationRequest); - - // Returning true indicates that focus moved. This will cause the HwndHost to - // move focus to the source’s hwnd (call SetFocus Win32 API) - return result.WasFocusMoved; - } - finally - { - _lastFocusRequest = Guid.Empty; - } - } - - /// - /// Transform bounds relative to FrameworkElement - /// - /// base rectangle - /// second of pair to transform - /// result of transformed rectangle - private static Windows.Foundation.Rect BoundsRelativeTo(FrameworkElement sibling1, System.Windows.Media.Visual sibling2) - { - Windows.Foundation.Rect origin = default(Windows.Foundation.Rect); - - if (sibling1 != null) - { - var transform = sibling1.TransformToVisual(sibling2); - var systemWindowsRect = transform.TransformBounds( - new Rect(0, 0, sibling1.ActualWidth, sibling1.ActualHeight)); - origin.X = systemWindowsRect.X; - origin.Y = systemWindowsRect.Y; - origin.Width = systemWindowsRect.Width; - origin.Height = systemWindowsRect.Height; - } - - return origin; - } - - /// - /// Handles the event. - /// - /// The sender. - /// The instance containing the event data. - private void OnTakeFocusRequested(object sender, Windows.UI.Xaml.Hosting.DesktopWindowXamlSourceTakeFocusRequestedEventArgs e) - { - if (_lastFocusRequest == e.Request.CorrelationId) - { - // If we've arrived at this point, then focus is being move back to us - // therefore, we should complete the operation to avoid an infinite recursion - // by "Restoring" the focus back to us under a new correctationId - var newRequest = new Windows.UI.Xaml.Hosting.XamlSourceFocusNavigationRequest( - Windows.UI.Xaml.Hosting.XamlSourceFocusNavigationReason.Restore); - _xamlSource.NavigateFocus(newRequest); - } - else - { - // Last focus request is not initiated by us, so continue - _lastFocusRequest = e.Request.CorrelationId; - var direction = MapReasonToDirection[e.Request.Reason]; - var request = new System.Windows.Input.TraversalRequest(direction); - MoveFocus(request); - } - } - } -} diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.XamlHost/WindowsXamlHostBase.Layout.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.XamlHost/WindowsXamlHostBase.Layout.cs deleted file mode 100644 index 0e44146ee0a..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.XamlHost/WindowsXamlHostBase.Layout.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Windows; - -namespace Microsoft.Toolkit.Wpf.UI.XamlHost -{ - /// - /// Integrates UWP XAML in to WPF's layout system - /// - public partial class WindowsXamlHostBase - { - /// - /// Measures wrapped UWP XAML content using passed in size constraint - /// - /// Available Size - /// XAML DesiredSize - protected override Size MeasureOverride(Size constraint) - { - var desiredSize = new Size(0, 0); - - if (_xamlSource.Content != null) - { - _xamlSource.Content.Measure(new Windows.Foundation.Size(constraint.Width, constraint.Height)); - desiredSize.Width = _xamlSource.Content.DesiredSize.Width; - desiredSize.Height = _xamlSource.Content.DesiredSize.Height; - } - - desiredSize.Width = Math.Min(desiredSize.Width, constraint.Width); - desiredSize.Height = Math.Min(desiredSize.Height, constraint.Height); - - return desiredSize; - } - - /// - /// Arranges wrapped UWP XAML content using passed in size constraint - /// - /// Final Size - /// Size - protected override Size ArrangeOverride(Size finalSize) - { - if (_xamlSource.Content != null) - { - // Arrange is required to support HorizontalAlignment and VerticalAlignment properties - // set to 'Stretch'. The UWP XAML content will be 0 in the stretch alignment direction - // until Arrange is called, and the UWP XAML content is expanded to fill the available space. - var finalRect = new Windows.Foundation.Rect(0, 0, finalSize.Width, finalSize.Height); - _xamlSource.Content.Arrange(finalRect); - } - - return base.ArrangeOverride(finalSize); - } - - /// - /// UWP XAML content size changed - /// - /// The sender. - /// The instance containing the event data. - protected void XamlContentSizeChanged(object sender, Windows.UI.Xaml.SizeChangedEventArgs e) - { - InvalidateMeasure(); - } - } -} diff --git a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.XamlHost/WindowsXamlHostBase.cs b/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.XamlHost/WindowsXamlHostBase.cs deleted file mode 100644 index fd5163a253f..00000000000 --- a/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Wpf.UI.XamlHost/WindowsXamlHostBase.cs +++ /dev/null @@ -1,204 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Runtime.InteropServices; -using System.Windows.Interop; -using Microsoft.Toolkit.Win32.UI.XamlHost; -using Windows.UI.Xaml; - -namespace Microsoft.Toolkit.Wpf.UI.XamlHost -{ - /// - /// WindowsXamlHost control hosts UWP XAML content inside the Windows Presentation Foundation - /// - public abstract partial class WindowsXamlHostBase : HwndHost - { - /// - /// UWP XAML Application instance and root UWP XamlMetadataProvider. Custom implementation required to - /// probe at runtime for custom UWP XAML type information. This must be created before - /// creating any DesktopWindowXamlSource instances if custom UWP XAML types are required. - /// - private readonly Windows.UI.Xaml.Application _application; - - /// - /// UWP XAML DesktopWindowXamlSource instance that hosts XAML content in a win32 application - /// - private readonly Windows.UI.Xaml.Hosting.DesktopWindowXamlSource _xamlSource; - - /// - /// A reference count on the UWP XAML framework is tied to WindowsXamlManager's - /// lifetime. UWP XAML is spun up on the first WindowsXamlManager creation and - /// deinitialized when the last instance of WindowsXamlManager is destroyed. - /// - private readonly Windows.UI.Xaml.Hosting.WindowsXamlManager _windowsXamlManager; - - /// - /// Private field that backs ChildInternal property. - /// - private UIElement _childInternal; - - /// - /// Fired when WindowsXamlHost root UWP XAML content has been updated - /// - public event EventHandler ChildChanged; - - /// - /// Initializes a new instance of the class. - /// - /// - /// Default constructor is required for use in WPF markup. When the default constructor is called, - /// object properties have not been set. Put WPF logic in OnInitialized. - /// - public WindowsXamlHostBase() - { - // Windows.UI.Xaml.Application object is required for loading custom control metadata. If a custom - // Application object is not provided by the application, the host control will create one (XamlApplication). - // Instantiation of the application object must occur before creating the DesktopWindowXamlSource instance. - // If no Application object is created before DesktopWindowXamlSource is created, DestkopWindowXamlSource - // will create a generic Application object unable to load custom UWP XAML metadata. - Microsoft.Toolkit.Win32.UI.XamlHost.XamlApplication.GetOrCreateXamlApplicationInstance(ref _application); - - // Create an instance of the WindowsXamlManager. This initializes and holds a - // reference on the UWP XAML DXamlCore and must be explicitly created before - // any UWP XAML types are programmatically created. If WindowsXamlManager has - // not been created before creating DesktopWindowXamlSource, DesktopWindowXaml source - // will create an instance of WindowsXamlManager internally. (Creation is explicit - // here to illustrate how to initialize UWP XAML before initializing the DesktopWindowXamlSource.) - _windowsXamlManager = Windows.UI.Xaml.Hosting.WindowsXamlManager.InitializeForCurrentThread(); - - // Create DesktopWindowXamlSource, host for UWP XAML content - _xamlSource = new Windows.UI.Xaml.Hosting.DesktopWindowXamlSource(); - - // Hook DesktopWindowXamlSource OnTakeFocus event for Focus processing - _xamlSource.TakeFocusRequested += OnTakeFocusRequested; - } - - /// - /// Gets or sets the root UWP XAML element displayed in the WPF control instance. - /// - /// The child. - /// This UWP XAML element is the root element of the wrapped . - protected Windows.UI.Xaml.UIElement ChildInternal - { - get - { - return _childInternal; - } - - set - { - if (value == ChildInternal) - { - return; - } - - var currentRoot = (Windows.UI.Xaml.FrameworkElement)ChildInternal; - if (currentRoot != null) - { - currentRoot.SizeChanged -= XamlContentSizeChanged; - } - - _childInternal = value; - SetContent(); - - var frameworkElement = ChildInternal as Windows.UI.Xaml.FrameworkElement; - if (frameworkElement != null) - { - // If XAML content has changed, check XAML size - // to determine if WindowsXamlHost needs to re-run layout. - frameworkElement.SizeChanged += XamlContentSizeChanged; - - // WindowsXamlHost DataContext should flow through to UWP XAML content - frameworkElement.DataContext = DataContext; - } - - // Fire updated event - ChildChanged?.Invoke(this, new EventArgs()); - } - } - - /// - /// Exposes ChildInternal without exposing its actual Type. - /// - /// the underlying UWP child object - public object GetUwpInternalObject() - { - return ChildInternal; - } - - /// - /// Gets or sets a value indicating whether this wrapper control instance been disposed - /// - protected bool IsDisposed { get; set; } - - /// - /// Creates object, wrapped instance; creates and - /// sets root UWP XAML element on . - /// - /// Parent window handle - /// Handle to XAML window - protected override HandleRef BuildWindowCore(HandleRef hwndParent) - { - // 'EnableMouseInPointer' is called by the WindowsXamlManager during initialization. No need - // to call it directly here. - - // Create DesktopWindowXamlSource instance - var desktopWindowXamlSourceNative = _xamlSource.GetInterop(); - - // Associate the window where UWP XAML will display content - desktopWindowXamlSourceNative.AttachToWindow(hwndParent.Handle); - - var windowHandle = desktopWindowXamlSourceNative.WindowHandle; - - // Overridden function must return window handle of new target window (DesktopWindowXamlSource's Window) - return new HandleRef(this, windowHandle); - } - - /// - /// The default implementation of SetContent applies ChildInternal to desktopWindowXamSource.Content. - /// Override this method if that shouldn't be the case. - /// For example, override if your control should be a child of another WindowsXamlHostBase-based control. - /// - protected virtual void SetContent() - { - if (_xamlSource != null) - { - _xamlSource.Content = _childInternal; - } - } - - /// - /// WPF framework request to destroy control window. Cleans up the HwndIslandSite created by DesktopWindowXamlSource - /// - /// Handle of window to be destroyed - protected override void DestroyWindowCore(HandleRef hwnd) - { - Dispose(true); - } - - /// - /// WindowsXamlHost Dispose - /// - /// Is disposing? - protected override void Dispose(bool disposing) - { - if (disposing) - { - ChildInternal = null; - - // Required by CA2213: _xamlSource?.Dispose() is insufficient. - if (_xamlSource != null) - { - _xamlSource.TakeFocusRequested -= OnTakeFocusRequested; - _xamlSource.Dispose(); - } - } - - // BUGBUG: CoreInputSink cleanup is failing when explicitly disposing - // WindowsXamlManager. Add dispose call back when that bug is fixed in 19h1. - base.Dispose(disposing); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/README.md b/Microsoft.Toolkit.Win32/README.md new file mode 100644 index 00000000000..f5455fefa3e --- /dev/null +++ b/Microsoft.Toolkit.Win32/README.md @@ -0,0 +1,3 @@ +# Windows Community Toolkit - WPF and Windows Forms + +The source has moved to a new repository: https://github.com/windows-toolkit/Microsoft.Toolkit.Win32 \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.Shared/ContextSpecification.cs b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.Shared/ContextSpecification.cs deleted file mode 100644 index db7f2e037e7..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.Shared/ContextSpecification.cs +++ /dev/null @@ -1,158 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Diagnostics; -using Microsoft.VisualStudio.TestTools.UnitTesting; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Test.WebView.Shared -{ - /// - /// Serves as a base class for implementing Behavior-Driven Development - /// - /// - /// Behavior-driven development (BDD) is based on test-driven development (TDD). TDD is a software development - /// methodology which essentially states that for each unit of software, a software developer must: - ///
    - ///
  • define a test set for the unit first;
  • - ///
  • then implement the unit;
  • - ///
  • >finally verify that the implementation of the unit makes the tests succeed.
  • - ///
- /// TDD tends to get far into the detail, which doesn't resonate with non-technical individuals. BDD specifies that - /// tests of any unit of software should be specified in terms of the desired behavior of the unit. - /// BDD takes advantage of user stories to represent the intended behavior of components in a vertical slice, - /// experienced as a user or client would experience the behavior. This perspective keeps focus on and allows - /// the engineer to prioritize what is and isn't important to test. - /// User Stories represent needed conversations: - /// As a [role] - /// I want [some feature / behavior] - /// So that [some benefit / value] - /// Scenarios document the conversation took place, and what should be tested in BDD - /// Given [some initial state / context] - /// When [action occurs] - /// Then [this should be the result] - /// Example using an e-Commerce site concept: - /// As a Customer with Products in my Cart - /// I want to remove an Item from my Cart - /// so that I can change my mind about buying it - /// The scenario of the story breaks down into several elements: - ///
    - ///
  • A case where there are multiple items in the cart and the user removes one, leaving items in the cart
  • - ///
  • A case where there is a single item in the cart and the user removes one, leaving no items in the cart
  • - ///
  • Permutations of the above
  • - ///
- /// BDD helps the clarification in the following way: - /// Given a Cart with multiple Items in it - /// When a single Item is removed - /// Then the other items are still in the Cart - /// Given a Cart with a single Item in it - /// When a single Item is removed - /// Then the Cart is empty - /// The _Then_ element can be compounded with multiple assertions. For example: - /// Given a Cart with a single Item in it - /// When a single Item is removed - /// Then the Cart is empty - /// And the Cart Subtotal is 0 - /// Notice that the language contains nouns with capital letters (Cart, Item, etc.) to drive out a native domain - /// language - /// (see Evans Fowler (2003). Domain-Driven Design: Tackling complexity in the Heart of Software. Prentice Hall.). - /// The - /// class uses a variation of the Arrange, Act, Assert behavior to allow BDD to work without extra tools within MSTest. - /// Example with code - /// - /// - /// [TestClass] - /// public class When_adding_a_single_item_to_an_empty_cart : ContextSpecification - /// { - /// ICart _cart; - /// - /// protected void override Given() - /// { - /// _cart = CartFactory.Create("TEST"); - /// _cart.AddItem(ProductFactory.Create("SKU")); - /// } - /// - /// protected void override When() - /// { - /// _cart.RemoveItem("SKU"); - /// } - /// - /// [TestMethod] - /// public void then_the_cart_is_empty() - /// { - /// Assert.AreEqual(1, _cart.TotalItems); - /// } - /// - /// [TestMethod] - /// public void then_the_cart_subtotal_is_zero() - /// { - /// Assert.AreEqual(0d, _cart.Subtotal); - /// } - /// } - /// - /// In the generated TRX file from MSTest, the test class and name are specified with the pass result: - /// - /// ------------------------------------------------------------------------------------------------------ - /// Result | Class name | Test Name - /// ------------------------------------------------------------------------------------------------------ - /// Passed When_adding_a_single_item_to_an_empty_cart then_the_cart_is_empty - /// Passed When_adding_a_single_item_to_an_empty_cart then_the_cart_subtotal_is_zero - /// - /// The TRX file is XML, and can be transformed to HTML to generate a report of capabilities of the system - /// automatically - /// during a build activity, yielding a "living spec". - /// More info on BDD: - /// http://en.wikipedia.org/wiki/Behavior-driven_development - /// http://channel9.msdn.com/Events/TechEd/NorthAmerica/2010/DPR302 - ///
- [DebuggerStepThrough] - public abstract class ContextSpecification - { - public TestContext TestContext { get; set; } - - [TestCleanup] - public void TestCleanup() - { - Cleanup(); - } - - [TestInitialize] - public void TestInitialize() - { - // Arrange - Given(); - // Act - When(); - } - - protected virtual void Cleanup() - { - } - - protected virtual void Given() - { - } - - protected virtual void When() - { - } - - protected virtual void WriteLine(string message) - { -#if DEBUG - Debug.WriteLine(message); -#else - TestContext.WriteLine(message); -#endif - } - - protected virtual void WriteLine(string format, params object[] args) - { -#if DEBUG - Debug.WriteLine(format, args); -#else - TestContext.WriteLine(format, args); -#endif - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.Shared/HttpRequestUriEqualityComparer.cs b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.Shared/HttpRequestUriEqualityComparer.cs deleted file mode 100644 index 1c1f57f8d79..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.Shared/HttpRequestUriEqualityComparer.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Test.WebView.Shared -{ - internal class HttpRequestUriEqualityComparer : IEqualityComparer - { - private HttpRequestUriEqualityComparer() - { - } - - internal static HttpRequestUriEqualityComparer Default => Nested.Instance; - - public bool Equals(Uri x, Uri y) - { - if (ReferenceEquals(x, y)) return true; - if (ReferenceEquals(x, null)) return false; - if (ReferenceEquals(y, null)) return false; - - return Uri.Compare(x, y, UriComponents.HttpRequestUrl, UriFormat.SafeUnescaped, StringComparison.OrdinalIgnoreCase) == - 0; - } - - public int GetHashCode(Uri obj) - { - return obj.GetHashCode(); - } - - private class Nested - { - internal static readonly HttpRequestUriEqualityComparer Instance = new HttpRequestUriEqualityComparer(); - - // Explict static ctor to tell compiler not to mark type as beforefieldinit - static Nested() { } - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.Shared/NativeMethods.cs b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.Shared/NativeMethods.cs deleted file mode 100644 index 25d57e18528..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.Shared/NativeMethods.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Runtime.InteropServices; -using System.Security; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.Win32 -{ - internal static class NativeMethods - { - [SecurityCritical] - [DllImport(ExternDll.Ntdll, SetLastError = true, EntryPoint = "RtlGetVersion")] - private static extern bool _RtlGetVersion(ref OSVERSIONINFOEX versionInfo); - - [SecurityCritical] - internal static OSVERSIONINFOEX RtlGetVersion() - { - var osVersionInfo = new OSVERSIONINFOEX { OSVersionInfoSize = Marshal.SizeOf(typeof(OSVERSIONINFOEX)) }; - _RtlGetVersion(ref osVersionInfo); - var err = Win32Error.GetLastError(); - if (!err.Equals(Win32Error.ERROR_SUCCESS)) - { - if (osVersionInfo.MajorVersion == 0) - { - err.ToHRESULT().ThrowIfFailed(); - } - } - - return osVersionInfo; - } - - // Critical: This calls into Marshal.GetExceptionForHR which is critical - // it populates the exception object from data stored in a per thread IErrorInfo - // the IErrorInfo may have security sensitive information like file paths stored in it - // TreatAsSafe: Uses overload of GetExceptionForHR that omits IErrorInfo information from exception message - [SecuritySafeCritical] - internal static Exception GetExceptionForHR(int hr) - { - return Marshal.GetExceptionForHR(hr, new IntPtr(-1)); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.Shared/OperatingSystemAssertions.cs b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.Shared/OperatingSystemAssertions.cs deleted file mode 100644 index ba84075148c..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.Shared/OperatingSystemAssertions.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using Microsoft.Toolkit.Win32.UI.Controls.Interop.Win32; -using Microsoft.VisualStudio.TestTools.UnitTesting; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Test.WebView.Shared -{ - public static class OperatingSystemAssertions - { -#pragma warning disable RECS0154 // Parameter is never used - public static void OSBuildShouldBeAtLeast(this Assert _, int buildNumber) => AssertOperatingSystemSinceBuild(buildNumber); -#pragma warning restore RECS0154 // Parameter is never used - -#pragma warning disable RECS0154 // Parameter is never used - public static void OSBuildShouldBeAtLeast(this Assert _, TestConstants.Windows10Builds build) => AssertOperatingSystemSinceBuild((int)build); -#pragma warning restore RECS0154 // Parameter is never used - - private static void AssertOperatingSystemSinceBuild(int buildNumber) - { - var os = NativeMethods.RtlGetVersion(); - if (os.BuildNumber < buildNumber) - { - Assert.Inconclusive($"Required build number {buildNumber}. OS is {os.BuildNumber}"); - } - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.Shared/ProcessExtensions.cs b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.Shared/ProcessExtensions.cs deleted file mode 100644 index cb170464ee2..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.Shared/ProcessExtensions.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Diagnostics; -using System.Management; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Test.WebView.Shared -{ - public static class ProcessExtensions - { - // Define an extension method for type System.Process that returns the command - // line via WMI. - public static string GetCommandLine(this Process process) - { - string cmdLine = null; - using (var searcher = new ManagementObjectSearcher($"SELECT CommandLine FROM Win32_Process WHERE ProcessId = {process.Id}")) - { - // By definition, the query returns at most 1 match, because the process - // is looked up by ID (which is unique by definition). - var matchEnum = searcher.Get().GetEnumerator(); - if (matchEnum.MoveNext()) // Move to the 1st item. - { - cmdLine = matchEnum.Current["CommandLine"]?.ToString(); - } - } - if (cmdLine == null) - { - // Not having found a command line implies 1 of 2 exceptions, which the - // WMI query masked: - // An "Access denied" exception due to lack of privileges. - // A "Cannot process request because the process () has exited." - // exception due to the process having terminated. - // We provoke the same exception again simply by accessing process.MainModule. - var dummy = process.MainModule; // Provoke exception. - } - return cmdLine; - } - - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.Shared/TestConstants.Builds.cs b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.Shared/TestConstants.Builds.cs deleted file mode 100644 index efc62dd3653..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.Shared/TestConstants.Builds.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Test.WebView.Shared -{ - public static partial class TestConstants - { - // Contains builds that offer functionality or bug fixes for WebView - public enum Windows10Builds - { - Unknown = 0, - InsiderFast17650 = 17650 - } - } -} diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.Shared/TestConstants.Uris.cs b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.Shared/TestConstants.Uris.cs deleted file mode 100644 index f0bb72aed09..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.Shared/TestConstants.Uris.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Test.WebView.Shared -{ - public static partial class TestConstants - { - public static class Uris - { - /* - * As described in RFC 2606 and RFC 6761, the following domains are maintained for documentation purposes - */ - public static readonly Uri ExampleCom = new Uri("http://example.com", UriKind.Absolute); - public static readonly Uri ExampleNet = new Uri("http://example.net", UriKind.Absolute); - public static readonly Uri ExampleOrg = new Uri("http://example.org", UriKind.Absolute); - - // Local navigation: when using a null value for Source the uri is about:blank - public static readonly Uri AboutBlank = new Uri("about:blank"); - - // A simple HTTP Request & Response Service - public static readonly Uri HttpBin = new Uri("http://httpbin.org", UriKind.Absolute); - } - } -} diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.Shared/TestConstants.cs b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.Shared/TestConstants.cs deleted file mode 100644 index fed7343919e..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.Shared/TestConstants.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Test.WebView.Shared -{ - public static partial class TestConstants - { - public static class Timeouts - { - /// - /// A timeout of 30 seconds - /// - public const int Longest = Long * 3; - /// - /// A timeout of 20 seconds - /// - public const int Longer = Long * 2; - /// - /// A timeout of 10 seconds - /// - public const int Long = 10000; - /// - /// A timeout of 5 seconds - /// - public const int Medium = 5000; - /// - /// A timeout of 3 seconds - /// - public const int Short = Shorter * 3; - /// - /// A timeout of 1 second - /// - public const int Shorter = 1000; - } - public static class Categories - { - public const string Init = "Initialization"; - public const string Nav = "Navigation"; - public const string Des = "Designer"; - public const string Proc = "Process"; - public const string Wf = "WinForms"; - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.Shared/UnitTests.WebView.Shared.csproj b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.Shared/UnitTests.WebView.Shared.csproj deleted file mode 100644 index e9bdc7dea42..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.Shared/UnitTests.WebView.Shared.csproj +++ /dev/null @@ -1,56 +0,0 @@ - - - net462 - Microsoft.Toolkit.Win32.UI.Controls.Test.WebView.Shared - Microsoft.Toolkit.Win32.UI.Controls.Test.WebView.Shared - UnitTests.WebView.Shared - UnitTests.WebView.Shared - Debug - AnyCPU - {B220BE88-944E-45D1-9248-6FAEF53868A3} - Library - Properties - Microsoft.Toolkit.Win32.UI.Controls.Test.WebView.Shared - Microsoft.Toolkit.Win32.UI.Controls.Test.WebView.Shared - v4.6.2 - true - false - - - - true - bin\Release\ - AnyCPU - TRACE - false - Off - prompt - full - - - TRACE;DEBUG - bin\Debug\ - Off - prompt - full - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.Shared/UriHostEqualityComparer.cs b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.Shared/UriHostEqualityComparer.cs deleted file mode 100644 index e1abf9894ce..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.Shared/UriHostEqualityComparer.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Test.WebView.Shared -{ - internal class UriHostEqualityComparer : IEqualityComparer - { - private UriHostEqualityComparer() - { - } - - internal static UriHostEqualityComparer Default => Nested.Instance; - - public bool Equals(Uri x, Uri y) - { - if (ReferenceEquals(x, y)) return true; - if (ReferenceEquals(x, null)) return false; - if (ReferenceEquals(y, null)) return false; - - return Uri.Compare(x, y, UriComponents.Host, UriFormat.SafeUnescaped, StringComparison.OrdinalIgnoreCase) == - 0; - } - - public int GetHashCode(Uri obj) - { - return obj.GetHashCode(); - } - - private class Nested - { - internal static readonly UriHostEqualityComparer Instance = new UriHostEqualityComparer(); - - // Explict static ctor to tell compiler not to mark type as beforefieldinit - static Nested() { } - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WPF/UnitTests.WebView.WPF.csproj b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WPF/UnitTests.WebView.WPF.csproj deleted file mode 100644 index f0f999ba9ba..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WPF/UnitTests.WebView.WPF.csproj +++ /dev/null @@ -1,67 +0,0 @@ - - - net462 - Microsoft.Toolkit.Win32.UI.Controls.Test.WPF.WebView - Microsoft.Toolkit.Win32.UI.Controls.Test.WPF.WebView - UnitTests.WebView.WPF - UnitTests.WebView.WPF - Debug - AnyCPU - {2E49400E-B114-4FAE-B743-6CB57B500E31} - Library - Properties - Microsoft.Toolkit.Win32.UI.Controls.Test.WPF.WebView - Microsoft.Toolkit.Win32.UI.Controls.Test.WPF.WebView - v4.6.2 - {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages - False - UnitTest - true - - - false - - - - true - bin\Release\ - AnyCPU - TRACE - Off - prompt - full - - - bin\Debug\ - TRACE;DEBUG - Off - prompt - full - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/AssemblyInitializer.cs b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/AssemblyInitializer.cs deleted file mode 100644 index 460d6e30252..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/AssemblyInitializer.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Windows.Forms; -using Microsoft.VisualStudio.TestTools.UnitTesting; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Test.WinForms.WebView -{ - [TestClass] - public class AssemblyInitializer - { - [AssemblyInitialize] - public static void AssemblyInitialize(TestContext context) - { - context.WriteLine("AssemblyInit"); - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - } - } -} diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/AcceleratorKeys/AcceleratorKeysTests.cs b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/AcceleratorKeys/AcceleratorKeysTests.cs deleted file mode 100644 index babca7e726a..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/AcceleratorKeys/AcceleratorKeysTests.cs +++ /dev/null @@ -1,146 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using WindowsInput.Native; -using Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT; -using Microsoft.Toolkit.Win32.UI.Controls.Test.WebView.Shared; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Should; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Test.WinForms.WebView.FunctionalTests.AcceleratorKeys -{ - [TestClass] - public class WebControlReceiveTunnelAndBubble : HostFormWebViewContextSpecification - { - private int _inputCount; - private RoutedInputInfo[] _expectedRoutedInput; - private RoutedInputInfo[] _actualRoutedInput; - private string _content = @" - - - - - -
starting
- - -"; - - protected override void Given() - { - _expectedRoutedInput = new[] - { - new RoutedInputInfo{RoutingStage = WebViewControlAcceleratorKeyRoutingStage.Tunneling, Key = VirtualKey.Control, IsKeyUp = false, ShouldHandle = false}, - new RoutedInputInfo{RoutingStage = WebViewControlAcceleratorKeyRoutingStage.Bubbling, Key = VirtualKey.Control, IsKeyUp = false, ShouldHandle = false}, - new RoutedInputInfo{RoutingStage = WebViewControlAcceleratorKeyRoutingStage.Tunneling, Key = VirtualKey.A, IsKeyUp = false, ShouldHandle = false}, - // The WebView actually handles the KeyDown for CTRL+A, so the app will not see the bubble phase - // Including it here in a comment for completeness and to make it clear that this is intentional - //new RoutedInputInfo{routingStage = WebViewControlAcceleratorKeyRoutingStage.Bubbling, virtualKey = VirtualKey.A, isKeyUp = false, shouldHandle = false}, - new RoutedInputInfo{RoutingStage = WebViewControlAcceleratorKeyRoutingStage.Tunneling, Key = VirtualKey.A, IsKeyUp = true, ShouldHandle = false}, - new RoutedInputInfo{RoutingStage = WebViewControlAcceleratorKeyRoutingStage.Bubbling, Key = VirtualKey.A, IsKeyUp = true, ShouldHandle = false}, - new RoutedInputInfo{RoutingStage = WebViewControlAcceleratorKeyRoutingStage.Tunneling, Key = VirtualKey.Control, IsKeyUp = true, ShouldHandle = false}, - new RoutedInputInfo{RoutingStage = WebViewControlAcceleratorKeyRoutingStage.Bubbling, Key = VirtualKey.Control, IsKeyUp = true, ShouldHandle = false} - }; - - _actualRoutedInput = new RoutedInputInfo[_expectedRoutedInput.Length]; - - base.Given(); - WebView.IsScriptNotifyAllowed = true; - WebView.IsJavaScriptEnabled = true; - WebView.NavigationCompleted += (o, e) => - { - if (!WebView.Focused) - { - WriteLine("Moving focus to WebView"); - Form.BringToFront(); - WebView.Focus(); - WebView.MoveFocus(WebViewControlMoveFocusReason.Programmatic); - } - else - { - WriteLine("WebView already has focus"); - } - }; - WebView.ScriptNotify += (o, e) => - { - WriteLine($"ScriptNotify received: '{e.Value ?? string.Empty}'"); - - if ("generateKeyPress".Equals(e.Value)) - { - Form.InputSimulator.Keyboard.ModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_A); - WriteLine("Keyboard input generated."); - } - else if ("keyboardInputFound".Equals(e.Value)) - { - WriteLine("Keyboard input received in WebView"); - } - }; - WebView.AcceleratorKeyPressed += (o, e) => - { - WriteLine("Received routed accelerator event"); - _actualRoutedInput[_inputCount] = new RoutedInputInfo() - { - RoutingStage = (WebViewControlAcceleratorKeyRoutingStage)e.RoutingStage, - Key = (VirtualKey)e.VirtualKey, - IsKeyUp = e.EventType == CoreAcceleratorKeyEventType.KeyUp - }; - - _inputCount++; - - if (_expectedRoutedInput.Length == _inputCount) - { - Form.Close(); - } - - }; - - } - - protected override void When() - { - NavigateToStringAndWaitForFormClose(_content); - } - - [TestMethod] - [Timeout(TestConstants.Timeouts.Longer)] - [Ignore("Cannot reliably focus")] - public void InputsAreInTheExpectedOrder() - { - _actualRoutedInput.ShouldEqual(_expectedRoutedInput); - } - } - - public struct RoutedInputInfo - { - public WebViewControlAcceleratorKeyRoutingStage RoutingStage { get; set; } - public VirtualKey Key { get; set; } - public bool IsKeyUp { get; set; } - public bool ShouldHandle { get; set; } - - public override string ToString() - { - return $"Stage: {RoutingStage}, VirtualKey: {Key}, IsDown: {!IsKeyUp}, ShouldHandle: {ShouldHandle}"; - } - } -} diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/BlockTestStartEndContextSpecification.cs b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/BlockTestStartEndContextSpecification.cs deleted file mode 100644 index d1e1af75af8..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/BlockTestStartEndContextSpecification.cs +++ /dev/null @@ -1,194 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Diagnostics; -using System.Linq; -using System.Text.RegularExpressions; -using System.Threading.Tasks; -using Microsoft.Toolkit.Win32.UI.Controls.Test.WebView.Shared; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Test.WinForms.WebView.FunctionalTests -{ - [DebuggerStepThrough] - public abstract class BlockTestStartEndContextSpecification : WebViewContextSpecification - { - protected override void Given() - { - PrintStartEnd( - TestContext.TestName, - nameof(Given), - () => - { - TryAction(WaitForWindowsExceptionReporting); - base.Given(); - - TryAction(() => - { - if (WebView.Process == null) return; - - var process = Process.GetProcessById((int)WebView.Process.ProcessId); - if (process != null) - { - WriteLine($"[{process.Id}] {process.ProcessName}"); - } - - }); - }); - } - - - - protected override void Cleanup() - { - PrintStartEnd( - TestContext.TestName, - nameof(Cleanup), - () => - { - TryAction(WaitForWindowsExceptionReporting); - - // The layer above us should have cleaned everything up; if not log information about it here and clean up for the next test - TryAction(() => - { - if (WebView?.Process != null) - { - var closeRequested = false; - var closeMainWindowRequested = false; - var orphan = false; - - TryAction(PrintProcessDetails); - - while (WebView.Process.ProcessId != 0) - { - orphan = true; - var process = Process.GetProcessById((int)WebView.Process.ProcessId); - if (process != null) - { - WriteLine( - $"{process.ProcessName} (PID: {process.Id}) found; waiting for exit..."); - - if (!process.WaitForExit(TestConstants.Timeouts.Shorter)) - { - var msg = $"{process.ProcessName} (PID: {process.Id}) did not exit as expected; "; - if (!closeRequested && !closeMainWindowRequested) - { - closeRequested = true; - msg += " Process.Close requested..."; - process.Close(); - } - else if (closeRequested && !closeMainWindowRequested) - { - closeMainWindowRequested = true; - msg += " Process.CloseMainWindow requested..."; - process.CloseMainWindow(); - } - else - { - msg += " Process.Kill requested..."; - process.Kill(); - } - WriteLine(msg); - } - } - } - - if (!orphan) - { - WriteLine("WebView processes were cleaned up as expected"); - } - } - - base.Cleanup(); - }); - }); - } - - private void PrintProcessDetails(string processName) - { - var processes = Process.GetProcessesByName(processName); - var msg = $"Running instances of {processName}.exe: "; - if (processes.Length == 0) - { - msg += " NONE\r\n"; - WriteLine(msg); - } - else - { - WriteLine(msg); - var header = "\r\n\r\nName\t\t\tPID\tTitle\r\n------------------------------------------------"; - WriteLine(header); - foreach (var process in processes) - { - WriteLine($"{process.ProcessName}\t{process.Id}\t{process.MainWindowTitle}"); - } - - WriteLine(""); - } - } - - private void PrintProcessDetails() - { - PrintProcessDetails("WWAHost"); - PrintProcessDetails("Win32WebViewHost"); - } - - private void WaitForWindowsExceptionReporting() - { - // We may have had a crash, wait until WER is completed - var processes = Process.GetProcessesByName("WerFault"); - if (processes.Any()) - { - var msg = $"Found {processes.Length} instances of WerFault.exe; waiting for those to exit..."; - WriteLine(msg); - - var tasks = new Task[processes.Length]; - for (var i = 0; i < processes.Length; i++) - { - var p = processes[i]; - var pid = p.Id; - var name = p.ProcessName; - var cl = p.GetCommandLine(); - var testName = string.Empty; - var regexMatch = Regex.Match(cl, @"-p\s(?\d{1,7})", RegexOptions.IgnoreCase | RegexOptions.Singleline); - - if (regexMatch.Success) - { - if (uint.TryParse(regexMatch.Groups["id"].Value, out var testPid)) - { - // NOTE: The PID for Win32WebViewHost.exe is not exposed, so we can't wait for that - var testForProcessId = GetTestNameForProcessId(testPid); - if (!string.IsNullOrEmpty(testForProcessId)) - { - testName = testForProcessId; - } - } - } - - msg = $"\t[{pid}] {name} (\"{cl}\") {testName}"; - WriteLine(msg); - - // Only wait if WER is gathering information from one of our tests - if (string.IsNullOrEmpty(testName)) - { - tasks[i] = Task.CompletedTask; - } - else - { - tasks[i] = Task.Run(() => p.WaitForExit()); - } - } - - - Task.WaitAll(tasks); - } - } - - - - - } - - -} - diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Close/CloseTests.cs b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Close/CloseTests.cs deleted file mode 100644 index 3b00472d085..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Close/CloseTests.cs +++ /dev/null @@ -1,61 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.ComponentModel; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Should; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Test.WinForms.WebView.FunctionalTests.Close -{ - [TestClass] - public class CallCloseOnceAfterInit : BlockTestStartEndContextSpecification - { - protected override void CreateWebView() - { - WebView = new Forms.UI.Controls.WebView(); - ((ISupportInitialize) WebView).BeginInit(); - ((ISupportInitialize) WebView).EndInit(); - - WebView.ShouldNotBeNull(); - WebView.Process.ShouldNotBeNull(); - } - - protected override void When() - { - WebView.Close(); - } - - [TestMethod] - public void Close() - { - WebView.Process.ShouldBeNull(); - } - } - - [TestClass] - public class CallCloseTwiceAfterInit : BlockTestStartEndContextSpecification - { - protected override void CreateWebView() - { - WebView = new Forms.UI.Controls.WebView(); - ((ISupportInitialize)WebView).BeginInit(); - ((ISupportInitialize)WebView).EndInit(); - - WebView.ShouldNotBeNull(); - WebView.Process.ShouldNotBeNull(); - } - - protected override void When() - { - WebView.Close(); - WebView.Close(); - } - - [TestMethod] - public void Close() - { - WebView.Process.ShouldBeNull(); - } - } -} diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Cookies/CookieTests.cs b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Cookies/CookieTests.cs deleted file mode 100644 index 50eb976ac06..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Cookies/CookieTests.cs +++ /dev/null @@ -1,252 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT; -using Microsoft.Toolkit.Win32.UI.Controls.Test.WebView.Shared; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Should; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Test.WinForms.WebView.FunctionalTests.Cookies -{ - [TestCategory(TestConstants.Categories.Nav)] - public abstract class CookieTestContext : HostFormWebViewContextSpecification - { - public Uri CookieUri { get; } = new Uri(TestConstants.Uris.HttpBin, "/cookies"); - - protected abstract Task SetCookieAsync(Forms.UI.Controls.WebView webView); - - protected async Task SetCookieAsync( - Forms.UI.Controls.WebView webView, - string cookieName, - string cookieValue, - DateTime? expiry = null) - { - string formatExpiry(DateTime? e) => e != null - ? $"; expires={e.Value.ToUniversalTime():R}" - : string.Empty; - - var cookie = $"{cookieName}={cookieValue}{formatExpiry(expiry)}"; - if (webView != null) - { - await webView.InvokeScriptAsync("eval", $"document.cookie = \"{cookie}\"").ConfigureAwait(false); - } - } - - protected Task GetCookiesAsync(Forms.UI.Controls.WebView webView) - { - return webView.InvokeScriptAsync("eval", "document.cookie"); - } - - protected override void When() - { - NavigateAndWaitForFormClose(CookieUri); - } - } - - public abstract class MultipleWebViewCookieTestContext : CookieTestContext - { - public Forms.UI.Controls.WebView SecondWebView { get; private set; } - - public string Webview1Cookie - { - get => _webview1Cookie; - private set - { - WriteLine("WebView1 Cookie: {0}", value); - _webview1Cookie = value; - } - } - - public string Webview2Cookie - { - get => _webview2Cookie; - private set - { - WriteLine("WebView2 Cookie: {0}", value); - _webview2Cookie = value; - } - } - - private string _webview2Cookie; - private string _webview1Cookie; - - protected override void Given() - { - base.Given(); - - WebView.NavigationCompleted += OnWebViewOnNavigationCompleted; - } - - private async void OnWebViewOnNavigationCompleted(object sender, WebViewControlNavigationCompletedEventArgs e) - { - if (!e.IsSuccess) - { - Form.Close(); - } - - if (sender is Forms.UI.Controls.WebView wv) - { - if (SecondWebView == null) - { - await SetCookieAsync(wv); - Webview1Cookie = await GetCookiesAsync(wv); - - - // Once the session cookie is set - SecondWebView = CreateSecondWebView(wv.Process); - SecondWebView.NavigationCompleted += OnWebViewOnNavigationCompleted; - SecondWebView.Navigate(CookieUri); - } - else - { - Webview2Cookie = await GetCookiesAsync(wv); - Form.Close(); - } - } - } - - protected override void Cleanup() - { - SecondWebView?.Dispose(); - - base.Cleanup(); - } - - protected abstract Forms.UI.Controls.WebView CreateSecondWebView(WebViewControlProcess process); - } - - public abstract class WebViewDifferentProcessContext : MultipleWebViewCookieTestContext - { - protected override Forms.UI.Controls.WebView CreateSecondWebView(WebViewControlProcess process) - { - var webView = new Forms.UI.Controls.WebView(); - ((ISupportInitialize)webView).BeginInit(); - webView.IsScriptNotifyAllowed = WebView.IsScriptNotifyAllowed; - webView.IsIndexedDBEnabled = WebView.IsIndexedDBEnabled; - webView.IsJavaScriptEnabled = WebView.IsJavaScriptEnabled; - ((ISupportInitialize)webView).EndInit(); - - return webView; - } - } - - public abstract class WebViewSameProcessContext : MultipleWebViewCookieTestContext - { - protected override Forms.UI.Controls.WebView CreateSecondWebView(WebViewControlProcess process) - { - var webView = new Forms.UI.Controls.WebView(process); - ((ISupportInitialize) webView).BeginInit(); - webView.IsScriptNotifyAllowed = WebView.IsScriptNotifyAllowed; - webView.IsIndexedDBEnabled = WebView.IsIndexedDBEnabled; - webView.IsJavaScriptEnabled = WebView.IsJavaScriptEnabled; - ((ISupportInitialize) webView).EndInit(); - - return webView; - } - - - } - - [TestClass] - public class PersistentCookieSameProcessTests : WebViewSameProcessContext - { - [TestMethod] - [Timeout(TestConstants.Timeouts.Longest)] - public void PersistentCookieIsInNewWebView() - { - Webview1Cookie.ShouldNotBeNull(); - Webview2Cookie.ShouldNotBeNull(); - - Webview2Cookie.ShouldEqual(Webview1Cookie); - } - - protected override Task SetCookieAsync(Forms.UI.Controls.WebView webView) - { - return SetCookieAsync(webView, "persistent", "true", DateTime.UtcNow.Add(TimeSpan.FromSeconds(TestConstants.Timeouts.Longest))); - } - - protected override void Cleanup() - { - // Best effort clean up. Initial cookie has a short TTL anyway -#pragma warning disable 4014 - SetCookieAsync(SecondWebView, "persistent", string.Empty, new DateTime(1970, 1, 1)); -#pragma warning restore 4014 - - base.Cleanup(); - } - } - - [TestClass] - public class PersistentCookieDifferentProcessTests : WebViewDifferentProcessContext - { - [TestMethod] - [Timeout(TestConstants.Timeouts.Longest)] - public void PersistentCookieIsInNewWebView() - { - Webview1Cookie.ShouldNotBeNull(); - Webview2Cookie.ShouldNotBeNull(); - - Webview2Cookie.ShouldEqual(Webview1Cookie); - } - - protected override Task SetCookieAsync(Forms.UI.Controls.WebView webView) - { - return SetCookieAsync(webView, "persistent", "true", DateTime.UtcNow.Add(TimeSpan.FromSeconds(TestConstants.Timeouts.Longest))); - } - - protected override void Cleanup() - { - // Best effort clean up. Initial cookie has a short TTL anyway -#pragma warning disable 4014 - SetCookieAsync(SecondWebView, "persistent", string.Empty, new DateTime(1970, 1, 1)); -#pragma warning restore 4014 - - base.Cleanup(); - } - } - - [TestClass] - public class SessionCookieSameProcessTests : WebViewSameProcessContext - { - [TestMethod] - [Timeout(TestConstants.Timeouts.Longest)] - public void SessionCookieIsInNewWebView() - { - Webview1Cookie.ShouldNotBeNull(); - Webview2Cookie.ShouldNotBeNull(); - - Webview2Cookie.ShouldEqual(Webview1Cookie); - } - - protected override Task SetCookieAsync(Forms.UI.Controls.WebView webView) - { - return SetCookieAsync(webView, "session", "true"); - } - } - - [TestClass] - public class SessionCookieDifferentProcessTests : WebViewDifferentProcessContext - { - [TestMethod] - [Timeout(TestConstants.Timeouts.Longest)] - public void SessionCookieIsNotInNewWebView() - { - Webview1Cookie.ShouldNotBeNull(); - Webview2Cookie.ShouldNotBeNull(); - - Webview2Cookie.ShouldNotEqual(Webview1Cookie); - } - - protected override Task SetCookieAsync(Forms.UI.Controls.WebView webView) - { - return SetCookieAsync(webView, "session", "true"); - } - } -} diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Ctor/Ctor.cs b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Ctor/Ctor.cs deleted file mode 100644 index 735cb15ca50..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Ctor/Ctor.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.ComponentModel; -using Microsoft.Toolkit.Win32.UI.Controls.Test.WebView.Shared; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Should; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Test.WinForms.WebView.FunctionalTests.Ctor -{ - [TestClass] - public class CreationTests - { - [TestMethod] - [TestCategory(TestConstants.Categories.Init)] - public void CanInitializeCtorBeginEndInit() - { - var wv = new Forms.UI.Controls.WebView(); - ((ISupportInitialize)wv).BeginInit(); - ((ISupportInitialize)wv).EndInit(); - } - - [TestMethod] - [TestCategory(TestConstants.Categories.Init)] - public void CanInitializeCtorOnly() - { - var wv = new Forms.UI.Controls.WebView(); - wv.Process.ShouldBeNull(); - } - - [TestMethod] - [TestCategory(TestConstants.Categories.Init)] - public void DesignerPropertyEqualsSettingsProperty() - { - var wv = new Forms.UI.Controls.WebView(); - ((ISupportInitialize)wv).BeginInit(); - wv.IsScriptNotifyAllowed = !wv.IsScriptNotifyAllowed; - ((ISupportInitialize)wv).EndInit(); - - wv.IsScriptNotifyAllowed.ShouldEqual(wv.Settings.IsScriptNotifyAllowed); - } - - - } -} diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Ctor/DesignerPropertySettingsTests.cs b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Ctor/DesignerPropertySettingsTests.cs deleted file mode 100644 index de095cdda14..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Ctor/DesignerPropertySettingsTests.cs +++ /dev/null @@ -1,249 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.ComponentModel; -using Microsoft.Toolkit.Win32.UI.Controls.Test.WebView.Shared; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Should; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Test.WinForms.WebView.FunctionalTests.Ctor -{ - [TestClass] - [TestCategory(TestConstants.Categories.Init)] - public class ScriptNotifyPropertySetBetweenBeginEndInit : BlockTestStartEndContextSpecification - { - protected override void CreateWebView() - { - WebView = new Forms.UI.Controls.WebView(); - } - - protected override void When() - { - ((ISupportInitialize)WebView).BeginInit(); - WebView.IsScriptNotifyAllowed = false; - ((ISupportInitialize)WebView).EndInit(); - } - - [TestMethod] - public void ScriptNotifyIsDisabled() - { - WebView.IsScriptNotifyAllowed.ShouldBeFalse(); - WebView.Settings.IsScriptNotifyAllowed.ShouldBeFalse(); - WebView.Settings.IsScriptNotifyAllowed.ShouldEqual(WebView.IsScriptNotifyAllowed); - } - - protected override void Cleanup() - { - WebView.Dispose(); - base.Cleanup(); - } - } - - [TestClass] - [TestCategory(TestConstants.Categories.Init)] - public class ScriptNotifyPropertySetAfterEndInit : HostFormWebViewContextSpecification - { - private bool _expected; - - protected override void Given() - { - base.Given(); - _expected = WebView.IsScriptNotifyAllowed != true; - } - - protected override void When() - { - WebView.IsScriptNotifyAllowed = _expected; - } - - [TestMethod] - public void PropertyEqualsSettingsValue() - { - WebView.Settings.IsScriptNotifyAllowed.ShouldEqual(WebView.IsScriptNotifyAllowed); - } - } - - [TestClass] - [TestCategory(TestConstants.Categories.Init)] - public class ScriptNotifySettingSetAfterEndInit : HostFormWebViewContextSpecification - { - private bool _expected; - - protected override void Given() - { - base.Given(); - _expected = WebView.IsScriptNotifyAllowed != true; - } - - protected override void When() - { - WebView.Settings.IsScriptNotifyAllowed = _expected; - } - - [TestMethod] - public void PropertyEqualsSettingsValue() - { - WebView.IsScriptNotifyAllowed.ShouldEqual(WebView.Settings.IsScriptNotifyAllowed); - } - } - - [TestClass] - [TestCategory(TestConstants.Categories.Init)] - public class JavaScriptPropertySetBetweenBeginEndInit : BlockTestStartEndContextSpecification - { - protected override void CreateWebView() - { - WebView = new Forms.UI.Controls.WebView(); - } - - protected override void When() - { - ((ISupportInitialize)WebView).BeginInit(); - WebView.IsJavaScriptEnabled = false; - ((ISupportInitialize)WebView).EndInit(); - } - - [TestMethod] - public void ScriptNotifyIsDisabled() - { - WebView.IsJavaScriptEnabled.ShouldBeFalse(); - WebView.Settings.IsJavaScriptEnabled.ShouldBeFalse(); - WebView.Settings.IsJavaScriptEnabled.ShouldEqual(WebView.IsJavaScriptEnabled); - } - - protected override void Cleanup() - { - WebView.Close(); - base.Cleanup(); - } - } - - [TestClass] - [TestCategory(TestConstants.Categories.Init)] - public class JavaScriptPropertySetAfterEndInit : HostFormWebViewContextSpecification - { - private bool _expected; - - protected override void Given() - { - base.Given(); - _expected = WebView.IsJavaScriptEnabled != true; - } - - protected override void When() - { - WebView.IsJavaScriptEnabled = _expected; - } - - [TestMethod] - public void PropertyEqualsSettingsValue() - { - WebView.Settings.IsJavaScriptEnabled.ShouldEqual(WebView.IsJavaScriptEnabled); - } - } - - [TestClass] - [TestCategory(TestConstants.Categories.Init)] - public class JavaScriptSettingSetAfterEndInit : HostFormWebViewContextSpecification - { - private bool _expected; - - protected override void Given() - { - base.Given(); - _expected = WebView.IsJavaScriptEnabled != true; - } - - protected override void When() - { - WebView.Settings.IsJavaScriptEnabled = _expected; - } - - [TestMethod] - public void PropertyEqualsSettingsValue() - { - WebView.IsJavaScriptEnabled.ShouldEqual(WebView.Settings.IsJavaScriptEnabled); - } - } - - [TestClass] - [TestCategory(TestConstants.Categories.Init)] - public class IndexDbPropertySetAfterEndInit : HostFormWebViewContextSpecification - { - private bool _expected; - - protected override void Given() - { - base.Given(); - _expected = WebView.IsIndexedDBEnabled != true; - } - - protected override void When() - { - WebView.IsIndexedDBEnabled = _expected; - } - - [TestMethod] - public void PropertyEqualsSettingsValue() - { - WebView.Settings.IsIndexedDBEnabled.ShouldEqual(WebView.IsIndexedDBEnabled); - } - } - - [TestClass] - [TestCategory(TestConstants.Categories.Init)] - public class IndexDbSettingSetAfterEndInit : HostFormWebViewContextSpecification - { - private bool _expected; - - protected override void Given() - { - base.Given(); - _expected = WebView.IsIndexedDBEnabled != true; - } - - protected override void When() - { - WebView.Settings.IsIndexedDBEnabled = _expected; - } - - [TestMethod] - public void PropertyEqualsSettingsValue() - { - WebView.IsIndexedDBEnabled.ShouldEqual(WebView.Settings.IsIndexedDBEnabled); - } - } - - [TestClass] - [TestCategory(TestConstants.Categories.Init)] - public class IndexDbPropertySetBetweenBeginEndInit : BlockTestStartEndContextSpecification - { - protected override void CreateWebView() - { - WebView = new Forms.UI.Controls.WebView(); - } - - protected override void When() - { - // Behavior like the designer - ((ISupportInitialize)WebView).BeginInit(); - WebView.IsIndexedDBEnabled = false; - ((ISupportInitialize)WebView).EndInit(); - } - - [TestMethod] - public void ScriptNotifyIsDisabled() - { - WebView.IsIndexedDBEnabled.ShouldBeFalse(); - WebView.Settings.IsIndexedDBEnabled.ShouldBeFalse(); - WebView.Settings.IsIndexedDBEnabled.ShouldEqual(WebView.IsIndexedDBEnabled); - } - - protected override void Cleanup() - { - WebView.Close(); - base.Cleanup(); - } - } -} diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Ctor/DesignerTests.cs b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Ctor/DesignerTests.cs deleted file mode 100644 index a74babffe2f..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Ctor/DesignerTests.cs +++ /dev/null @@ -1,9 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Test.WinForms.WebView.FunctionalTests.Ctor -{ - //TODO: Designer mode - -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Ctor/ISupportInitializeDefaultsTests.cs b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Ctor/ISupportInitializeDefaultsTests.cs deleted file mode 100644 index eb97f6bff08..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Ctor/ISupportInitializeDefaultsTests.cs +++ /dev/null @@ -1,111 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.ComponentModel; -using Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT; -using Microsoft.Toolkit.Win32.UI.Controls.Test.WebView.Shared; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Should; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Test.WinForms.WebView.FunctionalTests.Ctor -{ - [TestClass] - [TestCategory(TestConstants.Categories.Init)] - public class WebViewBeginEndInitDefaults : BlockTestStartEndContextSpecification - { - protected override void CreateWebView() - { - WebView = new Forms.UI.Controls.WebView(); - } - - protected override void When() - { - ((ISupportInitialize)WebView).BeginInit(); - ((ISupportInitialize)WebView).EndInit(); - } - - [TestMethod] - public void IndexDBEnabled() - { - WebView.IsIndexedDBEnabled.ShouldEqual(WebViewDefaults.IsIndexedDBEnabled); - } - - [TestMethod] - public void JavaScriptEnabled() - { - WebView.IsJavaScriptEnabled.ShouldEqual(WebViewDefaults.IsJavaScriptEnabled); - } - - [TestMethod] - public void ScriptNotifyDisabled() - { - WebView.IsScriptNotifyAllowed.ShouldEqual(WebViewDefaults.IsScriptNotifyEnabled); - } - - [TestMethod] - public void PrivateNetworkDisabled() - { - WebView.IsPrivateNetworkClientServerCapabilityEnabled.ShouldEqual(WebViewDefaults.IsPrivateNetworkEnabled); - } - - protected override void Cleanup() - { - WebView.Dispose(); - - base.Cleanup(); - } - } - - [TestClass] - [TestCategory(TestConstants.Categories.Init)] - public class WebViewControlProcessUnavailableBeforeEndInit : BlockTestStartEndContextSpecification - { - protected override void CreateWebView() - { - WebView = new Forms.UI.Controls.WebView(); - } - - [TestMethod] - public void ProcessIsUnavailable() - { - WebView.Process.ShouldBeNull(); - } - - protected override void Cleanup() - { - WebView.Close(); - base.Cleanup(); - } - } - - [TestClass] - [TestCategory(TestConstants.Categories.Init)] - public class WebViewControlProcessAvailableAfterEndInit : BlockTestStartEndContextSpecification - { - protected override void CreateWebView() - { - WebView = new Forms.UI.Controls.WebView(); - ((ISupportInitialize)WebView).BeginInit(); - ((ISupportInitialize)WebView).EndInit(); - } - - [TestMethod] - public void ProcessIsAvailable() - { - WebView.Process.ShouldNotBeNull(); - } - - [TestMethod] - public void SettingsIsAvailable() - { - WebView.Settings.ShouldNotBeNull(); - } - - protected override void Cleanup() - { - WebView.Close(); - base.Cleanup(); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Designer/DesignerTests.cs b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Designer/DesignerTests.cs deleted file mode 100644 index 7fc57c653e6..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Designer/DesignerTests.cs +++ /dev/null @@ -1,85 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.ComponentModel; -using Microsoft.Toolkit.Win32.UI.Controls.Test.WebView.Shared; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Should; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Test.WinForms.WebView.FunctionalTests.Designer -{ - //TODO: Designer mode - [TestClass] - [TestCategory(TestConstants.Categories.Des)] - public class ScriptNotifyPropertySet : BlockTestStartEndContextSpecification - { - protected override void CreateWebView() - { - WebView = new Forms.UI.Controls.WebView() - { - IsScriptNotifyAllowed = true - }; - } - - protected override void When() - { - WebView.IsScriptNotifyAllowed = false; - } - - [TestMethod] - //[Timeout(TestConstants.Timeouts.Short)] - public void ScriptNotifyIsDisabled() - { - WebView.IsScriptNotifyAllowed.ShouldBeFalse(); - } - - protected override void Cleanup() - { - try - { - WebView.Close(); - } - finally - { - base.Cleanup(); - } - } - } - - [TestClass] - [TestCategory(TestConstants.Categories.Des)] - public class BeginInitAfterScriptNotifyPropertySet : BlockTestStartEndContextSpecification - { - protected override void CreateWebView() - { - WebView = new Forms.UI.Controls.WebView(); - } - - protected override void When() - { - WebView.IsScriptNotifyAllowed = false; - } - - [TestMethod] - [Timeout(TestConstants.Timeouts.Short)] - [ExpectedException(typeof(InvalidOperationException))] - public void ControlIsAlreadyInitialized() - { - ((ISupportInitialize)WebView).BeginInit(); - } - - protected override void Cleanup() - { - try - { - WebView.Close(); - } - finally - { - base.Cleanup(); - } - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/DocumentTitle/DocumentTitleTests.cs b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/DocumentTitle/DocumentTitleTests.cs deleted file mode 100644 index 2bec21d59c4..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/DocumentTitle/DocumentTitleTests.cs +++ /dev/null @@ -1,65 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using Microsoft.Toolkit.Win32.UI.Controls.Test.WebView.Shared; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Should; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Test.WinForms.WebView.FunctionalTests.DocumentTitle -{ - [TestClass] - public class DocumentTitleNavigateToStringTest : HostFormWebViewContextSpecification - { - public string Expected { get; set; } = "Hello World!"; - private string _actual; - private string _content; - - protected override void Given() - { - _content = $@" - -{Expected} - -

DocumentTitleNavigateToStringTest

- - -"; - - base.Given(); - WebView.NavigationCompleted += (o, e) => - { - _actual = WebView.DocumentTitle; - Form.Close(); - }; - } - - protected override void When() - { - NavigateToStringAndWaitForFormClose(_content); - } - - [TestMethod] - [Timeout(TestConstants.Timeouts.Longest)] - public void DocumentTitleIsExpectedValue() - { - _actual.ShouldEqual(Expected); - } - } - - [TestClass] - public class DocumentTitleNavigateTest : DocumentTitleNavigateToStringTest - { - protected override void Given() - { - Expected = "Example Domain"; - - base.Given(); - } - - protected override void When() - { - NavigateAndWaitForFormClose(TestConstants.Uris.ExampleCom); - } - } -} diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/FullScreen/FullScreenTests.cs b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/FullScreen/FullScreenTests.cs deleted file mode 100644 index 6820750c8b0..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/FullScreen/FullScreenTests.cs +++ /dev/null @@ -1,110 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using WindowsInput.Native; -using Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT; -using Microsoft.Toolkit.Win32.UI.Controls.Test.WebView.Shared; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Should; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Test.WinForms.WebView.FunctionalTests.FullScreen -{ - [TestClass] - public class WhenFullScreenElement : HostFormWebViewContextSpecification - { - private bool _fullScreenEventCalled; - private bool _fullScreenBeforeEvent; - private bool _fullScreenAfterEvent; - private string _content; - protected override void Given() - { - _content = @" - -WhenFullScreenElement - -

WhenFullScreenElement

- -
starting
- - - -"; - - base.Given(); - - WebView.IsJavaScriptEnabled = true; - WebView.IsScriptNotifyAllowed = true; - - _fullScreenBeforeEvent = WebView.ContainsFullScreenElement; - - WebView.ScriptNotify += (o, e) => - { - WriteLine($"ScriptNotify received: '{e.Value ?? string.Empty}"); - - if ("generateKeyPress".Equals(e.Value)) - { - Form.Focus(); - Form.InputSimulator.Keyboard.KeyPress(VirtualKeyCode.TAB); - Form.InputSimulator.Keyboard.KeyPress(VirtualKeyCode.RETURN); - Form.InputSimulator.Keyboard.KeyPress(VirtualKeyCode.ESCAPE); - } - }; - - WebView.DOMContentLoaded += (o, e) => - { - WebView.MoveFocus(WebViewControlMoveFocusReason.Programmatic); - }; - - WebView.ContainsFullScreenElementChanged += (o, e) => - { - WriteLine($"{nameof(WebView.ContainsFullScreenElementChanged)}: Args: {e ?? string.Empty}"); - _fullScreenEventCalled = true; - _fullScreenAfterEvent = WebView.ContainsFullScreenElement; - Form.Close(); - }; - } - - protected override void When() - { - NavigateToStringAndWaitForFormClose(_content); - } - - [TestMethod] - [Timeout(TestConstants.Timeouts.Medium)] - [Ignore("WebView focus unreliable")] - public void FullScreenEventRaisedWhenFullScreenRequested() - { - _fullScreenEventCalled.ShouldBeTrue(); - _fullScreenBeforeEvent.ShouldBeFalse(); - _fullScreenAfterEvent.ShouldBeTrue(); - } - } -} diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/HostFormWebViewContextSpecification.cs b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/HostFormWebViewContextSpecification.cs deleted file mode 100644 index 8e656cdb723..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/HostFormWebViewContextSpecification.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.ComponentModel; -using System.Windows.Forms; -using Microsoft.Toolkit.Win32.UI.Controls.Test.WebView.Shared; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Should; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Test.WinForms.WebView.FunctionalTests -{ - [TestCategory(TestConstants.Categories.Des)] - public abstract class HostFormWebViewContextSpecification : WebViewFormContextSpecification - { - protected override void CreateWebView() - { - // This is what Windows Forms designer emits - WebView = new Forms.UI.Controls.WebView(); - ((ISupportInitialize)WebView).BeginInit(); - Form.SuspendLayout(); - WebView.Dock = DockStyle.Fill; - WebView.Size = Form.ClientSize; - WebView.IsScriptNotifyAllowed = true; - WebView.IsIndexedDBEnabled = true; - WebView.IsJavaScriptEnabled = true; - WebView.Visible = true; - Form.Controls.Add(WebView); - ((ISupportInitialize)WebView).EndInit(); - Form.ResumeLayout(false); - Form.PerformLayout(); - - WebView.IsScriptNotifyAllowed.ShouldBeTrue(); - WebView.IsIndexedDBEnabled.ShouldBeTrue(); - WebView.IsJavaScriptEnabled.ShouldBeTrue(); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Input/MousewheelTests.cs b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Input/MousewheelTests.cs deleted file mode 100644 index 1e398875893..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Input/MousewheelTests.cs +++ /dev/null @@ -1,107 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT; -using Microsoft.Toolkit.Win32.UI.Controls.Test.WebView.Shared; -using Microsoft.VisualStudio.TestTools.UnitTesting; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Test.WinForms.WebView.FunctionalTests.Input -{ - [TestClass] - public class MousewheelTests : HostFormWebViewContextSpecification - { - private string _content = @" - - - - - -

Mouse Wheel Chaining Test

-
starting
- - - -"; - - protected override void Given() - { - base.Given(); - - WebView.IsScriptNotifyAllowed = true; - WebView.IsJavaScriptEnabled = true; - WebView.NavigationCompleted += (o, e) => - { - if (!WebView.Focused) - { - WriteLine("Moving focus to WebView"); - Form.BringToFront(); - Form.Focus(); - WebView.Focus(); - WebView.MoveFocus(WebViewControlMoveFocusReason.Programmatic); - Form.InputSimulator.Mouse.LeftButtonClick(); - } - else - { - WriteLine("WebView already has focus"); - } - }; - WebView.ScriptNotify += (o, e) => - { - WriteLine($"ScriptNotify received: {e.Value ?? String.Empty}"); - - if ("generatedMouseWheelInput".Equals(e.Value)) - { - // When the page is loaded and attached its mouse wheel event listener it signals us to send mouse wheel input - if (!WebView.Focused) - { - WriteLine("Moving focus to WebView"); - Form.BringToFront(); - WebView.Focus(); - WebView.MoveFocus(WebViewControlMoveFocusReason.Programmatic); - } - else - { - WriteLine("WebView already has focus"); - } - Form.InputSimulator.Mouse.VerticalScroll(-500); - - } - else if ("mouseWheelInputFound".Equals(e.Value)) - { - Form.Close(); - } - else - { - Assert.Fail("Unexpected ScriptNotify value: " + e.Value); - } - }; - } - - protected override void When() - { - NavigateToStringAndWaitForFormClose(_content); - } - - [TestMethod] - [Timeout(TestConstants.Timeouts.Short)] - [Ignore("Cannot reliably focus")] - public void MouseWheelEventsChained() - { - - } - } -} diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/InvokeScript/InvokeScriptTests.cs b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/InvokeScript/InvokeScriptTests.cs deleted file mode 100644 index ba8d1f7237a..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/InvokeScript/InvokeScriptTests.cs +++ /dev/null @@ -1,206 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Threading.Tasks; -using Microsoft.Toolkit.Win32.UI.Controls.Test.WebView.Shared; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Should; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Test.WinForms.WebView.FunctionalTests.InvokeScript -{ - // Issue #2367 - Deadlock when UI thread calls multiple InvokeScript with return value - [TestClass] - public class InvokeScriptMultipleTimesOnUIThread : HostFormWebViewContextSpecification - { - private string _actual; - - protected override void Given() - { - base.Given(); - - WebView.NavigationCompleted += (o, e) => - { - _actual = WebView.InvokeScript("eval", "document.title"); - _actual = WebView.InvokeScript("eval", "document.title"); - _actual = WebView.InvokeScript("eval", "document.title"); - Form.Close(); - }; - } - - protected override void When() - { - NavigateAndWaitForFormClose(TestConstants.Uris.ExampleCom); - } - - [TestMethod] - public void JavaScriptReturnsWithoutDeadlock() - { - _actual.ShouldEqual("Example Domain"); - } - } - - [TestClass] - public class InvokeScriptAsyncNoArgumentsTests : HostFormWebViewContextSpecification - { - private static string _expected = "exampleReturnValue"; - private string _actual; - private readonly string _content = @" -

" + nameof(InvokeScriptAsyncNoArgumentsTests) + @"

- -"; - - protected override void Given() - { - base.Given(); - - WebView.NavigationCompleted += (a, b) => - { - _actual = WebView.InvokeScriptAsync("getTextContent", null).GetAwaiter().GetResult(); - Form.Close(); - }; - } - - protected override void When() - { - NavigateToStringAndWaitForFormClose(_content); - } - - [TestMethod] - [Timeout(TestConstants.Timeouts.Longest)] - [Ignore("Causing test run to abort")] - public void InvokedScriptReturnedExpectedValue() - { - _actual.ShouldEqual(_expected); - } - } - - [TestClass] - public class InvokeScriptNoArgumentsTests : HostFormWebViewContextSpecification - { - private static string _expected = "exampleReturnValue"; - private string _actual; - private readonly string _content = @" -

" + nameof(InvokeScriptNoArgumentsTests) + @"

- -"; - - protected override void Given() - { - base.Given(); - - WebView.NavigationCompleted += (a, b) => - { - _actual = (string)WebView.InvokeScript("getTextContent", null); - Form.Close(); - }; - } - - protected override void When() - { - NavigateToStringAndWaitForFormClose(_content); - } - - [TestMethod] - [Timeout(TestConstants.Timeouts.Longest)] - [Ignore("Causing test run to abort")] - public void InvokedScriptReturnedExpectedValue() - { - _actual.ShouldEqual(_expected); - } - } - - [TestClass] - public class InvokeScriptAsyncOneArgumentTests : HostFormWebViewContextSpecification - { - private static string _expected = "exampleParameter"; - private string _actual; - private readonly string _content = @" -

" + nameof(InvokeScriptAsyncOneArgumentTests) + @"

- -"; - - protected override void Given() - { - base.Given(); - - WebView.NavigationCompleted += (a, b) => - { - WriteLine($"Calling {nameof(WebView.InvokeScriptAsync)}"); -#pragma warning disable 4014 - NewMethod(a as Forms.UI.Controls.WebView); -#pragma warning restore 4014 - }; - } - - private async Task NewMethod(Forms.UI.Controls.WebView a) - { - _actual = await a.InvokeScriptAsync("echoOneArgument", "exampleParameter").ConfigureAwait(false); - Form.Close(); - } - - protected override void When() - { - NavigateToStringAndWaitForFormClose(_content); - } - - [TestMethod] - [Timeout(TestConstants.Timeouts.Longest)] - [Ignore("Causing test run to abort")] - public void InvokedScriptReturnedExpectedValue() - { - _actual.ShouldEqual(_expected); - } - } - - [TestClass] - public class InvokeScriptOneArgumentTests : HostFormWebViewContextSpecification - { - private static string _expected = "exampleParameter"; - private string _actual; - private readonly string _content = @" -

" + nameof(InvokeScriptOneArgumentTests) + @"

- -"; - - protected override void Given() - { - base.Given(); - - WebView.NavigationCompleted += (a, b) => - { - _actual = (string)WebView.InvokeScript("echoOneArgument", "exampleParameter"); - Form.Close(); - }; - } - - protected override void When() - { - NavigateToStringAndWaitForFormClose(_content); - } - - [TestMethod] - [Timeout(TestConstants.Timeouts.Longest)] - [Ignore("Causing test run to abort")] - public void InvokedScriptReturnedExpectedValue() - { - _actual.ShouldEqual(_expected); - } - } -} diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/LongRunningJavaScript/LongRunningJavaScriptTests.cs b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/LongRunningJavaScript/LongRunningJavaScriptTests.cs deleted file mode 100644 index 9a23f00333f..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/LongRunningJavaScript/LongRunningJavaScriptTests.cs +++ /dev/null @@ -1,70 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using Microsoft.Toolkit.Win32.UI.Controls.Test.WebView.Shared; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Should; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Test.WinForms.WebView.FunctionalTests.LongRunningJavaScript -{ - [TestClass] - public class LongRunningJavaScriptTests : HostFormWebViewContextSpecification - { - private string _result; - private bool _slowEventRaised; - private string _content = @" -

TEST

- -"; - - protected override void Given() - { - base.Given(); - WebView.IsJavaScriptEnabled = true; - - // BUG: The content causes browsers to show prompt when loaded externally without a problem - WebView.LongRunningScriptDetected += (o, e) => - { - WriteLine($"LongRunningScriptDetected: {e.ExecutionTime}"); - _slowEventRaised = true; - e.StopPageScriptExecution = true; - - Form.Close(); - }; - - WebView.NavigationCompleted += (o, e) => - { - _result = WebView.InvokeScriptAsync("mySlowFunction", "3000000").Result; - Form.Close(); - }; - } - - protected override void When() - { - NavigateToStringAndWaitForFormClose(_content); - } - - [TestMethod] - [Timeout(TestConstants.Timeouts.Longest)] - [Ignore("LongRunningScriptDetected event is not raised")] - public void LongRunningJavaScriptEventRaised() - { - _slowEventRaised.ShouldBeTrue(); - _result.ShouldNotBeNull(); - } - } -} diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/NavigateToLocalStreamUri/BuildStreamTests.cs b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/NavigateToLocalStreamUri/BuildStreamTests.cs deleted file mode 100644 index 5338a1f49c2..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/NavigateToLocalStreamUri/BuildStreamTests.cs +++ /dev/null @@ -1,227 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Should; -using System; -using System.Reflection; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Test.WinForms.WebView.FunctionalTests.NavigateToLocalStreamUri -{ - public abstract class BuildStreamContextSpecification : HostFormWebViewContextSpecification - { - public Uri Actual { get; set; } - public Uri Expected { get; set; } - public string RelativePath { get; set; } - - protected override void When() - { - var type = WebView.GetType(); - var hostPropertyInfo = type.GetProperty( - "Host", - BindingFlags.Instance | BindingFlags.GetProperty | BindingFlags.NonPublic); - - Assert.IsNotNull(hostPropertyInfo); - - var host = hostPropertyInfo.GetValue(WebView); - - Assert.IsNotNull(host); - - var streamMethodInfo = host - .GetType() - .GetMethod("BuildStream", BindingFlags.Instance | BindingFlags.NonPublic); - - Assert.IsNotNull(streamMethodInfo); - - try - { - Actual = (Uri) streamMethodInfo.Invoke(host, new[] {"Test", RelativePath}); - } - catch (TargetInvocationException tie) - { - if (tie.InnerException != null) - { - throw tie.InnerException; - } - - throw; - } - } - - [TestMethod] - public virtual void GeneratedStreamUriIsExpectedValue() - { - Actual.ShouldEqual(Expected); - } - } - - [TestClass] - public class Given_a_relative_path_referencing_two_ancestors : BuildStreamContextSpecification - { - protected override void Given() - { - base.Given(); - Expected = new Uri("ms-local-stream://microsoft.win32webviewhost_cw5n1h2txyewy_54657374/foo.htm"); - RelativePath = @"..\..\foo.htm"; - } - } - - [TestClass] - public class Given_a_relative_path_referencing_sibling : BuildStreamContextSpecification - { - protected override void Given() - { - base.Given(); - Expected = new Uri("ms-local-stream://microsoft.win32webviewhost_cw5n1h2txyewy_54657374/foo.htm"); - RelativePath = @"foo.htm"; - } - } - - [TestClass] - public class Given_a_relative_path_referencing_sibling_backslash : BuildStreamContextSpecification - { - protected override void Given() - { - base.Given(); - Expected = new Uri("ms-local-stream://microsoft.win32webviewhost_cw5n1h2txyewy_54657374//foo.htm"); - RelativePath = @"\foo.htm"; - } - } - - [TestClass] - public class Given_a_relative_path_referencing_sibling_dotbackslash : BuildStreamContextSpecification - { - protected override void Given() - { - base.Given(); - Expected = new Uri("ms-local-stream://microsoft.win32webviewhost_cw5n1h2txyewy_54657374/foo.htm"); - RelativePath = @".\foo.htm"; - } - } - - [TestClass] - public class Given_a_relative_path_referencing_sibling_frontslash : BuildStreamContextSpecification - { - protected override void Given() - { - base.Given(); - Expected = new Uri("ms-local-stream://microsoft.win32webviewhost_cw5n1h2txyewy_54657374/foo.htm"); - RelativePath = @"/foo.htm"; - } - } - - [TestClass] - public class Given_a_relative_path_referencing_sibling_dotfrontslash : BuildStreamContextSpecification - { - protected override void Given() - { - base.Given(); - Expected = new Uri("ms-local-stream://microsoft.win32webviewhost_cw5n1h2txyewy_54657374/foo.htm"); - RelativePath = @"./foo.htm"; - } - } - - [TestClass] - public class Given_a_relative_path_referencing_descendant : BuildStreamContextSpecification - { - protected override void Given() - { - base.Given(); - Expected = new Uri("ms-local-stream://microsoft.win32webviewhost_cw5n1h2txyewy_54657374/bar/foo.htm"); - RelativePath = @"bar/foo.htm"; - } - } - - [TestClass] - public class Given_a_relative_path_referencing_descendant_backslash : BuildStreamContextSpecification - { - protected override void Given() - { - base.Given(); - Expected = new Uri("ms-local-stream://microsoft.win32webviewhost_cw5n1h2txyewy_54657374//bar/foo.htm"); - RelativePath = @"\bar\foo.htm"; - } - } - - [TestClass] - public class Given_a_relative_path_referencing_descendant_dotbackslash : BuildStreamContextSpecification - { - protected override void Given() - { - base.Given(); - Expected = new Uri("ms-local-stream://microsoft.win32webviewhost_cw5n1h2txyewy_54657374/bar/foo.htm"); - RelativePath = @".\bar\foo.htm"; - } - } - - [TestClass] - public class Given_a_relative_path_referencing_descendant_frontslash : BuildStreamContextSpecification - { - protected override void Given() - { - base.Given(); - Expected = new Uri("ms-local-stream://microsoft.win32webviewhost_cw5n1h2txyewy_54657374/bar/foo.htm"); - RelativePath = @"/bar/foo.htm"; - } - } - - [TestClass] - public class Given_a_relative_path_referencing_descendant_dotfrontslash : BuildStreamContextSpecification - { - protected override void Given() - { - base.Given(); - Expected = new Uri("ms-local-stream://microsoft.win32webviewhost_cw5n1h2txyewy_54657374/bar/foo.htm"); - RelativePath = @"./bar/foo.htm"; - } - } - - [TestClass] - public class Given_an_absolute_path_referencing_two_ancestors : BuildStreamContextSpecification - { - protected override void Given() - { - base.Given(); - - RelativePath = @"C:\foo.htm"; - } - - protected override void When() - { - // Intentionally blank - } - - [TestMethod] - [ExpectedException(typeof(ArgumentOutOfRangeException))] - public override void GeneratedStreamUriIsExpectedValue() - { - // The error actually occurs in the BuildStream(String, String) method - base.When(); - } - } - - [TestClass] - public class Given_an_UNC_path_referencing_two_ancestors : BuildStreamContextSpecification - { - protected override void Given() - { - base.Given(); - - RelativePath = @"\\machine\share\foo.htm"; - } - - protected override void When() - { - // Intentionally blank - } - - [TestMethod] - [ExpectedException(typeof(ArgumentOutOfRangeException))] - public override void GeneratedStreamUriIsExpectedValue() - { - // The error actually occurs in the BuildStream(String, String) method - base.When(); - } - } -} diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/NavigateToLocalStreamUri/NavigateToLocalStreamUriTests.cs b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/NavigateToLocalStreamUri/NavigateToLocalStreamUriTests.cs deleted file mode 100644 index f742951e08d..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/NavigateToLocalStreamUri/NavigateToLocalStreamUriTests.cs +++ /dev/null @@ -1,108 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using Microsoft.Toolkit.Win32.UI.Controls.Test.WebView.Shared; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Should; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Test.WinForms.WebView.FunctionalTests.NavigateToLocalStreamUri -{ - [TestClass] - [TestCategory(TestConstants.Categories.Nav)] - [DeploymentItem("FunctionalTests\\NavigateToLocalStreamUri\\async.htm")] - public class Given_a_local_htm_file : HostFormWebViewContextSpecification - { - private bool _success; - - protected override void Given() - { - base.Given(); - - WebView.NavigationCompleted += (o, e) => - { - _success = e.IsSuccess; - - Form.Close(); - }; - } - - protected override void When() - { - NavigateToLocalAndWaitForFormClose(new Uri("async.htm", UriKind.Relative), new TestStreamResolver()); - } - - [TestMethod] - public void LocalNavigationCompleted() - { - _success.ShouldBeTrue(); - } - } - - [TestClass] - [TestCategory(TestConstants.Categories.Nav)] - [DeploymentItem("FunctionalTests\\NavigateToLocalStreamUri\\async.htm")] - public class Given_a_local_htm_file_with_async_XHR_for_local_content : HostFormWebViewContextSpecification - { - private string _scriptNotifyResult; - - protected override void Given() - { - base.Given(); - WebView.IsJavaScriptEnabled = true; - WebView.IsScriptNotifyAllowed = true; - - - WebView.ScriptNotify += (o, e) => - { - _scriptNotifyResult = e.Value; - Form.Close(); - }; - } - - protected override void When() - { - NavigateToLocalAndWaitForFormClose(new Uri("async.htm", UriKind.Relative), new TestStreamResolver()); - } - - [TestMethod] - public void LocalNavigationCompleted() - { - _scriptNotifyResult.ShouldEqual("Success"); - } - } - - [TestClass] - [TestCategory(TestConstants.Categories.Nav)] - [DeploymentItem("FunctionalTests\\NavigateToLocalStreamUri\\sync.htm")] - public class Given_a_local_htm_file_with_sync_XHR_for_local_content : HostFormWebViewContextSpecification - { - private string _scriptNotifyResult; - - protected override void Given() - { - base.Given(); - WebView.IsJavaScriptEnabled = true; - WebView.IsScriptNotifyAllowed = true; - - - WebView.ScriptNotify += (o, e) => - { - _scriptNotifyResult = e.Value; - Form.Close(); - }; - } - - protected override void When() - { - NavigateToLocalAndWaitForFormClose(new Uri("sync.htm", UriKind.Relative), new TestStreamResolver()); - } - - [TestMethod] - public void LocalNavigationCompleted() - { - _scriptNotifyResult.ShouldEqual("Success"); - } - } -} diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/NavigateToLocalStreamUri/TestStreamResolver.cs b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/NavigateToLocalStreamUri/TestStreamResolver.cs deleted file mode 100644 index 64980a22664..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/NavigateToLocalStreamUri/TestStreamResolver.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT; -using System.IO; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Test.WinForms.WebView.FunctionalTests.NavigateToLocalStreamUri -{ -#pragma warning disable 618 - internal class TestStreamResolver : UriToLocalStreamResolver -#pragma warning restore 618 - { - public TestStreamResolver() - :base(Path.GetDirectoryName(typeof(TestStreamResolver).Assembly.Location)) - { - } - } -} diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/NavigateToLocalStreamUri/async.htm b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/NavigateToLocalStreamUri/async.htm deleted file mode 100644 index 5ea5343f0d9..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/NavigateToLocalStreamUri/async.htm +++ /dev/null @@ -1,28 +0,0 @@ - - - - Async XHR Test - - - Loading... - - - - \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/NavigateToLocalStreamUri/sync.htm b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/NavigateToLocalStreamUri/sync.htm deleted file mode 100644 index a18e5e109aa..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/NavigateToLocalStreamUri/sync.htm +++ /dev/null @@ -1,28 +0,0 @@ - - - - Sync XHR Test - - - Loading... - - - - \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Navigation/CanGoBackTests.cs b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Navigation/CanGoBackTests.cs deleted file mode 100644 index ac0590f1ad7..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Navigation/CanGoBackTests.cs +++ /dev/null @@ -1,55 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using Microsoft.Toolkit.Win32.UI.Controls.Test.WebView.Shared; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Should; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Test.WinForms.WebView.FunctionalTests.Navigation -{ - [TestClass] - [TestCategory(TestConstants.Categories.Nav)] - public class AfterNavigatingMoreThanOnce : HostFormWebViewContextSpecification - { - private int _navigationCount; - private bool _canGoBack; - - protected override void Given() - { - base.Given(); - - WebView.NavigationCompleted += (o, e) => - { - if (e.Uri == null) return; - - _navigationCount++; - - WriteLine($"NavCompleted: {e.Uri}"); - e.IsSuccess.ShouldBeTrue($"Navigation failure: {e.WebErrorStatus}"); - if (e.Uri == TestConstants.Uris.ExampleCom) - { - WebView.Navigate(TestConstants.Uris.ExampleNet); - } - else - { - _canGoBack = WebView.CanGoBack; - Form.Close(); - } - }; - } - - protected override void When() - { - NavigateAndWaitForFormClose(TestConstants.Uris.ExampleCom); - } - - [TestMethod] - [Timeout(TestConstants.Timeouts.Medium)] - public void CanGoBackIsTrue() - { - _navigationCount.ShouldEqual(2); - _canGoBack.ShouldBeTrue(); - } - } -} diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Navigation/CanGoForwardTests.cs b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Navigation/CanGoForwardTests.cs deleted file mode 100644 index f8d4654f050..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Navigation/CanGoForwardTests.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using Microsoft.Toolkit.Win32.UI.Controls.Test.WebView.Shared; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Should; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Test.WinForms.WebView.FunctionalTests.Navigation -{ - [TestClass] - [TestCategory(TestConstants.Categories.Nav)] - public class AfterNavigatingMoreThanOnceThenGoingBack : HostFormWebViewContextSpecification - { - private int _navigationCount; - - protected override void Given() - { - base.Given(); - - WebView.NavigationCompleted += (o, e) => - { - _navigationCount++; - WriteLine($"NavCompleted: {e.Uri}; NavCount: {_navigationCount}"); - e.IsSuccess.ShouldBeTrue($"Navigation failure: {e.WebErrorStatus}"); - - if (WebView.CanGoBack) - { - WebView.GoBack(); - } else if (!WebView.CanGoBack && WebView.CanGoForward) - { - Form.Close(); - } - else - { - WebView.Navigate(new Uri(TestConstants.Uris.ExampleCom, "?" + _navigationCount)); - } - - - }; - - } - - protected override void When() - { - NavigateAndWaitForFormClose(TestConstants.Uris.ExampleCom); - } - - [TestMethod] - //[Timeout(TestConstants.Timeouts.Long)] - public void CanGoForwardIsTrue() - { - // NOTE: Due to asynchronous nature the actual assert is in Given() - } - } -} diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Navigation/NavigateTests.cs b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Navigation/NavigateTests.cs deleted file mode 100644 index 66f2baa8eff..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Navigation/NavigateTests.cs +++ /dev/null @@ -1,270 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using System.IO; -using System.Net.Http; -using System.Text; -using Microsoft.Toolkit.Win32.UI.Controls.Test.WebView.Shared; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Should; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Test.WinForms.WebView.FunctionalTests.Navigation -{ - [TestClass] - public class NavigateStringUri : HostFormWebViewContextSpecification - { - private bool _navigationCompleted; - protected override void Given() - { - base.Given(); - WebView.NavigationCompleted += (o, e) => - { - _navigationCompleted = true; - Form.Close(); - }; - } - - protected override void When() - { - PerformActionAndWaitForFormClose(() => - { - WebView.Navigate(TestConstants.Uris.ExampleOrg.ToString()); - }); - } - - [TestMethod] - public void NavigationCompleted() - { - _navigationCompleted.ShouldBeTrue(); - } - } - - [TestClass] - public class NavigateRelativeUri : HostFormWebViewContextSpecification - { - [TestMethod] - [ExpectedException(typeof(ArgumentException))] - public void NavigationFailedWithArgumentException() - { - WebView.Navigate(new Uri("/someresource", UriKind.Relative)); - } - } - - [TestClass] - public class NavigateFilePath : HostFormWebViewContextSpecification - { - private string path; - - protected override void Given() - { - var fileName = Guid.NewGuid().ToString("N") + ".txt"; - path = Path.Combine(TestContext.TestRunResultsDirectory, fileName); - - File.WriteAllText( - path, - @" - -HTML on Disk -

HTML on Disk

- -"); - - base.Given(); - } - - [TestMethod] - [ExpectedException(typeof(Exception), "E_ABORT expected")] - [Ignore] - public void Navigate() - { - PerformActionAndWaitForFormClose(() => - { - WebView.Navigate(new Uri(path)); - }); - } - } - - [TestClass] - public class Navigate2Tests : HostFormWebViewContextSpecification - { - private bool _navigationCompleted; - - protected override void Given() - { - base.Given(); - WebView.NavigationCompleted += (o, e) => - { - _navigationCompleted = e.IsSuccess; - Form.Close(); - }; - } - - protected override void When() - { - PerformActionAndWaitForFormClose(() => - { - WebView.Navigate(TestConstants.Uris.HttpBin, HttpMethod.Get); - }); - } - - [TestMethod] - public void Explict_HTTP_GET_succeeds() - { - _navigationCompleted.ShouldBeTrue(); - } - } - - [TestClass] - public class NavigateGetWithHeaders : HostFormWebViewContextSpecification - { - private bool _navigationCompleted; - - protected override void Given() - { - base.Given(); - WebView.NavigationCompleted += (o, e) => - { - _navigationCompleted = e.IsSuccess; - Form.Close(); - }; - } - - protected override void When() - { - PerformActionAndWaitForFormClose(() => - { - WebView.Navigate( - TestConstants.Uris.HttpBin, - HttpMethod.Get, - null, - new[] { new KeyValuePair("pragma", "no-cache") }); - }); - } - - [TestMethod] - public void Explict_HTTP_GET_with_HEADERS_succeeds() - { - _navigationCompleted.ShouldBeTrue(); - } - } - - [TestClass] - public class NavigateGetWithBasicAuth : HostFormWebViewContextSpecification - { - private bool _navigationCompleted; - - protected override void Given() - { - base.Given(); - WebView.NavigationCompleted += (o, e) => - { - _navigationCompleted = e.IsSuccess; - Form.Close(); - }; - } - - protected override void When() - { - PerformActionAndWaitForFormClose(() => - { - const string user = "usr"; - const string password = "pwd"; - const string header = "Authorization"; - - var authInfo = Convert.ToBase64String(Encoding.Default.GetBytes($"{user}:{password}")); - - WebView.Navigate( - new Uri(TestConstants.Uris.HttpBin, new Uri($"/basic-auth/{user}/{password}", UriKind.Relative)), - HttpMethod.Get, - null, - new[] { new KeyValuePair(header, $"Basic {authInfo}") }); - }); - } - - [TestMethod] - public void Explict_HTTP_GET_with_AUTH_BASIC_succeeds() - { - _navigationCompleted.ShouldBeTrue(); - } - } - - [TestClass] - public class NavigateOption : HostFormWebViewContextSpecification - { - private bool _navigationCompleted; - - protected override void Given() - { - base.Given(); - WebView.NavigationCompleted += (o, e) => - { - _navigationCompleted = e.IsSuccess; - Form.Close(); - }; - } - - protected override void When() - { - PerformActionAndWaitForFormClose(() => - { - - - WebView.Navigate( - TestConstants.Uris.ExampleCom, - HttpMethod.Options - ); - }); - } - - [TestMethod] - [ExpectedException(typeof(ArgumentOutOfRangeException))] - [Ignore("Pops UI that stalls test")] - public void Explict_HTTP_OPTION_fails() - { - _navigationCompleted.ShouldBeFalse(); - } - } - - [TestClass] - public class NavigatePostWithContent : HostFormWebViewContextSpecification - { - private bool _navigationCompleted; - - protected override void Given() - { - base.Given(); - WebView.NavigationCompleted += (o, e) => - { - _navigationCompleted = e.IsSuccess; - Form.Close(); - }; - } - - protected override void When() - { - PerformActionAndWaitForFormClose(() => - { - string Foo() - { - var c = new FormUrlEncodedContent(new[] { new KeyValuePair("Foo", "Bar"), }); - return c.ReadAsStringAsync().Result; - } - - WebView.Navigate( - new Uri(TestConstants.Uris.HttpBin, "/post"), - HttpMethod.Post, - Foo() - ); - }); - } - - [TestMethod] - public void Explict_HTTP_POST_with_data_succeeds() - { - _navigationCompleted.ShouldBeTrue(); - } - } -} diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Navigation/NavigateWithHttpMessageTests.cs b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Navigation/NavigateWithHttpMessageTests.cs deleted file mode 100644 index ecd2427993b..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Navigation/NavigateWithHttpMessageTests.cs +++ /dev/null @@ -1,77 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using System.Net.Http; -using Microsoft.Toolkit.Win32.UI.Controls.Test.WebView.Shared; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Should; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Test.WinForms.WebView.FunctionalTests.Navigation -{ - [TestClass] - [TestCategory(TestConstants.Categories.Nav)] - public class HTTP_GET : HostFormWebViewContextSpecification - { - private bool _success; - - protected override void Given() - { - base.Given(); - WebView.NavigationCompleted += (o, e) => - { - _success = e.IsSuccess; - Form.Close(); - }; - } - - protected override void When() - { - NavigateAndWaitForFormClose(TestConstants.Uris.ExampleCom, HttpMethod.Get); - } - - [TestMethod] - [Timeout(TestConstants.Timeouts.Longest)] - public void NavigationShouldComplete() - { - _success.ShouldBeTrue(); - } - } - - [TestClass] - [TestCategory(TestConstants.Categories.Nav)] - public class HTTP_POST : HostFormWebViewContextSpecification - { - private bool _success; - private Uri _uri = new Uri(TestConstants.Uris.HttpBin, "/post"); - - protected override void Given() - { - base.Given(); - WebView.NavigationCompleted += (o, e) => - { - _success = e.IsSuccess; - Form.Close(); - }; - } - - protected override void When() - { - - NavigateAndWaitForFormClose( - _uri, - HttpMethod.Post, - "{\"prop\":\"content\"}", - new []{new KeyValuePair("accept", "application/json"), }); - } - - [TestMethod] - [Timeout(TestConstants.Timeouts.Longest)] - public void NavigationShouldComplete() - { - _success.ShouldBeTrue(); - } - } -} diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Navigation/NavigationEvents.cs b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Navigation/NavigationEvents.cs deleted file mode 100644 index d1284612279..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Navigation/NavigationEvents.cs +++ /dev/null @@ -1,123 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using Microsoft.Toolkit.Win32.UI.Controls.Test.WebView.Shared; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Should; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Test.WinForms.WebView.FunctionalTests.Navigation -{ - [TestClass] - public class NavigatingFromNavigatingStartingEvent : HostFormWebViewContextSpecification - { - private List _navigatedUris; - - protected override void Given() - { - _navigatedUris = new List(); - - base.Given(); - WebView.NavigationStarting += (o, e) => - { - if (e.Uri != TestConstants.Uris.ExampleOrg) - { - WebView.Navigate(TestConstants.Uris.ExampleOrg); - } - }; - WebView.NavigationCompleted += (o, e) => - { - _navigatedUris.Add(e.Uri); - - if (e.Uri != TestConstants.Uris.ExampleCom) - { - Form.Close(); - } - }; - } - - protected override void When() - { - NavigateAndWaitForFormClose(TestConstants.Uris.ExampleCom); - } - - [TestMethod] - public void NavigatingFromNavigationStartingInterruptsOriginalNavigation() - { - _navigatedUris.Count.ShouldEqual(1, "Starting a new navigation while navigating cancels the original navigation"); - _navigatedUris.ShouldContain(TestConstants.Uris.ExampleOrg); - _navigatedUris.ShouldNotContain(TestConstants.Uris.ExampleCom); - } - } - - [TestCategory(TestConstants.Categories.Nav)] - public abstract class NavigationEventsFiredForHostFormContextSpecification : HostFormWebViewContextSpecification - { - private bool _navStarting; - private bool _contentLoading; - private bool _domContentLoaded; - private bool _navCompleted; - - protected override void Given() - { - base.Given(); - - WebView.NavigationStarting += (o, e) => { _navStarting = true; }; - WebView.ContentLoading += (o, e) => { _contentLoading = true; }; - WebView.DOMContentLoaded += (o, e) => { _domContentLoaded = true; }; - WebView.NavigationCompleted += (o, e) => - { - _navCompleted = true; - Form.Close(); - }; - } - - [TestMethod] - [Timeout(TestConstants.Timeouts.Long)] - public void NavigationEventsCompleted() - { - _navStarting.ShouldBeTrue(); - _contentLoading.ShouldBeTrue(); - _domContentLoaded.ShouldBeTrue(); - _navCompleted.ShouldBeTrue(); - } - } - - [TestClass] - public class NavigationEventsFiredForHostFormOnAboutBlank : NavigationEventsFiredForHostFormContextSpecification - { - protected override void When() - { - NavigateAndWaitForFormClose(TestConstants.Uris.AboutBlank); - } - } - - [TestClass] - public class NavigationEventsFiredForHostFormOnNullSource : NavigationEventsFiredForHostFormContextSpecification - { - protected override void When() - { - NavigateAndWaitForFormClose((Uri)null); - } - } - - [TestClass] - [TestCategory(TestConstants.Categories.Nav)] - public class NavigateToStringEvents : NavigationEventsFiredForHostFormContextSpecification - { - private readonly string _content = $@" - - -

{nameof(NavigateToStringEvents)}

- - -"; - - protected override void When() - { - NavigateToStringAndWaitForFormClose(_content); - } - } -} diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Navigation/RefreshTests.cs b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Navigation/RefreshTests.cs deleted file mode 100644 index 74aac3ade66..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Navigation/RefreshTests.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using Microsoft.Toolkit.Win32.UI.Controls.Test.WebView.Shared; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Should; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Test.WinForms.WebView.FunctionalTests.Navigation -{ - [TestClass] - [TestCategory(TestConstants.Categories.Nav)] - public class RefreshTests : HostFormWebViewContextSpecification - { - private int _navigations; - protected override void Given() - { - base.Given(); - WebView.NavigationCompleted += (o, e) => - { - _navigations++; - if (_navigations == 2) - { - Form.Close(); - } - else - { - WebView.Refresh(); - } - }; - } - - protected override void When() - { - NavigateAndWaitForFormClose(TestConstants.Uris.ExampleOrg); - } - - [TestMethod] - [Timeout(TestConstants.Timeouts.Longest)] - public void RefreshCountsAsNavigation() - { - _navigations.ShouldEqual(2); - } - } -} diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Navigation/StopTests.cs b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Navigation/StopTests.cs deleted file mode 100644 index 033594c384d..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Navigation/StopTests.cs +++ /dev/null @@ -1,84 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using Microsoft.Toolkit.Win32.UI.Controls.Test.WebView.Shared; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Should; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Test.WinForms.WebView.FunctionalTests.Navigation -{ - [TestClass] - [TestCategory(TestConstants.Categories.Nav)] - public class StopAfterNavigate : HostFormWebViewContextSpecification - { - private System.Windows.Forms.Timer _timer; - private bool _navCompleted; - protected override void Given() - { - _timer = new System.Windows.Forms.Timer - { - Interval = TestConstants.Timeouts.Shorter - }; - _timer.Tick += (o, e) => { Form.Close(); }; - - base.Given(); - WebView.NavigationCompleted += (o, e) => { _navCompleted = true; }; - } - - protected override void When() - { - PerformActionAndWaitForFormClose(() => - { - WebView.Navigate(TestConstants.Uris.ExampleOrg); - _timer.Start(); - WebView.Stop(); - }); - } - - [TestMethod] - [Timeout(TestConstants.Timeouts.Longest)] - [Ignore("Causing test run to abort")] - public void StopAfterNavigateDoesNotCompleteNavigation() - { - _navCompleted.ShouldBeFalse(); - } - } - - [TestClass] - [TestCategory(TestConstants.Categories.Nav)] - public class NavigationCancelOnNavigationStarting : HostFormWebViewContextSpecification - { - private System.Windows.Forms.Timer _timer; - private bool _navCompleted; - - protected override void Given() - { - _timer = new System.Windows.Forms.Timer - { - Interval = TestConstants.Timeouts.Shorter - }; - _timer.Tick += (o, e) => { Form.Close(); }; - - base.Given(); - WebView.NavigationStarting += (o, e) => { e.Cancel = true; }; - WebView.NavigationCompleted += (o, e) => { _navCompleted = true; }; - } - - protected override void When() - { - PerformActionAndWaitForFormClose(()=> - { - WebView.Navigate(TestConstants.Uris.ExampleOrg); - _timer.Start(); - }); - } - - [TestMethod] - [Timeout(TestConstants.Timeouts.Longest)] - public void NavigationCompletedEventNeverFired() - { - _navCompleted.ShouldBeFalse(); - } - } -} diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Navigation/WebGLTests.cs b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Navigation/WebGLTests.cs deleted file mode 100644 index f27c3f4ba93..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Navigation/WebGLTests.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using Microsoft.Toolkit.Win32.UI.Controls.Test.WebView.Shared; -using Microsoft.VisualStudio.TestTools.UnitTesting; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Test.WinForms.WebView.FunctionalTests.Navigation -{ - [TestClass] - [TestCategory(TestConstants.Categories.Nav)] - public class CanCreateWebGL : HostFormWebViewContextSpecification - { - // Execute some script that creates a WebGLRenderingContext. There is code that - // will prevent the underlying backend (edgeangle.dll) from loading in processes - // that are not part of a package. The process that hosts edgehtml.dll (and thus - // edgeangle.dll) in Win32WebView scenarios should be packaged so the below should - // succeed and not crash. - private string _content = @" -

TEST

- -"; - - protected override void Given() - { - base.Given(); - - WebView.NavigationCompleted += (o, e) => - { - Form.Close(); - }; - } - - protected override void When() - { - WebView.NavigateToString(_content); - } - - [TestMethod] - public void WebGLContextCreated() - { - } - } -} diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/NewWindow/NewWindowTests.cs b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/NewWindow/NewWindowTests.cs deleted file mode 100644 index 0f3d4593159..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/NewWindow/NewWindowTests.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -//namespace Microsoft.Windows10.Forms.Controls.FunctionalTests.NewWindow -//{ -// [TestClass] -// public class NewWindowTests : HostFormWebViewContextSpecification -// { -// private bool _newWindowRequested; -// private readonly string _content = $@" -// -// -//

JavaScript window.open

-// -// -//"; - -// protected override void Given() -// { -// base.Given(); - -// WebView.NewWindowRequested += (o, e) => -// { -// _newWindowRequested = true; -// WriteLine($"NewWindowRequested: Uri:{e.Uri}, Referrer: {e.Referrer}, Handled: {e.Handled}"); -// Form.Close(); -// }; -// } - -// protected override void When() -// { -// NavigateToStringAndWaitForFormClose(_content); -// } - -// [TestMethod] -// [Timeout(TestConstants.Timeouts.Short)] -// [Ignore("NewWindowRequested event is not firing")] -// public void NewWindowRequestedEventFired() -// { -// _newWindowRequested.ShouldBeTrue(); -// } -// } -//} diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/PartialTrust/PartialTrustTests.cs b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/PartialTrust/PartialTrustTests.cs deleted file mode 100644 index e80b75bd757..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/PartialTrust/PartialTrustTests.cs +++ /dev/null @@ -1,87 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Security; -using System.Security.Permissions; -using Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT; -using Microsoft.Toolkit.Win32.UI.Controls.Test.WebView.Shared; -using Microsoft.VisualStudio.TestTools.UnitTesting; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Test.WinForms.WebView.FunctionalTests.PartialTrust -{ - [TestClass] - public class PartialTrustTest : ContextSpecification - { - [TestMethod] - [ExpectedException(typeof(SecurityException))] - public void UnableToCreateInstance() - { - MediumTrustContext.Create(); - } - - internal static class MediumTrustContext - { - public static T Create() - { - var appDomain = CreatePartialTrustDomain(); - try - { - var t = (T) appDomain.CreateInstanceAndUnwrap(typeof(T).Assembly.FullName, typeof(T).FullName); - return t; - } - catch (Exception e) - { - // Getting a reflection exception since that is how the type is activated - // Interested in the inner-most exception; okay with blowing away the stack for this test - var e2 = e; - while (e2.InnerException != null) - { - e2 = e2.InnerException; - } - - throw e2; - } - } - - public static AppDomain CreatePartialTrustDomain() - { - var setup = new AppDomainSetup { ApplicationBase = AppDomain.CurrentDomain.BaseDirectory }; - var permissions = new PermissionSet(null); - permissions.AddPermission(new SecurityPermission(SecurityPermissionFlag.Execution)); - permissions.AddPermission(new ReflectionPermission(ReflectionPermissionFlag.RestrictedMemberAccess)); - return AppDomain.CreateDomain("Partial Trust AppDomain: " + DateTime.Now.Ticks, null, setup, permissions); - } - } - - } - - [Serializable] - public class ClassUnderTest : MarshalByRefObject - { - private readonly Context _context; - - public ClassUnderTest() - { - _context = new Context(); - } - - public void Navigate() - { - _context.Navigate(); - } - - private class Context : HostFormWebViewContextSpecification - { - public void Navigate() - { - base.Given(); - base.When(); - base.NavigateAndWaitForFormClose(TestConstants.Uris.AboutBlank); - } - - - } - } -} diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Permissions/GeolocationTests.cs b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Permissions/GeolocationTests.cs deleted file mode 100644 index e861f03e831..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Permissions/GeolocationTests.cs +++ /dev/null @@ -1,129 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT; -using Microsoft.Toolkit.Win32.UI.Controls.Test.WebView.Shared; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Should; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Test.WinForms.WebView.FunctionalTests.Permissions -{ - [TestClass] - [TestCategory(TestConstants.Categories.Nav)] - public class GeolocationPermissionRequestImmediatelyGranted : HostFormWebViewContextSpecification - { - private WebViewControlPermissionRequest _permissionRequest; -// private string _content = @" -//

TEST

-//
-// -//"; - - protected override void Given() - { - base.Given(); - - WebView.IsJavaScriptEnabled = true; - - WebView.PermissionRequested += (o, e) => - { - e.PermissionRequest.ShouldNotBeNull(); - - _permissionRequest = e.PermissionRequest; - - WriteLine($"Permission Request: Id: {e.PermissionRequest.Id}, PermissionType: {e.PermissionRequest.PermissionType}"); - e.PermissionRequest.PermissionType.ShouldEqual(WebViewControlPermissionType.Geolocation); - - if (e.PermissionRequest.State == WebViewControlPermissionState.Defer) - { - WebView.GetDeferredPermissionRequestById(e.PermissionRequest.Id)?.Allow(); - } - else - { - e.PermissionRequest.Allow(); - } - - Form.Close(); - }; - } - - protected override void When() - { - //BUG: Geolocation request not working with NavigateToString - //NavigateToStringAndWaitForFormClose(_content); - NavigateAndWaitForFormClose(new Uri("https://codepen.io/rjmurillo/pen/MVaKbJ")); - } - - [TestMethod] - [Timeout(TestConstants.Timeouts.Long)] - public void PermissionRequestReceived() - { - _permissionRequest.ShouldNotBeNull(); - _permissionRequest.State.ShouldEqual(WebViewControlPermissionState.Allow); - } - } - - [TestClass] - [TestCategory(TestConstants.Categories.Nav)] - public class GeolocationPermissionRequestDeferredThenGranted : HostFormWebViewContextSpecification - { - private uint _permissionRequest; - - protected override void Given() - { - base.Given(); - - WebView.IsJavaScriptEnabled = true; - - WebView.PermissionRequested += (o, e) => - { - e.PermissionRequest.ShouldNotBeNull(); - - _permissionRequest = e.PermissionRequest.Id; - - WriteLine($"Permission Request: Id: {e.PermissionRequest.Id}, PermissionType: {e.PermissionRequest.PermissionType}"); - e.PermissionRequest.PermissionType.ShouldEqual(WebViewControlPermissionType.Geolocation); - - if (e.PermissionRequest.State == WebViewControlPermissionState.Defer) - { - } - else - { - e.PermissionRequest.Defer(); - } - - WebView.GetDeferredPermissionRequestById(_permissionRequest)?.Allow(); - Form.Close(); - }; - } - - protected override void When() - { - NavigateAndWaitForFormClose(new Uri("https://codepen.io/rjmurillo/pen/MVaKbJ")); - } - - // TODO: Verify there are no more deferred permission requests - - [TestMethod] - [Timeout(TestConstants.Timeouts.Long)] - public void PermissionRequestReceived() - { - _permissionRequest.ShouldNotEqual(0); - } - } - -} diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/PreLoad/PreLoadTests.cs b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/PreLoad/PreLoadTests.cs deleted file mode 100644 index f137979acfe..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/PreLoad/PreLoadTests.cs +++ /dev/null @@ -1,123 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using Microsoft.Toolkit.Win32.UI.Controls.Test.WebView.Shared; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Should; -using System.IO; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Test.WinForms.WebView.FunctionalTests.PreLoad -{ - [TestClass] - public class NullPreLoadScript : HostFormWebViewContextSpecification - { - protected override void Given() - { - base.Given(); - WebView.IsJavaScriptEnabled = true; - } - - [TestMethod] - [ExpectedException(typeof(ArgumentNullException))] - public void CannotPassNullForPreLoadScript() - { - WebView.AddInitializeScript(null); - } - } - - [TestClass] - public class EmptyPreLoadScript : HostFormWebViewContextSpecification - { - private bool _navSuccess; - - protected override void Given() - { - base.Given(); - WebView.IsJavaScriptEnabled = true; - WebView.AddInitializeScript(string.Empty); - - WebView.NavigationCompleted += (o, e) => - { - _navSuccess = e.IsSuccess; - Form.Close(); - }; - } - - protected override void When() - { - NavigateAndWaitForFormClose(TestConstants.Uris.ExampleCom); - } - - [TestMethod] - public void NavigationCompletesForEmptyPreLoadScript() - { - _navSuccess.ShouldBeTrue(); - } - } - - [TestClass] - public class NonExistentPreLoadScript : HostFormWebViewContextSpecification - { - private bool _navSuccess; - - protected override void Given() - { - base.Given(); - WebView.IsJavaScriptEnabled = true; - WebView.AddInitializeScript($"./non-exist.js"); - - WebView.NavigationCompleted += (o, e) => - { - _navSuccess = e.IsSuccess; - Form.Close(); - }; - } - - protected override void When() - { - NavigateAndWaitForFormClose(TestConstants.Uris.ExampleCom); - } - - [TestMethod] - public void NavigateCompletesWithoutError() - { - _navSuccess.ShouldBeTrue(); - } - } - - [TestClass] - [DeploymentItem("FunctionalTests/PreLoad/preload.js")] - public class RelativePreLoadScript : HostFormWebViewContextSpecification - { - private bool _scriptNotifyCalled; - - protected override void Given() - { - base.Given(); - WebView.IsScriptNotifyAllowed = true; - WebView.IsJavaScriptEnabled = true; - WebView.AddInitializeScript("window.external.notify('preload');"); - - // Set up the event handler - WebView.ScriptNotify += (o, e) => - { - _scriptNotifyCalled = true; - Form.Close(); - }; - } - - protected override void When() - { - NavigateAndWaitForFormClose(TestConstants.Uris.ExampleCom); - } - - [TestMethod] - [Timeout(TestConstants.Timeouts.Longest)] - public void ScriptNotifyRaised() - { - _scriptNotifyCalled.ShouldBeTrue(); - } - } -} diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/PreLoad/preload.js b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/PreLoad/preload.js deleted file mode 100644 index 72c2ce8be9d..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/PreLoad/preload.js +++ /dev/null @@ -1 +0,0 @@ -window.external.notify('preload'); \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Scale/ScaleTests.cs b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Scale/ScaleTests.cs deleted file mode 100644 index 975749b138a..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Scale/ScaleTests.cs +++ /dev/null @@ -1,8 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Test.WinForms.WebView.FunctionalTests.Scale -{ - //TODO: Scale tests -} diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/ScriptNotify/ScriptNotifyOnNavigate.cs b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/ScriptNotify/ScriptNotifyOnNavigate.cs deleted file mode 100644 index 2b6d72d55a4..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/ScriptNotify/ScriptNotifyOnNavigate.cs +++ /dev/null @@ -1,55 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using Microsoft.Toolkit.Win32.UI.Controls.Test.WebView.Shared; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Should; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Test.WinForms.WebView.FunctionalTests.ScriptNotify -{ - [TestClass] - public class ScriptNotifyOnNavigate : HostFormWebViewContextSpecification - { - private string _parameter; - private string _content; - private bool _scriptNotifyCalled; - - protected override void Given() - { - _parameter = "2"; - _content = $"(()=> {{ window.external.notify('{_parameter}');}})()"; - - base.Given(); - WebView.IsScriptNotifyAllowed = true; - WebView.IsJavaScriptEnabled = true; - - // This runs after Navigate - WebView.NavigationCompleted += (o, e) => - { - // Set up the event handler - WebView.ScriptNotify += (c, a) => - { - _scriptNotifyCalled = true; - a.Value.ShouldEqual(_parameter, "ScriptNotify received, but with different argument."); - Form.Close(); - }; - - // Inject the script - WebView.InvokeScriptAsync("eval", _content); - }; - } - - protected override void When() - { - NavigateAndWaitForFormClose(TestConstants.Uris.ExampleCom); - } - - [TestMethod] - [Timeout(TestConstants.Timeouts.Longest)] - public void ScriptNotifyRaised() - { - _scriptNotifyCalled.ShouldBeTrue(); - } - } -} diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/ScriptNotify/ScriptNotifyOnNavigateToString.cs b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/ScriptNotify/ScriptNotifyOnNavigateToString.cs deleted file mode 100644 index e3ff62920d9..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/ScriptNotify/ScriptNotifyOnNavigateToString.cs +++ /dev/null @@ -1,52 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using Microsoft.Toolkit.Win32.UI.Controls.Test.WebView.Shared; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Should; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Test.WinForms.WebView.FunctionalTests.ScriptNotify -{ - [TestClass] - [TestCategory(TestConstants.Categories.Nav)] - public class ScriptNotifyOnNavigateToString : HostFormWebViewContextSpecification - { - private string _content; - private bool _scriptNotifyCalled; - - protected override void Given() - { - _content = @" - - - - -"; - - base.Given(); - WebView.IsScriptNotifyAllowed = true; - WebView.IsJavaScriptEnabled = true; - - WebView.ScriptNotify += (c, a) => - { - _scriptNotifyCalled = true; - a.Value.ShouldEqual("Hello World!", "ScriptNotify received, but with different argument."); - Form.Close(); - }; - } - - protected override void When() - { - NavigateToStringAndWaitForFormClose(_content); - } - - [TestMethod] - [Timeout(TestConstants.Timeouts.Longest)] - - public void ScriptNotifyRaised() - { - _scriptNotifyCalled.ShouldBeTrue(); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Termination/TerminationTests.cs b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Termination/TerminationTests.cs deleted file mode 100644 index d5eaaf99195..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/Termination/TerminationTests.cs +++ /dev/null @@ -1,68 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using Microsoft.Toolkit.Win32.UI.Controls.Test.WebView.Shared; -using Microsoft.VisualStudio.TestTools.UnitTesting; - -using Should; - -using System.ComponentModel; -using System.Threading; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Test.WinForms.WebView.FunctionalTests.Termination -{ - [TestClass] - public class TerminationTests : BlockTestStartEndContextSpecification - { - private bool _processExitedEventFired; - private ManualResetEvent _mre; - - protected override void Given() - { - // Perform check to see if we can run before we get too far - Assert.That.OSBuildShouldBeAtLeast(TestConstants.Windows10Builds.InsiderFast17650); - - base.Given(); - - _mre = new ManualResetEvent(false); - } - - protected override void CreateWebView() - { - WebView = new Forms.UI.Controls.WebView(); - ((ISupportInitialize)WebView).BeginInit(); - ((ISupportInitialize)WebView).EndInit(); - - WebView.ShouldNotBeNull(); - WebView.Process.ShouldNotBeNull(); - WebView.Process.ProcessId.ShouldNotEqual(0U); - - WebView.Process.ProcessExited += (o, e) => - { - _processExitedEventFired = true; - _mre.Set(); - }; - } - - protected override void When() - { - WebView.Process.Terminate(); - } - - [TestMethod] - [Timeout(TestConstants.Timeouts.Longest)] - public void TheTerminatedProcessShouldNoLongerHaveAProcessId() - { - WebView.Process.ProcessId.ShouldEqual(0U); - } - - [TestMethod] - [Timeout(TestConstants.Timeouts.Longest)] - public void TheProcessExitedEventWasRaised() - { - _mre.WaitOne(TestConstants.Timeouts.Short); - _processExitedEventFired.ShouldBeTrue(); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/TestHostForm.cs b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/TestHostForm.cs deleted file mode 100644 index 68f8fc8bc5f..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/TestHostForm.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Windows.Forms; -using WindowsInput; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Test.WinForms.WebView.FunctionalTests -{ - public class TestHostForm : Form - { - public InputSimulator InputSimulator { get; } - - public TestHostForm() - { - InputSimulator = new InputSimulator(); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/UnsupportedUriScheme/UnsupportedUriSchemeTests.cs b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/UnsupportedUriScheme/UnsupportedUriSchemeTests.cs deleted file mode 100644 index 7b37d5e4e82..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/UnsupportedUriScheme/UnsupportedUriSchemeTests.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -//namespace Microsoft.Windows10.Forms.Controls.FunctionalTests.UnsupportedUriScheme -//{ -// [TestClass] -// public class UnsupportedUriSchemeTests : HostFormWebViewContextSpecification -// { -// private bool _eventFired; - -// protected override void Given() -// { -// base.Given(); - -// WebView.UnsupportedUriSchemeIdentified += (o, e) => -// { -// WriteLine($"UnsupportedUriSchemeIdentified: Uri: {e.Uri}, Handled: {e.Handled}"); -// _eventFired = true; -// Form.Close(); -// }; -// } - -// protected override void When() -// { -// // Protocol exists as part of RFC6733 -// var uri = new UriBuilder("aaa", "localhost", 1813, ";transport=tcp").Uri; -// WriteLine(uri.ToString()); -// NavigateAndWaitForFormClose(uri); -// } - -// [TestMethod] -// [Timeout(Constants.Timeouts.Medium)] -// [Ignore("E_ABORT (0x80004004) is raised when an unhandled protocol is received")] -// public void UnsupportedUriSchemeEventFiredForAAA() -// { -// _eventFired.ShouldBeTrue(); -// } -// } -//} diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/WebResourceRequested/WebResourceRequestedTests.cs b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/WebResourceRequested/WebResourceRequestedTests.cs deleted file mode 100644 index 2aba2fd6293..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/WebResourceRequested/WebResourceRequestedTests.cs +++ /dev/null @@ -1,71 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -//namespace Microsoft.Windows10.Forms.Controls.FunctionalTests.WebResourceRequested -//{ -// [TestClass] -// public class WebResourceRequested : HostFormWebViewContextSpecification -// { -// private Uri _initialUri; -// private Uri _subResourceUri; -// private bool _setEvent; - -// protected override void Given() -// { -// _initialUri = TestConstants.Uris.ExampleCom; -// _subResourceUri = new Uri(TestConstants.Uris.ExampleCom, "foo.js"); - -// base.Given(); - -// WebView.WebResourceRequested += (o, e) => -// { -// WriteLine($"Request received for {e.Request.RequestUri}"); - -// var requestMessage = e.Request; -// var deferral = e.GetDeferral(); -// var responseMessage = new HttpResponseMessage(HttpStatusCode.Ok); -// var isInitialUri = HttpRequestUriEqualityComparer.Default.Equals(_initialUri, requestMessage.RequestUri); -// var isSubResourceUri = HttpRequestUriEqualityComparer.Default.Equals(_subResourceUri, requestMessage.RequestUri); - -// WriteLine($"IsInitialUri: {isInitialUri}"); -// WriteLine($"IsSubResourceUri: {isSubResourceUri}"); - -// // Verify Uri is expected -// if (isInitialUri) -// { -// responseMessage.Content = new HttpStringContent("Redirected response"); -// } -// else if (isSubResourceUri) -// { -// responseMessage.Content = new HttpStringContent(""); - -// // Only set the event once we've received notification of this resource request. -// // This validates that our initial response was actually used by the WebView control -// _setEvent = true; -// Form.Close(); -// } -// else -// { -// Assert.Fail("RequestUri did not match any of the expected values."); -// } - -// e.Response = responseMessage; -// deferral.Complete(); - -// }; -// } - -// protected override void When() -// { -// NavigateAndWaitForFormClose(_initialUri); -// } - -// [TestMethod] -// [Timeout(TestConstants.Timeouts.Longest)] -// public void ARedirectedResourceIsUsedByWebView() -// { -// _setEvent.ShouldBeTrue(); -// } -// } -//} diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/WebViewContextSpecification.cs b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/WebViewContextSpecification.cs deleted file mode 100644 index 38d726d1546..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/WebViewContextSpecification.cs +++ /dev/null @@ -1,188 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Windows.Forms; -using Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT; -using Microsoft.Toolkit.Win32.UI.Controls.Test.WebView.Shared; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Should; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Test.WinForms.WebView.FunctionalTests -{ - [DebuggerStepThrough] - [TestCategory(TestConstants.Categories.Wf)] - public abstract class WebViewContextSpecification : ContextSpecification - { - private static readonly Dictionary TestPids = new Dictionary(); - - internal static string GetTestNameForProcessId(uint pid) - { - TestPids.TryGetValue(pid, out string test); - return test; - } - - private static bool _alreadyInBlock = false; - protected Forms.UI.Controls.WebView WebView { get; set; } - - protected override void Cleanup() - { - PrintStartEnd( - TestContext.TestName, - nameof(Cleanup), - () => - { - UnsubscribeWebViewEvents(); - TryAction(() => - { - if (WebView != null && !WebView.IsDisposed) - { - WriteLine("WebView is not null and has not been disposed. Calling Dispose()"); - WebView.Dispose(); - WebView = null; - } - }); - }); - - base.Cleanup(); - } - - protected abstract void CreateWebView(); - - protected override void Given() - { - if (!Forms.UI.Controls.WebView.IsSupported) - { - // Test cannot execute because we're on the wrong OS - Assert.Inconclusive(DesignerUI.E_NOTSUPPORTED_OS_RS4); - } - - CreateWebView(); - WebView.ShouldNotBeNull(); - WriteLine($"Created WebView: {WebView.Version}"); - WireUpDiagnosticWebViewEvents(); - base.Given(); - } - protected void PrintStartEnd(string className, string methodName, Action a) - { - try - { - if (!_alreadyInBlock) - { - WriteLine($"\r\n=== Starting {className}.{methodName} ==="); - _alreadyInBlock = true; - } - - a(); - } - finally - { - if (_alreadyInBlock) - { - WriteLine($"=== Ending {className}.{methodName} ===\r\n"); - _alreadyInBlock = false; - } - } - } - - protected void TryAction(Action a) - { - try - { - a(); - } - catch (Exception e) - { - if (e.IsSecurityOrCriticalException()) throw; - } - } - - protected void UnsubscribeWebViewEvents() - { - if (WebView == null) return; - - WebView.NavigationStarting -= OnNavigationStarting; - WebView.ContentLoading -= OnContentLoading; - WebView.DOMContentLoaded -= OnDomContentLoaded; - WebView.NavigationCompleted -= OnNavigationCompleted; - - WebView.Disposed -= OnDisposed; - WebView.GotFocus -= OnGotFocus; - WebView.LostFocus -= OnLostFocus; - - if (WebView.Process != null) - { - WebView.Process.ProcessExited -= OnWebViewProcessExited; - } - } - - protected void WireUpDiagnosticWebViewEvents() - { - if (WebView == null) return; - - WebView.NavigationStarting += OnNavigationStarting; - WebView.ContentLoading += OnContentLoading; - WebView.DOMContentLoaded += OnDomContentLoaded; - WebView.NavigationCompleted += OnNavigationCompleted; - - WebView.Disposed += OnDisposed; - WebView.GotFocus += OnGotFocus; - WebView.LostFocus += OnLostFocus; - - if (WebView.Process != null) - { - WebView.Process.ProcessExited += OnWebViewProcessExited; - - // NOTE: There are two PIDs we really care about. One for WWAHost.exe and one for the sandbox Win32WebViewHost.exe - // The following is only for WWAHost.exe - WriteLine($"{nameof(WebView)} created with PID {WebView.Process.ProcessId}\r\n"); - TestPids[WebView.Process.ProcessId] = TestContext.TestName; - } - } - - private void OnLostFocus(object sender, EventArgs e) - { - WriteLine($"{WebView.GetType().Name}.{nameof(WebView.LostFocus)}"); - } - - private void OnGotFocus(object sender, EventArgs e) - { - WriteLine($"{WebView.GetType().Name}.{nameof(WebView.GotFocus)}"); - } - - private void OnDisposed(object sender, EventArgs e) - { - WriteLine($"{WebView.GetType().Name}.{nameof(WebView.Disposed)}"); - } - - private void OnContentLoading(object o, WebViewControlContentLoadingEventArgs a) - { - WriteLine($"{WebView.GetType().Name}.{nameof(WebView.ContentLoading)}: {a.Uri?.ToString() ?? string.Empty}"); - Application.DoEvents(); - } - - private void OnDomContentLoaded(object o, WebViewControlDOMContentLoadedEventArgs a) - { - WriteLine($"{WebView.GetType().Name}.{nameof(WebView.DOMContentLoaded)}: {a.Uri?.ToString() ?? string.Empty}"); - Application.DoEvents(); - } - - private void OnNavigationCompleted(object o, WebViewControlNavigationCompletedEventArgs a) - { - WriteLine($"{WebView.GetType().Name}.{nameof(WebView.NavigationCompleted)}: Uri: {a.Uri?.ToString() ?? string.Empty}, Success: {a.IsSuccess}, Error: {a.WebErrorStatus}"); - Application.DoEvents(); - } - private void OnNavigationStarting(object o, WebViewControlNavigationStartingEventArgs a) - { - WriteLine($"{WebView.GetType().Name}.{nameof(WebView.NavigationStarting)}: {a.Uri?.ToString() ?? string.Empty}"); - Application.DoEvents(); - } - private void OnWebViewProcessExited(object o, object e) - { - WriteLine($"{nameof(WebView)} {nameof(WebViewControlProcess.ProcessExited)}!"); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/WebViewFormContextSpecification.cs b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/WebViewFormContextSpecification.cs deleted file mode 100644 index 7db9e274526..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/FunctionalTests/WebViewFormContextSpecification.cs +++ /dev/null @@ -1,173 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Net.Http; -using System.Text; -using System.Windows.Forms; -using Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT; -using Should; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Test.WinForms.WebView.FunctionalTests -{ - [DebuggerStepThrough] - public abstract class WebViewFormContextSpecification : BlockTestStartEndContextSpecification - { - protected WebViewFormContextSpecification() - { - Form = new TestHostForm() - { - Width = 1000, - Height = 800 - }; - - Form.MouseEnter += (o, e) => { WriteLine($"Form.MouseEnter"); }; - Form.MouseWheel += (o, e) => { WriteLine($"Form.MouseWheel: {e.Location}"); }; - Form.GotFocus += (o, e) => { WriteLine("Form.GotFocus"); }; - Form.LostFocus += (o, e) => { WriteLine("Form.LostFocus"); }; - Form.KeyPress += (o, e) => { WriteLine($"Form.KeyPress: {e.KeyChar}"); }; - Form.Closing += (o, e) => { WriteLine("Form.Closing"); }; - Form.Closed += (o, e) => { WriteLine("Form.Closed"); }; - } - - protected TestHostForm Form { get; private set; } - - protected override void Cleanup() - { - PrintStartEnd( - TestContext.TestName, - nameof(Cleanup), - () => - { - try - { - if (!Form.IsDisposed) - { - // The Form is supposed to be closed when the test is completed (to signal it is done) - // If it has not been closed and disposed, go ahead and do that so we can unhook - - WriteLine("Closing the form instance..."); - - // Restore foreground to the window before ending the test - Form.BringToFront(); - - Form.Close(); - Form.Dispose(); - } - } - finally - { - base.Cleanup(); - } - }); - } - - protected override void Given() - { - Form.Text = TestContext.TestName; - - base.Given(); - - WebView.ShouldNotBeNull(); - - WebView.NavigationStarting += (o, e) => { Form.Text = $"{TestContext.TestName}: {e.Uri}" ?? string.Empty; }; - WebView.NavigationCompleted += (o, e) => - { - var focused = WebView.Focus(); - WriteLine($"WebView.Focused: {focused}"); - Application.DoEvents(); - }; - } - - protected virtual void NavigateAndWaitForFormClose(Uri uri) - { - PerformActionAndWaitForFormClose(() => - { - WriteLine($"Navigating WebView with URI: {uri}"); - WebView.Navigate(uri); - }); - } - - protected virtual void NavigateAndWaitForFormClose( - Uri requestUri, - HttpMethod httpMethod, - string content = null, - IEnumerable> headers = null) - { - PerformActionAndWaitForFormClose(() => - { - string Convert(IEnumerable> kvp) - { - if (kvp == null) - { - kvp = Enumerable.Empty>(); - } - - var sb = new StringBuilder(); - foreach (var k in kvp) - { - sb.AppendLine($"\r\n {k.Key}={k.Value}"); - } - - return sb.ToString(); - } - - WriteLine( -@"Navigating WebView with - URI: {0} - METHOD: {1} - CONTENT: {2} - HEADERS: {3}", - requestUri, httpMethod, content??string.Empty, Convert(headers)); - WebView.Navigate(requestUri, httpMethod, content, headers); - }); - } - - protected virtual void PerformActionAndWaitForFormClose(Action action) - { - void OnFormLoad(object sender, EventArgs e) - { - Application.DoEvents(); - action(); - } - - WebView.ShouldNotBeNull(); - Form.Load += OnFormLoad; - Application.Run(Form); - } - - protected virtual void NavigateToStringAndWaitForFormClose(string content) - { - PerformActionAndWaitForFormClose(() => - { - WriteLine("Navigating WebView with content:"); - WriteLine(content); - WebView.NavigateToString(content); - }); - } - - protected virtual void NavigateToLocalAndWaitForFormClose(string relativePath) - { - PerformActionAndWaitForFormClose(() => - { - WriteLine("Navigating WebView:"); -#pragma warning disable 618 - WebView.NavigateToLocal(relativePath); -#pragma warning restore 618 - }); - } - - protected virtual void NavigateToLocalAndWaitForFormClose(Uri relativePath, IUriToStreamResolver streamResolver) - { - PerformActionAndWaitForFormClose(() => - { - WriteLine("Navigating WebView"); - WebView.NavigateToLocalStreamUri(relativePath, streamResolver); - }); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/UnitTest1.cs b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/UnitTest1.cs deleted file mode 100644 index 36238642943..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/UnitTest1.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using Microsoft.VisualStudio.TestTools.UnitTesting; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Test.WinForms.WebView -{ - [TestClass] - public class UnitTest1 - { - [TestMethod] - public void TestMethod1() - { - } - } -} diff --git a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/UnitTests.WebView.WinForms.csproj b/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/UnitTests.WebView.WinForms.csproj deleted file mode 100644 index d7c45574491..00000000000 --- a/Microsoft.Toolkit.Win32/Tests/UnitTests.WebView.WinForms/UnitTests.WebView.WinForms.csproj +++ /dev/null @@ -1,89 +0,0 @@ - - - net462 - Microsoft.Toolkit.Win32.UI.Controls.Test.WinForms.WebView - Microsoft.Toolkit.Win32.UI.Controls.Test.WinForms.WebView - UnitTests.WebView.WinForms - UnitTests.WebView.WinForms - Debug - AnyCPU - {10129749-7761-49B8-96B9-94BC833BA60B} - Library - Properties - Microsoft.Toolkit.Win32.UI.Controls.Test.WinForms.WebView - Microsoft.Toolkit.Win32.UI.Controls.Test.WinForms.WebView - v4.6.2 - {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages - False - UnitTest - true - - - false - - 10.0.17134.0 - - - true - bin\Release\ - AnyCPU - TRACE - Off - prompt - full - - - TRACE;DEBUG - Off - bin\Debug\ - prompt - full - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Form - - - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/WebView.Shared/ClientUtilities.cs b/Microsoft.Toolkit.Win32/WebView.Shared/ClientUtilities.cs deleted file mode 100644 index f2c5fcfd822..00000000000 --- a/Microsoft.Toolkit.Win32/WebView.Shared/ClientUtilities.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Security; -using System.Threading; - -namespace Microsoft.Toolkit.Win32.UI.Controls -{ - internal static class ClientUtilities - { - internal static bool IsCriticalException(this Exception ex) - { - return ex is NullReferenceException - || ex is StackOverflowException - || ex is OutOfMemoryException - || ex is ThreadAbortException - || ex is IndexOutOfRangeException - || ex is AccessViolationException; - } - - internal static bool IsSecurityOrCriticalException(this Exception exception) - { - return exception is SecurityException || IsCriticalException(exception); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/WebView.Shared/Constants.cs b/Microsoft.Toolkit.Win32/WebView.Shared/Constants.cs deleted file mode 100644 index c7a680a4194..00000000000 --- a/Microsoft.Toolkit.Win32/WebView.Shared/Constants.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls -{ - internal static class Constants - { - internal const string CategoryAction = "CatAction"; - internal const string CategoryBehavior = "CatBehavior"; - internal const string ComponentDefaultProperty = "Source"; - internal const string ComponentDefaultEvent = "DOMContentLoaded"; - internal const string DescriptionEnterpriseId = "WebViewEnterpriseIdDesc"; - internal const string DescriptionSource = "WebViewSourceDesc"; - - internal const string DescriptionWebViewContainsFullScreenElement = - "WebViewContainsFullScreenElementChangedDesc"; - - internal const string DescriptionWebViewContentLoading = "WebViewContentLoadingDesc"; - internal const string DescriptionWebViewDomContentLoaded = "WebViewDomContentLoadedDesc"; - internal const string DescriptionWebViewFrameContentLoading = "WebViewFrameContentLoadingDesc"; - internal const string DescriptionWebViewFrameDomContentLoaded = "WebViewFrameDomContentLoadedDesc"; - internal const string DescriptionWebViewFrameNavigationCompleted = "WebViewFrameNavigationCompletedDesc"; - internal const string DescriptionWebViewFrameNavigationStarting = "WebViewFrameNavigationStartingDesc"; - internal const string DescriptionWebViewLongRunningScriptDetected = "WebViewLongRunningScriptDetectedDesc"; - internal const string DescriptionWebViewMoveFocusRequested = "WebViewMoveFocusRequestedDesc"; - internal const string DescriptionWebViewNavigationCompleted = "WebViewNavigationCompletedDesc"; - internal const string DescriptionWebViewNavigationStarting = "WebViewNavigationStartingDesc"; - internal const string DescriptionWebViewNewWindowRequested = "WebViewNewWindowRequestedDesc"; - internal const string DescriptionWebViewPermissionRequested = "WebViewPermissionRequestedDesc"; - internal const string DescriptionWebViewScriptNotify = "WebViewScriptNotifyDesc"; - internal const string DescriptionWebViewUnsafeContentWarningDisplaying = "WebViewUnsafeContentWarningDisplayingDesc"; - internal const string DescriptionWebViewUnsupportedUriSchemeIdentified = "WebViewUnsupportedUriSchemeIdentifiedDesc"; - internal const string DescriptionWebViewUnviewableContentIdentified = "WebViewUnviewableContentIdentifiedDesc"; - internal const string DescriptionWebViewWebResourceRequested = "WebViewWebResourceRequestedDesc"; - internal const string InitImmutable = "InvalidOp_Immutable"; - internal const string SecurityPermissionSetName = "FullTrust"; - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/WebView.Shared/DesignerUI.Designer.cs b/Microsoft.Toolkit.Win32/WebView.Shared/DesignerUI.Designer.cs deleted file mode 100644 index 56a0108ea0e..00000000000 --- a/Microsoft.Toolkit.Win32/WebView.Shared/DesignerUI.Designer.cs +++ /dev/null @@ -1,468 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Microsoft.Toolkit.Win32.UI.Controls { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class DesignerUI { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal DesignerUI() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.Toolkit.Win32.UI.Controls.DesignerUI", typeof(DesignerUI).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized string similar to Accessibility. - /// - internal static string CatAccessibility { - get { - return ResourceManager.GetString("CatAccessibility", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Action. - /// - internal static string CatAction { - get { - return ResourceManager.GetString("CatAction", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Appearance. - /// - internal static string CatAppearance { - get { - return ResourceManager.GetString("CatAppearance", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Behavior. - /// - internal static string CatBehavior { - get { - return ResourceManager.GetString("CatBehavior", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Data. - /// - internal static string CatData { - get { - return ResourceManager.GetString("CatData", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Display. - /// - internal static string CatDisplay { - get { - return ResourceManager.GetString("CatDisplay", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Drag Drop. - /// - internal static string CatDragDrop { - get { - return ResourceManager.GetString("CatDragDrop", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Focus. - /// - internal static string CatFocus { - get { - return ResourceManager.GetString("CatFocus", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Items. - /// - internal static string CatItems { - get { - return ResourceManager.GetString("CatItems", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Layout. - /// - internal static string CatLayout { - get { - return ResourceManager.GetString("CatLayout", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Settings. - /// - internal static string CatSettings { - get { - return ResourceManager.GetString("CatSettings", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The code in your application is attempting to set a property of the WebView control that is read-only because the control has already begun initializing. Your code can modify this property before it calls the ISupportInitialize.BeginInit method, but not after.. - /// - internal static string E_CANNOT_CHANGE_AFTER_INIT { - get { - return ResourceManager.GetString("E_CANNOT_CHANGE_AFTER_INIT", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Unable to initialize a WebView control in a ClickOnce application. See Release notes: https://go.microsoft.com/fwlink/?linkid=872619. - /// - internal static string E_CLICKONCE_PARTIAL_TRUST { - get { - return ResourceManager.GetString("E_CLICKONCE_PARTIAL_TRUST", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Unable to initialize the WebView control because the system is running a version of Windows that doesn’t support this control. The WebView control runs only on Windows 10 April 2018 Update or later.. - /// - internal static string E_NOTSUPPORTED_OS_RS4 { - get { - return ResourceManager.GetString("E_NOTSUPPORTED_OS_RS4", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The system is running a version of Windows that doesn't support this control.. - /// - internal static string E_UNRECOGNIZED_OS { - get { - return ResourceManager.GetString("E_UNRECOGNIZED_OS", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Unable to initialize the WebView control because the Microsoft Edge web browser has been disabled by the group or location admin policy of your system.. - /// - internal static string E_WEB_BROWSER_DISABLED { - get { - return ResourceManager.GetString("E_WEB_BROWSER_DISABLED", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Unable to initialize a WebView control in a ClickOnce application or from an application that is opened in certain types of Web browsers. See Release notes: https://go.microsoft.com/fwlink/?linkid=872619. - /// - internal static string E_WEB_PERMISSION_RESTRICTED { - get { - return ResourceManager.GetString("E_WEB_PERMISSION_RESTRICTED", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The code in your application is attempting to initialize a WebView control that is already initialized.. - /// - internal static string E_WEBVIEW_ALREADY_INITIALIZED { - get { - return ResourceManager.GetString("E_WEBVIEW_ALREADY_INITIALIZED", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The code in your application is attempting to initialize a WebView control that is already in the process of being initialized by a previous call to the ISupportInitialize.BeginInit() method.. - /// - internal static string E_WEBVIEW_ALREADY_INITIALIZING { - get { - return ResourceManager.GetString("E_WEBVIEW_ALREADY_INITIALIZING", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The code in your application is attempting to use a member of the WebView control before the control is completely initialized.. - /// - internal static string E_WEBVIEW_CANNOT_INVOKE_BEFORE_INIT { - get { - return ResourceManager.GetString("E_WEBVIEW_CANNOT_INVOKE_BEFORE_INIT", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The code in your application sets the Source property or calls the Navigate method by using an invalid URI.. - /// - internal static string E_WEBVIEW_INVALID_URI { - get { - return ResourceManager.GetString("E_WEBVIEW_INVALID_URI", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The code in your application sets the Source property or calls the Navigate method by using a URI that doesn’t have the format of an absolute URI.. - /// - internal static string E_WEBVIEW_NOT_ABSOLUTE_URI { - get { - return ResourceManager.GetString("E_WEBVIEW_NOT_ABSOLUTE_URI", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The WebView control is not initialized.. - /// - internal static string E_WEBVIEW_NOT_INITIALIZED { - get { - return ResourceManager.GetString("E_WEBVIEW_NOT_INITIALIZED", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Unable to initialize the WebView control because the code in your application calls the IsSupportInitialize.EndInit() method without first calling the ISupportInitialize.BeginInit() method. - /// - internal static string E_WEBVIEW_NOT_INITIALIZING { - get { - return ResourceManager.GetString("E_WEBVIEW_NOT_INITIALIZING", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Occurs when the status of WebView contains a full screen element.. - /// - internal static string WebViewContainsFullScreenElementChangedDesc { - get { - return ResourceManager.GetString("WebViewContainsFullScreenElementChangedDesc", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Occurs when WebView started loading new content.. - /// - internal static string WebViewContentLoadingDesc { - get { - return ResourceManager.GetString("WebViewContentLoadingDesc", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Embeds a view into your application that renders web content using the Microsoft Edge rendering engine.. - /// - internal static string WebViewDesc { - get { - return ResourceManager.GetString("WebViewDesc", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Occurs when WebView finished parsing the current content.. - /// - internal static string WebViewDomContentLoadedDesc { - get { - return ResourceManager.GetString("WebViewDomContentLoadedDesc", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Gets or sets the enterprise ID of this process.. - /// - internal static string WebViewEnterpriseIdDesc { - get { - return ResourceManager.GetString("WebViewEnterpriseIdDesc", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Occurs when a frame in WebView has started loading new content.. - /// - internal static string WebViewFrameContentLoadingDesc { - get { - return ResourceManager.GetString("WebViewFrameContentLoadingDesc", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Occurs when a frame in WebView finished parsing the current content.. - /// - internal static string WebViewFrameDomContentLoadedDesc { - get { - return ResourceManager.GetString("WebViewFrameDomContentLoadedDesc", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Occurs when a frame in WebView finished navigating to new content.. - /// - internal static string WebViewFrameNavigationCompletedDesc { - get { - return ResourceManager.GetString("WebViewFrameNavigationCompletedDesc", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Occurs before a frame in WebView navigates to new content.. - /// - internal static string WebViewFrameNavigationStartingDesc { - get { - return ResourceManager.GetString("WebViewFrameNavigationStartingDesc", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Occurs periodically while WebView executes JavaScript, letting you halt the script.. - /// - internal static string WebViewLongRunningScriptDetectedDesc { - get { - return ResourceManager.GetString("WebViewLongRunningScriptDetectedDesc", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Occurs when a focus move is requested.. - /// - internal static string WebViewMoveFocusRequestedDesc { - get { - return ResourceManager.GetString("WebViewMoveFocusRequestedDesc", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Occurs when WebView finished navigating to new content.. - /// - internal static string WebViewNavigationCompletedDesc { - get { - return ResourceManager.GetString("WebViewNavigationCompletedDesc", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Occurs before WebView navigates to new content.. - /// - internal static string WebViewNavigationStartingDesc { - get { - return ResourceManager.GetString("WebViewNavigationStartingDesc", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Occurs when an action is performed that causes content to be opened in a new window.. - /// - internal static string WebViewNewWindowRequestedDesc { - get { - return ResourceManager.GetString("WebViewNewWindowRequestedDesc", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Occurs when WebView requires a permission.. - /// - internal static string WebViewPermissionRequestedDesc { - get { - return ResourceManager.GetString("WebViewPermissionRequestedDesc", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Occurs when content in WebView passes a string from JavaScript.. - /// - internal static string WebViewScriptNotifyDesc { - get { - return ResourceManager.GetString("WebViewScriptNotifyDesc", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Gets or sets the Uniform Resource Identifier (URI) source of the content to display.. - /// - internal static string WebViewSourceDesc { - get { - return ResourceManager.GetString("WebViewSourceDesc", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Occurs when WebView shows a warning page for content that was reported as unsafe by SmartScreen filter.. - /// - internal static string WebViewUnsafeContentWarningDisplayingDesc { - get { - return ResourceManager.GetString("WebViewUnsafeContentWarningDisplayingDesc", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Occurs when an attempt is made to navigate to a Source using a scheme that WebView does not support.. - /// - internal static string WebViewUnsupportedUriSchemeIdentifiedDesc { - get { - return ResourceManager.GetString("WebViewUnsupportedUriSchemeIdentifiedDesc", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Occurs when WebView attempts to download an unsupported file.. - /// - internal static string WebViewUnviewableContentIdentifiedDesc { - get { - return ResourceManager.GetString("WebViewUnviewableContentIdentifiedDesc", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Occurs when WebView requests a HTTP resource.. - /// - internal static string WebViewWebResourceRequestedDesc { - get { - return ResourceManager.GetString("WebViewWebResourceRequestedDesc", resourceCulture); - } - } - } -} diff --git a/Microsoft.Toolkit.Win32/WebView.Shared/DesignerUI.resx b/Microsoft.Toolkit.Win32/WebView.Shared/DesignerUI.resx deleted file mode 100644 index a70787ba42d..00000000000 --- a/Microsoft.Toolkit.Win32/WebView.Shared/DesignerUI.resx +++ /dev/null @@ -1,268 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Accessibility - - - Action - - - Appearance - - - Behavior - - - Data - - - Display - - - Drag Drop - - - Focus - - - Items - - - Layout - - - Settings - - - The code in your application is attempting to set a property of the WebView control that is read-only because the control has already begun initializing. Your code can modify this property before it calls the ISupportInitialize.BeginInit method, but not after. - A member has been invoked after the control is already initialized - - - Unable to initialize a WebView control in a ClickOnce application. See Release notes: https://go.microsoft.com/fwlink/?linkid=872619 - ClickOnce uses AppLaunch.exe to host partial-trust applications (and we don't support partial trust) - - - Unable to initialize the WebView control because the system is running a version of Windows that doesn’t support this control. The WebView control runs only on Windows 10 April 2018 Update or later. - WebView requires RS4 or later - - - The system is running a version of Windows that doesn't support this control. - OS version check received an OS combination it did not understand - - - The code in your application is attempting to initialize a WebView control that is already initialized. - Caller attempted to call BeginInit after calling EndInit - - - The code in your application is attempting to initialize a WebView control that is already in the process of being initialized by a previous call to the ISupportInitialize.BeginInit() method. - Caller attempted to call BeginInit after calling BeginInit - - - The code in your application is attempting to use a member of the WebView control before the control is completely initialized. - A WebView member has been invoked before the control has been initialized - - - The code in your application sets the Source property or calls the Navigate method by using an invalid URI. - Navigate called with a value that cannot be converted to Uri - - - The code in your application sets the Source property or calls the Navigate method by using a URI that doesn’t have the format of an absolute URI. - Source property or Navigate target invoked with a value that is not a proper absolute Uri - - - The WebView control is not initialized. - - - Unable to initialize the WebView control because the code in your application calls the IsSupportInitialize.EndInit() method without first calling the ISupportInitialize.BeginInit() method - Caller attempted to finalize initialization of the control with EndInit with out requesting it be initialized with BeginInit - - - Unable to initialize the WebView control because the Microsoft Edge web browser has been disabled by the group or location admin policy of your system. - Browser disabled by admin local or group policy object - - - Unable to initialize a WebView control in a ClickOnce application or from an application that is opened in certain types of Web browsers. See Release notes: https://go.microsoft.com/fwlink/?linkid=872619 - Could be hosted in browser, as an internet zone XBAP, or standalone ClickOnce - - - Occurs when the status of WebView contains a full screen element. - - - Occurs when WebView started loading new content. - - - Embeds a view into your application that renders web content using the Microsoft Edge rendering engine. - Used for AutoPop in toolbox - - - Occurs when WebView finished parsing the current content. - - - Gets or sets the enterprise ID of this process. - - - Occurs when a frame in WebView has started loading new content. - - - Occurs when a frame in WebView finished parsing the current content. - - - Occurs when a frame in WebView finished navigating to new content. - - - Occurs before a frame in WebView navigates to new content. - - - Occurs periodically while WebView executes JavaScript, letting you halt the script. - - - Occurs when a focus move is requested. - - - Occurs when WebView finished navigating to new content. - - - Occurs before WebView navigates to new content. - - - Occurs when an action is performed that causes content to be opened in a new window. - - - Occurs when WebView requires a permission. - - - Occurs when content in WebView passes a string from JavaScript. - - - Gets or sets the Uniform Resource Identifier (URI) source of the content to display. - - - Occurs when WebView shows a warning page for content that was reported as unsafe by SmartScreen filter. - - - Occurs when an attempt is made to navigate to a Source using a scheme that WebView does not support. - - - Occurs when WebView attempts to download an unsupported file. - - - Occurs when WebView requests a HTTP resource. - - \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/WebView.Shared/GlobalSuppressions.cs b/Microsoft.Toolkit.Win32/WebView.Shared/GlobalSuppressions.cs deleted file mode 100644 index f5a03b225ce..00000000000 --- a/Microsoft.Toolkit.Win32/WebView.Shared/GlobalSuppressions.cs +++ /dev/null @@ -1,62 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -// This file is used by Code Analysis to maintain SuppressMessage -// attributes that are applied to this project. -// Project-level suppressions either have no target or are given -// a specific target and scoped to a namespace, type, member, etc. -// -// To add a suppression to this file, right-click the message in the -// Code Analysis results, point to "Suppress Message", and click -// "In Suppression File". -// You do not need to add suppressions to this file manually. -#pragma warning disable SA1404 // Code analysis suppression must have justification -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "A", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#A")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "B", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#B")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "C", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#C")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "D", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#D")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "E", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#E")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "F", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#F")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "G", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#G")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "H", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#H")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "I", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#I")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "J", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#J")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "K", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#K")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "L", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#L")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "M", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#M")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "N", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#N")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "O", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#O")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "P", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#P")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Q", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#Q")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "R", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#R")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "S", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#S")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "T", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#T")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "U", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#U")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "V", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#V")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "W", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#W")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "X", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#X")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Y", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#Y")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Z", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#Z")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Thumbstick", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#GamepadLeftThumbstickButton")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Thumbstick", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#GamepadRightThumbstickButton")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Thumbstick", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#GamepadLeftThumbstickUp")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Thumbstick", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#GamepadLeftThumbstickDown")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Thumbstick", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#GamepadLeftThumbstickRight")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Thumbstick", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#GamepadLeftThumbstickLeft")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Thumbstick", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#GamepadRightThumbstickUp")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Thumbstick", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#GamepadRightThumbstickDown")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Thumbstick", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#GamepadRightThumbstickRight")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Thumbstick", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#GamepadRightThumbstickLeft")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Junja", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.VirtualKey.#Junja")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Geolocation", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.WebViewControlPermissionType.#Geolocation")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Unviewable", Scope = "type", Target = "Microsoft.Windows10.Web.Wrappers.WebViewControlUnviewableContentIdentifiedEventArgs")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Satisfiable", Scope = "member", Target = "Microsoft.Windows10.Web.Wrappers.WebErrorStatus.#RequestedRangeNotSatisfiable")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1307:Accessible fields must begin with upper-case letter", Scope = "member", Target = "~F:Microsoft.Toolkit.Win32.UI.Controls.Interop.Win32.RECT.bottom")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1307:Accessible fields must begin with upper-case letter", Scope = "member", Target = "~F:Microsoft.Toolkit.Win32.UI.Controls.Interop.Win32.RECT.left")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1307:Accessible fields must begin with upper-case letter", Scope = "member", Target = "~F:Microsoft.Toolkit.Win32.UI.Controls.Interop.Win32.RECT.right")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1307:Accessible fields must begin with upper-case letter", Scope = "member", Target = "~F:Microsoft.Toolkit.Win32.UI.Controls.Interop.Win32.RECT.top")] - - - -#pragma warning restore SA1404 // Code analysis suppression must have justification \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/WebView.Shared/IWebView.cs b/Microsoft.Toolkit.Win32/WebView.Shared/IWebView.cs deleted file mode 100644 index 8374ac1854a..00000000000 --- a/Microsoft.Toolkit.Win32/WebView.Shared/IWebView.cs +++ /dev/null @@ -1,411 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using System.Net.Http; -using System.Threading.Tasks; -using Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT; - -namespace Microsoft.Toolkit.Win32.UI.Controls -{ - /// - /// Provides a control that hosts HTML content in an app. - /// - /// - /// - /// Subset of functionality from - /// - public interface IWebView - { - /// - /// An event that is triggered when the accelerator key is pressed. - /// - event EventHandler AcceleratorKeyPressed; - - /// - /// Occurs when the status of whether the currently contains a full screen element or not changes. - /// - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1009:DeclareEventHandlersCorrectly", Justification = "Matches IWebViewControl interface")] - event EventHandler ContainsFullScreenElementChanged; - - /// - /// Occurs when the has started loading new content. - /// - event EventHandler ContentLoading; - - /// - /// Occurs when the finished parsing the current content. - /// - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "DOM", Justification = "Name from WinRT type")] - event EventHandler DOMContentLoaded; - - /// - /// Occurs when a frame in the has started loading new content. - /// - event EventHandler FrameContentLoading; - - /// - /// Occurs when a frame in the finished parsing its current content. - /// - event EventHandler FrameDOMContentLoaded; - - /// - /// Occurs when a frame in the finished navigating to new content. - /// - event EventHandler FrameNavigationCompleted; - - /// - /// Occurs when a frame in the navigates to new content. - /// - event EventHandler FrameNavigationStarting; - - /// - /// Occurs periodically while the executes JavaScript, letting you halt the script. - /// - /// - /// Your app might appear unresponsive while scripts are running. This event provides an opportunity to interrupt a long-running - /// script. To determine how long the script has been running, check the - /// property of the object. To halt the script, set the event args - /// property to true. The halted script will - /// not execute again unless it is reloaded during a subsequent navigation. - /// - /// - /// - /// - event EventHandler LongRunningScriptDetected; - - /// - /// Occurs when a focus move is requested. - /// - event EventHandler MoveFocusRequested; - - /// - /// Occurs when the control finished navigating to new content. - /// - event EventHandler NavigationCompleted; - - /// - /// Occurs before the navigates to new content. - /// - event EventHandler NavigationStarting; - - /// - /// Occurs when an action is performed that causes content to be opened in a new window. - /// - event EventHandler NewWindowRequested; - - /// - /// Occurs when an action in a requires that permission be granted. - /// - /// - /// The types of permission that can be requested are defined in the enumeration. - /// - /// If you don't handle the event, the denies permission by default. - /// - /// When you handle a permission request in , you get a object as - /// the value of the property. You can call Allow to grant the request, - /// Deny to deny the request, or Defer to defer the request until a later time. - /// - event EventHandler PermissionRequested; - - /// - /// Occurs when the content contained in the control passes a string to the application by using JavaScript. - /// - event EventHandler ScriptNotify; - - /// - /// Occurs when shows a warning page for content that was reported as unsafe by SmartScreen filter. - /// - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1009:DeclareEventHandlersCorrectly", Justification = "This is the declaration from WinRT")] - event EventHandler UnsafeContentWarningDisplaying; - - /// - /// Occurs when an attempt is made to navigate to a using a scheme that does not support. - /// - event EventHandler UnsupportedUriSchemeIdentified; - - /// - /// Occurs when attempts to navigate to a content type it cannot render. Like other navigation events, it is only triggered by top level navigations. - /// - /// - /// Event is triggered as soon as the content that can be identified is unsupported. For HTTP(s) content, this is right after the headers have been received. - /// - event EventHandler UnviewableContentIdentified; - - /// - /// Gets a value indicating whether there is at least one page in the backward navigation history. - /// - /// true if the can navigate backward; otherwise, false. - bool CanGoBack { get; } - - /// - /// Gets a value indicating whether there is at least one page in the forward navigation history. - /// - /// true if the can navigate forward; otherwise, false. - bool CanGoForward { get; } - - /// - /// Gets a value indicating whether contains an element that supports full screen. - /// - /// if the contains an element that supports full screen; otherwise, . - bool ContainsFullScreenElement { get; } - - /// - /// Gets the title of the page currently displayed in the . - /// - /// The page title. - string DocumentTitle { get; } - - /// - /// Gets or sets an enterprise ID for this process. - /// - /// The enterprise ID of this process. - /// Value can be set prior to the component being initialized. - /// - string EnterpriseId { get; set; } - - /// - /// Gets or sets a value indicating whether the use of IndexedDB is allowed. - /// - /// true if IndexedDB is allowed; otherwise, false. The default is true. - /// - bool IsIndexedDBEnabled { get; set; } - - /// - /// Gets or sets a value indicating whether the use of JavaScript is allowed. - /// - /// true if JavaScript is allowed in the ; otherwise, false. The default is true. - /// - bool IsJavaScriptEnabled { get; set; } - - /// - /// Gets or sets a value indicating whether the - /// - /// if this instance is private network client server capability enabled; otherwise, . - /// Value can be set prior to the component being initialized. - /// - bool IsPrivateNetworkClientServerCapabilityEnabled { get; set; } - - /// - /// Gets or sets a value indicating whether is allowed. - /// - /// Whether is allowed. - /// - bool IsScriptNotifyAllowed { get; set; } - - /// - /// Gets the that the control is hosted in. - /// - /// The that the control is hosted in. - WebViewControlProcess Process { get; } - - /// - /// Gets a object that contains properties to enable or disable features. - /// - /// A object that contains properties to enable or disable features. - /// - /// - /// - /// Use the object to enable or disable the use of JavaScript, ScriptNotify, and IndexedDB in the . - WebViewControlSettings Settings { get; } - - /// - /// Gets or sets the Uniform Resource Identifier (URI) source of the HTML content to display in the . - /// - /// - /// The Uniform Resource Identifier (URI) source of the HTML content to display in the . - /// - Uri Source { get; set; } - - /// - /// Gets the version of EDGEHTML.DLL used by . - /// - /// The version of EDGEHTML.DLL used by . - Version Version { get; } - - /// - /// Adds the script to be loaded before any others on the page. - /// - /// The script. - [Obsolete("This item has been depreciated and will be removed in a future version. Use AddInitializeScript(string script) instead.", false)] - void AddPreLoadedScript(string script); - - /// - /// Adds the script to be loaded before any others on the page. - /// - /// The script. - void AddInitializeScript(string script); - - /// - /// Closes this instance. - /// - /// Equivalent to calling . - void Close(); - - /// - /// Gets the deferred permission request with the specified . - /// - /// The of the deferred permission request. - /// The deferred permission request with the specified , or null if no permission request with the specified was found. - WebViewControlDeferredPermissionRequest GetDeferredPermissionRequestById(uint id); - - /// - /// Navigates the to the previous page in the navigation history. - /// - /// true if the navigation to the previous page in the navigation history is successful; otherwise, false. - bool GoBack(); - - /// - /// Navigates the to the next page in the navigation history. - /// - /// true if the navigation to the next page in the navigation history is successful; otherwise, false. - bool GoForward(); - - /// - /// Executes the specified script function from the currently loaded HTML, with no arguments, as a synchronous action. - /// - /// Name of the script function to invoke. - /// When this method returns, the result of the script invocation. - /// To prevent malicious code from exploiting your app, be sure to call this method to invoke only scripts that you trust. - string InvokeScript(string scriptName); - - /// - /// Executes the specified script function from the currently loaded HTML, with no arguments, as a synchronous action. - /// - /// Name of the script function to invoke. - /// A string array that packages arguments to the script function. - /// When this method returns, the result of the script invocation. - /// - /// To prevent malicious code from exploiting your app, be sure to call this method to invoke only scripts that you trust. - /// - string InvokeScript(string scriptName, params string[] arguments); - - /// - /// Executes the specified script function from the currently loaded HTML, with no arguments, as a synchronous action. - /// - /// Name of the script function to invoke. - /// A string array that packages arguments to the script function. - /// When this method returns, the result of the script invocation. - /// - /// To prevent malicious code from exploiting your app, be sure to call this method to invoke only scripts that you trust. - /// - string InvokeScript(string scriptName, IEnumerable arguments); - - /// - /// Executes the specified script function from the currently loaded HTML, with no arguments, as an asynchronous action. - /// - /// Name of the script function to invoke. - /// When this method returns, the result of the script invocation. - /// - /// To prevent malicious code from exploiting your app, be sure to call this method to invoke only scripts that you trust. - /// The invoked script can only return string values. - /// - Task InvokeScriptAsync(string scriptName); - - /// - /// Executes the specified script function from the currently loaded HTML, with no arguments, as an asynchronous action. - /// - /// Name of the script function to invoke. - /// A string array that packages arguments to the script function. - /// When this method returns, the result of the script invocation. - /// - /// To prevent malicious code from exploiting your app, be sure to call this method to invoke only scripts that you trust. - /// The invoked script can only return string values. - /// - Task InvokeScriptAsync(string scriptName, params string[] arguments); - - /// - /// Executes the specified script function from the currently loaded HTML, with no arguments, as an asynchronous action. - /// - /// Name of the script function to invoke. - /// A string array that packages arguments to the script function. - /// When this method returns, the result of the script invocation. - /// - /// To prevent malicious code from exploiting your app, be sure to call this method to invoke only scripts that you trust. - /// The invoked script can only return string values. - /// - Task InvokeScriptAsync(string scriptName, IEnumerable arguments); - - /// - /// Moves the focus. - /// - /// The reason. - void MoveFocus(WebViewControlMoveFocusReason reason); - - /// - /// Loads the HTML content at the specified Uniform Resource Identifier (URI). - /// - /// The Uniform Resource Identifier (URI) to load. - /// - /// is asynchronous. Use the event to detect when - /// navigation has completed. - void Navigate(Uri source); - - /// - /// Loads the HTML content at the specified Uniform Resource Identifier (URI). - /// - /// The Uniform Resource Identifier (URI) to load. - /// is asynchronous. Use the event to detect when - /// navigation has completed. - void Navigate(string source); - - /// - /// Navigates the web view with the URI with a HTTP request and HTTP headers. - /// - /// The Uniform Resource Identifier (URI) to send the request. - /// The HTTP method of the request. - /// Optional content to send with the request. - /// Optional headers to send with the request. - /// - /// This method only supports and for the parameter. - /// - /// - void Navigate( - Uri requestUri, - HttpMethod httpMethod, - string content = null, - IEnumerable> headers = null); - - /// - /// Loads the specified HTML content relative to the location of the current executable. - /// - /// The relative path. - /// is asynchronous. Use the event to detect when - /// navigation has completed. - void NavigateToLocal(string relativePath); - - /// - /// Loads local web content at the specified Uniform Resource Identifier (URI) using an . - /// - /// A path identifying the local HTML content to load. - /// A instance that converts a Uniform Resource Identifier (URI) into a stream to load. - void NavigateToLocalStreamUri(Uri relativePath, IUriToStreamResolver streamResolver); - - /// - /// Loads the specified HTML content as a new document. - /// - /// The HTML content to display in the . - /// - /// is asynchronous. Use the event to detect when - /// navigation has completed. - /// - /// supports content with references to external files such as CSS, scripts, images, - /// and fonts. However, it does not provide a way to generate or provide these resources programmatically. - /// - void NavigateToString(string text); - - /// - /// Reloads the current in the . - /// - /// If the current source was loaded via , this method reloads the file without forced cache validation by sending a Pragma:no-cache header to the server. - void Refresh(); - - /// - /// Halts the current navigation or download. - /// - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Stop", Justification = "Method exposed in WinRT type")] - void Stop(); - } -} diff --git a/Microsoft.Toolkit.Win32/WebView.Shared/IWebViewCompatible.cs b/Microsoft.Toolkit.Win32/WebView.Shared/IWebViewCompatible.cs deleted file mode 100644 index a704f13cf71..00000000000 --- a/Microsoft.Toolkit.Win32/WebView.Shared/IWebViewCompatible.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT; - -namespace Microsoft.Toolkit.UI.Controls -{ - public interface IWebViewCompatible - { - event EventHandler ContentLoading; - - event EventHandler NavigationCompleted; - - event EventHandler NavigationStarting; - - bool CanGoBack { get; } - - bool CanGoForward { get; } - - Uri Source { get; set; } - - bool GoBack(); - - bool GoForward(); - - string InvokeScript(string scriptName); - - void Navigate(Uri url); - - void Navigate(string url); - - void Refresh(); - - void Stop(); - } -} diff --git a/Microsoft.Toolkit.Win32/WebView.Shared/InitializationState.cs b/Microsoft.Toolkit.Win32/WebView.Shared/InitializationState.cs deleted file mode 100644 index e31142493f0..00000000000 --- a/Microsoft.Toolkit.Win32/WebView.Shared/InitializationState.cs +++ /dev/null @@ -1,35 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.ComponentModel; - -namespace Microsoft.Toolkit.Win32.UI.Controls -{ - /// - /// Initialization states of WebView object. - /// - /// - internal enum InitializationState - { - /// - /// The state in which the WebView has not been initialized. - /// At this state, all operations on the object would cause InvalidOperationException. - /// The object can only transit to 'IsInitializing' state with call. - /// - Uninitialized, - - /// - /// The state in which the WebView is being initialized. At this state, user can - /// set values into the required properties. The object can only transit to 'IsInitialized' state - /// with call. - /// - IsInitializing, - - /// - /// The state in which the WebView object is fully initialized. At this state the object - /// is fully functional. There is no valid transition out of the state. - /// - IsInitialized - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/OSVersionHelper.cs b/Microsoft.Toolkit.Win32/WebView.Shared/Interop/OSVersionHelper.cs deleted file mode 100644 index a0d39dac68d..00000000000 --- a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/OSVersionHelper.cs +++ /dev/null @@ -1,178 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.IO; -using System.Security; -using Microsoft.Toolkit.Win32.UI.Controls.Interop.Win32; -using Windows.Foundation.Metadata; -using Windows.Security.EnterpriseData; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop -{ - internal static class OSVersionHelper - { - private const string ContractName = "Windows.Foundation.UniversalApiContract"; - - [SecurityCritical] - static OSVersionHelper() - { - if (IsSince(WindowsVersions.Win10)) - { - if (IsApiContractPresent(6)) - { - Windows10Release = Windows10Release.April2018; - } - else if (IsApiContractPresent(5)) - { - Windows10Release = Windows10Release.FallCreators; - } - else if (IsApiContractPresent(4)) - { - Windows10Release = Windows10Release.Creators; - } - else if (IsApiContractPresent(3)) - { - Windows10Release = Windows10Release.Anniversary; - } - else if (IsApiContractPresent(2)) - { - Windows10Release = Windows10Release.Threshold2; - } - else if (IsApiContractPresent(1)) - { - Windows10Release = Windows10Release.Threshold1; - } - else - { - Windows10Release = Windows10Release.Unknown; - } - } - } - - internal static bool IsWindowsNt { get; } = Environment.OSVersion.Platform == PlatformID.Win32NT; - - internal static bool EdgeExists { get; } = File.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), ExternDll.EdgeHtml)); - - internal static bool IsWindows10 { get; } = IsWindowsNt && IsSince(WindowsVersions.Win10); - - /// - /// Gets a value indicating whether the current OS is Windows 10 April 2018 Update (Redstone 4) or greater - /// - internal static bool IsWindows10April2018OrGreater => IsWindows10 && Windows10Release >= Windows10Release.April2018; - - /// - /// Gets a value indicating whether the current OS is Windows 10 Fall Creators Update (Redstone 3) or greater - /// - internal static bool IsWindows10FallCreatorsOrGreater => IsWindows10 && Windows10Release >= Windows10Release.FallCreators; - - /// - /// Gets a value indicating whether the current OS is Windows 10 Creators Update (Redstone 2) or greater - /// - internal static bool IsWindows10CreatorsOrGreater => IsWindows10 && Windows10Release >= Windows10Release.Creators; - - /// - /// Gets a value indicating whether the current OS is Windows 10 Anniversary Update (Redstone 1) or greater - /// - internal static bool IsWindows10AnniversaryOrGreater => IsWindows10 && Windows10Release >= Windows10Release.Anniversary; - - /// - /// Gets a value indicating whether the current OS is Windows 10 Threshold 2 or greater - /// - internal static bool IsWindows10Threshold2OrGreater => IsWindows10 && Windows10Release >= Windows10Release.Threshold2; - - /// - /// Gets a value indicating whether the current OS is Windows 10 Threshold 1 or greater - /// - internal static bool IsWindows10Threshold1OrGreater => IsWindows10 && Windows10Release >= Windows10Release.Threshold1; - - internal static bool IsWorkstation { get; } = !IsServer(); - - internal static bool UseWindowsInformationProtectionApi - { - [SecurityCritical] - get => Windows10Release >= Windows10Release.Anniversary && ProtectionPolicyManager.IsProtectionEnabled; - } - - internal static Windows10Release Windows10Release { get; } - - /// - /// Checks if OS is Windows 10 April 2018 or later, is a workstation, and Microsoft Edge exists. - /// - /// Not running correct OS or OS Version, or Microsoft Edge does not exist. - internal static void ThrowIfBeforeWindows10April2018() - { - if (IsWindows10April2018OrGreater && IsWorkstation && EdgeExists) - { - return; - } - - throw new NotSupportedException(DesignerUI.E_NOTSUPPORTED_OS_RS4); - } - - [SecurityCritical] - private static bool IsApiContractPresent(ushort majorVersion) => ApiInformation.IsApiContractPresent(ContractName, majorVersion); - - [SecurityCritical] - private static bool IsServer() - { - var versionInfo = NativeMethods.RtlGetVersion(); - return versionInfo.ProductType == ProductType.VER_NT_DOMAIN_CONTROLLER - || versionInfo.ProductType == ProductType.VER_NT_SERVER; - } - - [SecurityCritical] - internal static bool IsSince(WindowsVersions version) - { - int major; - int minor; - - switch (version) - { - case WindowsVersions.Win7: - case WindowsVersions.Server2008R2: - major = 6; - minor = 1; - break; - - case WindowsVersions.Win8: - case WindowsVersions.Server2012: - major = 6; - minor = 2; - break; - - case WindowsVersions.Win81: - case WindowsVersions.Server2012R2: - major = 6; - minor = 3; - break; - - case WindowsVersions.Win10: - case WindowsVersions.Server2016: - major = 10; - minor = 0; - break; - - default: - throw new ArgumentException(DesignerUI.E_UNRECOGNIZED_OS, nameof(version)); - } - - // After 8.1 apps without manifest or are not manifested for 8.1/10 return 6.2 when using GetVersionEx. - // Need to use RtlGetVersion to get correct major/minor/build - var os = NativeMethods.RtlGetVersion(); - - if (os.MajorVersion > major) - { - return true; - } - - if (os.MajorVersion == major) - { - return os.MinorVersion >= minor; - } - - return false; - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/Win32/DpiHelper.cs b/Microsoft.Toolkit.Win32/WebView.Shared/Interop/Win32/DpiHelper.cs deleted file mode 100644 index ba959f6cb6e..00000000000 --- a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/Win32/DpiHelper.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using Microsoft.Toolkit.Win32.UI.Controls.Interop.Win32; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop -{ - /// - /// Class for scaling coordinates according to current DPI scaling set in Windows - /// - internal static class DpiHelper - { - // Sets DPI awareness for the process. Returns true if DPI awareness is successfully set; otherwise, false. - public static bool SetPerMonitorDpiAwareness() - { - // Only works if we're on RS2 or later and have ComCtl v6 - if (OSVersionHelper.IsWindows10CreatorsOrGreater) - { - const int rs2AndAboveDpiFlag = NativeMethods.DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2; - return NativeMethods.SetProcessDpiAwarenessContext(rs2AndAboveDpiFlag); - } - - return false; - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/GenericUriToStreamResolver.cs b/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/GenericUriToStreamResolver.cs deleted file mode 100644 index bc1589274a8..00000000000 --- a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/GenericUriToStreamResolver.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.IO; -using System.Threading.Tasks; -using Windows.Foundation; -using Windows.Storage.Streams; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// An adapter converting to . - /// - internal sealed class GenericUriToStreamResolver : Windows.Web.IUriToStreamResolver, IUriToStreamResolver - { - private readonly IUriToStreamResolver _streamResolver; - - public GenericUriToStreamResolver(IUriToStreamResolver streamResolver) - { - _streamResolver = streamResolver ?? throw new ArgumentNullException(nameof(streamResolver)); - } - - public Stream UriToStream(Uri uri) - { - return _streamResolver.UriToStream(uri); - } - - public IAsyncOperation UriToStreamAsync(Uri uri) - { - var streamOp = UriToStream(uri); - if (streamOp == null) - { - return null; - } - - return Task.FromResult(streamOp.AsInputStream()).AsAsyncOperation(); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/IUriToStreamResolver.cs b/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/IUriToStreamResolver.cs deleted file mode 100644 index 50359bff683..00000000000 --- a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/IUriToStreamResolver.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.IO; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// Provides a method to translate a Uniform Resource I (URI) to a for use by the method. - /// - /// - public interface IUriToStreamResolver - { - Stream UriToStream(Uri uri); - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebErrorStatus.cs b/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebErrorStatus.cs deleted file mode 100644 index 4737b7d85f8..00000000000 --- a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebErrorStatus.cs +++ /dev/null @@ -1,290 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// Defines errors encountered during operations involving web services, such as authentication, proxy configuration, and destination URIs. - /// - /// Copy from to avoid requirement to link Windows.winmd - /// - public enum WebErrorStatus - { - /// - /// An unknown error has occurred. - /// - Unknown = 0, - - /// - /// The SSL certificate common name does not match the web address. - /// - CertificateCommonNameIsIncorrect = 1, - - /// - /// The SSL certificate has expired. - /// - CertificateExpired = 2, - - /// - /// The SSL certificate contains errors. - /// - CertificateContainsErrors = 3, - - /// - /// The SSL certificate has been revoked. - /// - CertificateRevoked = 4, - - /// - /// The SSL certificate is invalid. - /// - CertificateIsInvalid = 5, - - /// - /// The server is not responding. - /// - ServerUnreachable = 6, - - /// - /// The connection has timed out. - /// - Timeout = 7, - - /// - /// The server returned an invalid or unrecognized response. - /// - ErrorHttpInvalidServerResponse = 8, - - /// - /// The connection was aborted. - /// - ConnectionAborted = 9, - - /// - /// The connection was reset. - /// - ConnectionReset = 10, - - /// - /// The connection was ended. - /// - Disconnected = 11, - - /// - /// Redirected from a location to a secure location. - /// - HttpToHttpsOnRedirection = 12, - - /// - /// Redirected from a secure location to an unsecure location. - /// - HttpsToHttpOnRedirection = 13, - - /// - /// Cannot connect to destination. - /// - CannotConnect = 14, - - /// - /// Could not resolve provided host name. - /// - HostNameNotResolved = 15, - - /// - /// The operation was canceled. - /// - OperationCanceled = 16, - - /// - /// The request redirect failed. - /// - RedirectFailed = 17, - - /// - /// An unexpected status code indicating a failure was received. - /// - UnexpectedStatusCode = 18, - - /// - /// A request was unexpectedly redirected. - /// - UnexpectedRedirection = 19, - - /// - /// An unexpected client-side error has occurred. - /// - UnexpectedClientError = 20, - - /// - /// An unexpected server-side error has occurred. - /// - UnexpectedServerError = 21, - - /// - /// The request does not support the range. - /// - InsufficientRangeSupport = 22, - - /// - /// The request is mising the file size. - /// - MissingContentLengthSupport = 23, - - /// - /// The requested URL represents a high level grouping of which lower level selections need to be made. - /// - MultipleChoices = 300, - - /// - /// This and all future requests should be directed to the given URI. - /// - MovedPermanently = 301, - - /// - /// The resource was found but is available in a location different from the one included in the request. - /// - Found = 302, - - /// - /// The response to the request can be found under another URI using a GET method. - /// - SeeOther = 303, - - /// - /// Indicates the resource has not been modified since last requested. - /// - NotModified = 304, - - /// - /// The requested resource must be accessed through the proxy given by the Location field. - /// - UseProxy = 305, - - /// - /// The requested resource resides temporarily under a different URI. - /// - TemporaryRedirect = 307, - - /// - /// The request cannot be fulfilled due to bad syntax. - /// - BadRequest = 400, - - /// - /// Authentication has failed or credentials have not yet been provided. - /// - Unauthorized = 401, - - /// - /// Reserved. - /// - PaymentRequired = 402, - - /// - /// The server has refused the request. - /// - Forbidden = 403, - - /// - /// The requested resource could not be found but may be available again in the future. - /// - NotFound = 404, - - /// - /// A request was made of a resource using a request method not supported by that resource. - /// - MethodNotAllowed = 405, - - /// - /// The requested resource is only capable of generating content not acceptable according to the Accept headers sent in the request. - /// - NotAcceptable = 406, - - /// - /// The client must first authenticate itself with the proxy. - /// - ProxyAuthenticationRequired = 407, - - /// - /// The server timed out waiting for the request. - /// - RequestTimeout = 408, - - /// - /// Indicates that the request could not be processed because of conflict in the request. - /// - Conflict = 409, - - /// - /// Indicates that the resource requested is no longer available and will not be available again. - /// - Gone = 410, - - /// - /// The request did not specify the length of its content, which is required by the requested resource. - /// - LengthRequired = 411, - - /// - /// The server does not meet one of the preconditions that the requester put on the request. - /// - PreconditionFailed = 412, - - /// - /// The request is larger than the server is willing or able to process. - /// - RequestEntityTooLarge = 413, - - /// - /// Provided URI length exceeds the maximum length the server can process. - /// - RequestUriTooLong = 414, - - /// - /// The request entity has a media type which the server or resource does not support. - /// - UnsupportedMediaType = 415, - - /// - /// The client has asked for a portion of the file, but the server cannot supply that portion. - /// - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Satisfiable", Justification="Spelling of WinRT type")] - RequestedRangeNotSatisfiable = 416, - - /// - /// The server cannot meet the requirements of the Expect request-header field. - /// - ExpectationFailed = 417, - - /// - /// A generic error message, given when no more specific message is suitable. - /// - InternalServerError = 500, - - /// - /// The server either does not recognize the request method, or it lacks the ability to fulfill the request. - /// - NotImplemented = 501, - - /// - /// The server was acting as a gateway or proxy and received an invalid response from the upstream server. - /// - BadGateway = 502, - - /// - /// The server is currently unavailable. - /// - ServiceUnavailable = 503, - - /// - /// The server was acting as a gateway or proxy and did not receive a timely response from the upstream server. - /// - GatewayTimeout = 504, - - /// - /// The server does not support the HTTP protocol version used in the request. - /// - HttpVersionNotSupported = 505, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlAcceleratorKeyPressedEventArgs.cs b/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlAcceleratorKeyPressedEventArgs.cs deleted file mode 100644 index 7ab9cc2edc7..00000000000 --- a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlAcceleratorKeyPressedEventArgs.cs +++ /dev/null @@ -1,78 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Security; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// This class provides information for the event. - /// - public sealed class WebViewControlAcceleratorKeyPressedEventArgs : EventArgs - { - [SecurityCritical] - private readonly Windows.Web.UI.Interop.WebViewControlAcceleratorKeyPressedEventArgs _args; - - [SecurityCritical] - internal WebViewControlAcceleratorKeyPressedEventArgs(Windows.Web.UI.Interop.WebViewControlAcceleratorKeyPressedEventArgs args) - { - _args = args; - } - - /// - /// Gets the type of the event. - /// - /// The type of the event. - public CoreAcceleratorKeyEventType EventType - { - [SecurityCritical] - get { return (CoreAcceleratorKeyEventType)_args.EventType; } - } - - /// - /// Gets or sets a value indicating whether this is handled. - /// - /// if handled; otherwise, . - public bool Handled - { - [SecurityCritical] - get => _args.Handled; - [SecurityCritical] - set => _args.Handled = value; - } - - /// - /// Gets the routing stage. - /// - /// The routing stage. - public WebViewControlAcceleratorKeyRoutingStage RoutingStage - { - [SecurityCritical] - get { return (WebViewControlAcceleratorKeyRoutingStage)_args.RoutingStage; } - } - - /// - /// Gets the virtual key. - /// - /// The virtual key. - public VirtualKey VirtualKey - { - [SecurityCritical] - get { return (VirtualKey)_args.VirtualKey; } - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - [SecurityCritical] - public static implicit operator WebViewControlAcceleratorKeyPressedEventArgs( - Windows.Web.UI.Interop.WebViewControlAcceleratorKeyPressedEventArgs args) - { - return new WebViewControlAcceleratorKeyPressedEventArgs(args); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlAcceleratorKeyRoutingStage.cs b/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlAcceleratorKeyRoutingStage.cs deleted file mode 100644 index 9d6599297a8..00000000000 --- a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlAcceleratorKeyRoutingStage.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// An enumeration that describes the accelerator key routing stage. - /// Copy from to avoid requirement to link Windows.winmd - /// - public enum WebViewControlAcceleratorKeyRoutingStage - { -#pragma warning disable 1591 - Tunneling, - Bubbling, -#pragma warning restore 1591 - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlContentLoadingEventArgs.cs b/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlContentLoadingEventArgs.cs deleted file mode 100644 index 243ef22cc2c..00000000000 --- a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlContentLoadingEventArgs.cs +++ /dev/null @@ -1,126 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Security; -using System.Windows.Forms; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// Provides data for the and events. This class cannot be inherited. - /// - /// Copy from to avoid requirement to link Windows.winmd - /// - public sealed class WebViewControlContentLoadingEventArgs : EventArgs - { - [SecurityCritical] - private readonly Windows.Web.UI.WebViewControlContentLoadingEventArgs _winrtArgs; -#if WINFORMS - [SecurityCritical] - private readonly WebBrowserNavigatingEventArgs _formArgs; -#endif - -#if WPF - [SecurityCritical] - private readonly System.Windows.Navigation.NavigatingCancelEventArgs _wpfArgs; -#endif - - [SecurityCritical] - internal WebViewControlContentLoadingEventArgs(Windows.Web.UI.WebViewControlContentLoadingEventArgs args) - { - _winrtArgs = args; - } - -#if WPF - [SecurityCritical] - internal WebViewControlContentLoadingEventArgs(System.Windows.Navigation.NavigatingCancelEventArgs args) - { - _wpfArgs = args; - } -#endif -#if WINFORMS - [SecurityCritical] - internal WebViewControlContentLoadingEventArgs(WebBrowserNavigatingEventArgs args) - { - _formArgs = args; - } -#endif - - /// - /// Gets the Uniform Resource Identifier (URI) of the content the is loading. - /// - public Uri Uri - { - [SecurityCritical] - get - { -#if WINFORMS - return _winrtArgs?.Uri ?? _formArgs?.Url; -#elif WPF - return _winrtArgs?.Uri ?? _wpfArgs?.Uri; -#else - return _winrtArgs?.Uri; -#endif - } - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - [SecurityCritical] - public static implicit operator WebViewControlContentLoadingEventArgs( - Windows.Web.UI.WebViewControlContentLoadingEventArgs args) - { - return FromWebViewControlContentLoadingEventArgs(args); - } - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static WebViewControlContentLoadingEventArgs FromWebViewControlContentLoadingEventArgs(Windows.Web.UI.WebViewControlContentLoadingEventArgs args) - { - return new WebViewControlContentLoadingEventArgs(args); - } - -#if WPF - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator WebViewControlContentLoadingEventArgs(System.Windows.Navigation.NavigatingCancelEventArgs args) => ToWebViewControlContentLoadingEventArgs(args); - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// . - public static WebViewControlContentLoadingEventArgs ToWebViewControlContentLoadingEventArgs( - System.Windows.Navigation.NavigatingCancelEventArgs args) => - new WebViewControlContentLoadingEventArgs(args); -#endif -#if WINFORMS - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator WebViewControlContentLoadingEventArgs(WebBrowserNavigatingEventArgs args) => ToWebViewControlNavigationStartingEventArgs(args); - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// . - public static WebViewControlContentLoadingEventArgs ToWebViewControlNavigationStartingEventArgs( - WebBrowserNavigatingEventArgs args) => - new WebViewControlContentLoadingEventArgs(args); -#endif - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlDeferredPermissionRequest.cs b/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlDeferredPermissionRequest.cs deleted file mode 100644 index 988b1bcb1f0..00000000000 --- a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlDeferredPermissionRequest.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Security; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// Represents a deferred request for permissions in an . This class cannot be inherited. - /// - /// Copy from to avoid requirement to link Windows.winmd - /// - public sealed class WebViewControlDeferredPermissionRequest - { - [SecurityCritical] - private readonly Windows.Web.UI.WebViewControlDeferredPermissionRequest _webViewControlDeferredPermissionRequest; - - internal WebViewControlDeferredPermissionRequest(Windows.Web.UI.WebViewControlDeferredPermissionRequest webViewControlDeferredPermissionRequest) - { - _webViewControlDeferredPermissionRequest = webViewControlDeferredPermissionRequest; - } - - /// - /// Gets the identifier for the permission request. - /// - public uint Id => _webViewControlDeferredPermissionRequest.Id; - - /// - /// Gets a value that indicates the type of permission that's requested. - /// - public WebViewControlPermissionType PermissionType => (WebViewControlPermissionType)_webViewControlDeferredPermissionRequest.PermissionType; - - /// - /// Gets the Uniform Resource Identifier (URI) of the content where the permission request originated. - /// - public Uri Uri => _webViewControlDeferredPermissionRequest.Uri; - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator WebViewControlDeferredPermissionRequest(Windows.Web.UI.WebViewControlDeferredPermissionRequest args) => ToWebViewControlDeferredPermissionRequest(args); - - /// - /// Creates a from . - /// - /// The instance containing the deferred permission request. - /// . - public static WebViewControlDeferredPermissionRequest ToWebViewControlDeferredPermissionRequest(Windows.Web.UI.WebViewControlDeferredPermissionRequest args) => new WebViewControlDeferredPermissionRequest(args); - - /// - /// Grants the requested permission. - /// - [SecurityCritical] - public void Allow() => _webViewControlDeferredPermissionRequest.Allow(); - - /// - /// Denies the requested permission. - /// - [SecurityCritical] - public void Deny() => _webViewControlDeferredPermissionRequest.Deny(); - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlDomContentLoadedEventArgs.cs b/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlDomContentLoadedEventArgs.cs deleted file mode 100644 index 160e6f7452f..00000000000 --- a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlDomContentLoadedEventArgs.cs +++ /dev/null @@ -1,56 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Security; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// Provides data for the and events. This class cannot be inherited. - /// - /// Copy from to avoid requirement to link Windows.winmd - /// - /// - [System.Diagnostics.CodeAnalysis.SuppressMessage( - "Microsoft.Naming", - "CA1709:IdentifiersShouldBeCasedCorrectly", - MessageId = "DOM", - Justification = "Maintain consistency with WinRT type name")] - public sealed class WebViewControlDOMContentLoadedEventArgs : EventArgs - { - [SecurityCritical] - internal WebViewControlDOMContentLoadedEventArgs(Windows.Web.UI.WebViewControlDOMContentLoadedEventArgs args) - { - Uri = args.Uri; - } - - internal WebViewControlDOMContentLoadedEventArgs(Uri uri) - { - Uri = uri; - } - - /// - /// Gets the Uniform Resource Identifier (URI) of the content the is loading. - /// - /// The Uniform Resource Identifier (URI) of the content the is loading. - public Uri Uri { get; } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator WebViewControlDOMContentLoadedEventArgs(Windows.Web.UI.WebViewControlDOMContentLoadedEventArgs args) => FromWebViewControlDOMContentLoadedEventArgs(args); - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// . - public static WebViewControlDOMContentLoadedEventArgs FromWebViewControlDOMContentLoadedEventArgs( - Windows.Web.UI.WebViewControlDOMContentLoadedEventArgs args) => - new WebViewControlDOMContentLoadedEventArgs(args); - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlHost.cs b/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlHost.cs deleted file mode 100644 index c1dc959fc6b..00000000000 --- a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlHost.cs +++ /dev/null @@ -1,1146 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Runtime.InteropServices; -using System.Security; -using System.Threading.Tasks; -using Microsoft.Toolkit.Win32.UI.Controls.Interop.Win32; -using Windows.Foundation.Metadata; -using Windows.Web; -using Windows.Web.Http; -using Windows.Web.UI; -using Windows.Web.UI.Interop; -using Rect = Windows.Foundation.Rect; - -// Suppress document warnings as the items are internal and are used to propagate exception info up to consuming classes -#pragma warning disable SA1604 // Element documentation must have summary -#pragma warning disable SA1615 // Element return value must be documented - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// Provides a control that hosts HTML content in an app. - /// - /// - /// navigation events occur in the following order: - /// - /// - /// - /// - /// - /// - /// Similar events occur in the same order for each iframe in the content: - /// - /// - /// - /// - /// - /// - /// - internal sealed class WebViewControlHost : IDisposable - { - private const string LocalContentIdentifier = "LocalContent"; - private const string WinRtType = "Windows.Web.UI.Interop.WebViewControl"; - - [SecurityCritical] - private WebViewControl _webViewControl; - - private bool _webViewControlClosed; - - internal WebViewControlHost(WebViewControl webViewControl) - { - Verify.IsNotNull(webViewControl); - - _webViewControl = webViewControl ?? throw new ArgumentNullException(nameof(webViewControl)); - Process = _webViewControl.Process; - SubscribeEvents(); - SubscribeProcessExited(); - } - - ~WebViewControlHost() - { - Dispose(false); - } - - internal event EventHandler AcceleratorKeyPressed = (sender, args) => { }; - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1009:DeclareEventHandlersCorrectly", Justification = "This is the declaration from WinRT")] - internal event EventHandler ContainsFullScreenElementChanged = (sender, args) => { }; - - internal event EventHandler ContentLoading = (sender, args) => { }; - - internal event EventHandler DOMContentLoaded = (sender, args) => { }; - - internal event EventHandler FrameContentLoading = (sender, args) => { }; - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "DOM", Justification = "This is the name from WinRT")] - internal event EventHandler FrameDOMContentLoaded = (sender, args) => { }; - - internal event EventHandler FrameNavigationCompleted = (sender, args) => { }; - - internal event EventHandler FrameNavigationStarting = (sender, args) => { }; - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1009:DeclareEventHandlersCorrectly", Justification = "This is the declaration from WinRT")] - internal event EventHandler GotFocus = (sender, args) => { }; - - internal event EventHandler LongRunningScriptDetected = (sender, args) => { }; - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1009:DeclareEventHandlersCorrectly", Justification = "This is the declaration from WinRT")] - internal event EventHandler LostFocus = (sender, args) => { }; - - internal event EventHandler MoveFocusRequested = (sender, args) => { }; - - internal event EventHandler NavigationCompleted = (sender, args) => { }; - - internal event EventHandler NavigationStarting = (sender, args) => { }; - - internal event EventHandler NewWindowRequested = (sender, args) => { }; - - internal event EventHandler PermissionRequested = (sender, args) => { }; - - internal event EventHandler ScriptNotify = (sender, args) => { }; - - [System.Diagnostics.CodeAnalysis.SuppressMessage( - "Microsoft.Design", - "CA1009:DeclareEventHandlersCorrectly", - Justification = "WinRT type does not derive from EventArgs. Signature kept to maintain compatibility")] - internal event EventHandler UnsafeContentWarningDisplaying = (sender, args) => { }; - - internal event EventHandler UnsupportedUriSchemeIdentified = (sender, args) => { }; - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Unviewable", Justification ="This is the name from WinRT")] - internal event EventHandler UnviewableContentIdentified = (sender, args) => { }; - - internal static bool IsSupported => OSVersionHelper.IsWindows10April2018OrGreater - && OSVersionHelper.IsWorkstation - && OSVersionHelper.EdgeExists; - - internal bool CanGoBack - { - get - { - Verify.IsFalse(IsDisposed); - Verify.IsNotNull(_webViewControl); - - if (!IsDisposed && _webViewControl != null) - { - return _webViewControl.CanGoBack; - } - - return false; - } - } - - internal bool CanGoForward - { - get - { - Verify.IsFalse(IsDisposed); - Verify.IsNotNull(_webViewControl); - - if (!IsDisposed && _webViewControl != null) - { - return _webViewControl.CanGoForward; - } - - return false; - } - } - - internal bool ContainsFullScreenElement - { - get - { - Verify.IsFalse(IsDisposed); - Verify.IsNotNull(_webViewControl); - - if (!IsDisposed && _webViewControl != null) - { - return _webViewControl.ContainsFullScreenElement; - } - - return false; - } - } - - internal string DocumentTitle - { - get - { - Verify.IsFalse(IsDisposed); - Verify.IsNotNull(_webViewControl); - - return _webViewControl?.DocumentTitle; - } - } - - private bool IsDisposed { get; set; } - - private bool IsDisposing { get; set; } - - internal bool IsVisible - { - get - { - Verify.IsFalse(IsDisposed); - Verify.IsNotNull(_webViewControl); - - return _webViewControl?.IsVisible ?? false; - } - - set - { - Verify.IsFalse(IsDisposed); - Verify.IsNotNull(_webViewControl); - - _webViewControl.IsVisible = value; - } - } - - internal Windows.Web.UI.Interop.WebViewControlProcess Process { get; private set; } - - internal Windows.Web.UI.WebViewControlSettings Settings - { - get - { - Verify.IsFalse(IsDisposed); - Verify.IsNotNull(_webViewControl); - return _webViewControl?.Settings; - } - } - - internal Uri Source - { - get - { - Verify.IsFalse(IsDisposed); - Verify.IsNotNull(_webViewControl); - - Uri url = null; - - if (_webViewControl != null) - { - // Current url - url = _webViewControl.Source; - - // When Source set to null or navigating to stream/string, we navigate to "about:blank" - // internally. Make sure we return null in those cases. - // Note that the current Source may not be "about:blank" yet - // Also, we'll (inconsistently) return "about:blank" in some cases - if (NavigatingToAboutBlank) - { - url = null; - } - } - - return url; - } - - set - { - Verify.IsFalse(IsDisposed); - Verify.IsNotNull(_webViewControl); - - if (_webViewControl != null) - { - Navigate(value); - } - } - } - - /// - /// Gets the version of EDGEHTML.DLL used by the control. - /// - /// The version of EDGEHTML.DLL used by the control. - internal Version Version - { - get - { - if (OSVersionHelper.EdgeExists) - { - var versionInfo = FileVersionInfo.GetVersionInfo( - Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), "edgehtml.dll")); - return new Version( - versionInfo.FileMajorPart, - versionInfo.FileMinorPart, - versionInfo.FileBuildPart, - versionInfo.FilePrivatePart); - } - - // Reuse the message, close enough - throw new InvalidOperationException(DesignerUI.E_NOTSUPPORTED_OS_RS4); - } - } - - private Guid LastNavigation - { - get; - [SecurityCritical] - set; - } - - // Indicates whether we are navigating to "about:blank" internally because Source is set to null or navigating to string - // Set is SecurityCritical because it is involved in making security decisions - private bool NavigatingToAboutBlank - { - get; - [SecurityCritical] - set; - } - - internal void AddInitializeScript(string script) - { - ApiInformationExtensions.ExecuteIfMethodPresent( - WinRtType, - "AddInitializeScript", - 1, - () => { _webViewControl?.AddInitializeScript(script); }); - } - - internal Uri BuildStream(string contentIdentifier, string relativePath) - { - if (string.IsNullOrWhiteSpace(contentIdentifier)) - { - throw new ArgumentNullException(nameof(contentIdentifier)); - } - - if (string.IsNullOrWhiteSpace(relativePath)) - { - throw new ArgumentNullException(nameof(relativePath)); - } - - // If not passing a relative path, the method faults. No exception is thrown, the application just fails fast - // Until that issue resolved, add our own error checking - if (PathUtilities.IsAbsolute(relativePath)) - { - throw new ArgumentOutOfRangeException(nameof(relativePath), DesignerUI.E_WEBVIEW_INVALID_URI); - } - - // The content identifier is used in conjunction with the application identity to create a guid. The - // guid is appended to the win32webviewhost identity and a ms-local-stream URI is created. - // Given a relative path of "/content.htm" the following is generated: - // ms-local-stream://microsoft.win32webviewhost_xxxxxxxxxxxxx_yyyyyyyyyyyyyyyyyyyyyyyy//content.htm - // If there is relative navigation items (e.g. "..\") they are resolved. URI will ALWAYS be relative to - // the application container, e.g. "..\..\..\..\..\..\file" will resolve to "/file" - return _webViewControl?.BuildLocalStreamUri(contentIdentifier, relativePath); - } - - internal void Close() - { - var webViewControlAlreadyClosed = _webViewControlClosed; - _webViewControlClosed = true; - - // Unsubscribe all events: - UnsubscribeEvents(); - UnsubscribeProcessExited(); - - if (!webViewControlAlreadyClosed) - { - Verify.IsNotNull(_webViewControl); - - _webViewControl?.Close(); - } - - _webViewControl = null; - Process = null; - } - - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - internal WebViewControlDeferredPermissionRequest GetDeferredPermissionRequestById(uint id) - { - Verify.IsFalse(IsDisposed); - Verify.IsNotNull(_webViewControl); - if (_webViewControl == null) - { - return null; - } - - _webViewControl.GetDeferredPermissionRequestById(id, out var retval); - return retval; - } - - internal bool GoBack() - { - Verify.IsFalse(IsDisposed); - Verify.IsNotNull(_webViewControl); - - var retval = _webViewControl != null; - try - { - _webViewControl?.GoBack(); - } - catch (Exception e) - { - if (e.IsSecurityOrCriticalException()) - { - throw; - } - - retval = false; - } - - return retval; - } - - internal bool GoForward() - { - Verify.IsFalse(IsDisposed); - Verify.IsNotNull(_webViewControl); - - var retval = _webViewControl != null; - try - { - _webViewControl?.GoForward(); - } - catch (Exception e) - { - if (e.IsSecurityOrCriticalException()) - { - throw; - } - - retval = false; - } - - return retval; - } - - /// When the underlying is not yet initialized. - internal Task InvokeScriptAsync(string scriptName) => InvokeScriptAsync(scriptName, null); - - /// When the underlying is not yet initialized. - internal Task InvokeScriptAsync(string scriptName, params string[] arguments) => InvokeScriptAsync(scriptName, (IEnumerable)arguments); - - /// When the underlying is not yet initialized. - /// is - internal Task InvokeScriptAsync(string scriptName, IEnumerable arguments) - { - Verify.IsFalse(IsDisposed); - Verify.IsNotNull(_webViewControl); - Verify.IsNeitherNullNorEmpty(scriptName); - - if (string.IsNullOrEmpty(scriptName)) - { - throw new ArgumentNullException(nameof(scriptName)); - } - - // Cannot invoke script - if (_webViewControl == null) - { - throw new InvalidOperationException(DesignerUI.E_WEBVIEW_CANNOT_INVOKE_BEFORE_INIT); - } - - // Protect against the cross domain scripting attacks - // If it is our internal navigation to about:blank for navigating to null or load string or before navigation has happened, Source will be null - var currentSource = Source; - if (currentSource != null) - { - Security.DemandWebPermission(currentSource); - } - - return _webViewControl - .InvokeScriptAsync(scriptName, arguments) - .AsTask(); - } - - internal void MoveFocus(WebViewControlMoveFocusReason reason) - { - _webViewControl?.MoveFocus((Windows.Web.UI.Interop.WebViewControlMoveFocusReason)reason); - } - - /// The provided is a relative URI. - internal void Navigate(Uri source) - { - Verify.IsNotNull(_webViewControl); - - if (_webViewControl != null) - { - // Cancel any outstanding navigation - // TODO: Does this show a cancel page? Can we suppress that? - _webViewControl.Stop(); - - LastNavigation = Guid.NewGuid(); - - if (source == null) - { - NavigatingToAboutBlank = true; - source = WebViewDefaults.AboutBlankUri; - } - else - { - CleanInternalState(); - } - - // Absolute URI only. Not sure what the host would be if using relative - if (!source.IsAbsoluteUri) - { - throw new ArgumentException(DesignerUI.E_WEBVIEW_NOT_ABSOLUTE_URI, nameof(source)); - } - - // TODO: Handle POPUP window - // TODO: Handle navigation for frame - - // TODO: Security for partial trust (e.g. about:blank is not allowed) - // If we are navigating to "about:blank" internally as a result of setting source to null - // or navigating to string, do not demand WebPermission - if (!NavigatingToAboutBlank) - { - Security.DemandWebPermission(source); - } - - // TODO: Sanitize URI containing invalid UTF-8 sequences - try - { - _webViewControl.Navigate(source); - } - catch (Exception) - { - // Clear internal state if navigation fails - CleanInternalState(); - - throw; - } - } - } - - /// - /// In the .NET for Windows Store apps or the Portable Class Library, catch the base class exception, , instead. - /// is empty.-or- The scheme specified in is not correctly formed. See .-or- - /// contains too many slashes.-or- The password specified in is not valid.-or- The host name specified in is not valid.-or- The file name specified in is not valid. -or- The user name specified in is not valid.-or- The host or authority name specified in cannot be terminated by backslashes.-or- The port number specified in is not valid or cannot be parsed.-or- The length of exceeds 65519 characters.-or- The length of the scheme specified in exceeds 1023 characters.-or- There is an invalid character sequence in .-or- The MS-DOS path specified in must start with c:\\. - internal void Navigate(string source) - { - Navigate(UriHelper.StringToUri(source)); - } - - [Obsolete("Use NavigateToLocalStreamUri(Uri, IUriToStreamResolver) instead")] - internal void NavigateToLocal(string relativePath) - { - var relativeUri = UriHelper.StringToRelativeUri(relativePath); - NavigateToLocalStreamUri( - relativeUri, -#pragma warning disable SA1129 // Do not use default value type constructor - new UriToLocalStreamResolver(Path.GetDirectoryName(UnsafeNativeMethods.GetModuleFileName(new HandleRef())))); -#pragma warning restore SA1129 // Do not use default value type constructor - } - - internal void NavigateToLocalStreamUri(Uri relativePath, IUriToStreamResolver streamResolver) - { - if (relativePath == null) - { - throw new ArgumentNullException(nameof(relativePath)); - } - - if (relativePath.IsAbsoluteUri) - { - throw new ArgumentOutOfRangeException(nameof(relativePath), DesignerUI.E_WEBVIEW_INVALID_URI); - } - - if (streamResolver == null) - { - throw new ArgumentNullException(nameof(streamResolver)); - } - - Windows.Web.IUriToStreamResolver AsWindowsRuntimeUriToStreamResolver(IUriToStreamResolver streamResolverInterop) - { - // Check to see if the stream resolver is actually a wrapper of a WinRT stream resolver - if (streamResolverInterop is Windows.Web.IUriToStreamResolver streamResolverAdapter) - { - return streamResolverAdapter; - } - - if (streamResolverInterop is GenericUriToStreamResolver genericAdapter) - { - return genericAdapter; - } - - // We have an unwrapped stream resolver - return new GenericUriToStreamResolver(streamResolver); - } - - var uri = BuildStream(LocalContentIdentifier, UriHelper.UriToString(relativePath)); - _webViewControl?.NavigateToLocalStreamUri(uri, AsWindowsRuntimeUriToStreamResolver(streamResolver)); - } - - internal void Navigate( - Uri requestUri, - System.Net.Http.HttpMethod method, - string content = null, - IEnumerable> headers = null) - { - if (requestUri == null) - { - throw new ArgumentNullException(nameof(requestUri)); - } - - if (method == null) - { - throw new ArgumentNullException(nameof(method)); - } - - // Convert a System.Net.Http.HttpMethod to Windows.Web.Http.HttpMethod - HttpMethod ToHttpMethod(System.Net.Http.HttpMethod httpMethod) - { - if (System.Net.Http.HttpMethod.Get.Equals(httpMethod)) - { - return HttpMethod.Get; - } - - if (System.Net.Http.HttpMethod.Post.Equals(httpMethod)) - { - return HttpMethod.Post; - } - - // For compatabilty with WebView.NavigateWithHttpRequestMessage, this only supports POST and GET - throw new ArgumentOutOfRangeException(nameof(httpMethod)); - } - - var requestMessage = new HttpRequestMessage - { - RequestUri = requestUri, - Method = ToHttpMethod(method) - }; - - if (content != null) - { - requestMessage.Content = new HttpStringContent(content); - } - - if (headers != null) - { - foreach (var header in headers) - { - requestMessage.Headers.Add(header); - } - } - - NavigateWithHttpRequestMessage(requestMessage); - } - - internal void NavigateWithHttpRequestMessage(HttpRequestMessage requestMessage) - { - _webViewControl?.NavigateWithHttpRequestMessage(requestMessage); - } - - /// is - internal void NavigateToString(string text) - { - if (string.IsNullOrEmpty(text)) - { - throw new ArgumentNullException(nameof(text)); - } - - _webViewControl?.NavigateToString(text); - } - - internal void Refresh() - { - try - { - _webViewControl?.Refresh(); - } - catch (Exception e) - { - if (e.IsSecurityOrCriticalException()) - { - throw; - } - } - } - - internal void Stop() - { - try - { - _webViewControl?.Stop(); - } - catch (Exception e) - { - if (e.IsSecurityOrCriticalException()) - { - throw; - } - } - } - - // We don't expose the Bounds property because of issues with placement of Core window - internal void UpdateBounds(Rect bounds) - { - if (_webViewControl != null) - { - _webViewControl.Bounds = bounds; - } - } - - [SecurityCritical] // Resets NavigatingToAboutBlank which is used in security decisions - private void CleanInternalState() - { - NavigatingToAboutBlank = false; - } - - private void Dispose(bool disposing) - { - IsDisposing = true; - try - { - if (disposing) - { - Close(); - } - } - finally - { - IsDisposing = false; - IsDisposed = true; - } - } - - private void OnAcceleratorKeyPressed(WebViewControlAcceleratorKeyPressedEventArgs args) - { - var handler = AcceleratorKeyPressed; - if (handler != null) - { - handler(this, args); - } - } - - private void OnAcceleratorKeyPressed(WebViewControl sender, Windows.Web.UI.Interop.WebViewControlAcceleratorKeyPressedEventArgs args) => OnAcceleratorKeyPressed(args); - - private void OnContainsFullScreenElementChanged(object args) - { - var handler = ContainsFullScreenElementChanged; - if (handler != null) - { - handler(this, args); - } - } - - private void OnContainsFullScreenElementChanged(IWebViewControl sender, object args) => OnContainsFullScreenElementChanged(args); - - private void OnContentLoading(WebViewControlContentLoadingEventArgs args) - { - var handler = ContentLoading; - if (handler != null) - { - handler(this, args); - } - } - - private void OnContentLoading(IWebViewControl sender, Windows.Web.UI.WebViewControlContentLoadingEventArgs args) => OnContentLoading(args); - - private void OnDOMContentLoaded(WebViewControlDOMContentLoadedEventArgs args) - { - var handler = DOMContentLoaded; - if (handler != null) - { - handler(this, args); - } - } - - private void OnDOMContentLoaded(IWebViewControl sender, Windows.Web.UI.WebViewControlDOMContentLoadedEventArgs args) - { - // When Source set to null or navigating to stream/string, we navigate to "about:blank" internally. - if (NavigatingToAboutBlank) - { - Verify.Implies(NavigatingToAboutBlank, Source == null || Source == WebViewDefaults.AboutBlankUri); - - // Make sure we pass null in the event args - var a = new WebViewControlDOMContentLoadedEventArgs((Uri)null); - OnDOMContentLoaded(a); - } - else - { - OnDOMContentLoaded(args); - } - } - - private void OnFrameContentLoading(WebViewControlContentLoadingEventArgs args) - { - var handler = FrameContentLoading; - if (handler != null) - { - handler(this, args); - } - } - - private void OnFrameContentLoading(IWebViewControl sender, Windows.Web.UI.WebViewControlContentLoadingEventArgs args) => OnFrameContentLoading(args); - - private void OnFrameDOMContentLoaded(WebViewControlDOMContentLoadedEventArgs args) - { - var handler = FrameDOMContentLoaded; - if (handler != null) - { - handler(this, args); - } - } - - private void OnFrameDOMContentLoaded(IWebViewControl sender, Windows.Web.UI.WebViewControlDOMContentLoadedEventArgs args) => OnFrameDOMContentLoaded(args); - - private void OnFrameNavigationCompleted(WebViewControlNavigationCompletedEventArgs args) - { - var handler = FrameNavigationCompleted; - if (handler != null) - { - handler(this, args); - } - } - - private void OnFrameNavigationCompleted(IWebViewControl sender, Windows.Web.UI.WebViewControlNavigationCompletedEventArgs args) - { - // TODO: Need to handle frame navigation like NavigationCompleted? - OnFrameNavigationCompleted(args); - } - - private void OnFrameNavigationStarting(WebViewControlNavigationStartingEventArgs args) - { - var handler = FrameNavigationStarting; - if (handler != null) - { - handler(this, args); - } - } - - private void OnGotFocus(object args) - { - var handler = GotFocus; - if (handler != null) - { - handler(this, args); - } - } - - private void OnFrameNavigationStarting(IWebViewControl sender, Windows.Web.UI.WebViewControlNavigationStartingEventArgs args) => OnFrameNavigationStarting(args); - - private void OnGotFocus(IWebViewControl sender, object args) => OnGotFocus(args); - - private void OnLongRunningScriptDetected(WebViewControlLongRunningScriptDetectedEventArgs args) - { - var handler = LongRunningScriptDetected; - if (handler != null) - { - handler(this, args); - } - } - - private void OnLongRunningScriptDetected(IWebViewControl sender, Windows.Web.UI.WebViewControlLongRunningScriptDetectedEventArgs args) => OnLongRunningScriptDetected(args); - - private void OnLostFocus(object args) - { - var handler = LostFocus; - if (handler != null) - { - handler(this, args); - } - } - - private void OnLostFocus(IWebViewControl sender, object args) => OnLostFocus(args); - - private void OnMoveFocusRequested(WebViewControlMoveFocusRequestedEventArgs args) - { - var handler = MoveFocusRequested; - if (handler != null) - { - handler(this, args); - } - } - - private void OnMoveFocusRequested(WebViewControl sender, Windows.Web.UI.Interop.WebViewControlMoveFocusRequestedEventArgs args) => OnMoveFocusRequested(args); - - private void OnNavigationCompleted(WebViewControlNavigationCompletedEventArgs args) - { - // We could have used - // if (NavigationCompleted != null) NavigationCompleted(this, args); - // However, if there is a subscriber and the moment the null check and the call to - // the event handler by the method is invoked, the subscriber may unsubscribe - // (e.g. on a different thread) and cause a NullReferenceException. - // To work around this create a temporarily local variable to store the reference and check that - var handler = NavigationCompleted; - if (handler != null) - { - handler(this, args); - } - } - - private void OnNavigationCompleted(IWebViewControl sender, Windows.Web.UI.WebViewControlNavigationCompletedEventArgs args) - { - // When Source set to null or navigating to stream/string, we navigate to "about:blank" internally. - if (NavigatingToAboutBlank) - { - Verify.Implies(NavigatingToAboutBlank, Source == null || Source == WebViewDefaults.AboutBlankUri); - - // Make sure we pass null in the event args - var a = new WebViewControlNavigationCompletedEventArgs(args, null); - OnNavigationCompleted(a); - } - else - { - OnNavigationCompleted(args); - } - } - - private void OnNavigationStarting(WebViewControlNavigationStartingEventArgs args) - { - var handler = NavigationStarting; - if (handler != null) - { - handler(this, args); - } - } - - private void OnNavigationStarting(IWebViewControl sender, Windows.Web.UI.WebViewControlNavigationStartingEventArgs args) - { - var newNavigationRequested = false; - var cancelRequested = false; - - try - { - var url = args.Uri; - - // The NavigatingToAboutBlank property indicates whether we are navigating to "about:blank" as a result of navigating - // to a null source, or stream/string navigation. - // We set the NavigatingToAboutBlank bit to true in the void Navigate(Uri) method. When the above conditions are true, - // the NavigatingToAboutBlank is true and the source must be "about:blank" - if (NavigatingToAboutBlank && url != null && url != new Uri("about:blank")) - { - NavigatingToAboutBlank = false; - } - - if (!NavigatingToAboutBlank && !Security.CallerHasWebPermission(url)) - { - cancelRequested = true; - } - else - { - // When Source is set to null or navigating to stream/string, we navigate to "about:blank" internally. - // Make sure we pass null in the event args - if (NavigatingToAboutBlank) - { - url = null; - } - - var a = new WebViewControlNavigationStartingEventArgs(args, url); - - // Launching a navigation from the NavigationStarting event handler causes re-entrancy - var lastNavigation = LastNavigation; - - // Fire navigating event - OnNavigationStarting(a); - - if (LastNavigation != lastNavigation) - { - newNavigationRequested = true; - } - - cancelRequested = a.Cancel; - } - } - - // Disable to suppress FXCop warning since we really do want to catch all exceptions -#pragma warning disable 6502 - catch - { - cancelRequested = true; - } -#pragma warning restore 6502 - finally - { - if (cancelRequested && !newNavigationRequested) - { - CleanInternalState(); - } - - if (cancelRequested || newNavigationRequested) - { - args.Cancel = true; - } - } - } - - private void OnNewWindowRequested(WebViewControlNewWindowRequestedEventArgs args) - { - var handler = NewWindowRequested; - if (handler != null) - { - handler(this, args); - } - } - - private void OnNewWindowRequested(IWebViewControl sender, Windows.Web.UI.WebViewControlNewWindowRequestedEventArgs args) => OnNewWindowRequested(args); - - private void OnOnScriptNotify(IWebViewControl sender, Windows.Web.UI.WebViewControlScriptNotifyEventArgs args) => OnScriptNotify(args); - - private void OnPermissionRequested(WebViewControlPermissionRequestedEventArgs args) - { - var handler = PermissionRequested; - if (handler != null) - { - handler(this, args); - } - } - - private void OnPermissionRequested(IWebViewControl sender, Windows.Web.UI.WebViewControlPermissionRequestedEventArgs args) => OnPermissionRequested(args); - - private void OnProcessExited(object sender, object e) - { - _webViewControlClosed = true; - Close(); - } - - private void OnScriptNotify(WebViewControlScriptNotifyEventArgs args) - { - var handler = ScriptNotify; - if (handler != null) - { - handler(this, args); - } - } - - private void OnUnsafeContentWarningDisplaying(object args) - { - var handler = UnsafeContentWarningDisplaying; - if (handler != null) - { - handler(this, args); - } - } - - private void OnUnsafeContentWarningDisplaying(IWebViewControl sender, object args) => OnUnsafeContentWarningDisplaying(args); - - private void OnUnsupportedUriSchemeIdentified(WebViewControlUnsupportedUriSchemeIdentifiedEventArgs args) - { - var handler = UnsupportedUriSchemeIdentified; - if (handler != null) - { - handler(this, args); - } - } - - private void OnUnsupportedUriSchemeIdentified(IWebViewControl sender, Windows.Web.UI.WebViewControlUnsupportedUriSchemeIdentifiedEventArgs args) => OnUnsupportedUriSchemeIdentified(args); - - private void OnUnviewableContentIdentified(WebViewControlUnviewableContentIdentifiedEventArgs args) - { - var handler = UnviewableContentIdentified; - if (handler != null) - { - handler(this, args); - } - } - - private void OnUnviewableContentIdentified(IWebViewControl sender, Windows.Web.UI.WebViewControlUnviewableContentIdentifiedEventArgs args) => OnUnviewableContentIdentified(args); - - [SecurityCritical] - private void SubscribeEvents() - { - if (_webViewControl == null) - { - return; - } - - _webViewControl.AcceleratorKeyPressed += OnAcceleratorKeyPressed; - _webViewControl.ContainsFullScreenElementChanged += OnContainsFullScreenElementChanged; - _webViewControl.ContentLoading += OnContentLoading; - _webViewControl.DOMContentLoaded += OnDOMContentLoaded; - _webViewControl.FrameContentLoading += OnFrameContentLoading; - _webViewControl.FrameDOMContentLoaded += OnFrameDOMContentLoaded; - _webViewControl.FrameNavigationCompleted += OnFrameNavigationCompleted; - _webViewControl.FrameNavigationStarting += OnFrameNavigationStarting; - _webViewControl.LongRunningScriptDetected += OnLongRunningScriptDetected; - _webViewControl.MoveFocusRequested += OnMoveFocusRequested; - _webViewControl.NavigationCompleted += OnNavigationCompleted; - _webViewControl.NavigationStarting += OnNavigationStarting; - _webViewControl.NewWindowRequested += OnNewWindowRequested; - _webViewControl.PermissionRequested += OnPermissionRequested; - _webViewControl.ScriptNotify += OnOnScriptNotify; - _webViewControl.UnsafeContentWarningDisplaying += OnUnsafeContentWarningDisplaying; - _webViewControl.UnsupportedUriSchemeIdentified += OnUnsupportedUriSchemeIdentified; - _webViewControl.UnviewableContentIdentified += OnUnviewableContentIdentified; - - ApiInformationExtensions.ExecuteIfEventPresent( - WinRtType, - "GotFocus", - () => { _webViewControl.GotFocus += OnGotFocus; }); - - ApiInformationExtensions.ExecuteIfEventPresent( - WinRtType, - "LostFocus", - () => { _webViewControl.LostFocus += OnLostFocus; }); - } - - [SecurityCritical] - private void SubscribeProcessExited() - { - if (Process == null) - { - return; - } - - Process.ProcessExited += OnProcessExited; - } - - private void UnsubscribeEvents() - { - if (_webViewControl == null) - { - return; - } - - _webViewControl.AcceleratorKeyPressed -= OnAcceleratorKeyPressed; - _webViewControl.ContainsFullScreenElementChanged -= OnContainsFullScreenElementChanged; - _webViewControl.ContentLoading -= OnContentLoading; - _webViewControl.DOMContentLoaded -= OnDOMContentLoaded; - _webViewControl.FrameContentLoading -= OnFrameContentLoading; - _webViewControl.FrameDOMContentLoaded -= OnFrameDOMContentLoaded; - _webViewControl.FrameNavigationCompleted -= OnFrameNavigationCompleted; - _webViewControl.FrameNavigationStarting -= OnFrameNavigationStarting; - _webViewControl.LongRunningScriptDetected -= OnLongRunningScriptDetected; - _webViewControl.MoveFocusRequested -= OnMoveFocusRequested; - _webViewControl.NavigationCompleted -= OnNavigationCompleted; - _webViewControl.NavigationStarting -= OnNavigationStarting; - _webViewControl.NewWindowRequested -= OnNewWindowRequested; - _webViewControl.PermissionRequested -= OnPermissionRequested; - _webViewControl.ScriptNotify -= OnOnScriptNotify; - _webViewControl.UnsafeContentWarningDisplaying -= OnUnsafeContentWarningDisplaying; - _webViewControl.UnsupportedUriSchemeIdentified -= OnUnsupportedUriSchemeIdentified; - _webViewControl.UnviewableContentIdentified -= OnUnviewableContentIdentified; - - ApiInformationExtensions.ExecuteIfEventPresent( - WinRtType, - "GotFocus", - () => { _webViewControl.GotFocus -= OnGotFocus; }); - - ApiInformationExtensions.ExecuteIfEventPresent( - WinRtType, - "LostFocus", - () => { _webViewControl.LostFocus -= OnLostFocus; }); - } - - private void UnsubscribeProcessExited() - { - if (Process == null) - { - return; - } - - try - { - Process.ProcessExited -= OnProcessExited; - } - catch (Exception) - { - // Yes, really catch all - // 'The process terminated unexpectedly. (Exception from HRESULT: 0x8007042B)' - } - } - - // TODO: Expose Bounds - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlLongRunningScriptDetectedEventArgs.cs b/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlLongRunningScriptDetectedEventArgs.cs deleted file mode 100644 index 1efc95f8fa9..00000000000 --- a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlLongRunningScriptDetectedEventArgs.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Security; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// Provides data for the event. This class cannot be inherited. - /// - /// Copy from to avoid requirement to link Windows.winmd - /// - /// - public sealed class WebViewControlLongRunningScriptDetectedEventArgs : EventArgs - { - [SecurityCritical] - private readonly Windows.Web.UI.WebViewControlLongRunningScriptDetectedEventArgs _args; - - internal WebViewControlLongRunningScriptDetectedEventArgs(Windows.Web.UI.WebViewControlLongRunningScriptDetectedEventArgs args) - { - _args = args ?? throw new ArgumentNullException(nameof(args)); - } - - /// - /// Gets the amount of time that the has been executing a long-running script. - /// - /// The execution time of a long-running script. - public TimeSpan ExecutionTime => _args.ExecutionTime; - - /// - /// Gets or sets a value indicating whether a long-running script executing in a should halt. - /// - /// if the long-running script should halt; otherwise, . - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "StopPage", Justification = "Name from WinRT type")] - public bool StopPageScriptExecution - { - get => _args.StopPageScriptExecution; - set => _args.StopPageScriptExecution = value; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator WebViewControlLongRunningScriptDetectedEventArgs(Windows.Web.UI.WebViewControlLongRunningScriptDetectedEventArgs args) => ToWebViewControlLongRunningScriptDetectedEventArgs(args); - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// WebViewControlLongRunningScriptDetectedEventArgs. - public static WebViewControlLongRunningScriptDetectedEventArgs - ToWebViewControlLongRunningScriptDetectedEventArgs( - Windows.Web.UI.WebViewControlLongRunningScriptDetectedEventArgs args) => - new WebViewControlLongRunningScriptDetectedEventArgs(args); - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlMoveFocusReason.cs b/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlMoveFocusReason.cs deleted file mode 100644 index 1ccbca5bc06..00000000000 --- a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlMoveFocusReason.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// An enum that describes the reason for moving the focus. - /// - /// Copy from to avoid requirement to link Windows.winmd - /// - public enum WebViewControlMoveFocusReason - { -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - Programmatic, - Next, - Previous, -#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlMoveFocusRequestedEventArgs.cs b/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlMoveFocusRequestedEventArgs.cs deleted file mode 100644 index 3ed1299c116..00000000000 --- a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlMoveFocusRequestedEventArgs.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Security; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// Provides data for the event. This class cannot be inherited. - /// - /// Copy from to avoid requirement to link Windows.winmd - /// - /// - public sealed class WebViewControlMoveFocusRequestedEventArgs : EventArgs - { - [SecurityCritical] - private readonly Windows.Web.UI.Interop.WebViewControlMoveFocusRequestedEventArgs _args; - - internal WebViewControlMoveFocusRequestedEventArgs(Windows.Web.UI.Interop.WebViewControlMoveFocusRequestedEventArgs args) - { - _args = args ?? throw new ArgumentNullException(nameof(args)); - } - - /// - /// Gets the move focus reason. - /// - /// The move focus reason - public WebViewControlMoveFocusReason Reason => (WebViewControlMoveFocusReason)_args.Reason; - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator WebViewControlMoveFocusRequestedEventArgs(Windows.Web.UI.Interop.WebViewControlMoveFocusRequestedEventArgs args) => ToWebViewControlMoveFocusRequestedEventArgs(args); - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static WebViewControlMoveFocusRequestedEventArgs ToWebViewControlMoveFocusRequestedEventArgs( - Windows.Web.UI.Interop.WebViewControlMoveFocusRequestedEventArgs args) => - new WebViewControlMoveFocusRequestedEventArgs(args); - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlNavigationCompletedEventArgs.cs b/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlNavigationCompletedEventArgs.cs deleted file mode 100644 index fbcca63d3e9..00000000000 --- a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlNavigationCompletedEventArgs.cs +++ /dev/null @@ -1,114 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Security; -using System.Windows.Forms; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// Provides data for the and events. This class cannot be inherited. - /// - /// Copy from to avoid requirement to link Windows.winmd - /// - /// - public sealed class WebViewControlNavigationCompletedEventArgs : EventArgs - { - internal WebViewControlNavigationCompletedEventArgs(Windows.Web.UI.WebViewControlNavigationCompletedEventArgs args) - { - IsSuccess = args.IsSuccess; - Uri = args.Uri; - WebErrorStatus = (WebErrorStatus)args.WebErrorStatus; - } - - internal WebViewControlNavigationCompletedEventArgs(Windows.Web.UI.WebViewControlNavigationCompletedEventArgs args, Uri uri) - : this(args) - { - Uri = uri; - } - -#if WPF - internal WebViewControlNavigationCompletedEventArgs(System.Windows.Navigation.NavigationEventArgs e) - { - IsSuccess = true; // no ability to detect otherwise - Uri = e.Uri; - } -#endif - - internal WebViewControlNavigationCompletedEventArgs(WebBrowserNavigatedEventArgs e) - { - IsSuccess = true; // no ability to detect otherwise - Uri = e.Url; - } - - /// - /// Gets a value indicating whether the navigation completed successfully. - /// - /// if the navigation completed successfully; otherwise, . - public bool IsSuccess { get; } - - /// - /// Gets the Uniform Resource Identifier (URI) of the navigated content. - /// - /// The URI. - public Uri Uri { get; } - - /// - /// Gets the reason the navigation was successful. - /// - /// The web error status. - /// - public WebErrorStatus WebErrorStatus { get; } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator WebViewControlNavigationCompletedEventArgs(Windows.Web.UI.WebViewControlNavigationCompletedEventArgs args) => ToWebViewControlNavigationCompletedEventArgs(args); - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static WebViewControlNavigationCompletedEventArgs ToWebViewControlNavigationCompletedEventArgs( - Windows.Web.UI.WebViewControlNavigationCompletedEventArgs args) => - new WebViewControlNavigationCompletedEventArgs(args); -#if WPF - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator WebViewControlNavigationCompletedEventArgs(System.Windows.Navigation.NavigationEventArgs args) => ToWebViewControlNavigationCompletedEventArgs(args); - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// . - public static WebViewControlNavigationCompletedEventArgs ToWebViewControlNavigationCompletedEventArgs( - System.Windows.Navigation.NavigationEventArgs args) => - new WebViewControlNavigationCompletedEventArgs(args); -#endif - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator WebViewControlNavigationCompletedEventArgs(WebBrowserNavigatedEventArgs args) => ToWebViewControlNavigationCompletedEventArgs(args); - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// . - public static WebViewControlNavigationCompletedEventArgs ToWebViewControlNavigationCompletedEventArgs( - WebBrowserNavigatedEventArgs args) => - new WebViewControlNavigationCompletedEventArgs(args); - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlNavigationStartingEventArgs.cs b/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlNavigationStartingEventArgs.cs deleted file mode 100644 index 6e534471e6f..00000000000 --- a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlNavigationStartingEventArgs.cs +++ /dev/null @@ -1,158 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Security; -using System.Windows.Forms; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// Provides data for the and events. This class cannot be inherited. - /// - /// Copy from to avoid requirement to link Windows.winmd - /// - /// - public sealed class WebViewControlNavigationStartingEventArgs : EventArgs - { - [SecurityCritical] - private readonly Windows.Web.UI.WebViewControlNavigationStartingEventArgs _args; -#if WPF - [SecurityCritical] - private readonly System.Windows.Navigation.NavigatingCancelEventArgs _wpfArgs; -#endif -#if WINFORMS - [SecurityCritical] - private readonly WebBrowserNavigatingEventArgs _formsArgs; -#endif - - [SecurityCritical] - internal WebViewControlNavigationStartingEventArgs(Windows.Web.UI.WebViewControlNavigationStartingEventArgs args) - { - _args = args; - Uri = args.Uri; - } - - [SecurityCritical] - internal WebViewControlNavigationStartingEventArgs(Windows.Web.UI.WebViewControlNavigationStartingEventArgs args, Uri uri) - : this(args) - { - Uri = uri; - } - -#if WPF - [SecurityCritical] - internal WebViewControlNavigationStartingEventArgs(System.Windows.Navigation.NavigatingCancelEventArgs args) - { - _wpfArgs = args; - Uri = args.Uri; - } -#endif -#if WINFORMS - [SecurityCritical] - internal WebViewControlNavigationStartingEventArgs(WebBrowserNavigatingEventArgs e) - { - _formsArgs = e; - Uri = e.Url; - } -#endif - - /// - /// Gets or sets a value indicating whether to cancel the navigation. - /// - /// if cancel; otherwise, . - public bool Cancel - { - [SecurityCritical] - get - { -#if WINFORMS - return _args?.Cancel ?? _formsArgs?.Cancel ?? false; -#elif WPF - - return _args?.Cancel ?? _wpfArgs?.Cancel ?? false; -#else - return _args?.Cancel ?? false; -#endif - } - - [SecurityCritical] - set - { - if (_args != null) - { - _args.Cancel = value; - } -#if WINFORMS - else if (_formsArgs != null) - { - _formsArgs.Cancel = value; - } -#endif -#if WPF - else if (_wpfArgs != null) - { - _wpfArgs.Cancel = value; - } -#endif - } - } - - /// - /// Gets the Uniform Resource Identifier (URI) of the content the is loading. - /// - /// The Uniform Resource Identifier (URI) of the content the is loading. - public Uri Uri { get; } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator WebViewControlNavigationStartingEventArgs(Windows.Web.UI.WebViewControlNavigationStartingEventArgs args) => ToWebViewControlNavigationStartingEventArgs(args); - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// . - public static WebViewControlNavigationStartingEventArgs ToWebViewControlNavigationStartingEventArgs( - Windows.Web.UI.WebViewControlNavigationStartingEventArgs args) => - new WebViewControlNavigationStartingEventArgs(args); -#if WPF - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator WebViewControlNavigationStartingEventArgs(System.Windows.Navigation.NavigatingCancelEventArgs args) => ToWebViewControlNavigationStartingEventArgs(args); - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// . - public static WebViewControlNavigationStartingEventArgs ToWebViewControlNavigationStartingEventArgs( - System.Windows.Navigation.NavigatingCancelEventArgs args) => - new WebViewControlNavigationStartingEventArgs(args); -#endif -#if WINFORMS - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator WebViewControlNavigationStartingEventArgs(WebBrowserNavigatingEventArgs args) => ToWebViewControlNavigationStartingEventArgs(args); - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// . - public static WebViewControlNavigationStartingEventArgs ToWebViewControlNavigationStartingEventArgs( - WebBrowserNavigatingEventArgs args) => - new WebViewControlNavigationStartingEventArgs(args); -#endif - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlNewWindowRequestedEventArgs.cs b/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlNewWindowRequestedEventArgs.cs deleted file mode 100644 index 4446e173eff..00000000000 --- a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlNewWindowRequestedEventArgs.cs +++ /dev/null @@ -1,64 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Security; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// Provides data for the event. This class cannot be inherited. - /// - /// Copy from to avoid requirement to link Windows.winmd - /// - /// - public sealed class WebViewControlNewWindowRequestedEventArgs : EventArgs - { - [SecurityCritical] - private readonly Windows.Web.UI.WebViewControlNewWindowRequestedEventArgs _args; - - internal WebViewControlNewWindowRequestedEventArgs(Windows.Web.UI.WebViewControlNewWindowRequestedEventArgs args) - { - _args = args ?? throw new ArgumentNullException(nameof(args)); - } - - /// - /// Gets the Uniform Resource Identifier (URI) of the content the is attempting to navigate to. - /// - /// The Uniform Resource Identifier (URI) of the content the is attempting to navigate to. - public Uri Uri => _args.Uri; - - /// - /// Gets the Uniform Resource Identifier (URI) of the content where the navigation was initiated. - /// - /// The the Uniform Resource Identifier (URI) of the content where the navigation was initiated. - public Uri Referrer => _args.Referrer; - - /// - /// Gets or sets a value indicating whether the routed event is handled. - /// - /// if handled; otherwise, . - public bool Handled - { - get => _args.Handled; - set => _args.Handled = value; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator WebViewControlNewWindowRequestedEventArgs(Windows.Web.UI.WebViewControlNewWindowRequestedEventArgs args) => ToWebViewControlNewWindowRequestedEventArgs(args); - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static WebViewControlNewWindowRequestedEventArgs ToWebViewControlNewWindowRequestedEventArgs( - Windows.Web.UI.WebViewControlNewWindowRequestedEventArgs args) => - new WebViewControlNewWindowRequestedEventArgs(args); - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlPermissionRequest.cs b/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlPermissionRequest.cs deleted file mode 100644 index 8eb49220aa5..00000000000 --- a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlPermissionRequest.cs +++ /dev/null @@ -1,92 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Security; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// Represents a request for permissions in an . This class cannot be inherited. - /// - /// - ///

Copy from to avoid requirement to link Windows.winmd.

- ///

For more info, see the event.

- ///
- /// - public sealed class WebViewControlPermissionRequest - { - [SecurityCritical] - private readonly Windows.Web.UI.WebViewControlPermissionRequest _permissionRequest; - - internal WebViewControlPermissionRequest(Windows.Web.UI.WebViewControlPermissionRequest permissionRequest) - { - _permissionRequest = permissionRequest ?? throw new ArgumentNullException(nameof(permissionRequest)); - } - - /// - /// Gets the identifier for the permission request. - /// - /// The permission request identifier. - public uint Id => _permissionRequest?.Id ?? 0U; - - /// - /// Gets the type of the permission that's requested. - /// - /// The type of the permission that's requested. - public WebViewControlPermissionType PermissionType => (WebViewControlPermissionType)_permissionRequest.PermissionType; - - /// - /// Gets the current state of the permission request. - /// - /// The current state of the permission request. - public WebViewControlPermissionState State => (WebViewControlPermissionState)_permissionRequest.State; - - /// - /// Gets the Uniform Resource Identifier (URI) of the content where the permission request originated. - /// - /// The Uniform Resource Identifier (URI) of the content where the permission request originated. - public Uri Uri => _permissionRequest.Uri; - - /// - /// Performs an implicit conversion from to . - /// - /// The permission request. - /// The result of the conversion. - public static implicit operator WebViewControlPermissionRequest(Windows.Web.UI.WebViewControlPermissionRequest args) => ToWebViewControlPermissionRequest(args); - - /// - /// Creates a from . - /// - /// The . - /// - public static WebViewControlPermissionRequest ToWebViewControlPermissionRequest( - Windows.Web.UI.WebViewControlPermissionRequest args) => new WebViewControlPermissionRequest(args); - - /// - /// Grants the requested permission. - /// - public void Allow() - { - _permissionRequest?.Allow(); - } - - /// - /// Defers the permission request to be allowed or denied at a later time. - /// - /// - public void Defer() - { - _permissionRequest?.Defer(); - } - - /// - /// Denies the requested permission. - /// - public void Deny() - { - _permissionRequest?.Deny(); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlPermissionRequestedEventArgs.cs b/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlPermissionRequestedEventArgs.cs deleted file mode 100644 index 68bcf376553..00000000000 --- a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlPermissionRequestedEventArgs.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Security; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// Provides data for the event. This class cannot be inherited. - /// - /// Copy from to avoid requirement to link Windows.winmd - /// - /// - public sealed class WebViewControlPermissionRequestedEventArgs : EventArgs - { - [SecurityCritical] - private readonly Windows.Web.UI.WebViewControlPermissionRequestedEventArgs _args; - - internal WebViewControlPermissionRequestedEventArgs(Windows.Web.UI.WebViewControlPermissionRequestedEventArgs args) - { - _args = args; - } - - /// - /// Gets the object that contains information about the request. - /// - /// The permission request. - public WebViewControlPermissionRequest PermissionRequest => _args.PermissionRequest; - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator WebViewControlPermissionRequestedEventArgs(Windows.Web.UI.WebViewControlPermissionRequestedEventArgs args) => ToWebViewControlPermissionRequestedEventArgs(args); - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static WebViewControlPermissionRequestedEventArgs ToWebViewControlPermissionRequestedEventArgs( - Windows.Web.UI.WebViewControlPermissionRequestedEventArgs args) => - new WebViewControlPermissionRequestedEventArgs(args); - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlPermissionState.cs b/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlPermissionState.cs deleted file mode 100644 index b288feb32a7..00000000000 --- a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlPermissionState.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - // Type is a copy. Information regarding the origination of the type is in summary comments -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - /// - /// Defines constants that specify the state of a event. - /// - /// Copy from to avoid requirement to link Windows.winmd - /// - public enum WebViewControlPermissionState - { - Unknown, - Defer, - Allow, - Deny, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlPermissionType.cs b/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlPermissionType.cs deleted file mode 100644 index 64b032d01db..00000000000 --- a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlPermissionType.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// Defines constants that specify the state of a event. - /// - /// Copy from to avoid requirement to link Windows.winmd - /// - public enum WebViewControlPermissionType - { - /// - /// Permission is for geolocation. - /// - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Geolocation", Justification = "Value from WinRT type")] - Geolocation, - - /// - /// Permission is for unlimited IndexedDB data storage. - /// - UnlimitedIndexedDBQuota, - - /// - /// Permission is for media. - /// - Media, - - /// - /// Permission is for pointer lock. - /// - PointerLock, - - /// - /// Permission is for web notifications. - /// - WebNotifications, - - /// - /// Permission is for screen. - /// - Screen, - - /// - /// Permissions is for immersive view. - /// - /// New for RS5 - ImmersiveView, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlProcess.cs b/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlProcess.cs deleted file mode 100644 index 731a0de6b53..00000000000 --- a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlProcess.cs +++ /dev/null @@ -1,141 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Security; -using System.Threading.Tasks; -using Windows.Foundation; -using Windows.Foundation.Metadata; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// A proxy for . - /// - public sealed class WebViewControlProcess - { - [SecurityCritical] - private readonly Windows.Web.UI.Interop.WebViewControlProcess _process; - - /// - /// Initializes a new instance of the class. - /// - public WebViewControlProcess() - : this(new WebViewControlProcessOptions()) - { - } - - /// - /// Initializes a new instance of the class with the specified . - /// - /// The process options. - public WebViewControlProcess(WebViewControlProcessOptions processOptions) - : this(new Windows.Web.UI.Interop.WebViewControlProcess(processOptions.ToWinRtWebViewControlProcessOptions())) - { - } - - private WebViewControlProcess(Windows.Web.UI.Interop.WebViewControlProcess process) - { - _process = process ?? throw new ArgumentNullException(nameof(process)); - SubscribeEvents(); - } - - /// - /// Occurs when the underlying WWAHost process exits. - /// - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1009:DeclareEventHandlersCorrectly", Justification ="This is the declaration from WinRT")] - public event EventHandler ProcessExited = (sender, args) => { }; - - /// - /// Gets the enterprise identifier. - /// - /// The enterprise identifier. - public string EnterpriseId => _process.EnterpriseId; - - /// - /// Gets a value indicating whether this instance is private network client server capability enabled. - /// - /// true if this instance can access the private network; otherwise, false. - public bool IsPrivateNetworkClientServerCapabilityEnabled => _process.IsPrivateNetworkClientServerCapabilityEnabled; - - /// - /// Gets the process identifier (PID) of the underlying WWAHost. - /// - /// The process identifier (PID). - public uint ProcessId => _process.ProcessId; - - /// - /// Performs an implicit conversion from to . - /// - /// The process. - /// The result of the conversion. - public static implicit operator WebViewControlProcess(Windows.Web.UI.Interop.WebViewControlProcess process) => ToWebViewControlProcess(process); - - /// - /// Creates a from . - /// - /// The instance. - /// - public static WebViewControlProcess ToWebViewControlProcess( - Windows.Web.UI.Interop.WebViewControlProcess process) => new WebViewControlProcess(process); - - /// - /// Terminates the underlying WWAHost process. - /// - public void Terminate() => _process.Terminate(); - - internal async Task CreateWebViewControlHostAsync(IntPtr hostWindowHandle, Rect bounds) - { - if (hostWindowHandle == IntPtr.Zero) - { - throw new ArgumentNullException(nameof(hostWindowHandle)); - } - - var wvc = await await Task.Run(() => CreateWebViewControlAsync(hostWindowHandle, bounds)).ConfigureAwait(false); - - return new WebViewControlHost(wvc); - } - - private IAsyncOperation CreateWebViewControlAsync( - IntPtr hostWindowHandle, - Rect bounds) - { - var hwh = hostWindowHandle.ToInt64(); - return CreateWebViewControlAsync(hwh, bounds); - } - - [SecurityCritical] - private IAsyncOperation CreateWebViewControlAsync( - long hostWindowHandle, - Rect bounds) - { - Security.DemandUnmanagedCode(); - if (hostWindowHandle == 0) - { - throw new ArgumentNullException(nameof(hostWindowHandle)); - } - - return _process.CreateWebViewControlAsync(hostWindowHandle, bounds); - } - - private void OnWebViewControlProcessExited(Windows.Web.UI.Interop.WebViewControlProcess sender, object args) - { - var handler = ProcessExited; - if (handler != null) - { - handler(this, args); - } - } - - private void SubscribeEvents() - { - _process.ProcessExited += OnWebViewControlProcessExited; - } - - private void UnsubscribeEvents() - { - _process.ProcessExited -= OnWebViewControlProcessExited; - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlProcessCapabilityState.cs b/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlProcessCapabilityState.cs deleted file mode 100644 index 3d66f68cd30..00000000000 --- a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlProcessCapabilityState.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// Represents the state of the . - /// - /// Copy from to avoid requirement to link Windows.winmd - /// - public enum WebViewControlProcessCapabilityState - { - /// - /// The process is in an unknown state. - /// - Default, - - /// - /// The process is disabled. - /// - Disabled, - - /// - /// The process is enabled. - /// - Enabled, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlProcessOptions.cs b/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlProcessOptions.cs deleted file mode 100644 index fb32498b011..00000000000 --- a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlProcessOptions.cs +++ /dev/null @@ -1,70 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using Windows.Foundation.Metadata; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// This class contains options that can be set when creating a instance. - /// - /// - /// Copy from to avoid requirement to link Windows.winmd. - /// - /// - public sealed class WebViewControlProcessOptions - { - /// - /// Gets or sets the enterprise identifier for apps that are WIP-enabled. - /// - /// The enterprise identifier. - public string EnterpriseId { get; set; } - - /// - /// Gets or sets the private network client server capability. - /// - /// The private network client server capability. - public WebViewControlProcessCapabilityState PrivateNetworkClientServerCapability { get; set; } - - /// - /// Initializes a new instance of the class. - /// - public WebViewControlProcessOptions() - { - EnterpriseId = string.Empty; - PrivateNetworkClientServerCapability = WebViewControlProcessCapabilityState.Default; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The options. - /// The result of the conversion. - public static implicit operator WebViewControlProcessOptions(Windows.Web.UI.Interop.WebViewControlProcessOptions options) => ToWinRtWebViewControlProcessOptions(options); - - public static Windows.Web.UI.Interop.WebViewControlProcessOptions ToWinRtWebViewControlProcessOptions(WebViewControlProcessOptions options) - { - var retval = new Windows.Web.UI.Interop.WebViewControlProcessOptions(); - - if (!string.IsNullOrEmpty(options?.EnterpriseId) && !StringComparer.InvariantCulture.Equals(retval.EnterpriseId, options?.EnterpriseId)) - { - retval.EnterpriseId = options.EnterpriseId; - } - - retval.PrivateNetworkClientServerCapability = (Windows.Web.UI.Interop.WebViewControlProcessCapabilityState)options?.PrivateNetworkClientServerCapability; - - return retval; - } - - /// - /// Converts this instance to a instance. - /// - /// A instance. - internal Windows.Web.UI.Interop.WebViewControlProcessOptions ToWinRtWebViewControlProcessOptions() - { - return ToWinRtWebViewControlProcessOptions(this); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlScriptNotifyEventArgs.cs b/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlScriptNotifyEventArgs.cs deleted file mode 100644 index 4228941da4f..00000000000 --- a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlScriptNotifyEventArgs.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Security; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// Provides data for the event. This class cannot be inherited. - /// - /// Copy from to avoid requirement to link Windows.winmd - /// - /// - public sealed class WebViewControlScriptNotifyEventArgs : EventArgs - { - [SecurityCritical] - private readonly Windows.Web.UI.WebViewControlScriptNotifyEventArgs _args; - - internal WebViewControlScriptNotifyEventArgs(Windows.Web.UI.WebViewControlScriptNotifyEventArgs args) - { - _args = args; - } - - /// - /// Gets the Uniform Resource Identifier (URI) that originated the event. - /// - /// The Uniform Resource Identifier (URI). - public Uri Uri => _args.Uri; - - /// - /// Gets the string value passed to the app. - /// - /// The string value passed to the app. - public string Value => _args.Value; - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator WebViewControlScriptNotifyEventArgs(Windows.Web.UI.WebViewControlScriptNotifyEventArgs args) => ToWebViewControlScriptNotifyEventArgs(args); - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static WebViewControlScriptNotifyEventArgs ToWebViewControlScriptNotifyEventArgs( - Windows.Web.UI.WebViewControlScriptNotifyEventArgs args) => new WebViewControlScriptNotifyEventArgs(args); - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlSettings.cs b/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlSettings.cs deleted file mode 100644 index caf965dd2b2..00000000000 --- a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlSettings.cs +++ /dev/null @@ -1,69 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Security; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// A proxy for . This class cannot be inherited. - /// - /// - public sealed class WebViewControlSettings - { - [SecurityCritical] - private readonly Windows.Web.UI.WebViewControlSettings _settings; - - internal WebViewControlSettings(Windows.Web.UI.WebViewControlSettings settings) - { - _settings = settings ?? throw new ArgumentNullException(nameof(settings)); - } - - /// - /// Gets or sets a value indicating whether the use of IndexedDB is allowed. - /// - /// true if IndexedDB is allowed; otherwise, false. The default is true. - public bool IsIndexedDBEnabled - { - get => _settings.IsIndexedDBEnabled; - set => _settings.IsIndexedDBEnabled = value; - } - - /// - /// Gets or sets a value indicating whether the use of JavaScript is allowed. - /// - /// true if JavaScript is allowed in the ; otherwise, false. The default is true. - public bool IsJavaScriptEnabled - { - get => _settings.IsJavaScriptEnabled; - set => _settings.IsJavaScriptEnabled = value; - } - - /// - /// Gets or sets a value indicating whether is allowed. - /// - /// Whether is allowed. - public bool IsScriptNotifyAllowed - { - get => _settings.IsScriptNotifyAllowed; - set => _settings.IsScriptNotifyAllowed = value; - } - - /// - /// Performs an implicit conversion from to . - /// - /// The settings. - /// The result of the conversion. - public static implicit operator WebViewControlSettings(Windows.Web.UI.WebViewControlSettings settings) => ToWebViewControlSettings(settings); - - /// - /// Creates a from . - /// - /// The settings. - /// - public static WebViewControlSettings ToWebViewControlSettings(Windows.Web.UI.WebViewControlSettings settings) => - new WebViewControlSettings(settings); - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlUnsupportedUriSchemeIdentifiedEventArgs.cs b/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlUnsupportedUriSchemeIdentifiedEventArgs.cs deleted file mode 100644 index d1f60fc25fc..00000000000 --- a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlUnsupportedUriSchemeIdentifiedEventArgs.cs +++ /dev/null @@ -1,58 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Security; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// Provides data for the event. This class cannot be inherited. - /// - /// Copy from to avoid requirement to link Windows.winmd - /// - /// - public sealed class WebViewControlUnsupportedUriSchemeIdentifiedEventArgs : EventArgs - { - [SecurityCritical] - private readonly Windows.Web.UI.WebViewControlUnsupportedUriSchemeIdentifiedEventArgs _args; - - internal WebViewControlUnsupportedUriSchemeIdentifiedEventArgs(Windows.Web.UI.WebViewControlUnsupportedUriSchemeIdentifiedEventArgs args) - { - _args = args ?? throw new ArgumentNullException(nameof(args)); - } - - /// - /// Gets or sets a value indicating whether the routed event is handled. A value for Handled prevents other handlers along the event route from handling the same event again. - /// - /// to mark the routed event handled. to leave the routed event unhandled, which permits the event to potentially route further and be acted on by other handlers. The default is . - public bool Handled - { - get => _args.Handled; - set => _args.Handled = value; - } - - /// - /// Gets the Uniform Resource Identifier (URI) of the content the attempted to navigate to. - /// - /// The Uniform Resource Identifier (URI) of the content. - public Uri Uri => _args.Uri; - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator WebViewControlUnsupportedUriSchemeIdentifiedEventArgs(Windows.Web.UI.WebViewControlUnsupportedUriSchemeIdentifiedEventArgs args) => ToWebViewControlUnsupportedUriSchemeIdentifiedEventArgs(args); - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static WebViewControlUnsupportedUriSchemeIdentifiedEventArgs ToWebViewControlUnsupportedUriSchemeIdentifiedEventArgs( - Windows.Web.UI.WebViewControlUnsupportedUriSchemeIdentifiedEventArgs args) => - new WebViewControlUnsupportedUriSchemeIdentifiedEventArgs(args); - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlUnviewableContentIdentifiedEventArgs.cs b/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlUnviewableContentIdentifiedEventArgs.cs deleted file mode 100644 index ff97f04de00..00000000000 --- a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewControlUnviewableContentIdentifiedEventArgs.cs +++ /dev/null @@ -1,62 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Security; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - /// - /// CProvides data for the event. This class cannot be inherited. - /// - /// Copy from to avoid requirement to link Windows.winmd - /// - /// - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Unviewable", Justification = "Same as WinRT type")] - public sealed class WebViewControlUnviewableContentIdentifiedEventArgs : EventArgs - { - [SecurityCritical] - private readonly Windows.Web.UI.WebViewControlUnviewableContentIdentifiedEventArgs _args; - - internal WebViewControlUnviewableContentIdentifiedEventArgs(Windows.Web.UI.WebViewControlUnviewableContentIdentifiedEventArgs args) - { - _args = args ?? throw new ArgumentNullException(nameof(args)); - } - - /// - /// Gets the Uniform Resource Identifier (URI) of the content the attempted to load. - /// - /// The URI. - public Uri Uri => _args.Uri; - - /// - /// Gets the Uniform Resource Identifier (URI) of the page that contains the link to the unviewable content. - /// - /// The referrer. - public Uri Referrer => _args.Referrer; - - /// - /// Gets the media type of the content that cannot be viewed. - /// - /// The type of the media. - public string MediaType => _args.MediaType; - - /// - /// Performs an implicit conversion from to . - /// - /// The instance containing the event data. - /// The result of the conversion. - public static implicit operator WebViewControlUnviewableContentIdentifiedEventArgs(Windows.Web.UI.WebViewControlUnviewableContentIdentifiedEventArgs args) => ToWebViewControlUnviewableContentIdentifiedEventArgs(args); - - /// - /// Creates a from . - /// - /// The instance containing the event data. - /// - public static WebViewControlUnviewableContentIdentifiedEventArgs - ToWebViewControlUnviewableContentIdentifiedEventArgs( - Windows.Web.UI.WebViewControlUnviewableContentIdentifiedEventArgs args) => - new WebViewControlUnviewableContentIdentifiedEventArgs(args); - } -} diff --git a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewDefaults.cs b/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewDefaults.cs deleted file mode 100644 index 60a29f29ad2..00000000000 --- a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WinRT/WebViewDefaults.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - internal static class WebViewDefaults - { - public const string AboutBlank = "about:blank"; - public const string EnterpriseId = ""; - public const bool IsIndexedDBEnabled = true; - public const bool IsJavaScriptEnabled = true; - public const bool IsPrivateNetworkEnabled = false; - public const bool IsScriptNotifyEnabled = false; - public static readonly Uri AboutBlankUri = new Uri(AboutBlank); - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/Windows10Release.cs b/Microsoft.Toolkit.Win32/WebView.Shared/Interop/Windows10Release.cs deleted file mode 100644 index bfb0c119616..00000000000 --- a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/Windows10Release.cs +++ /dev/null @@ -1,52 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop -{ - /// - /// Identifies Windows 10 release IDs - /// - internal enum Windows10Release - { - /// - /// Unknown - /// - Unknown = 0, - - /// - /// 10.0.10240.0 - /// - Threshold1 = 1507, - - /// - /// 10.0.10586 - /// - Threshold2 = 1511, - - /// - /// 10.0.14393.0 (Redstone 1) - /// - Anniversary = 1607, - - /// - /// 10.0.15063.0 (Redstone 2) - /// - Creators = 1703, - - /// - /// 10.0.16299.0 (Redstone 3) - /// - FallCreators = 1709, - - /// - /// 10.0.17134.0 (Redstone 4) - /// - April2018 = 1803, - - /// - /// 10.0.17763.0 (Redstone 5) - /// - October2018 = 1809, - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WindowsVersions.cs b/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WindowsVersions.cs deleted file mode 100644 index 7c6653d8221..00000000000 --- a/Microsoft.Toolkit.Win32/WebView.Shared/Interop/WindowsVersions.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop -{ - internal enum WindowsVersions - { - Win7, - Server2008R2, // 6.1 - Win8, - Server2012, // 6.2 - Win81, - Server2012R2, // 6.3 - Win10, - Server2016, // 10.0 - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/WebView.Shared/PathUtilities.cs b/Microsoft.Toolkit.Win32/WebView.Shared/PathUtilities.cs deleted file mode 100644 index 09fcea25884..00000000000 --- a/Microsoft.Toolkit.Win32/WebView.Shared/PathUtilities.cs +++ /dev/null @@ -1,42 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.IO; - -namespace Microsoft.Toolkit.Win32.UI.Controls -{ - // Contains path parsing utilities - internal static class PathUtilities - { - // true if the character is the platform directory separator character or the alternate directory separator - public static bool IsDirectorySeparator(char c) => c == Path.DirectorySeparatorChar || c == Path.AltDirectorySeparatorChar; - - public static bool IsAbsolute(string path) - { - if (string.IsNullOrEmpty(path)) - { - return false; - } - - // "C:\" - if (IsDriveRootedAbsolutePath(path)) - { - // Including invalid paths (e.g. "*:\") - return true; - } - - // "\\machine\share" - // Including invalid/incomplete UNC paths (e.g. "\\foo") - return path.Length >= 2 && - IsDirectorySeparator(path[0]) && - IsDirectorySeparator(path[1]); - } - - // true if given path is absolute and starts with a drive specification (e.g. "C:\"); otherwise, false. - private static bool IsDriveRootedAbsolutePath(string path) - { - return path.Length >= 3 && path[1] == Path.VolumeSeparatorChar && IsDirectorySeparator(path[2]); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/WebView.Shared/Security.cs b/Microsoft.Toolkit.Win32/WebView.Shared/Security.cs deleted file mode 100644 index d2dc846dbfd..00000000000 --- a/Microsoft.Toolkit.Win32/WebView.Shared/Security.cs +++ /dev/null @@ -1,115 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Net; -using System.Security; -using System.Security.Permissions; - -namespace Microsoft.Toolkit.Win32.UI.Controls -{ - internal static class Security - { - private static SecurityPermission _unmanagedCodePermission; - - private static WebBrowserPermission _webBrowserPermission; - - internal static WebBrowserPermission CachedWebBrowserPermission - { - [SecurityCritical] - get - { - return _webBrowserPermission ?? (_webBrowserPermission = new WebBrowserPermission(PermissionState.Unrestricted)); - } - } - - [SecuritySafeCritical] - internal static bool AppDomainHasPermission(IPermission permissionToCheck) - { - var psToCheck = new PermissionSet(PermissionState.None); - psToCheck.AddPermission(permissionToCheck); - return psToCheck.IsSubsetOf(AppDomain.CurrentDomain.PermissionSet); - } - - [SecuritySafeCritical] - internal static bool CallerAndAppDomainHaveUnrestrictedWebBrowserPermission() - { - if (!AppDomainHasPermission(CachedWebBrowserPermission)) - { - return false; - } - - try - { - DemandWebBrowserPermission(); - } - catch (SecurityException) - { - return false; - } - - return true; - } - - [SecurityCritical] - internal static bool CallerHasWebPermission(Uri uri) - { - try - { - DemandWebPermission(uri); - return true; - } - catch (SecurityException) - { - return false; - } - } - - // Critical: Exception raised by a demand may contain security sensitive information - - /// - /// Demands for - /// - /// A caller higher in the call stack does not have the permission specified by the current instance.-or- A caller higher in the call stack has called on the current permission object. - [SecurityCritical] - internal static void DemandUnmanagedCode() - { - if (_unmanagedCodePermission == null) - { - _unmanagedCodePermission = new SecurityPermission(SecurityPermissionFlag.UnmanagedCode); - } - - _unmanagedCodePermission.Demand(); - } - - [SecurityCritical] - internal static void DemandWebBrowserPermission() - { - CachedWebBrowserPermission.Demand(); - } - - // Critical: Exceptions raised by a demand may contain security sensitive information - [SecurityCritical] - internal static void DemandWebPermission(Uri uri) - { - if (uri == null) - { - return; - } - - if (uri.IsFile) - { - new FileIOPermission(FileIOPermissionAccess.Read, uri.LocalPath).Demand(); - } - else - { - // As a security measure, since the code below uses a string anyway, - // sanitize the input - var finalUri = UriHelper.UriToString(uri); - - new WebPermission(NetworkAccess.Connect, finalUri).Demand(); - } - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/WebView.Shared/StringResource.cs b/Microsoft.Toolkit.Win32/WebView.Shared/StringResource.cs deleted file mode 100644 index 384cf5b744a..00000000000 --- a/Microsoft.Toolkit.Win32/WebView.Shared/StringResource.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Globalization; -using System.Resources; -using System.Threading; - -namespace Microsoft.Toolkit.Win32.UI.Controls -{ - internal sealed class StringResource - { - private static StringResource _loader; - private readonly ResourceManager _resources; - - static StringResource() - { - } - - internal StringResource() - { - _resources = DesignerUI.ResourceManager; - } - - public static ResourceManager Resources => GetLoader()?._resources; - - private static CultureInfo Culture => null; - - public static object GetObject(string name) => Resources?.GetObject(name, Culture); - - public static string GetString(string name) => Resources?.GetString(name, Culture); - - private static StringResource GetLoader() - { - if (_loader == null) - { - var r = new StringResource(); - Interlocked.CompareExchange(ref _loader, r, null); - } - - return _loader; - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/WebView.Shared/StringResourceCategoryAttribute.cs b/Microsoft.Toolkit.Win32/WebView.Shared/StringResourceCategoryAttribute.cs deleted file mode 100644 index 9bdb371e111..00000000000 --- a/Microsoft.Toolkit.Win32/WebView.Shared/StringResourceCategoryAttribute.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.ComponentModel; - -namespace Microsoft.Toolkit.Win32.UI.Controls -{ - [AttributeUsage(AttributeTargets.All)] - internal sealed class StringResourceCategoryAttribute : CategoryAttribute - { - public StringResourceCategoryAttribute(string category) - : base(category) - { - } - - protected override string GetLocalizedString(string value) => StringResource.GetString(value); - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/WebView.Shared/StringResourceDescriptionAttribute.cs b/Microsoft.Toolkit.Win32/WebView.Shared/StringResourceDescriptionAttribute.cs deleted file mode 100644 index d07d8e6d86e..00000000000 --- a/Microsoft.Toolkit.Win32/WebView.Shared/StringResourceDescriptionAttribute.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.ComponentModel; - -namespace Microsoft.Toolkit.Win32.UI.Controls -{ - [AttributeUsage(AttributeTargets.All)] - internal sealed class StringResourceDescriptionAttribute : DescriptionAttribute - { - private bool _replaced; - - public StringResourceDescriptionAttribute(string description) - : base(description) - { - } - - public override string Description - { - get - { - if (!_replaced) - { - _replaced = true; - DescriptionValue = StringResource.GetString(Description); - } - - return base.Description; - } - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/WebView.Shared/UriHelper.cs b/Microsoft.Toolkit.Win32/WebView.Shared/UriHelper.cs deleted file mode 100644 index 73f9da6e83e..00000000000 --- a/Microsoft.Toolkit.Win32/WebView.Shared/UriHelper.cs +++ /dev/null @@ -1,85 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Text; -using Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT; - -namespace Microsoft.Toolkit.Win32.UI.Controls -{ - // TODO: Place within WebBrowserUriTypeConverter - internal static class UriHelper - { - private const int MAX_PATH_LENGTH = 2048; - private const int MAX_SCHEME_LENGTH = 32; - private const int MAX_URL_LENGTH = MAX_PATH_LENGTH + MAX_SCHEME_LENGTH + 3; /*=sizeof("://")*/ - - /// - /// Converts a Uniform Resource Identifier (URI) to string. - /// - /// The Uniform Resource Identifier (URI). - /// System.String. - /// is - /// If the length of the URI exceeds 2048 characters, the first 2048 are returned. - internal static string UriToString(Uri uri) - { - if (uri == null) - { - throw new ArgumentNullException(nameof(uri)); - } - - return new StringBuilder( - uri.GetComponents( - uri.IsAbsoluteUri ? UriComponents.AbsoluteUri : UriComponents.SerializationInfoString, - UriFormat.SafeUnescaped), - MAX_URL_LENGTH).ToString(); - } - - internal static string RelativeUriToString(Uri uri) - { - if (uri == null) - { - throw new ArgumentNullException(nameof(uri)); - } - - return new StringBuilder( - uri.GetComponents( - UriComponents.PathAndQuery, - UriFormat.SafeUnescaped), - MAX_URL_LENGTH).ToString(); - } - - internal static Uri StringToUri(string source) - { - if (string.IsNullOrEmpty(source)) - { - source = WebViewDefaults.AboutBlank; - } - - if (Uri.TryCreate(source, UriKind.Absolute, out Uri result)) - { - return result; - } - - // Unrecognized URI - throw new ArgumentException(DesignerUI.E_WEBVIEW_INVALID_URI); - } - - internal static Uri StringToRelativeUri(string source) - { - if (string.IsNullOrEmpty(source)) - { - throw new ArgumentNullException(nameof(source)); - } - - if (Uri.TryCreate(source, UriKind.Relative, out Uri result)) - { - return result; - } - - // Unrecognized URI - throw new ArgumentException(DesignerUI.E_WEBVIEW_INVALID_URI); - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/WebView.Shared/UriToLocalStreamResolver.cs b/Microsoft.Toolkit.Win32/WebView.Shared/UriToLocalStreamResolver.cs deleted file mode 100644 index 6341a6eee31..00000000000 --- a/Microsoft.Toolkit.Win32/WebView.Shared/UriToLocalStreamResolver.cs +++ /dev/null @@ -1,79 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.IO; - -namespace Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT -{ - [Obsolete("Use NavigateToLocalStreamUri(Uri, IUriToStreamResolver) instead")] - internal class UriToLocalStreamResolver : IUriToStreamResolver - { - private readonly string _path; - - internal UriToLocalStreamResolver(string path) - { - _path = path; - } - - public Stream UriToStream(Uri uri) - { - var fullPath = ConvertToPath(uri); - - // TODO: Make this proper async all the way through -#pragma warning disable SCS0018 // Path traversal: injection possible in {1} argument passed to '{0}' - return File.Open(fullPath, FileMode.Open, FileAccess.Read); -#pragma warning restore SCS0018 // Path traversal: injection possible in {1} argument passed to '{0}' - } - - private string ConvertToPath(Uri uri) - { - if (uri == null) - { - throw new ArgumentNullException(nameof(uri)); - } - - // The incoming URI will be in the form of - // ms-local-stream://microsoft.win32webviewhost_xxxxxxxx_yyyyyyyyyyyyyy/content.htm - // We are only interested in the items after the application identity (x) and guid (y), e.g. "/content.htm" - // Since we must not read content from web view host - var path = UriHelper.RelativeUriToString(uri); - - if (string.IsNullOrEmpty(path)) - { - throw new ArgumentException(DesignerUI.E_WEBVIEW_INVALID_URI, nameof(uri)); - } - - // Clean up path - path = path.TrimStart(Path.AltDirectorySeparatorChar); - - if (string.IsNullOrEmpty(path)) - { - // After stripping away the separator chars, we have nothing left - // e.g. uri was "ms-local-stream://microsoft.win32webviewhost_xxxxxxxx_yyyyyyyyyyyyyy/" - throw new ArgumentException(DesignerUI.E_WEBVIEW_INVALID_URI, nameof(uri)); - } - - // This should never be the case, but guard just in case - if (PathUtilities.IsAbsolute(path)) - { - throw new ArgumentException(DesignerUI.E_WEBVIEW_INVALID_URI, nameof(uri)); - } - - // Translate forward slash into backslash for use in file paths - path = path.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar); - - var fullPath = Path.Combine(_path, path); - - // At this point there should be no relative paths (e.g. ../../file.htm) - // This check is the last guard against potential path/directory traversal attack - if (fullPath.IndexOfAny(Path.GetInvalidPathChars()) >= 0) - { - throw new ArgumentOutOfRangeException(nameof(uri)); - } - - return fullPath; - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Win32/WebView.Shared/WebBrowserUriTypeConverter.cs b/Microsoft.Toolkit.Win32/WebView.Shared/WebBrowserUriTypeConverter.cs deleted file mode 100644 index 2d57ea8accf..00000000000 --- a/Microsoft.Toolkit.Win32/WebView.Shared/WebBrowserUriTypeConverter.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.ComponentModel; -using System.Globalization; - -namespace Microsoft.Toolkit.Win32.UI.Controls -{ - /// - /// Converts a type to a type for (both WPF and WinForms) WebView controls, and vice versa. - /// - public class WebBrowserUriTypeConverter : UriTypeConverter - { - /// - /// Converts the given to the type of this converter, using the specified and information. - /// - /// An that provides a format context. - /// The to use as the current culture. - /// The to convert. - /// An that represents the converted value. - public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) - { - var uri = base.ConvertFrom(context, culture, value) as Uri; - if (uri != null && !string.IsNullOrEmpty(uri.OriginalString) && !uri.IsAbsoluteUri) - { - try - { - uri = new Uri("http://" + uri.OriginalString.Trim()); - } - catch (UriFormatException) - { - } - } - - return uri; - } - } -} \ No newline at end of file diff --git a/UnitTests/Markdown/Parse/ParseTestExtensionMethods.cs b/UnitTests/Markdown/Parse/ParseTestExtensionMethods.cs index 49946f1ec39..1305d97a556 100644 --- a/UnitTests/Markdown/Parse/ParseTestExtensionMethods.cs +++ b/UnitTests/Markdown/Parse/ParseTestExtensionMethods.cs @@ -59,6 +59,8 @@ private static void AddChild(T parent, object child) AddChild(() => ((StrikethroughTextInline)(object)parent).Inlines, (value) => ((StrikethroughTextInline)(object)parent).Inlines = value, (MarkdownInline)child); else if (parent is SuperscriptTextInline) AddChild(() => ((SuperscriptTextInline)(object)parent).Inlines, (value) => ((SuperscriptTextInline)(object)parent).Inlines = value, (MarkdownInline)child); + else if (parent is SubscriptTextInline) + AddChild(() => ((SubscriptTextInline)(object)parent).Inlines, (value) => ((SubscriptTextInline)(object)parent).Inlines = value, (MarkdownInline)child); else throw new NotSupportedException(string.Format("Unsupported type {0}", typeof(T).Name)); } diff --git a/UnitTests/Markdown/Parse/SubscriptTests.cs b/UnitTests/Markdown/Parse/SubscriptTests.cs new file mode 100644 index 00000000000..4a4a9864cfe --- /dev/null +++ b/UnitTests/Markdown/Parse/SubscriptTests.cs @@ -0,0 +1,41 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Microsoft.Toolkit.Parsers.Markdown.Blocks; +using Microsoft.Toolkit.Parsers.Markdown.Inlines; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace UnitTests.Markdown.Parse +{ + [TestClass] + public class SubscriptTests : ParseTestBase + { + [TestMethod] + [TestCategory("Parse - inline")] + public void Superscript_Tag() + { + AssertEqual( + "This is tag create test", + new ParagraphBlock().AddChildren( + new TextRunInline { Text = "This is " }, + new SubscriptTextInline().AddChildren( + new TextRunInline { Text = "tag" }), + new TextRunInline { Text = " create test" })); + } + + [TestMethod] + [TestCategory("Parse - inline")] + public void Superscript_TagWithSup() + { + AssertEqual( + "This is **tag** create test", + new ParagraphBlock().AddChildren( + new TextRunInline { Text = "This is " }, + new SubscriptTextInline().AddChildren( + new BoldTextInline().AddChildren( + new TextRunInline { Text = "tag" })), + new TextRunInline { Text = " create test" })); + } + } +} diff --git a/UnitTests/Markdown/Parse/SuperscriptTests.cs b/UnitTests/Markdown/Parse/SuperscriptTests.cs index 305f47ebade..46be3b91512 100644 --- a/UnitTests/Markdown/Parse/SuperscriptTests.cs +++ b/UnitTests/Markdown/Parse/SuperscriptTests.cs @@ -23,6 +23,19 @@ public void Superscript_Simple() new TextRunInline { Text = " create exponentials" })); } + [TestMethod] + [TestCategory("Parse - inline")] + public void Superscript_Tag() + { + AssertEqual( + "This is tag create test", + new ParagraphBlock().AddChildren( + new TextRunInline { Text = "This is " }, + new SuperscriptTextInline().AddChildren( + new TextRunInline { Text = "tag" }), + new TextRunInline { Text = " create test" })); + } + [TestMethod] [TestCategory("Parse - inline")] public void Superscript_Nested() diff --git a/UnitTests/UnitTests.csproj b/UnitTests/UnitTests.csproj index 5fd1c729d6a..bedbb2bb25c 100644 --- a/UnitTests/UnitTests.csproj +++ b/UnitTests/UnitTests.csproj @@ -159,6 +159,7 @@ + diff --git a/Windows Community Toolkit.sln b/Windows Community Toolkit.sln index fb0e4e311a7..afe96a143b7 100644 --- a/Windows Community Toolkit.sln +++ b/Windows Community Toolkit.sln @@ -52,6 +52,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTests.Notifications.Win EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{CFA75BE0-5A44-45DE-8114-426A605B062B}" ProjectSection(SolutionItems) = preProject + .editorconfig = .editorconfig build\build.cake = build\build.cake build\build.ps1 = build\build.ps1 Directory.Build.props = Directory.Build.props diff --git a/azure-pipelines.yml b/azure-pipelines.yml index bf0e0b5d573..8aad4a98fe5 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -2,6 +2,10 @@ trigger: - master - rel/* +pr: +- master +- rel/* + pool: vmImage: vs2017-win2016 @@ -27,12 +31,10 @@ steps: custom: tool arguments: install --tool-path . nbgv displayName: Install NBGV tool - condition: and(succeeded(), eq(variables['system.pullrequest.isfork'], false)) - script: nbgv cloud displayName: Set Version - condition: and(succeeded(), eq(variables['system.pullrequest.isfork'], false)) - + - powershell: .\build\Install-WindowsSdkISO.ps1 17763 displayName: Insider SDK @@ -55,4 +57,3 @@ steps: pathToPublish: .\bin\nupkg artifactType: container artifactName: Packages - condition: and(succeeded(), eq(variables['system.pullrequest.isfork'], false)) diff --git a/build/Install-WindowsSdkISO.ps1 b/build/Install-WindowsSdkISO.ps1 index e96b33d56c3..5ac8ec0be80 100644 --- a/build/Install-WindowsSdkISO.ps1 +++ b/build/Install-WindowsSdkISO.ps1 @@ -20,59 +20,18 @@ function Download-File [string] $downloadUrl, [string] $downloadName) - # The ISO file can be large (800 MB), we want to use smart caching if we can to avoid long delays - # Note that some sources explicitly disable caching, so this may not be possible - $etagFile = Join-path $outDir "$downloadName.ETag" $downloadPath = Join-Path $outDir "$downloadName.download" $downloadDest = Join-Path $outDir $downloadName $downloadDestTemp = Join-Path $outDir "$downloadName.tmp" - $headers = @{} - Write-Host -NoNewline "Ensuring that $downloadName is up to date..." - - # if the destination folder doesn't exist, delete the ETAG file if it exists - if (!(Test-Path -PathType Container $downloadDest) -and (Test-Path -PathType Container $etagFile)) - { - Remove-Item -Force $etagFile - } - - if (Test-Path $etagFile) - { - $headers.Add("If-None-Match", [System.IO.File]::ReadAllText($etagFile)) - } + Write-Host -NoNewline "Downloading $downloadName..." try { - # Dramatically speeds up download performance - $ProgressPreference = 'SilentlyContinue' - $response = Invoke-WebRequest -Headers $headers -Uri $downloadUrl -PassThru -OutFile $downloadPath -UseBasicParsing + $webclient = new-object System.Net.WebClient + $webclient.DownloadFile($downloadUrl, $downloadPath) } catch [System.Net.WebException] - { - $response = $_.Exception.Response - } - - if ($response.StatusCode -eq 200) - { - Unblock-File $downloadPath - [System.IO.File]::WriteAllText($etagFile, $response.Headers["ETag"]) - - $downloadDestTemp = $downloadPath; - - # Delete and rename to final dest - if (Test-Path -PathType Container $downloadDest) - { - [System.IO.Directory]::Delete($downloadDest, $true) - } - - Move-Item -Force $downloadDestTemp $downloadDest - Write-Host "Updated $downloadName" - } - elseif ($response.StatusCode -eq 304) - { - Write-Host "Done" - } - else { Write-Host Write-Warning "Failed to fetch updated file from $downloadUrl" @@ -86,6 +45,19 @@ function Download-File } } + Unblock-File $downloadPath + + $downloadDestTemp = $downloadPath; + + # Delete and rename to final dest + if (Test-Path -PathType Container $downloadDest) + { + [System.IO.Directory]::Delete($downloadDest, $true) + } + + Move-Item -Force $downloadDestTemp $downloadDest + Write-Host "Done" + return $downloadDest } diff --git a/build/build.cake b/build/build.cake index b3b488eb0c5..9a948ce69e8 100644 --- a/build/build.cake +++ b/build/build.cake @@ -27,7 +27,6 @@ var inheritDocVersion = "1.1.1.1"; var baseDir = MakeAbsolute(Directory("../")).ToString(); var buildDir = baseDir + "/build"; var Solution = baseDir + "/Windows Community Toolkit.sln"; -var win32Solution = baseDir + "/Microsoft.Toolkit.Win32/Microsoft.Toolkit.Win32.sln"; var toolsDir = buildDir + "/tools"; var binDir = baseDir + "/bin"; @@ -155,7 +154,6 @@ Task("Build") .WithTarget("Restore"); MSBuild(Solution, buildSettings); - MSBuild(win32Solution, buildSettings); EnsureDirectoryExists(nupkgDir); @@ -168,7 +166,6 @@ Task("Build") .WithTarget("Build") .WithProperty("GenerateLibraryLayout", "true"); - MSBuild(win32Solution, buildSettings); MSBuild(Solution, buildSettings); }); @@ -216,7 +213,6 @@ Task("Package") .WithProperty("PackageOutputPath", nupkgDir); MSBuild(Solution, buildSettings); - MSBuild(win32Solution, buildSettings); // Build and pack C++ packages buildSettings = new MSBuildSettings diff --git a/contributing.md b/contributing.md index 9c12656b89c..8b7bb40bfa4 100644 --- a/contributing.md +++ b/contributing.md @@ -36,10 +36,9 @@ For every contribution, you must: * target master branch (or an appropriate release branch if appropriate for a bug fix) * If adding a new feature - * Before starting coding, **you should open an uservoice entry** under "Windows Community Toolkit" on [Uservoice](https://wpdev.uservoice.com/forums/110705-universal-windows-platform/category/193402-uwp-community-toolkit) and start discussing with the community to see if your idea/feature is interesting enough. - * Add or update a documentation page in the [documentation folder](https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/docs) which should follow the [documentation template](https://github.com/windows-toolkit/WindowsCommunityToolkit/blob/master/docs/.template.md). Once validated, your documentation will be visible [here](https://docs.microsoft.com/en-us/windows/uwpcommunitytoolkit/) + * Before starting coding, **you should open an uservoice entry** under "Windows Community Toolkit" on [Uservoice](https://wpdev.uservoice.com/forums/110705-universal-windows-platform/category/193402-uwp-community-toolkit) and start discussing with the community to see if your idea/feature is interesting enough. * Add or update a sample for the [Sample app](https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.SampleApp) - * If creating a new sample, create a new icon by following the [Thumbnail Style Guide and templates](https://github.com/windows-toolkit/WindowsCommunityToolkit-design-assets) + * If creating a new sample, create a new icon by following the [Thumbnail Style Guide and templates](https://github.com/Microsoft/UWPCommunityToolkit-design-assets) * Add or update unit tests (if applicable) @@ -47,6 +46,16 @@ PR has to be validated by at least two core members before being merged. Once merged, you can get a pre-release package of the toolkit by adding this ([Nuget repo](https://dotnet.myget.org/F/uwpcommunitytoolkit/api/v3/index.json) | [Gallery](https://dotnet.myget.org/gallery/uwpcommunitytoolkit)) to your Visual Studio. +### Adding Documentation + +Documentation is **required** when adding, removing, or updating a control or an API. To update the documentation, you must submit a seperate Pull Request in the [documentation repository](https://github.com/MicrosoftDocs/WindowsCommunityToolkitDocs) (use the *master* branch). **Both Pull Requests (code and docs) must be approved by the core team before either one is merged.** + +Make sure to update both Pull Requests with a link to each other. + +If adding a new documentation page: +* Copy the [documentation template](https://github.com/MicrosoftDocs/WindowsCommunityToolkitDocs/blob/master/docs/.template.md) and follow the same format. +* Update the [Table of Contents](https://github.com/MicrosoftDocs/WindowsCommunityToolkitDocs/blob/master/docs/toc.md) to point to the new page + ## Quality assurance for pull requests for XAML controls We encourage developers to follow the following guidances when submitting pull requests for controls: * Your control must be usable and efficient with keyboard only diff --git a/docs/.template.md b/docs/.template.md deleted file mode 100644 index ed8df9ab925..00000000000 --- a/docs/.template.md +++ /dev/null @@ -1,127 +0,0 @@ ---- -title: -author: GitHub_UserName -description: describe your control in one sentence -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, your control name -dev_langs: - - csharp ---- - - - - - -# Title - -The [Control Name](API-Link) ... - - - - -## Syntax - -```csharp - -``` - - -```xaml - -``` - -## Sample Output - - - -## Properties - - - -| Property | Type | Description | -| -- | -- | -- | -| A | bool | Description | -| B | int | Description | - - - -## Methods - - - -| Methods | Return Type | Description | -| -- | -- | -- | -| A(int) | bool | Description | -| B(float, string) | int | Description | - - - -## Events - - - -| Events | Description | -| -- | -- | -| A | Description | -| B | Description | - - - -## Examples - - - - - -## Sample Code - - -[control/helper name sample page Source](sample-page-link). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Requirements - -| Device family | Universal, MinVersion or higher | -| -- | -- | -| Namespace | | -| NuGet package | [NuGet package](NuGet-package-link) | - - - - - - -## API Source Code - -- [control/helper name source code](source-code-link) - -## Related Topics - - - -- [Topic 1](link) -- [Topic 2](link) diff --git a/docs/Getting-Started.md b/docs/Getting-Started.md deleted file mode 100644 index bce3322d0e6..00000000000 --- a/docs/Getting-Started.md +++ /dev/null @@ -1,47 +0,0 @@ ---- -title: Getting Started with the Windows Community Toolkit -author: nmetulev -description: Overview of how to get started with the Windows Community Toolkit to build amazing UWP apps -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, get started, visual studio ---- - -# Getting Started with the Windows Community Toolkit - -The toolkit is available as NuGet packages that can be added to any existing or new project using Visual Studio. - -1. Download [Visual Studio 2017](https://developer.microsoft.com/en-us/windows/downloads) and ensure you choose the **Universal Windows Platform development** Workload in the Visual Studio installer. - - > [!NOTE] - Visual Studio 2015 is not supported with the Windows Community Toolkit 2.0 or higher - -2. Open an existing project, or create a new project using the Blank App template under Visual C# -> Windows -> Universal. **Important**: Build 15063 or higher is supported by current version of the Toolkit. - -3. In Solution Explorer panel, right click on your project name and select **Manage NuGet Packages**. Search for **Microsoft.Toolkit.UWP**, and choose your desired [NuGet Packages](Nuget-Packages.md) from the list. - - ![NuGet Packages](resources/images/ManageNugetPackages.png "Manage NuGet Packages Image") - -4. Add a reference to the toolkit in your XAML pages or C# - - * In your XAML page, add a reference at the top of your page - - ```xaml - xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls" - ``` - - * In your C# page, add the namespaces to the toolkit - - ```c# - using Microsoft.Toolkit.Uwp; - ``` - - -5. You can copy and paste code snippets for each feature from the [Windows Community Toolkit Sample App](http://aka.ms/uwptoolkitapp). - -## Other Resources - -Download the [Windows Community Toolkit Sample App](http://aka.ms/uwptoolkitapp) from the Windows store to see the controls in an actual app. - -We recommend developers new to UWP visit the [Getting Started with UWP Development](https://developer.microsoft.com/en-us/windows/getstarted) pages on the Developer portal. - -Visit the [Windows Community Toolkit Github Repository](http://aka.ms/uwptoolkit) to see the current source code, what is coming next, and to clone the repository. Community contributions are welcome! - diff --git a/docs/Nuget-Packages.md b/docs/Nuget-Packages.md deleted file mode 100644 index 7f53451ae0e..00000000000 --- a/docs/Nuget-Packages.md +++ /dev/null @@ -1,49 +0,0 @@ ---- -title: Windows Community Toolkit Nuget Packages -author: nmetulev -description: The Windows Community Toolkit is updated regularly with new controls, services, APIs, and more importantly, bug fixes. Make sure to regularly update your nuget packages -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, nuget, visual studio ---- - -# Windows Community Toolkit Nuget Packages - -NuGet is a standard package manager for .Net applications that is built into Visual Studio. From your open solution choose the *Tools* menu, *NuGet Package Manager*, *Manage NuGet packages for solution...* to open the UI. Enter one of the package names below to search for it online. - -| NuGet Package Name | Description | -| --- | --- | -| Microsoft.Toolkit | .NET Standard NuGet package containing common code | -| Microsoft.Toolkit.Parsers | .NET Standard NuGet package containing cross-platform parsers, such as Markdown and RSS | -| Microsoft.Toolkit.Services | .NET Standard NuGet package containing cross-platform services | -| Microsoft.Toolkit.Uwp | Main NuGet package includes code only helpers such as Colors conversion tool, Storage file handling, a Stream helper class, etc. | -| Microsoft.Toolkit.Uwp.Notifications | Notifications Package - Generate tile, toast, and badge notifications for Windows 10 via code. Includes intellisense support to avoid having to use the XML syntax. | -| Microsoft.Toolkit.Uwp.Notifications.Javascript | Notification Packages for JavaScript | -| Microsoft.Toolkit.Uwp.Services | Services Package - This NuGet package includes the service helpers for Facebook, LinkedIn, Microsoft Graph, Twitter and more | -| Microsoft.Toolkit.Uwp.UI | UI Packages - Brushes, XAML converters, Visual tree extensions, and other extensions and helpers for your XAML UI. | -| Microsoft.Toolkit.Uwp.UI.Animations | Animations and Composition behaviors such as Blur, Fade, Rotate, etc. | -| Microsoft.Toolkit.Uwp.UI.Controls | XAML Controls such as RadialGauge, RangeSelector, etc. | -| Microsoft.Toolkit.Uwp.UI.Controls.DataGrid | XAML DataGrid control | -| Microsoft.Toolkit.Uwp.Connectivity | API helpers such as BluetoothLEHelper and Networking | -| Microsoft.Toolkit.Uwp.DeveloperTools | XAML user controls and services to help developer building their app | - - -## Search in Visual Studio - -Searching in Visual Studio package manager you should see a list similar to the one below (version numbers may be different, but names should be the same). - -![NuGet packages](resources/images/NugetPackages.png "Nuget Packages") - -## Update Nuget Packages - -The Windows Community Toolkit is updated regularly with new controls, services, APIs, and more importantly, bug fixes. To make sure you are on the latest version, open your project in Visual Studio, choose the **Tools** menu, select **NuGet Package Manager** -> **Manage NuGet Packages for Solution...** and select the *Updates* tab. Select the package you want to update and click Instal to update to the latest version. - -## Getting Started - -Read the [getting Started with the Windows Community Toolkit](getting-started.md) for more instructions on using these NuGet Packages in your own projects. - -## Windows 10 Store App - -Want to see the controls and animations in action before jumping into the code? We have published the [Windows Community Toolkit Sample App](http://aka.ms/uwptoolkitapp) to the Windows 10 store. Download the app and play with the controls live to see what they do before ever writing a line of code. - -## GitHub Repository - -Visit the [Windows Community Toolkit Github Repository](http://aka.ms/uwptoolkit) to see the current source code, what is coming next, and to clone the repository. Community contributions are welcome! diff --git a/docs/Toolbox-Support.md b/docs/Toolbox-Support.md deleted file mode 100644 index 2343c201a06..00000000000 --- a/docs/Toolbox-Support.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -title: Windows Community Toolkit controls in the Visual Studio Toolbox -author: nmetulev -description: Adding the Windows Community Toolkit to your Visual Studio Toolbox simplifies the development workflow with the Visual Studio designer -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, visual studio, toolbox ---- - -> [!NOTE] -Starting with version 2.1, the Windows Community Toolkit controls will be automatically available in the Visual Studio Toolbox as soon as the NuGet package is installed. - -# Adding the Windows Community Toolkit to your Visual Studio Toolbox (for version 2.0 or below) - -Add the Windows Community Toolkit controls into the Visual Studio toolbox by following these steps: - -1) Add the *Microsoft.Toolkit.Uwp.UI.Controls* NuGet package to your application. - -2) Open any XAML page and select the Toolbox on the left side of Visual Studio. - -3) Right click in a blank area and select *Add Tab*. Name the tab *Windows Community Toolkit Controls*. - -4) Right click in the tab you just created and select *Choose Items...*. Then select *Browse* from the *Choose Toolbox Items* dialog and navigate to the folder on your machine: - - ``` - c:\Users\%USERNAME%\.nuget\packages\Microsoft.Toolkit.Uwp.UI.Controls\ - ``` - -a. Choose the folder name matching the version you have installed, then continue to the *lib\uap10.0* folder and select the *Microsoft.Toolkit.Uwp.UI.Controls.dll* file. You should end up with a dialog similar to the one shown below. - -![UI Toolbox Items](resources/images/choosetoolboxitems.png "Choose Toolbox Image") - -5) Your toolbox should now have a list of UI Controls from the toolkit that you can drag and drop onto your XAML surfaces. - -![Completed Toolbox Items](resources/images/toolboxfinal.png "Toolbox Final Image") - diff --git a/docs/animations/AnimationSet.md b/docs/animations/AnimationSet.md deleted file mode 100644 index 7b095b16c16..00000000000 --- a/docs/animations/AnimationSet.md +++ /dev/null @@ -1,188 +0,0 @@ ---- -title: AnimationSet class -author: Vijay-Nirmal -description: The AnimationSet class defines an object for storing and managing Storyboard and CompositionAnimations for an element -keywords: windows 10, uwp, windows community toolkit, uwp toolkit, animationset, animationset class -dev_langs: - - csharp - - vb ---- - -# AnimationSet - -The AnimationSet class defines an object for storing and managing Storyboard and CompositionAnimations for an element. AnimationSet includes [Blur](Blur.md), [Fade](Fade.md), [Light](Light.md), [Offset](Offset.md), [Rotate](Rotate.md), [Saturation](Saturation.md) and [Scale](Scale.md) animations. AnimationSet animations is applied to all the XAML elements in its parent control/panel. AnimationSet animations doesn't affect the functionality of the control. - -## Syntax - -```xaml - - - - - - - - - -``` - -```csharp -var anim = MyUIElement.Light(5).Offset(offsetX: 100, offsetY: 100).Saturation(0.5).Scale(scaleX: 2, scaleY: 2); -anim.SetDurationForAll(2500); -anim.SetDelay(250); -anim.Start(); -``` -```vb -Dim anim = MyUIElement.Light(5).Offset(offsetX:=100, offsetY:=100).Saturation(0.5).Scale(scaleX:=2, scaleY:=2) -anim.SetDurationForAll(2500) -anim.SetDelay(250) -anim.Start() -``` - -## Sample Output - -![AnimationSet animations](../resources/images/Animations/Chaining-Animations-Light-Offset-Saturation-Scale.gif) - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| Element | UIElement | Gets the UIElement | -| State | [AnimationSetState](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.animations.animationsetstate) | Gets the current state of the AnimationSet | -| UseComposition | Boolean | Gets or sets a value indicating whether composition must be use even on SDK > 10586 | -| Visual | Visual | Gets the Visual object that backs the XAML element | - -### EasingType - -You can change the way how the animation interpolates between keyframes by defining the EasingType. - -| EasingType | Explanation | Graphical Explanation | -| ---------- | ---------------------------------------------------------------------------------------------------------- | ------------------------------------------ | -| Default | Creates an animation that accelerates with the default EasingType which is specified in AnimationExtensions.DefaultEasingType which is by default Cubic | | -| Linear | Creates an animation that accelerates or decelerates linear | | -| Back | Retracts the motion of an animation slightly before it begins to animate in the path indicated | ![BackEase](https://docs.microsoft.com/dotnet/framework/wpf/graphics-multimedia/media/backease-graph.png) | -| Bounce | Creates a bouncing effect | ![BounceEase](https://docs.microsoft.com/dotnet/framework/wpf/graphics-multimedia/media/bounceease-graph.png) | -| Circle | Creates an animation that accelerates or decelerates using a circular function | ![CircleEase](https://docs.microsoft.com/dotnet/framework/wpf/graphics-multimedia/media/circleease-graph.png) | -| Cubic | Creates an animation that accelerates or decelerates using the formula f(t) = t3 | ![CubicEase](https://docs.microsoft.com/dotnet/framework/wpf/graphics-multimedia/media/cubicease-graph.png) | -| Elastic | Creates an animation that resembles a spring oscillating back and forth until it comes to rest | ![ElasticEase](https://docs.microsoft.com/dotnet/framework/wpf/graphics-multimedia/media/elasticease-graph.png) | -| Quadratic | Creates an animation that accelerates or decelerates using the formula f(t) = t2 | ![QuadraticEase](https://docs.microsoft.com/dotnet/framework/wpf/graphics-multimedia/media/quadraticease-graph.png) | -| Quartic | Creates an animation that accelerates or decelerates using the formula f(t) = t4 | ![QuarticEase](https://docs.microsoft.com/dotnet/framework/wpf/graphics-multimedia/media/quarticease-graph.png) | -| Quintic | Create an animation that accelerates or decelerates using the formula f(t) = t5 | ![QuinticEase](https://docs.microsoft.com/dotnet/framework/wpf/graphics-multimedia/media/quinticease-graph.png) | -| Sine | Creates an animation that accelerates or decelerates using a sine formula | ![SineEase](https://docs.microsoft.com/dotnet/framework/wpf/graphics-multimedia/media/sineease-graph.png) | - -## Methods - -| Methods | Description | -| -- | -- | -| AddCompositionAnimation(String, CompositionAnimation) | Adds a composition animation to be run on StartAsync() | -| AddCompositionDirectPropertyChange(String, Object) | Adds a composition property that will change instantaneously | -| AddCompositionEffectAnimation(CompositionObject, CompositionAnimation, String) | Adds a composition effect animation to be run on backing Visual | -| AddStoryboardAnimation(String, Timeline) | Adds a storyboard animation to be run | -| Dispose() | Dispose resources | -| RemoveCompositionAnimation(String) | Removes a composition animation from being run on Visual property | -| RemoveCompositionDirectPropertyChange(String) | Removes a composition property change | -| SetDelay(Double) | Ovewrites the delay time on all animations after last Then() to the specified value | -| SetDelay(TimeSpan) | Ovewrites the delay time on all animations after last Then() to the specified value | -| SetDelayForAll(Double)| Ovewrites the delay time on all animations to the specified value | -| SetDelayForAll(TimeSpan) | Ovewrites the delay time on all animations to the specified value | -| SetDuration(Double) | Ovewrites the duration on all animations after last Then() to the specified value | -| SetDuration(TimeSpan) | Ovewrites the duration on all animations after last Then() to the specified value | -| SetDurationForAll(Double) | Ovewrites the duration on all animations to the specified value | -| SetDurationForAll(TimeSpan) | Ovewrites the duration on all animations to the specified value | -| Start() | Stats all animations. This method is not awaitable. | -| StartAsync() | Starts all animations and returns an awaitable task | -| Stop() | Stops all animations | -| Then() | Wait for existing animations to complete before running new animations | - -## Events - -| Events | Description | -| -- | -- | -| Completed | Occurs when all animations have completed | - -## Examples - -- AnimationSet has endless possibility. Here is an example of creating popup effect - - **Sample Code** - - ```csharp - FrameworkElement preElement = null; - private void MyUIElement_PointerEntered(object sender, PointerRoutedEventArgs e) - { - preElement = sender as FrameworkElement; - preElement.Blur(value: 0).Fade(value: 1).Scale(centerX: 100, centerY: 100, easingType: EasingType.Sine) - .SetDurationForAll(500) - .Start(); - } - - private void MyUIElement_PointerExited(object sender, PointerRoutedEventArgs e) - { - if (preElement != null) - { - preElement.Blur(value: 0).Fade(value: 0.1f).Scale(scaleX: 0.5f, scaleY: 0.5f, centerX: 100, centerY: 100, easingType: EasingType.Sine) - .SetDurationForAll(500) - .Start(); - } - } - ``` - ```vb - Private Sub MyUIElement_PointerEntered(ByVal sender As Object, ByVal e As PointerRoutedEventArgs) - preElement = TryCast(sender, FrameworkElement) - preElement.Blur(value:=0).Fade(value:=1).Scale(centerX:=100, centerY:=100, easingType:=EasingType.Sine).SetDurationForAll(500).Start() - End Sub - - Private Sub MyUIElement_PointerExited(ByVal sender As Object, ByVal e As PointerRoutedEventArgs) - If preElement IsNot Nothing Then - preElement.Blur(value:=0).Fade(value:=0.1F).Scale(scaleX:=0.5F, scaleY:=0.5F, centerX:=100, centerY:=100, easingType:=EasingType.Sine).SetDurationForAll(500).Start() - End If - End Sub - ``` - - **Sample Output** - - ![Use Case 1 Output](../resources/images/Animations/AnimationSet/Use-Case-1.gif) -- Use `Then()` to create a successive animation - - **Sample Code** - - ```csharp - MyUIElement.Blur(value: 10).Fade(value: 0.5f) - .Then() - .Fade(value: 1).Scale(scaleX: 2, scaleY: 2, centerX: 100, centerY: 100, easingType: EasingType.Sine) - .SetDurationForAll(2500) - .Start(); - ``` - ```vb - MyUIElement.Blur(value:=10) _ - .Fade(value:=0.5F) _ - .[Then]() _ - .Fade(value:=1) _ - .Scale(scaleX:=2, scaleY:=2, centerX:=100, centerY:=100, easingType:=EasingType.Sine) _ - .SetDurationForAll(2500) _ - .Start() - ``` - - **Sample Output** - - ![Use Case 2 Output](../resources/images/Animations/AnimationSet/Use-Case-2.gif) - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| ---------------------------------------------------------------- | ----------------------------------- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Animations | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Animations](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Animations/) | - -## API - -* [AnimationSet source code](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.UI.Animations) - -## Related - -- [ ClAnimationSetCompletedEventArgsass](hTopicsttps://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.animations.animationsetcompletedeventargs) - -- [ Class](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.animations.animationextensions) -AnimationExtensions \ No newline at end of file diff --git a/docs/animations/Blur.md b/docs/animations/Blur.md deleted file mode 100644 index 9dff783e857..00000000000 --- a/docs/animations/Blur.md +++ /dev/null @@ -1,124 +0,0 @@ ---- -title: Blur animation behavior -author: nmetulev -description: The Windows Community Toolkit Blur animation behavior selectively blurs a XAML element by increasing or decreasing pixel size -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, blur, blur animation -dev_langs: - - csharp - - vb ---- - -# Blur - -The [Blur animation](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.animations.animationextensions.blur) blurs a XAML element by increasing or decreasing pixel size. Blur animation is applied to all the XAML elements in its parent control/panel. Blur animation doesn't affect the functionality of the control. - -## Syntax - -```xaml - - - - - -``` - -```csharp -MyUIElement.Blur(value: 5, duration: 2500, delay: 250).Start(); -await MyUIElement.Blur(value: 5, duration: 2500, delay: 250).StartAsync(); // Blur animation can be awaited -``` -```vb -MyUIElement.Blur(value:=5, duration:=2500, delay:=250).Start() -Await MyUIElement.Blur(value:=5, duration:=2500, delay:=250).StartAsync() ' Blur animation can be awaited -``` - -## Sample Output - -![Blur Behavior animation](../resources/images/Animations/Blur/Sample-Output.gif) - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| Value | double | The blur amount | -| Duration | double | The duration in milliseconds | -| Delay | double | The delay for the animation to begin | - -## Methods - -| Methods | Return Type | Description | -| -- | -- | -- | -| Blur(AnimationSet, Double, Double, Double) | AnimationSet | Animates the gaussian blur of the the UIElement | -| Blur(FrameworkElement, Double, Double, Double) | AnimationSet | Animates the gaussian blur of the the UIElement | - -## Examples - -- Use this to shift the focus to foreground controls. - - **Sample Code** - - ```xaml - - - - - - - - - - - ``` - - **Sample Output** - - ![Use Case 1 Output](../resources/images/Animations/Blur/Use-Case-1.gif) - -- Use this to create chaining animations with other animations. Visit the [AnimationSet](AnimationSet.md) documentation for more information. - - **Sample Code** - - ```csharp - var anim = MyUIElement.Blur(5).Fade(0.5f).Rotate(30); - anim.SetDurationForAll(2500); - anim.SetDelay(250); - anim.Completed += animation_completed; - anim.Start(); - ``` - ```vb - Dim anim = MyUIElement.Blur(5).Fade(0.5F).Rotate(30) - anim.SetDurationForAll(2500) - anim.SetDelay(250) - AddHandler anim.Completed, AddressOf animation_completed - anim.Start() - ``` - - **Sample Output** - - ![Use Case 2 Output](../resources/images/Animations/Chaining-Animations-Blur-Fade-Rotate.gif) - -## Sample Project - -[Blur Behavior Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Blur). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ) - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| ---------------------------------------------------------------- | ----------------------------------- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Animations | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Animations](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Animations/) | - -## API - -* [Blur source code](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors/Blur.cs) - -## Related Topics - -- [AnimationSet Class](https://docs.microsoft.com/windows/communitytoolkit/animations/animationset) -- [CompositionEffectBrush Class](https://docs.microsoft.com/uwp/api/Windows.UI.Composition.CompositionEffectBrush) diff --git a/docs/animations/CompositionAnimations.md b/docs/animations/CompositionAnimations.md deleted file mode 100644 index 2b1639e627e..00000000000 --- a/docs/animations/CompositionAnimations.md +++ /dev/null @@ -1,163 +0,0 @@ ---- -title: Composition Animations in XAML -author: nmetulev -description: The Composition Animations can be used directly from XAML including with Implicit animations -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, composition animations, animation, implicit animations, XAML, implicit, composition ---- - -# Composition Animations in XAML - -[Composition animations](https://docs.microsoft.com/windows/uwp/composition/composition-animation) in the universal windows platform provide a powerful and efficient way to run animations in your application UI and have been designed to ensure that your animations run at 60 FPS independent of the UI thread. - -These XAML elements enable developer to specify composition animations directly in their XAML code to enable scenarios such as Implicit animations - -## Syntax - -```xaml - - - - - - -``` - -## Animations - -### Animation Types - -| Animation Type | Accepted KeyFrame type | Description | -| -- | -- | -- | -| ScalarAnimation | ScalarKeyFrame and ExpressionKeyFrame | Animation that animates a scalar (double) value | -| Vector2Animation | Vector2KeyFrame and ExpressionKeyFrame | Animation that animates a value of type [Vector2](https://docs.microsoft.com/uwp/api/Windows.Foundation.Numerics.Vector2) ("0" or "0, 0") | -| Vector3Animation | Vector3KeyFrame and ExpressionKeyFrame | Animation that animates a value of type [Vector3](https://docs.microsoft.com/uwp/api/Windows.Foundation.Numerics.Vector3) ("0" or "0, 0, 0") | -| Vector4Animation | Vector4KeyFrame and ExpressionKeyFrame | Animation that animates a value of type [Vector4](https://docs.microsoft.com/uwp/api/Windows.Foundation.Numerics.Vector4) ("0" or "0, 0, 0, 0") | -| OpacityAnimation | ScalarKeyFrame and ExpressionKeyFrame | ScalarAnimation where `Target = "Opacity". Animates the Visual.Opacity property | -| RotationAnimation | ScalarKeyFrame and ExpressionKeyFrame | ScalarAnimation where `Target = "RotationAngle". Animates the Visual.RotationAngle property | -| RotationInDegreesAnimation | ScalarKeyFrame and ExpressionKeyFrame | ScalarAnimation where `Target = "RotationAngleInDegrees". Animates the Visual.RotationAngleInDegrees property | -| ScaleAnimation | Vector3KeyFrame and ExpressionKeyFrame | Vector3Animation where `Target = "Scale". Animates the Visual.Scale property | -| TranslationAnimation | Vector3KeyFrame and ExpressionKeyFrame | Vector3Animation where `Target = "Translation". Animates the Visual.Translation property | -| OffsetAnimations | Vector3KeyFrame and ExpressionKeyFrame | Vector3Animation where `Target = "Offset". Animates the Visual.Offset property | - -### Animation Properties - -| Property | Type | Description | -| -- | -- | -- | -| Duration | TimeSpan | The duration of the animation. Default is 400ms | -| Delay | TimeSpan | The delay before starting the animation. Default is 0ms | -| KeyFrames | KeyFrameCollection | Key frames for the animation. Each animation will only use the appropriate type KeyFrame and ExpressionKeyFrame | -| Target | string | The property to animate | -| ImplicitTarget | string | The property that, if changed, will invoke this animation. This property is only used when specifying Implicit Animations. If this value is not set, it will default to the **Target** property | -| From | T | Setting this value will insert a new key frame at Key 0 | -| To | T | Setting this value will insert a new key frame at Key 1 | - -## KeyFrames - -KeyFrames permit more than one target value that is reached at a point along the animation timeline. In other words each key frame can specify a different intermediate value. - -### KeyFrame Types - -| KeyFrame Type | Description | -| -- | -- | -| ExpressionKeyFrame | A KeyFrame of type string | -| ScalarKeyFrame | A KeyFrame of type double | -| Vector2KeyFrame | A KeyFrame of type string representing a Vector2 ("0" or "0, 0") | -| Vector3KeyFrame | A KeyFrame of type string representing a Vector3 ("0" or "0, 0, 0") | -| Vector4KeyFrame | A KeyFrame of type string representing a Vector4 ("0" or "0, 0, 0, 0") | - -### KeyFrame Properties - -| Property | Type | Description | -| -- | -- | -- | -| Key | double | A value between 0.0 and 1.0 | -| Value | T | The value that should be reached at specified Key | - -## AnimationCollection - -A collection of animations. - -### AnimationCollection Properties - -| Property | Type | Description | -| -- | -- | -- | -| ContainsTranslationAnimation | bool | True if any of the animations in the collection target the **Visual.Translation** property | - -### AnimationCollection Events - -| Events | Description | -| -- | -- | -| AnimationCollectionChanged | Raised when an animation has been added, removed, or a value of an animation has changed | - -## Examples - -> [!NOTE] -Use [Implicit Composition Animations in XAML](https://docs.microsoft.com/windows/communitytoolkit/animations/implicitanimations) to run these animations. - -Let's create some plain animation first. Theses animation will run when the `Target` property is changed. - -- Creating a `ScalarAnimation`. ScalarAnimation can target Opacity, RotationAngle, RotationAngleInDegrees, Translation.X, Translation.Y, Translation.Z. - ```xaml - - ``` -- Creating a `Vector2Animation`. Vector2Animation can target AnchorPoint, RelativeSizeAdjustment, Size. - ```xaml - - ``` -- Creating a `Vector3Animation`. Vector3Animation can target CenterPoint, Offset, RelativeOffsetAdjustment, RotationAxis, Scale, Translation. - ```xaml - - ``` -- Creating a animation that takes final value as `To` value. If you didn't set From/To value or any KeyFrames then in this case, an ExpressionKeyFrame will be added of `Value="this.FinalValue"`. - ```xaml - - ``` - > [!NOTE] - OffsetAnimations is equivalent to setting `Target = "Offset"` in Vector3Animation. So there is no Target property. -- Creating an animation which runs when another property changes. You can use `ImplicitTarget`. Whenever ImplicitTarget property changes the animation will run. In this example, if Offset changes then the ScaleAnimation will run. - ```xaml - - ``` - > [!NOTE] - If `ImplicitTarget` is set then the animation will no longer run when `Target` property is changed. - -Now we can add KeyFrames - -- Creating a blink and disappear animation with OpacityAnimation. To create a blink animation, we need to reduce and increase the opacity. - ```xaml - - - - - - - ``` - **Sample Output** - ![Example Output](../resources/images/Animations/CompositionAnimations/Example-Output-1.gif) -- You can use ExpressionKeyFrame to specify expression to create [ExpressionAnimation](https://docs.microsoft.com/uwp/api/Windows.UI.Composition.ExpressionAnimation). - ```xaml - - - - ``` - -## Sample Code - -[Implicit Composition Animations in XAML sample page source](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Implicit%20Animations/ImplicitAnimationsPage.xaml). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| ---------------------------------------------------------------- | ----------------------------------- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Animations | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Animations](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Animations/) | - -## API - -* [Composition animations source code](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.UI.Animations/CompositionAnimations) - -## Related Topics - -- [Visual layer](https://docs.microsoft.com/windows/uwp/composition/visual-layer) -- [Composition animations](https://docs.microsoft.com/windows/uwp/composition/composition-animation) -- [ExpressionAnimation](https://docs.microsoft.com/uwp/api/Windows.UI.Composition.ExpressionAnimation) diff --git a/docs/animations/ConnectedAnimations.md b/docs/animations/ConnectedAnimations.md deleted file mode 100644 index c76424929d2..00000000000 --- a/docs/animations/ConnectedAnimations.md +++ /dev/null @@ -1,143 +0,0 @@ ---- -title: Connected Animations XAML Attached Properties -author: nmetulev -description: The Connected Animation XAML Attached Properties enable connected animations to be defined in your XAML code -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, connected animations, animation, coordinated animations ---- - -# Connected Animations XAML Attached Properties - -[Connected animations](https://docs.microsoft.com/windows/uwp/style/connected-animation) let you create a dynamic and compelling navigation experience by animating the transition of an element between two different views. - -The Connected Animations XAML Attached Properties enable connected animations to be defined directly in your XAML code by simply adding a Key to the element that should animate. There are also attached properties to enable coordinated animations and animations in lists and grids. - -## Syntax - -```xaml - - - - - - - - - - - - - -``` - -## Sample Output - -![Connected animations](../resources/images/Animations/connected.gif) - -## Properties - -### Connected.Key -Registers element with the [ConnectedAnimationsService](https://msdn.microsoft.com/library/windows/apps/windows.ui.xaml.media.animation.connectedanimation.aspx). For the animation to work, the same key must be registered on two different pages when navigating - -### Connected.AnchorElement -To enable [coordinated animations](https://docs.microsoft.com/windows/uwp/style/connected-animation#coordinated-animation), use the AnchorElement attached property on the element that should appear alongside the connected animation element by specifying the connected animation element - -### Connected.ListItemKey -Registers a ListView/GridView for connected animations. When navigating from/to a page that is using this property, the connected animation will use the item passed as a **parameter** in the page navigation to select the item in the list that should animate. The Connected.ListItemElementName attached property must also be set for the animation to be registered - -### Connected.ListItemElementName -Specifies what named element in the DataTemplate of an item should animate. The Connected.ListItemKey attached property must also be set for the animation to be registered. - -## Examples - -We can create the above connected animations. - -**In first page** - -We need a set a key for the element to be connected with another element in a different page. - -```xaml - - - -``` - -**In second page** - -We need to set the same key for the element to be connected with. Also, You can anchor another element to move along the connected animation path. - -```xaml - - - - - Header - Lorem ipsum ... - - -``` - -In this page, we can also create a GridView which implements connected animation for its items. You need to set ListItemKey and ListItemElementName for specifying the UIElement to animate. - -```xaml - - - - - - - - - - -``` - -**In third page** - -In this page, you just need to give the same key. - -```xaml - - - - - Lorem ipsum ... - - - - - - Lorem Ipsum ... - -``` - -## Sample Code - -[Connected Animations sample page source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Connected%20Animations). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| ---------------------------------------------------------------- | ----------------------------------- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Animations | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Animations](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Animations/) | - -## API - -* [Connected animations source code](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.UI.Animations/ConnectedAnimations) - -## Related Topics - -- [ConnectedAnimationService Class](https://docs.microsoft.com/uwp/api/Windows.UI.Xaml.Media.Animation.ConnectedAnimationService) diff --git a/docs/animations/Expressions.md b/docs/animations/Expressions.md deleted file mode 100644 index 530fc3902a4..00000000000 --- a/docs/animations/Expressions.md +++ /dev/null @@ -1,1140 +0,0 @@ ---- -title: ExpressionBuilder -author: nmetulev -description: The ExpressionBuilder classes are a C#-only alternative to building Composition Expressions with type safety. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, expressions, expressionbuilder ---- - -# ExpressionBuilder - -- [Quick Start](#quick-start) - - [Setting up the ExpressionBuilder classes with your app](#setting-up-the-expressionbuilder-classes-with-your-app) - - [Getting started with ExpressionBuilder classes](#getting-started-with-expressionbuilder-classes) - - [ExpressionAnimation Overview](#expressionAnimation-overview) - - [Using the ExpressionBuilder classes](#using-the-expressionbuilder-classes) - - [Extension Methods](#extension-methods) - - [How to template with ExpressionBuilder](#how-to-template-with-expressionbuilder) - - [E2E Example](#e2e-example) - - [Things to Note](#things-to-note) -- [Intro](#intro) - - [What are Expressions?](#what-are-expressions) - - [Why ExpressionBuilder?](#why-expressionbuilder) -- [How to: Build Core Components of Expressions](#how-to-build-core-components-of-expressions) - - [General Construction](#general-construction) - - [Interacting with ExpressionNodes via Static Methods](#interacting-with-expressionnodes-via-static-methods) - - [Implicit Conversion to ExpressionNodes](#implicit-conversion-to-expressionnodes) - - [Using ExpressionNodes with StartAnimation](#using-expressionnodes-with-startanimation) - - [Using ExpressionNodes with ExpressionKeyFrames](#using-expressionnodes-with-expressionkeyframes) - - [Using ExpressionNodes in other places](#using-expressionnodes-in-other-places) - - [Parameters](#parameters) - - [Definitions: Constants vs. References](#definitions-constants-vs-references) - - [Definitions: Dynamic vs. Static Parameters](#definitions-dynamic-vs-static-parameters) - - [Creating Constant Parameters](#creating-constant-parameters) - - [Creating Reference Parameters](#creating-reference-parameters) - - [Subchanneling (Swizzling)](#subchanneling-swizzling) - - [Templating](#templating) - - [Keywords](#expressions-keywords) - - [Math shortcuts & basic operators](#math-shortcuts-basic-operators) - - [Basic Operators](#basic-operators) - - [Math Shortcuts (Functions)](#math-shortcuts-functions) - - [Advanced Operations](#advanced-operations) - - [Comparison Operators](#comparison-operators) - - [Conditional Operation](#conditional-operation) - - [Tips and Tricks for using Classes](#tips-and-tricks-for-using-classes) - - [Shortening Class Names](#shortening-class-names) -- [Translating Old World to New](#translating-old-world-to-new) - - [Creating an Expression](#creating-an-expression) - - [Defining Constant Parameters](#defining-constant-parameters) - - [Building Constants](#building-constants) - - [Defining Reference Parameters](#defining-reference-parameters) - - [Using Math Functions & Math Operators](#using-math-functions-math-operators) - - [Using Ternary and Conditional Operators](#using-ternary-and-conditional-operators) - - [Keywords](#new-world-keywords) - - [Starting an Expression on a CompositionObject](#starting-an-expression-on-a-compositionobject) -- [E2E Building Examples](#e2e-building-examples) - - [Parallaxing Listing Items](#parallaxing-listing-items) - - [Old Expression](#parallaxing-old-expression) - - [Summary of Expression definition](#parallaxing-summary-of-expression-definition) - - [Building with ExpressionNodes](#parallaxing-building-with-expressionnodes) - - [Final code snippet](#parallaxing-final-code-snippet) - - [PropertySets](#propertysets) - - [Old Expression](#propertysets-old-expression) - - [Summary of Expression definition](#propertysets-summary-of-expression-definition) - - [Building with ExpressionNodes](#propertysets-building-with-expressionnodes) - - [Final code snippet](#propertysets-final-code-snippet) - - [Curtain](#curtain) - - [Old Expression](#curtain-old-expression) - - [Summary Expression Definition](#curtain-summary-expression-definition) - - [Building with ExpressionNodes](#curtain-building-with-expressionnodes) - - [Final code snippet](#curtain-final-code-snippet) -- [Requirements](#requirements) -- [API](#api) - -## Quick Start - -Welcome to the ExpressionBuilder classes! The ExpressionBuilder classes are a C#-only alternative to building Expressions with type safety. Below is a quick introduction to using the ExpressionBuilder classes with your application. Complete documentation and walkthroughs will start from [Intro](#intro) section. - -## Setting up the ExpressionBuilder classes with your app - -To use the ExpressionBuilder in your app, add the Microsoft.Toolkit.Uwp.UI.Animations nuget package to your project. Next, within your app project, make sure to add the using statement to leverage the ExpressionBuilder classes: - -```csharp -using Microsoft.Toolkit.Uwp.UI.Animations.Expressions; -``` - -Once you have the nuget package added to your project, you are all set to start using the ExpressionBuilder classes! - -## Getting started with ExpressionBuilder classes - -### ExpressionAnimation Overview - -A brief recap of ExpressionAnimations: - -- ExpressionAnimations are a type of CompositionAnimations used to create mathematical relationships between Composition Objects. Simple examples include making a relationship such that one object will move relative to another. - -- Like other CompositionAnimations, ExpressionAnimations are templates, meaning you can create an Expression and use it to animate multiple objects. You can also change aspects of the animation and have those changes take effect the next time you animate an object (without affecting any previously connected animations). - -- For more information on ExpressionAnimations, [please check our documentation](https://docs.microsoft.com/uwp/api/Windows.UI.Composition.ExpressionAnimation). - -ExpressionAnimations can create some very powerful and unique experiences, but can be a bit cumbersome to author. One of the big pain points with ExpressionAnimations is that the equation or mathematical relationship that defines the animation is written as a string, e.g.: - -```csharp -_parallaxExpression = compositor.CreateExpressionAnimation( - "(ScrollManipulation.Translation.Y + StartOffset) * ParallaxValue - - (ScrollManipulation.Translation.Y + StartOffset)"); -``` - -This creates a series of challenges when authoring Expressions in this manner: - -- No type safety checks - -- No intellisense or autocomplete - -- Semantic errors with the equation appear at runtime, not compile time - -Thus, the ExpressionBuilder classes were created to help alleviate these challenges and present an alternative way to create ExpressionAnimations. - -## Using the ExpressionBuilder classes - -For full documentation on how to use the ExpressionBuilder classes, please refer to the [Word document](https://github.com/Microsoft/WindowsUIDevLabs/tree/master/ExpressionBuilder/Docs) from the composition team. - -Before we highlight how to use the classes, let's reiterate the core components that make up an Expression: - -- Parameters: These are key-value pairs that can either be references to a CompositionObject or constant values. The values to these keys can be changed later on. - -- Functions: Similar to operators, there are a series of mathematical functions that provide a series of common math behaviors (clamp, max, min, cos, etc.) - -- Keywords: a set of known phrases to the Expression language to provide specific behaviors (referencing the CurrentValue, etc.) - -- Operators: The glue that brings together all the components of an equation. Your typical mathematical operators (+, -, *, /) - -On the surface, the ExpressionBuilder classes provide three major components to build Expressions with: - -- ExpressionFunctions Class: object that defines all the math functions and type (Scalar, Vector2, Vector3, etc.) constructors - -- ExpressionValues Class: object that defines the creation of parameters and keywords - -- Extension Methods for Composition Objects: a series of extension methods off of CompositionObject and it's children. - -Behind the scenes, methods off the ExpressionFunctions and ExpressionValues classes construct ExpressionNode objects that represent an Expression. These nodes can be combined with other ExpressionNodes or System.Numerics objects using operators, resulting in a new ExpressionNode. Via the extension methods, anywhere you would normally insert an ExpressionAnimation object, you can instead use an ExpressionNode. - -### Extension Methods (GetReference(), StartAnimation()) - -Prior to ExpressionBuilder, in order to reference a CompositionObject property, a SetReferenceParameter on the ExpressionAnimation must always be called: - -```csharp -var expression = _compositor.CreateExpressionAnimation("visualA.Offset.X + 50"); -expression.SetReferenceParameter("visualA", _visualA); -_visualB.StartAnimation("Offset.X", expression); -``` -With ExpressionBuilder, you can use the GetReference() extension method that performs this same behavior if you don't need to template, but in a type safe manner: - -```csharp -_visualB.StartAnimation("Offset.X", _visualA.GetReference().Offset.X + 50f); -``` -Also notice in the above code snippet, the CompositionObject.StartAnimation() extension method was used to pass in an ExpressionNode instead of an ExpressionAnimation. - -### How to template with ExpressionBuilder - -Templating is a big value prop of CompositionAnimations. As a developer, you define a template for an animation that you then can create multiple instances of later when binding to CompositionObjects via StartAnimation(). In some cases, when templating, you want to change the value of parameters you define. For example, changing which Visual you want to reference, or changing the value of a constant. This means that parameters must be able to be referenced later on so their reference or value can be changed; for this reason, parameters are defined with a string property name. - -In the following code snippet, we update the Expression defined earlier: - -- Make the Visual we reference a parameter so it can be changed at a later time - -- Create a constant parameter instead of hardcoding the value “50f”, so this can easily be changed at a later time - -```csharp -var additionOffset = ExpressionValues.Constant.CreateScalarConstant("addOffset", 50f); -var expressionNode = ExpressionValues.Reference.CreateVisualReference("visualA", _visualA) + addOffset; -[...] -// If want to change what "visualA" references and value of "addOffset" in the Expression template ... -expressionNode.SetReferenceParameter("visualA", _visualC); -expressionNode.SetScalarParameter("addOffset", 100f); -``` - -### E2E Example - -Let's walk through the expression used in the PullToAnimate sample to animate Opacity with InteractionTracker - -```csharp -// Expression written with strings -var progressExp = _compositor.CreateExpressionAnimation(); -progressExp.Expression = "Clamp(tracker.Position.Y / tracker.MaxPosition.Y, 0, 1)"; -progressExp.SetReferenceParameter("tracker", _tracker); -visual.StartAnimation("Opacity", progressExp); -``` - -Now let's show what this looks like with ExpressionBuilder: - -```csharp -// Expression written with ExpressionBuilder -var trackerNode = _tracker.GetReference(); -var progressExp = EF.Clamp(trackerNode.Position.Y / trackerNode.MaxPosition.Y, 0, 1); -_propertySet.StartAnimation("progress", progressExp); -``` - -### Things to Note - -If you are familiar with how Expressions were built with strings, there are a few things to note: - -- The ternary operator (condition ? ifTrue : ifFalse) is now represented by ExpressionFunctions.Conditional(condition, ifTrue, ifFalse) - -- The "And" and "Or" operators (“&&” and “||”) are now represented by the & and | operators. - -- If using ExpressionBuilder to create expressions for use with InteractionTracker’s InertiaModifiers, the following extensions methods are available: - - - InteractionTrackerInertiaRestingValue.SetCondition - - - InteractionTrackerInertiaRestingValue.SetRestingValue - - - InteractionTrackerInertiaMotion.SetCondition - - - InteractionTrackerInertiaMotion.SetMotion - - - Referencing ExpressionValues and ExpressionFunctions in your code can be a bit verbose, so you can define shortened versions in the Using section of your app: - - ```csharp - using EF = ExpressionBuilder.ExpressionFunctions; - using EV = ExpressionBuilder.ExpressionValues; - ``` - -# Intro - -## What are Expressions? - -ExpressionAnimations (or Expressions, for short) are a new type of animation introduced to Windows App developers in Windows 10 to provide a more expressive animation model than what is provided from traditional KeyFrameAnimations and -XAML Storyboards. - -Expressions are mathematical equations and relationships that are defined by the developer and used by the system to calculate the value of an animation property each frame. These equations can be used to define relationships between objects such as relative size to more complex UI experiences such as Parallax, Sticky Headers, and other input-driven experiences. - -The documentation below assumes you are familiar with the Composition and CompositionAnimation APIs, including Expressions. For more information on these, check out the following resources: - -- [Composition Overview](https://msdn.microsoft.com/windows/uwp/graphics/visual-layer) - -- [Composition Animation Overview](https://msdn.microsoft.com/windows/uwp/graphics/composition-animation) - -- [Windows UI Dev Labs Github](https://github.com/Microsoft/WindowsUIDevLabs) - -- [ExpressionAnimation MSDN Documentation](https://msdn.microsoft.com/library/windows/apps/windows.ui.composition.expressionanimation.aspx) - -## Why ExpressionBuilder? - -To use ExpressionAnimations today, developers are required to write their mathematical equation/relationship in a string (example shown below). - -```csharp -parallaxExpression = compositor.CreateExpressionAnimation(); -_parallaxExpression.Expression = "(ScrollManipulation.Translation.Y + StartOffset - (0.5 * ItemHeight)) * ParallaxValue - (ScrollManipulation.Translation.Y + StartOffset - (0.5 * ItemHeight))"; -``` - -This experience presents a series of challenges for developers: - -- No Intellisense or auto complete support. - -- No type safety when building equations. - -- All errors are runtime errors, many of which are desirable to be detected at compile time. - -- Working with strings for complicated equations not intuitive or ideal. - -To improve the Expression authoring experience, the team put together the ExpressionBuilder classes, which act as a series of “helper classes” to bring -type safety, Intellisense, and compile-time errors to the Expression-building experience. The classes can be used as an alternative experience to building Expressions than what is available today. - -# How to: Build Core Components of Expressions - -The following sections will cover how the classes work to create the core -components of an Expression. - -**Note:** Each section will provide short code lines that implement the Expression Builder syntax to demonstrate the core concept. These are not meant to be E2E working samples - E2E walkthroughs using the Expression Builder Classes are provided in Section [E2E Building Examples](#e2e-building-examples). - -## General Construction - -What is the general model for building Expressions with the classes? How do the classes plug into existing entry points for CompositionAnimations? (StartAnimation, ExpressionKeyFrames) - -Before talking about the core components of Expressions and how the ExpressionBuilder classes achieve them, let’s first discuss how to think about these classes, their general architecture and how to integrate into your existing app code. - -### Interacting with ExpressionNodes via Static Methods - -To start, let’s talk about how Expressions are represented in the Helper Class. When using the Expression Builder Classes, developers will be generating ExpressionNodes – a single node, or a combination of nodes, can be used to define an Expression. It is important to note that you do not need to “new-up” ExpressionNodes; instead, there are a series of static methods to create typed Expression nodes such as: - -- ScalarNode - -- Vector2Node - -- Vector3Node - -- Vector4Node - -- ColorNode - -- QuaternionNode - -- Matrix3x2Node - -- Matrix4x4Node - -For example, to generate a Vector3ExpressionNode, use a static method: - -```csharp -// Using ExpressionFunction class and the Vector3 static method -// Defines an Expression that creates a Vec3 of 1, 2, 3 -var vec3Node = ExpressionFunctions.Vector3(1.0f, 2.0f, 3.0f); -``` - -Don’t worry about understanding the syntax right now, we’ll cover that later. For now, understand that you will create most ExpressionNodes using static methods off two main classes: - -- ExpressionValues - -- ExpressionFunction - -As stated earlier, a combination of ExpressionNodes can be used to define an -Expression. Like any math equation, ExpressionNodes can be combined using mathematical or logical operators and mathematical functions (more on this -later). - -For example, the code snippet below shows adding together two Vector3Nodes that will result in a Vector3Node (invalid combinations will be caught as -compile-time errors). - -```csharp -// Combining together multiple Expression Nodes using add operator -Vector3Node vec3Sum = ExpressionFunctions.Vector3(1.0f, 2.0f, 3.0f) + - ExpressionFunctions.Vector3(4.0f, 5.0f, 6.0f); -``` - -### Implicit Conversion to ExpressionNodes - -In addition to using the static methods to generate ExpressionNodes, the classes will also handle implicit conversion of numerical values (e.g. System.Numerics) to the appropriate ExpressionNode type. This is done so you do not need to explicitly create new nodes for existing Numerics objects you have already defined. - -For example, if you have already defined a System.Numerics object, you can use it directly when combining with other ExpressionNodes: - -```csharp -// Using a Numerics Vector3 object directly with an ExpressionNode -Vector3Node vec3NodeA = ExpressionFunctions.Vector3(1.0f, 2.0f, 3.0f); -Vector3Node vec3Sum = vec3NodeA + new System.Numerics.Vector3(1.0f, 1.0f, 1.0f); -``` - -When building your Expression with ExpressionNodes, you can use a numerics type anywhere an ExpressionNode would normally be used and it will get implicitly converted to one. For example, the math function Length(…) takes in a QuaternionNode, if a System.Numerics.Quaternion object was provided, it would get implicitly converted: - -```csharp -var quatLength = ExpressionFunctions.Length(new Quaternion(new Vector3(1), 1f)); -``` - -### Using ExpressionNodes with StartAnimation - -Once you’ve created an ExpressionNode using the ExpressionBuilder classes, you need to connect the ExpressionNode to a target (CompositionObject). The ExpressionBuilder classes include an extension method that mimics the publicly available StartAnimation(…) API, but instead of taking in a CompositionAnimation, it takes in an ExpressionNode. This extension method is defined in CompositionExtension.StartAnimation(…), and is accessible via CompositionObject.StartAnimation(…). - -The following uses the ExpressionNode defined earlier and attaches it via StartAnimation to a Composition Visual: - -```csharp -var numericsVec3 = new System.Numerics.Vector3(1.0f, 1.0f, 1.0f); -var vec3NodeA = ExpressionFunctions.Vector3(1.0f, 2.0f, 3.0f); -Vector3Node vec3Sum = vec3NodeA + numericsVec3; - -// StartAnimation extension method takes in a ExpressionNode -_visualA.StartAnimation("Offset", vec3Sum); -``` - -### Using ExpressionNodes with ExpressionKeyFrames - -In the existing CompositionAnimation API, you can also use Expressions with KeyFrameAnimations. This is done by using an ExpressionKeyFrame where you define the progression point and a string representing the equation (the Expression provided is used by the system to evaluate the keyframe value each frame). - -The ExpressionBuilder classes also provides an extension method for the InsertExpressionKeyFrame API that takes in an ExpressionNode instead of a string. - -The following defines a KeyFrameAnimation that uses an ExpressionKeyFrame with an ExpressionNode: - -```csharp -var kfa = _compositor.CreateVector3KeyFrameAnimation(); - -Vector3Node vec3Sum = ExpressionFunctions.Vector3(1.0f, 2.0f, 3.0f) + - new System.Numerics.Vector3(1.0f, 1.0f, 1.0f); - -// Extension method for InsertExpressionKeyFrame to take in an ExpressionNode -kfa.InsertExpressionKeyFrame(1.0f, vec3Sum); -_visual.StartAnimation("Offset", kfa); -``` - -**Note:** In the above example, the Expression only consists of constant parameters for example purposes. Your Expression should always contain at least one reference; an Expression made up of only constant parameters is wasteful as it can be equivalently accomplished with a direct property set via the API . - -### Using ExpressionNodes in other places - -Using ExpressionNodes with StartAnimation and ExpressionKeyFrames will be the most common places you will utilize Expressions. However, there are other places that Expressions are used today – for each of the cases below, extension methods are provided that will take in an ExpressionNode instead of a string: - -- InteractionTrackerInertiaMotion Extension Methods - - - SetCondition - - - SetMotion - -- InteractionTrackerInertiaRestingValue ExtensionMethods - - - SetCondition - - - SetMotion - -## Parameters - -The big value prop to use ExpressionAnimations is that you can define equations and mathematical relationships that utilize constants and reference values from other objects. These objects are often other CompositionObjects or variables that make the mathematical relationship more meaningful. For example, you can use a parameter to create an equation that references another’s object’s x Offset. - -There are two types of Parameters: Constants and References. Both Constants and References can be described as either a dynamic or static Parameter - this defines whether you can change what they refer to. These topics will be discussed in more detail in the next sections. - -### Definitions: Constants vs. References - -There are two types of Parameters that can be used in an Expression. Moving forward, we’ll use the following definitions to distinguish Constants vs References: - -- **Constant:** A typed value (Scalar, Vector2/3/4, etc.), which will be used directly as a literal in the Expression. - -```csharp -var extraOffset = new Vector3(50f, 50f, 0f); -``` - -- **Reference:** A CompositionObject (Visual, Clip, InteractionTracker, etc.), whose properties will be evaluated each frame the Expression is processed in the Compositor. - - - The usefulness of including a Reference Parameter in an Expression is to reference properties off it (e.g. referencing the Offset property of a Visual). - -```csharp -var redVisual = _compositor.CreateSpriteVisual(); -``` - -### Definitions: Dynamic vs. Static Parameters - -Templating, which is discussed in more detail in section [Templating](#templating) refers to the reuse of an Expression while changing the values of dynamic parameters. Unless you are in a templating scenario, you will only need static parameters. - -- **Static:** A parameter in which the value or CompositionObject it references will never change - -- **Dynamic:** A parameter in which the value or CompositionObject can be changed without modifying the Expression. It is changed by associating a string parameter name with a new value or CompositionObject. Dynamic parameters are required for templating. - -How to create static and dynamic parameters for both Constants and References will be discussed in the next two sections. - -### Creating Constant Parameters - -**How to create static Constant Parameters:** - -- Simply place the value straight into the equation - -In the example below, we want to utilize a float constant variable that gets defined earlier in the equation. - -```csharp -var delta = new Vector3(50.0f); - -// Place “delta” into the equation to represent a static constant parameter -// (aka a constant value) -var newPosition = ExpressionFunctions.Vector3(50.0f, 75.0f, 0.0f) + delta; - -// When StartAnimation is called, for the lifetime of the Expression, -// “delta” will be a Vec3 of (50,50,50) -_visual.StartAnimation("Offset", newPosition); -``` - -**Note:** Plugging in CompositionObject values directly into the equation will have the same effect, as they are just variable values. For example, plugging in \_visual.Offset will get evaluated to its Vector3 value and treated as a Constant. If you want the equation to use the frame-accurate value of a CompositionObject property, make it either a static or dynamic Reference Parameter. - -**How to create dynamic Constant Parameters:** - -- Create a named parameter using the static methods off ExpressionValues.Constants class - -You can create a constant parameter via static Create\*Parameter() methods (e.g. ExpressionValues.Constants.CreateScalarParameter(“foo”, 7)). Note: setting the initial value as part of the creation is optional; you can always set the value of the parameter using ExpressionNode.Set\*Parameter(). Let’s expand the above example. In this case, let’s say we want to create a generic equation that can be reused for similar scenarios, but tailored by changing the value of constant(s). In the example below, we create the Expression that contains a Constant Parameter, using ExpressionValues.Constant.CreateConstantVector3(…). Before connecting it to a target, the Expression is tailored by setting the parameter using ExpressionNode.SetVector3Parameter(…). - -```csharp -var delta = new Vector3(50.0f); - -// Create a dynamic Constant Parameter for delta of value (50,50,50) -var newPosition = ExpressionFunctions.Vector3(50.0f, 75.0f, 0.0f) + - ExpressionValues.Constant.CreateConstantVector3("delta", delta); - -_visualA.StartAnimation("Offset", newPosition); - -// [...] -// Later in the code, we want to reuse the newPosition ExpressionNode but with a -// different value for the “delta” parameter. -newPosition.SetVector3Parameter("delta", new Vector3(75f, 85f, 0f)); - -// When StartAnimation is called, delta parameter is (75,85,0) not (50,50,50) -_visualB.StartAnimation("Offset", newPosition); -``` - -### Creating Reference Parameters - -**How to create static Reference Parameters:** - -- Call the GetReference() extension method off of the CompositionObject you would like to create a reference for - -In the example below, we further expand on the above code such that instead of using a constant Vector3 for the first part of the equation, we will reference the frame-accurate Offset of a Visual: - -```csharp -var delta = new Vector3(50.0f); - -// Create a static Reference Parameter to the _redBall Visual and its Offset property -var newPosition = _redBall.GetReference().Offset + delta; -_visual.StartAnimation("Offset", newPosition); -``` - -Thus, as the Offset value of \_redBall changes (via direct property set or animation), so will the output of this equation. - -**How to create dynamic Reference Parameters:** - -- Create a Parameter using the static methods off the ExpressionValues.Reference class - - - The value of the parameter can be set via the SetReferenceParameter function - -In the example below, we further expand on the above code such that instead of using a static reference to the redBall visual, we use a named one, so that we can change the parameter to refer to a blueBall Visual later. - -```csharp -var delta = new Vector3(50.0f); - -// Create a dynamic Reference Parameter to the Red Ball Visual so can change later -var newPosition = ExpressionValues.Reference.CreateVisualReference("ball").Offset + delta; - -// When StartAnimation is called, “ball” parameter refers to _redBall Visual -newPosition.SetReferenceParameter("ball",_redball); -_visual.StartAnimation("Offset", newPosition); - -// [Later in code, we want to use same Expression but use different Visual for Parameter] - -// When StartAnimation is called, “ball” parameter refers to _blueBall Visual -newPosition.SetReferenceParameter("ball", _blueBall); -_visualB.StartAnimation("Offset", newPosition); -``` - -To refer to a property in a CompositionPropertySet, you will need to get or create a reference to the PropertySet, then call GetParameter() function and pass in the name of the property in the form of a string. - -```csharp -_propSet.InsertScalarProperty("delta", new Vector3(10)); - -// Create a static Reference Parameter to a PropertySet and a property inside it -var newPosition = _redBall.GetReference().Offset + - _propSet.GetReference().GetVector3Property("delta"); -_visual.StartAnimation("Offset", newPosition); -``` - -### Subchanneling (Swizzling) - -*[Also known as “dotting into things”]* - -When using a vector or matrix node type in your equations, you also can access a subchannel of (or “dot into”) the parameter to use an individual component property. For example, when using a Vector3 Constant, developers can dot into its X, Y, or Z component: - -```csharp -var delta = new Vector3(50f, 100f, 150f); -Vector3Node vec3NodeA = ExpressionValues.Constant.CreateConstantVector3("delta", delta); -ScalarNode xComponent = vec3NodeA.X; -ScalarNode yComponent = vec3NodeA.Y; -ScalarNode zComponent = vec3NodeA.Z; -``` - -In addition, when using Reference Parameters, all the animatable properties on the different CompositionObjects can be subchanneled into as well. For example, modifying the above example to use the offset of a Visual instead of a Vector3 constant: - -```csharp -// _redBall is a SpriteVisual created previously -var vec3NodeA = _redBall.GetReference().Offset; -var xComponent = vec3NodeA.X; -var yComponent = vec3NodeA.Y; -var zComponent = vec3NodeA.Z; -``` - -The classes only provide the common subchannels off the different types. However, in Expressions, you can also reference more complicated subchannels such as XX, XXY, etc. In this case, you can use the Subchannels(…) function to define a particular combination: - -In the example below, the developer wants to grab a subchannel reference to an XY component of a Visual’s Offset. The output of this is a Vector2Node: - -```csharp -Vector2Node xYChannel = _visual.GetReference().Offset.Subchannels( - Vector3Node.Subchannel.X, Vector3Node.Subchannel.Y); -``` - -### Templating - -There are times where you want to use a generic Expression across different parts of your app to animate multiple CompositionObjects. However, depending on which target the Expression is connected to, different values for parameters in the equation may be desired. - -This is where using named Dynamic Parameters with Constant and Reference Parameters comes into play. When creating parameters using the ExpressionValues.Constant or ExpressionValues.Reference classes, you define a string name that you will later use to set the value of the parameter. For constants, this will be a different variable/value that you want to use. For References, this will be a different CompositionObject that you want to reference. - -**Note:** Whenever a templated Expression is connected to a target (via StartAnimation(…)), an instance of that Expression is created and associated with that target. For this reason, any changes to parameters (via Set\*Parameter(…)) only affect the template and future instances created from that template. For example, take an Expression with a parameter “P” that is connected to three targets: “T1”, “T2”, and “T3” (in order). If the value of “P” is changed after “T1” and “T2” have been connected, this new value will only be used in “T3”. - -In the example below, we create a generic Expression and attach to two different Visuals. Each time, we change the value of the parameter before starting the animation. - -```csharp -// Define the Expression template -var delta = new Vector3(50.0f); -var deltaExpression = - ExpressionValues.Reference.CreateVisualReference("visual").Offset + delta; - -// [Later on in code ...] -// Set value of "visual" to be a reference to _redBall -deltaExpression.SetReferenceParameter("visual", _redBall); -_visualA.StartAnimation("Offset", deltaExpression); - -// [Later on in code ...] -// Set value of "visual" to be a refernece to _blueBall -deltaExpression.SetReferenceParameter("visual", _blueBall); -_visualB.StartAnimation("Offset", deltaExpression); -``` - -A real-world example that demonstrates the need for changing the value of a Parameter using different constants would be using the index number of an itemized List as a Constant Parameter. - -We can extend this concept by imagining a real-world scenario in which a common equation is needed across many targets: list items. A list is typically comprised of homogeneous items, each with a unique ID indicating its position in the list. Each item needs to be behave very similarly, with slight differences based on its position. For this example, a single Expression could be designed that gives a consistent behavior across all items, but is customized by using the list item ID as a Constant Parameter. When connecting this Expression template to each list item, the ID Parameter is set using SetScalarParameter(…) with the ID of the current list item. - -### Keywords - -In Expressions, there are several certain keywords that can be used as shortcuts when defining the equation. These keywords are available off of the -ExpressionValues object: - -- **ExpressionValues.Target** – This keyword defines a reference to whichever CompositionObject this Expression is connected to. - -- **ExpressionValues.StartingValue** – This keyword defines a reference to the property the Expression targets, sampled at the first frame of execution. **Note**: if the Expression is connected to a subchannel of a property (e.*g. “Offset.X”), then StartingValue will be of the same data type as the subchannel (e.g. ScalarStartingValue for “Offset.X”). - -- **ExpressionValues.CurrentValue** – This keyword defines a frame-accurate reference to the property the Expression targets. *Note: if the Expression is connected to a subchannel of a property (e.*g. “Offset.X”), then CurrentValue will be of the same data type as the subchannel (e.g. ScalarCurrentValue for “Offset.X”). - -In the example below, we create an Expression using the Target keyword: - -```csharp -// windowWidth defined earlier -// Target creates a reference to _visual -var opacityExpression = - ExpressionValues.Target.CreateVisualTarget().Offset.X / windowWidth; -_visual.StartAnimation("Opacity", opacityExpression); -``` - - The usage of the Target keyword here is a shortcut to a Reference Parameter that references the CompositionObject being targeted by the Expression. In this example, that would be \_visual, but will always refer to the object StartAnimation(…) is called on. - -## Math shortcuts & basic operators - -### Basic Operators - -As mentioned earlier, you define an Expression by a single ExpressionNode or multiple – when defined by multiple, they are combined using operators. The basic supported operators are: - -- Plus (+) - -- Minus (-) - -- Multiply (\*) - -- Divide (/) - -- Mod (%) - -The classes are designed such that you will be able to use Intellisense to identify compile-time errors for invalid math operations. For example, the following ExpressionNode attempts to add a Vector3 reference from a Visual to Vector2 constant – note that this will throw a compile time error in Visual Studio: - -```csharp -var numericsVec2 = new Vector2(1f, 2f); - -// Invalid operation: cannot add Vec3 to Vec2, compile time + intellisense error -var expNodeSum = _visual.GetReference().Offset + numericsVec2; -``` - -### Math Shortcuts (Functions) - -To build more complex equations, more advanced mathematical operations are needed. Some operations are tedious to perform manually, so helper functions (a subset of System.Numerics functions, e.g. Min, Max, etc.) are available in the ExpressionFunctions class. The following example creates an Expression that calculates the length of a Quaternion: - -```csharp -var targetVisual = _visual.GetReference(); -var quatLength = ExpressionFunctions.Length(targetVisual.Orientation); -``` - -## Advanced Operations - -### Comparison Operators - -In addition to the basic mathematical operations (+, -, /, etc.), you can also create Expressions that use comparison operators: - -- Greater than (\>) - -- Less than (\<) - -- Greater than or equal to (\>=) - -- Less than or equal to (\<=) - -- Equal to (==) - -- Not Equal to (!=) - -The following example demonstrates creating an Expression that outputs a Boolean Node showing whether the length of one Quaternion is equal to another: - -```csharp -var visAReference = _visualA.GetReference(); -var visBReference = _visualB.GetReference(); - -BooleanNode equalLength = ExpressionFunctions.Length(visAReference.Orientation) == - ExpressionFunctions.Length(visBReference.Orientation); -``` - -### Conditional Operation - -Finally, you can make some of the most powerful Expressions using a Conditional operation. This enables developers to define different behaviors for an Expression depending on a condition. This operation is defined by the ExpressionFunctions.Conditional method and contains three parts to mimic the standard *condition ? true: false* ternary operator: - -- The Boolean Expression condition that is checked - -- The Expression to be run if the condition is true - -- The Expression to be run if the condition is false - -The following example builds upon the above example. It compares the length of two quaternions, and based on the result uses one of two rotations in the form of a quaternion: - -```csharp -var visAReference = _visualA.GetReference(); -var visBReference = _visualB.GetReference(); - -var condition = ExpressionFunctions.Length(visAReference.Orientation) <= - ExpressionFunctions.Length(visBReference.Orientation); - -var trueCase = visAReference.Orientation; -var falseCase = visBReference.Orientation; - -// This Expression chooses between A or B’s Orientation, based on their lengths -var ternary = ExpressionFunctions.Conditional(condition, trueCase, falseCase); - -_visual.StartAnimation("Orientation", ternary); -``` - -## Tips and Tricks for using Classes - -Below are some tips and tricks that can be used for interacting with the classes - -### Shortening Class Names - -One of the challenges with this class model is an ExpressionNode can get very verbose and lengthy because the needing to “dot into” a class object to access the static method. If you run into this yourself, you can shorten the naming of the classes by defining a shortened version via the “using” syntax at the top of your file: - -```csharp -using EF = HelperClasses.ExpressionFunctions; -// Later in code ... -var test = EF.Abs(_visual.GetReference().Offset.X); -``` - -# Translating Old World to New - -If you’re familiar with building Expressions in the old world by writing the equation as a string, the following sections outlines how the creation of an Expression compares between the old and new way. - -## Creating an Expression - -In the old world, you use the CreateExpressionAnimation() method off the Compositor. In the new one, you simply assign the variable an ExpressionNode (output from static methods of ExpressionValue, ExpressionFunctions or extension methods) - -```csharp -// Old way -var expOldWorld = _compositor.CreateExpressionAnimation("visB.Offset"); -expOldWorld.SetReferenceParameter("visB", _visualB); - -// New way -var expNewWorld = _visualB.GetReference().Offset; -``` - -## Defining Constant Parameters - -In the old world for both Constants and References, whether you intended them to be static or dynamic, you were required to define a string name and set the parameter value separately. In the new world, you only need to set the parameter if you want to template the Expression and later change what the parameter points to. Otherwise, you simply include the value directly in the equation. - -In the example below, we plan to template this expression, varying the value of “extraOffset”. Shown is how to achieve this in the new and old way: - -```csharp -var extraOffset = new Vector3(50f); - -// Old way -var expOldWorld = _compositor.CreateExpressionAnimation("visB.Offset + extraOffset"); -expOldWorld.SetReferenceParameter("visB", _visualB); -expOldWorld.SetVector3Parameter("extraOffset", extraOffset); - -// New way (Note: we could have set value in CreateConstantVector3) -var expNewWorldTemplate = _visualB.GetReference().Offset + - ExpressionValues.Constant.CreateConstantVector3("extraOffset"); -expNewWorldTemplate.SetVector3Parameter("extraOffset", extraOffset); -``` - -## Building Constants - -In the old world, you could construct constant types within the string equation. In the new world, you use the static methods off the ExpressionFunction class. - -```csharp -// Old way -var expOldWorld = - _compositor.CreateExpressionAnimation("visB.Offset + Vector3(50f, 50f, 0f)"); -expOldWorld.SetReferenceParameter("visB", _visualB); - -// New Way (Option 1) -var expNewWorldTemplate = - _visualB.GetReference().Offset + ExpressionFunctions.Vector3(50f, 50f, 50f); -// New Way (Option 2) -var expNewWorldTemplate = - _visualB.GetReference().Offset + new System.Numerics.Vector3(50, 50, 50); -``` - -## Defining Reference Parameters - -In the old world, if you wanted to create a reference to a CompositionObject, it needed to have the parameter set for the string name in the equation. In the new world, you can either *get* the reference using the extension method off the CompositionObject, or create one using static methods off ExpressionValue. - -```csharp -// Old way -var expOldWorld = _compositor.CreateExpressionAnimation("visB.Offset"); -expOldWorld.SetReferenceParameter("visB", _visualB); - -// New Way (1) -// "Get" a reference to a known Composition Object -var expNewWorld = _visualB.GetReference().Offset; - -// New Way (2) -// "Create" a reference and assign the value -var expNewWorldTemplate = - ExpressionValues.Reference.CreateVisualReference("visB").Offset; -expNewWorldTemplate.SetReferenceParameter("visB", _visualB); -``` - -## Using Math Functions & Math Operators - -In the old world, you would include the function name inside the string equation. This presented problems with misspelling, knowing what parameters to provide and type safety on the output. In the new world, you get this through Intellisense as all the available Math functions are available off the ExpressionFunction class. - -For operators, they were simply included in the string in the old world. In the new world, you can use them similar to the System.Numerics experience. - -```csharp -// Old way -var extraOffset = new Vector3(50f); -var expOldWorld = _compositor.CreateExpressionAnimation( - "Lerp(0f, 1f, visB.Offset.X / windowWidth"); -expOldWorld.SetReferenceParameter("visB", _visualB); -expOldWorld.SetScalarParameter("windowWidth", windowWidth); - -// New Way -var expNewWorld = - ExpressionFunctions.Lerp(0f, 1f, _visualB.GetReference().Offset.X / windowWidth); -``` - -## Using Ternary and Conditional Operators - -In the old world you would use the *Condition ? ifTrue : ifFalse* format for the ternary operation, using the appropriate conditional operators in the condition portion of the string. In the new world, the Ternary operator behavior is found off the Conditional function under the ExpressionFunctions class. All the same comparison operators are supported and can be used in the same format like the basic math operators. - -```csharp -// rotateBy30, rotateBy45 are Quaternions defined earlier - -// Old way -var expOldWorld = _compositor.CreateExpressionAnimation( - "(visA.Orientation == visB.Orientation) ? rotBy30 : rotby45"); -expOldWorld.SetReferenceParameter("visB", _visualB); -expOldWorld.SetReferenceParameter("visA", _visualA); -expOldWorld.SetQuaternionParameter("rotBy30", rotateBy30); -expOldWorld.SetQuaternionParameter("rotBy45", rotateBy45); - -// New Way -var condition = ExpressionFunctions.Length(_visualA.GetReference().Orientation) == - ExpressionFunctions.Length(_visualB.GetReference().Orientation); -var expNewWorld = ExpressionFunctions.Conditional(condition, rotateBy30, rotateBy45); -``` - -## Keywords - -In the old world, there were reserved string keywords that can be used to achieve specific behavior: - -- This.StartingValue - -- This.CurrentValue - -- This.Target - -- Pi - -- True/False - -The challenge with this model in the old world was they were not discoverable. - -In the new world, the StartingValue/CurrentValue/Target keywords are made available off the ExpressionValue class. For the use of Pi and True/False, the values defined in C\# are sufficient. - -```csharp -// Old way -var expOldWorld = _compositor.CreateExpressionAnimation( - "visA.RotationAngle <= Pi ? this.StartingValue : fullSize"); -expOldWorld.SetReferenceParameter("visA", _visualA); -expOldWorld.SetVector2Parameter("fullSize", fullSize); - -// New Way -var condition = ExpressionFunctions.Length(_visualA.GetReference().RotationAngle) <= (float)Math.PI; -var expNewWorld = ExpressionFunctions.Conditional(condition, ExpressionValues.StartingValue.CreateVector2StartingValue(), fullSize); -``` - -## Starting an Expression on a CompositionObject - -In the old world, developers utilized the StartAnimation() method off of CompositionObject that passed in two values: the string name of the property animate and the ExpressionAnimation defined by a string. In the new world, there is an extension method that takes in an ExpressionNode instead an ExpressionAnimation. - -# E2E Building Examples - -This section is dedicated to walking through building a few different Expressions using the Expression Builder Classes. Each of the examples will start with an Expression (and any needed supporting code) and break down how these can be re-written using the new classes. All the examples will be pulled from samples on the [Windows UI Dev Labs Github Project](https://github.com/Microsoft/WindowsUIDevLabs). - -There is an assumption that the reader has a general understanding of what Expressions are and how the ExpressionBuilder classes work. If not, it is recommended to read the [Intro](#intro) and [How to: Build Core Components of Expressions](#how-to-build-core-components-of-expressions) first. - -## Parallaxing Listing Items - -([Github Link](https://github.com/Microsoft/WindowsUIDevLabs/tree/master/SampleGallery/Samples/SDK%2010586/ParallaxingListItems)) - -The first example we will walk through is the Parallaxing List Item sample found on the Windows UI Dev Labs Github Sample Gallery project. In this sample, we want to create a UI experience such that the background image for each list item parallax as the user scrolls through the list. - -### Old Expression - -Let’s first look at the relevant code for how the Expression is built today using strings: - -```csharp -_parallaxExpression = compositor.CreateExpressionAnimation(); -_parallaxExpression.SetScalarParameter("StartOffset", 0.0f); -_parallaxExpression.SetScalarParameter("ParallaxValue", 0.5f); -_parallaxExpression.SetScalarParameter("ItemHeight", 0.0f); -_parallaxExpression.SetReferenceParameter("ScrollManipulation", _scrollProperties); -_parallaxExpression.Expression = "(ScrollManipulation.Translation.Y + StartOffset - (0.5 * ItemHeight)) * ParallaxValue - (ScrollManipulation.Translation.Y + StartOffset - (0.5 * ItemHeight))"; -//[Later in the code …] -_parallaxExpression.SetScalarParameter( - "StartOffset", (float)args.ItemIndex * visual.Size.Y / 4.0f); -visual.StartAnimation("Offset.Y", _parallaxExpression); -``` - -### Summary of Expression definition - -- The core of this Expression is uses a ScrollManipulationPropertySet, a CompositionPropertySet that contains information about the XAML ScrollViewer that manages the item in the XAML ListView. - - - Specifically, we are looking at the Translation.Y property. When building our Expression, we will need to grab a reference to this property. - -- There are three other scalar parameters that comprise the remainder of this equation (StartOffset, ParallaxValue and ItemHeight). Note, that in this sample, the intent was to make this Expression a template, meaning that these values may need to be changed later. - - - If the intent was not to template, the Expression would have been created differently, with the values being written directly into the string. - -- Finally, the equation itself has a common component (we’ll denote it “A”) that gives it the form A\*Parallax – A. - - - In this case “A” is: - "(ScrollManipulation.Translation.Y + StartOffset - (0.5 \* ItemHeight))” - -### Building with ExpressionNodes - -So let’s get started building this Expression into an ExpressionNode. To start, we’ll make three variables to keep track of the three Scalar Parameters and specifically for templating purposes: - -```csharp -var startOffset = - ExpressionValues.Constant.CreateConstantScalar("startOffset", 0.0f); -var parallaxValue = - ExpressionValues.Constant.CreateConstantScalar("parallaxValue", 0.5f); -var itemHeight = - ExpressionValues.Constant.CreateConstantScalar("itemHeight", 0.0f); -``` - -Next, let’s get a reference to that ManipulationPropertySet (specifically, the Translation.Y property). To do that, we need to: - -- Get a reference to the PropertySet - -- Use the static method to get the Translation.Y property - - - A Scalar property - - This can be done all in one line: - - ```csharp - var yTranslation = - _scrollProperties.GetSpecializedReference() - .Translation.Y; - ``` - - (For walkthrough purposes, this is stored as a separate variable and then put into the final equation. This also could have been included directly in the final ExpressionNode parallax below.) - -Now let’s build out the “A” component of the A\*Parallax – A format that was described earlier: - -```csharp -var parallax = (yTranslation + startOffset - (0.5f * itemHeight)); -``` - -Now we are ready to build out the full Expression pass it into the StartAnimation() function call! - -```csharp -var parallaxExpression = parallax * parallaxValue - parallax; - -// Later on in the code -visual.StartAnimation("Offset.Y", parallaxExpression); -``` - -### Final code snippet - -```csharp -// Not necessary to define as variables, could put directly into parallax variable -var startOffset = - ExpressionValues.Constant.CreateConstantScalar("startOffset", 0.0f); -var parallaxValue = - ExpressionValues.Constant.CreateConstantScalar("parallaxValue", 0.5f); -var itemHeight = - ExpressionValues.Constant.CreateConstantScalar("itemHeight", 0.0f); -// Not necessary to define into variable, could put directly into parallax variable -var yTranslation = -_scrollProperties.GetSpecializedReference() -.Translation.Y; - -var parallax = (yTranslation + startOffset - (0.5f * itemHeight)); -var parallaxExpression = parallax * parallaxValue - parallax; - -// This Expression is connected later in the code. -visual.StartAnimation("Offset.Y", parallaxExpression); -``` - -## PropertySets - -([Github Project](https://github.com/Microsoft/WindowsUIDevLabs/tree/master/SampleGallery/Samples/SDK%2010586/PropertySets)) - -The second example we will walk through is the PropertySets sample on the Windows UI Dev Labs Sample Gallery Github project. In this sample, we want to make a UI experience where we want to have a colored ball orbit another that is moving up and down. - -### Old Expression - -Let’s first look at the relevant code for how the Expression is built today using strings: - -```csharp -ExpressionAnimation expressionAnimation = -compositor.CreateExpressionAnimation( - "visual.Offset + propertySet.CenterPointOffset + " + "Vector3(cos(ToRadians(propertySet.Rotation)) * 150," + "sin(ToRadians(propertySet.Rotation)) * 75, 0)"); - -expressionAnimation.SetReferenceParameter("propertySet", propertySet); -expressionAnimation.SetReferenceParameter("visual", redSprite); - -blueSprite.StartAnimation("Offset", expressionAnimation); -``` - -### Summary of Expression definition - -- At a high level, this Expression is simply the sum of three components: A Visual reference, a CompositionPropertySet reference and a Vector3 object construction. - -- A scalar property in a CompositionPropertySet named “Rotation” that is being animated by a separate KeyFrameAnimation dictates the core behavior of this Expression. - - - This property “Rotation”, and another property “CenterPointOffset, will need to be referenced in the equation. - -- The Expression also constructs a Vector3 that takes the Cosine of the Radians-converted property “Rotation” in the CompositionPropertySet - -### Building with ExpressionNodes - -Note that, as mentioned earlier in the Tips and Tricks section of the doc, this walkthrough uses a shorthand to refer to the ExpressionFunctionClass as EF: - -```csharp -using EF = HelperClasses.ExpressionFunctions; -``` - -First, we get a reference to the PropertySet and its Rotation and CenterPointOffset properties: - -```csharp -var rotation = - propertySet.GetReference().GetScalarProperty("Rotation"); -var centerPointOffset = propertySet.GetReference().GetVector3Property("CenterPointOffset"); -``` - -Now we are ready to put together the full Expression: - -```csharp -var orbitExp = visual.GetReference().Offset + centerPointOffset + - EF.Vector3(EF.Cos(EF.ToRadians(rotation)) * 150, - EF.Sin(EF.ToRadians(rotation)) * 75, - 0f); -``` - -### Final code snippet - -```csharp -using EF = HelperClasses.ExpressionFunctions; - -var rotation = - propertySet.GetReference().GetScalarProperty("Rotation"); -var centerPointOffset = propertySet.GetReference().GetVector3Property("CenterPointOffset"); -var orbitExp = visual.GetReference().Offset + centerPointOffset + - EF.Vector3(EF.Cos(EF.ToRadians(rotation)) * 150, - EF.Sin(EF.ToRadians(rotation)) * 75, - 0f); -``` - -## Curtain - -([Github Project](https://github.com/Microsoft/WindowsUIDevLabs/tree/master/SampleGallery/Samples/SDK%2014393/Curtain)) - -The third example we will walk through is the Curtain sample on the Windows UI Dev Labs Sample Gallery Github project. Although there are a few instances where Expressions are used, we will focus on the Expression that defines the Spring motion of the curtain (the function named ActivateSpringForce()). - -### Old Expression - -Let’s look at the relevant code for how the Expression is built today with strings: - -```csharp -var dampingConstant = 5; -var springConstant = 20; - -var modifier = InteractionTrackerInertiaMotion.Create(_compositor); - -// Set the condition to true (always) -modifier.Condition = _compositor.CreateExpressionAnimation("true"); - -// Define a spring-like force, anchored at position 0. -modifier.Motion = _compositor.CreateExpressionAnimation( - @"(-(this.target.Position.Y) * springConstant) - (dampingConstant * this.target.PositionVelocityInPixelsPerSecond.Y)"); - -modifier.Motion.SetScalarParameter("dampingConstant", dampingConstant); -modifier.Motion.SetScalarParameter("springConstant", springConstant); - -_tracker.ConfigurePositionYInertiaModifiers( - new InteractionTrackerInertiaModifier[] { modifier }); -``` - -### Summary Expression Definition - -- The equation for this Expression is leveraging the force equation used for damped harmonic oscillators: kx – cv, where k is the Spring Constant, x is the displacement of the spring, c is the damping constant and v is the velocity of the spring. - -- The main component of this equation is an InteractionTracker and the associated properties of it to drive the damped harmonic oscillator equation. - - - In particular, the properties Position.Y and PositionVelocityInPixelsPerSecond.Y - -- Because this Expression is getting properties from the same InteractionTracker it is animating, the Target keyword will be used here. - -### Building with ExpressionNodes - -We’ll start with defining out the first Expression, which is the Condition portion of the InertiaMotion Modifier. This is done by using the CompositionExtensions.SetCondition(…) extension method, which is accessed via InterationTrackerInertiaMotion.SetCondition(…). - -```csharp -modifier.SetCondition(true); -``` - -Next, we’ll use the Target keyword to get a reference to the InteractionTracker object that this Expression will be applied to. - -```csharp -var target = ExpressionValues.Target.CreateInteractionTrackerTarget(); -``` - -At this point, we are ready to build out the rest of the Expression and set the Motion component of the InertiaModifier, using another extension method CompositionExtensions.SetMotion(…): - -```csharp -var motion = (-target.Position.Y * springConstant) - - (dampingConstant * target.PositionVelocityInPixelsPerSecond.Y); -modifier.SetMotion(motion); -``` - -### Final code snippet - -```csharp -var dampingConstant = 5; -var springConstant = 20; - -var modifier = InteractionTrackerInertiaMotion.Create(_compositor); - -// Set the condition to true (always) -modifier.SetCondition(true); - -var target = ExpressionValues.Target.CreateInteractionTrackerTarget(); -var motion = (-target.Position.Y * springConstant) - - (dampingConstant * target.PositionVelocityInPixelsPerSecond.Y); -modifier.SetMotion(motion); - -_tracker.ConfigurePositionYInertiaModifiers( - new InteractionTrackerInertiaModifier[] { modifier }); -``` - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| ---------------------------------------------------------------- | ----------------------------------- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Animations | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Animations](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Animations/) | - -## API - -* [Expressions source code](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.UI.Animations/Expressions) diff --git a/docs/animations/Fade.md b/docs/animations/Fade.md deleted file mode 100644 index c6c86b8f172..00000000000 --- a/docs/animations/Fade.md +++ /dev/null @@ -1,123 +0,0 @@ ---- -title: Fade animation behavior -author: nmetulev -description: The Fade animation behavior fades objects, in and out, over time and delay. It can be used along side other animations directly through XAML or code -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, fade, fade animation -dev_langs: - - csharp - - vb ---- - -# Fade - -The [Fade animation](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.animations.animationextensions.fade) fades objects, in and out, over time. Fade animation is applied to all the XAML elements in its parent control/panel. Fade animation doesn't affect the functionality of the control. - -## Syntax - -```xaml - - - - - -``` - -```csharp -MyUIElement.Fade(value: 0.5f, duration: 2500, delay: 250, easingType: EasingType.Default).Start(); -await MyUIElement.Fade(value: 0.5f, duration: 2500, delay: 250, easingType: EasingType.Default).StartAsync(); //Fade animation can be awaited -``` -```vb -MyUIElement.Fade(value:=0.5F, duration:=2500, delay:=250, easingType:=EasingType.[Default]).Start() -Await MyUIElement.Fade(value:=0.5F, duration:=2500, delay:=250, easingType:=EasingType.[Default]).StartAsync() ' Fade animation can be awaited -``` - -## Sample Output - -![Fade Behavior animation](../resources/images/Animations/Fade/Sample-Output.gif) - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| Value | float | The fade value, between 0 and 1 | -| Duration | double | The duration in milliseconds | -| Delay | double | The delay for the animation to begin | -| EasingType | EasingType | Used to describe how the animation interpolates between keyframes | - -### EasingType - -You can change the way how the animation interpolates between keyframes by defining the EasingType. - -| EasingType | Explanation | Graphical Explanation | -| ---------- | ---------------------------------------------------------------------------------------------------------- | ------------------------------------------ | -| Default | Creates an animation that accelerates with the default EasingType which is specified in AnimationExtensions.DefaultEasingType which is by default Cubic | | -| Linear | Creates an animation that accelerates or decelerates linear | | -| Back | Retracts the motion of an animation slightly before it begins to animate in the path indicated | ![BackEase](https://docs.microsoft.com/dotnet/framework/wpf/graphics-multimedia/media/backease-graph.png) | -| Bounce | Creates a bouncing effect | ![BounceEase](https://docs.microsoft.com/dotnet/framework/wpf/graphics-multimedia/media/bounceease-graph.png) | -| Circle | Creates an animation that accelerates or decelerates using a circular function | ![CircleEase](https://docs.microsoft.com/dotnet/framework/wpf/graphics-multimedia/media/circleease-graph.png) | -| Cubic | Creates an animation that accelerates or decelerates using the formula f(t) = t3 | ![CubicEase](https://docs.microsoft.com/dotnet/framework/wpf/graphics-multimedia/media/cubicease-graph.png) | -| Elastic | Creates an animation that resembles a spring oscillating back and forth until it comes to rest | ![ElasticEase](https://docs.microsoft.com/dotnet/framework/wpf/graphics-multimedia/media/elasticease-graph.png) | -| Quadratic | Creates an animation that accelerates or decelerates using the formula f(t) = t2 | ![QuadraticEase](https://docs.microsoft.com/dotnet/framework/wpf/graphics-multimedia/media/quadraticease-graph.png) | -| Quartic | Creates an animation that accelerates or decelerates using the formula f(t) = t4 | ![QuarticEase](https://docs.microsoft.com/dotnet/framework/wpf/graphics-multimedia/media/quarticease-graph.png) | -| Quintic | Create an animation that accelerates or decelerates using the formula f(t) = t5 | ![QuinticEase](https://docs.microsoft.com/dotnet/framework/wpf/graphics-multimedia/media/quinticease-graph.png) | -| Sine | Creates an animation that accelerates or decelerates using a sine formula | ![SineEase](https://docs.microsoft.com/dotnet/framework/wpf/graphics-multimedia/media/sineease-graph.png) | - -## Methods - -| Methods | Return Type | Description | -| -- | -- | -- | -| Fade(AnimationSet, Single, Double, Double, EasingType) | AnimationSet | Animates the opacity of the the UIElement | -| Fade(UIElement, Single, Double, Double, EasingType) | AnimationSet | Animates the opacity of the the UIElement | - -## Examples - -- Use this to create chaining animations with other animations. Visit the [AnimationSet](AnimationSet.md) documentation for more information. - - **Sample Code** - - ```csharp - var anim = MyUIElement.Fade(0.5f).Blur(5).Rotate(30); - anim.SetDurationForAll(2500); - anim.SetDelay(250); - anim.Completed += animation_completed; - anim.Start(); - ``` - ```vb - Dim anim = MyUIElement.Fade(0.5F).Blur(5).Rotate(30) - anim.SetDurationForAll(2500) - anim.SetDelay(250) - AddHandler anim.Completed, AddressOf animation_completed - anim.Start() - ``` - - **Sample Output** - - ![Use Case 1 Output](../resources/images/Animations/Chaining-Animations-Blur-Fade-Rotate.gif) - -## Sample Project - -[Fade Behavior Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Fade). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| ---------------------------------------------------------------- | ----------------------------------- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Animations | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Animations](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Animations/) | - -## API - -* [Fade source code](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors/Fade.cs) - -## Related Topics - -- [AnimationSet Class](https://docs.microsoft.com/windows/communitytoolkit/animations/animationset) -- [Storyboard Class](https://docs.microsoft.com/uwp/api/Windows.UI.Xaml.Media.Animation.Storyboard) diff --git a/docs/animations/FadeHeader.md b/docs/animations/FadeHeader.md deleted file mode 100644 index 3c9d22695ae..00000000000 --- a/docs/animations/FadeHeader.md +++ /dev/null @@ -1,98 +0,0 @@ ---- -title: FadeHeader Behavior -author: nmetulev -description: The FadeHeader Behavior fades a ListView or GridView Header UIElement when the user scrolls. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, fadeheader, fadeheader behavior -dev_langs: - - csharp - - vb ---- - -# FadeHeader - -The [FadeHeader](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.animations.behaviors.fadeheaderbehavior) fades a ListView or GridView Header UIElement when the user scrolls. The UIElement fades out to 0 opacity when the edge of the Header reaches the edge of the visible bounds of the ListElement. - -## Syntax - -***Implicit usage***: Automatically detects the Header element by finding the ListViewBase (note: GridView uses ListViewBase) - -```xaml - - - - - - - - - - -``` - -***Explicit usage***: Set the ElementName property using the UIElement of the Header manually - -```xaml - - - - - - - - - - - - -``` - -***Implicit usage***: - -```csharp -Microsoft.Xaml.Interactivity.Interaction.GetBehaviors(MyListView).Add(new FadeHeaderBehavior()); -``` -```vb -Microsoft.Xaml.Interactivity.Interaction.GetBehaviors(MyListView).Add(New FadeHeaderBehavior()) -``` - -***Explicit usage***: - -```csharp -Microsoft.Xaml.Interactivity.Interaction.GetBehaviors(MyListView).Add(new FadeHeaderBehavior { HeaderElement = MyHeaderGrid }); -``` -```vb -Microsoft.Xaml.Interactivity.Interaction.GetBehaviors(MyListView).Add(New FadeHeaderBehavior With {.HeaderElement = MyHeaderGrid}) -``` - -## Sample Output - -![FadeHeader Behavior animation](../resources/images/Animations/FadeHeader/Sample-Output.gif) - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| HeaderElement | UIElement | Gets or sets the target element for the Fading behavior | - -## Sample Project - -[FadeHeader Behavior Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/FadeHeader). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| ---------------------------------------------------------------- | ----------------------------------- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Animations | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Animations](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Animations/) | - -## API - -* [FadeHeader source code](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors/FadeHeaderBehavior.cs) - -## Related Topics - -- [ListViewBase Header](https://docs.microsoft.com/uwp/api/windows.ui.xaml.controls.listviewbase#Windows_UI_Xaml_Controls_ListViewBase_Header) diff --git a/docs/animations/ImplicitAnimations.md b/docs/animations/ImplicitAnimations.md deleted file mode 100644 index e9a5b8c945a..00000000000 --- a/docs/animations/ImplicitAnimations.md +++ /dev/null @@ -1,139 +0,0 @@ ---- -title: Implicit Animations XAML Attached Properties -author: nmetulev -description: The Implicit Animations Attached Properties enable implicit animations to be defined in your XAML code -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, composition animations, animation, implicit animations, XAML, implicit, composition, show animation, hide animation ---- - -# Implicit Composition Animations in XAML - -Implicit Animations are Composition Animations that are used to describe how and when animations occur as a response to direct property changes, such as Opacity or Offset. Show and Hide animations describe the animation to be applied to an element when the Visibility is changed, or the element is added/removed to the visual tree. - -**Prerequisites** - [Composition Animation in XAML](https://docs.microsoft.com/windows/communitytoolkit/animations/compositionanimations) - -The Implicit Animations Attached Properties enable implicit animations to be defined in your XAML code by using the [Composition Animation](https://docs.microsoft.com/windows/communitytoolkit/animations/compositionanimations) XAML objects. This allows animations to be defined directly on the element, or defined as XAML resources and applied to any XAML element. - -The Implicit Animations Attached Properties can be used in combination with the [VisualExtensions](https://docs.microsoft.com/windows/communitytoolkit/extensions/visualex). This works well when used in Storyboards. - -## Syntax - -```xaml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -``` - -## Properties - -### Implicit.Animations -Specifies an [Composition Animation](https://docs.microsoft.com/windows/communitytoolkit/animations/compositionanimations) with animations to run when properties are modified. - -### Implicit.ShowAnimations and Implicit.HideAnimations -Specifies an [Composition Animation](https://docs.microsoft.com/windows/communitytoolkit/animations/compositionanimations) with animations to run when an element is added or removed from the visual tree respectively (including when Visibility on an element is changed). - -## Examples - -- Let's create a scaling animation. - - ```xaml - - - - - - ``` - ![Example Output 1](../resources/images/Animations/ImplicitAnimations/Example-Output-1.gif) - -- Let's create blink animation to show and hide controls. - - ```xaml - - - - - - - - - - - - - - - - - - - - ``` - Now, when you set `Element.Visibility = Visibility.Collapsed` the HideAnimations will run and when you set `Element.Visibility = Visibility.Visible` the ShowAnimations will run. - - ![Example Output 2](../resources/images/Animations/ImplicitAnimations/Example-Output-2.gif) - -- Now, we can create a rotating animation whenever offset changes. This time we can use [Resources](https://docs.microsoft.com/windows/uwp/design/controls-and-patterns/resourcedictionary-and-xaml-resource-references) to set Implicit Animations. - - ```xaml - - - - - - - - - - - - - - ``` - ![Example Output 3](../resources/images/Animations/ImplicitAnimations/Example-Output-3.gif) - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| ---------------------------------------------------------------- | ----------------------------------- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Animations | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Animations](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Animations/) | - -## API - -* [Implicit animations source code](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.UI.Animations/Implicit.cs) - -## Related Topics - -- [Visual layer](https://docs.microsoft.com/windows/uwp/composition/visual-layern) -- [Composition animations](https://docs.microsoft.com/windows/uwp/composition/composition-animation) -- [ExpressionAnimation](https://docs.microsoft.com/uwp/api/Windows.UI.Composition.ExpressionAnimation) \ No newline at end of file diff --git a/docs/animations/Light.md b/docs/animations/Light.md deleted file mode 100644 index e6e9a6917db..00000000000 --- a/docs/animations/Light.md +++ /dev/null @@ -1,108 +0,0 @@ ---- -title: Light animation behavior -author: nmetulev -description: The Light animation behavior performs a point light in the middle of a given UIElement. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, light, light animation -dev_langs: - - csharp - - vb ---- - -# Light - -The [Light animation](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.animations.animationextensions.light) behavior performs a point light (A point source of light that emits light in all directions) in the middle of a given UIElement. You set the distance property of the light to determine how bright the light will be. The closer the light source, the darker the UI element will be. - -> [!NOTE] -Heavy usage of effects may have a negative impact on the performance of your application. - -## Syntax - -```xaml - - - - - -``` - -```csharp -MyUIElement.Light(distance: 5, duration: 2500, delay: 250, color: Colors.Red).Start(); -await MyUIElement.Light(distance: 5, duration: 2500, delay: 250, color: Colors.Red).StartAsync(); //Light animation can be awaited -``` -```vb -MyUIElement.Light(distance:=5, duration:=2500, delay:=250, color:=Colors.Red).Start() -Await MyUIElement.Light(distance:=5, duration:=2500, delay:=250, color:=Colors.Red).StartAsync() ' Light animation can be awaited -``` - -## Sample Output - -![Light Behavior animation](../resources/images/Animations/Light/Sample-Output.gif) - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| Color | Brush | The color of the spot light | -| Delay | double | The delay for the animation to begin | -| Distance | double | The distance of the spotlight. 0 being the furthest. | -| Duration | double | The duration in milliseconds | - -## Methods - -| Methods | Return Type | Description | -| -- | -- | -- | -| Light(AnimationSet, Double, Double, Double) | AnimationSet | Animates a point light and it's distance | -| Light(FrameworkElement, Double, Double, Double) | AnimationSet | Animates a point light and it's distance | - -## Examples - -- The light behavior is great at drawing the user's eye towards a particular pieces of user interface. Closer the light source, the more focused it will be, but, will make the overall UI element darker. The further away from the light source the more the light will spread over the UIElement. -- Use this to create chaining animations with other animations. Visit the [AnimationSet](AnimationSet.md) documentation for more information. - - **Sample Code** - - ```csharp - var anim = MyUIElement.Light(5).Offset(offsetX: 100, offsetY: 100).Saturation(0.5).Scale(scaleX: 2, scaleY: 2); - anim.SetDurationForAll(2500); - anim.SetDelay(250); - anim.Completed += animation_completed; - anim.Start(); - ``` - ```vb - Dim anim = MyUIElement.Light(5).Offset(offsetX:=100, offsetY:=100).Saturation(0.5).Scale(scaleX:=2, scaleY:=2) - anim.SetDurationForAll(2500) - anim.SetDelay(250) - AddHandler anim.Completed, AddressOf animation_completed - anim.Start() - ``` - - **Sample Output** - - ![Use Case 1 Output](../resources/images/Animations/Chaining-Animations-Light-Offset-Saturation-Scale.gif) - -## Sample Project - -[Light Behavior Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Light). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ) - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| ---------------------------------------------------------------- | ----------------------------------- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Animations | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Animations](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Animations/) | - -## API - -* [Light source code](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors/Light.cs) - -## Related Topics - -- [SceneLightingEffect Class](https://docs.microsoft.com/uwp/api/Windows.UI.Composition.Effects.SceneLightingEffect) diff --git a/docs/animations/Offset.md b/docs/animations/Offset.md deleted file mode 100644 index 0535ef8a4cd..00000000000 --- a/docs/animations/Offset.md +++ /dev/null @@ -1,160 +0,0 @@ ---- -title: Offset animation behavior -author: nmetulev -description: The Offset animation behavior gets the number of pixels, from the origin of the associated control, then offsets the control. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, offset animation -dev_langs: - - csharp - - vb ---- - -# Offset - -The [Offset animation](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.animations.animationextensions.offset) is used to move the control from one place to another. Offset animation is applied to all the XAML elements in its parent control/panel. Offset animation doesn't affect the functionality of the control. - -## Syntax - -```xaml - - - - - -``` - -```csharp -MyUIElement.Offset(offsetX: 25, offsetY: 25, duration: 2500, delay: 250, easingType: EasingType.Default).Start(); -await MyUIElement.Offset(offsetX: 25, offsetY: 25, duration: 2500, delay: 250, easingType: EasingType.Default).StartAsync(); //Offset animation can be awaited -``` -```vb -MyUIElement.Offset(offsetX:=25, offsetY:=25, duration:=2500, delay:=250, easingType:=EasingType.[Default]).Start() -Await MyUIElement.Offset(offsetX:=25, offsetY:=25, duration:=2500, delay:=250, easingType:=EasingType.[Default]).StartAsync() ' Offset animation can be awaited -``` - -## Sample Output - -![Offset Behavior animation](../resources/images/Animations/Offset/Sample-Output.gif) - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| OffsetX | float | The offset on the x axis | -| OffsetY | float | The offset on the y axis | -| Duration | double | The duration in milliseconds | -| Delay | double | The delay for the animation to begin | -| EasingType | EasingType | Used to describe how the animation interpolates between keyframes | - -### EasingType - -You can change the way how the animation interpolates between keyframes by defining the EasingType. - -| EasingType | Explanation | Graphical Explanation | -| ---------- | ---------------------------------------------------------------------------------------------------------- | ------------------------------------------ | -| Default | Creates an animation that accelerates with the default EasingType which is specified in AnimationExtensions.DefaultEasingType which is by default Cubic | | -| Linear | Creates an animation that accelerates or decelerates linear | | -| Back | Retracts the motion of an animation slightly before it begins to animate in the path indicated | ![BackEase](https://docs.microsoft.com/dotnet/framework/wpf/graphics-multimedia/media/backease-graph.png) | -| Bounce | Creates a bouncing effect | ![BounceEase](https://docs.microsoft.com/dotnet/framework/wpf/graphics-multimedia/media/bounceease-graph.png) | -| Circle | Creates an animation that accelerates or decelerates using a circular function | ![CircleEase](https://docs.microsoft.com/dotnet/framework/wpf/graphics-multimedia/media/circleease-graph.png) | -| Cubic | Creates an animation that accelerates or decelerates using the formula f(t) = t3 | ![CubicEase](https://docs.microsoft.com/dotnet/framework/wpf/graphics-multimedia/media/cubicease-graph.png) | -| Elastic | Creates an animation that resembles a spring oscillating back and forth until it comes to rest | ![ElasticEase](https://docs.microsoft.com/dotnet/framework/wpf/graphics-multimedia/media/elasticease-graph.png) | -| Quadratic | Creates an animation that accelerates or decelerates using the formula f(t) = t2 | ![QuadraticEase](https://docs.microsoft.com/dotnet/framework/wpf/graphics-multimedia/media/quadraticease-graph.png) | -| Quartic | Creates an animation that accelerates or decelerates using the formula f(t) = t4 | ![QuarticEase](https://docs.microsoft.com/dotnet/framework/wpf/graphics-multimedia/media/quarticease-graph.png) | -| Quintic | Create an animation that accelerates or decelerates using the formula f(t) = t5 | ![QuinticEase](https://docs.microsoft.com/dotnet/framework/wpf/graphics-multimedia/media/quinticease-graph.png) | -| Sine | Creates an animation that accelerates or decelerates using a sine formula | ![SineEase](https://docs.microsoft.com/dotnet/framework/wpf/graphics-multimedia/media/sineease-graph.png) | - -## Methods - -| Methods | Return Type | Description | -| -- | -- | -- | -| Offset(AnimationSet, Single, Single, Double, Double, EasingType) | AnimationSet | Animates the offset of the the UIElement | -| Offset(UIElement, Single, Single, Double, Double, EasingType) | AnimationSet | Animates the offset of the the UIElement | - -## Examples - -- You can just call `Offset()` set the control in the original position - - **Sample Code** - - ```csharp - await MyUIElement.Offset().Start(); - ``` - ```vb - Await MyUIElement.Offset().Start() - ``` -- Use await to create a continuous movement - - **Sample Code** - - ```csharp - public async void OffsetAsync() - { - await MyUIElement.Offset(offsetX: 100, duration:1000).StartAsync(); - await MyUIElement.Offset(offsetX: 100, offsetY: 100, duration: 1000).StartAsync(); - await MyUIElement.Offset(offsetX: 0, offsetY:100, duration: 1000).StartAsync(); - await MyUIElement.Offset(duration: 1000).StartAsync(); - } - ``` - ```vb - Public Async Function OffsetAsync() As Task - Await MyUIElement.Offset(offsetX:=100, duration:=1000).StartAsync() - Await MyUIElement.Offset(offsetX:=100, offsetY:=100, duration:=1000).StartAsync() - Await MyUIElement.Offset(offsetX:=0, offsetY:=100, duration:=1000).StartAsync() - Await MyUIElement.Offset(duration:=1000).StartAsync() - End Function - ``` - - **Sample Output** - - ![Use Case 2 Output](../resources/images/Animations/Offset/Use-Case-1.gif) - -- Use this to create chaining animations with other animations. Visit the [AnimationSet](AnimationSet.md) documentation for more information. - - **Sample Code** - - ```csharp - var anim = MyUIElement.Light(5).Offset(offsetX: 100, offsetY: 100).Saturation(0.5).Scale(scaleX: 2, scaleY: 2); - anim.SetDurationForAll(2500); - anim.SetDelay(250); - anim.Completed += animation_completed; - anim.Start(); - ``` - ```vb - Dim anim = MyUIElement.Light(5).Offset(offsetX:=100, offsetY:=100).Saturation(0.5).Scale(scaleX:=2, scaleY:=2) - anim.SetDurationForAll(2500) - anim.SetDelay(250) - AddHandler anim.Completed, AddressOf animation_completed - anim.Start() - ``` - - **Sample Output** - - ![Use Case 2 Output](../resources/images/Animations/Chaining-Animations-Light-Offset-Saturation-Scale.gif) - -## Sample Project - -[Offset Behavior Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Offset). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| ---------------------------------------------------------------- | ----------------------------------- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Animations | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Animations](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Animations/) | - -## API - -* [Offset source code](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors/Offset.cs) - -## Related Topics - -- [AnimationSet Class](https://docs.microsoft.com/windows/communitytoolkit/animations/animationset) -- [Storyboard Class](https://docs.microsoft.com/uwp/api/Windows.UI.Xaml.Media.Animation.Storyboard) diff --git a/docs/animations/ParallaxService.md b/docs/animations/ParallaxService.md deleted file mode 100644 index b161907fb97..00000000000 --- a/docs/animations/ParallaxService.md +++ /dev/null @@ -1,95 +0,0 @@ ---- -title: ParallaxService -author: nmetulev -description: The ParallaxService class allows to create a parallax effect for items contained within an element that scrolls like a ScrollViewer or ListView. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, parallaxservice -dev_langs: - - csharp - - vb ---- - -# ParallaxService - -> [!WARNING] -The ParallaxService is deprecated and will be removed in a future major release. Please use the [ParallaxView](https://docs.microsoft.com/windows/uwp/style/parallax) available in the Fall Creators Update. Read the [Moving to ParallaxView](#parallaxview) section for more info. - -The [ParallaxService class](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.animations.parallaxservice) allows to create a parallax effect for items contained within an element that scrolls like a ScrollViewer or ListView. - -## Syntax - -```xaml - - - - - -``` - -```csharp -ParallaxService.SetHorizontalMultiplier(MyUIElement, 0.5) -ParallaxService.SetVerticalMultiplier(MyUIElement, 0.5) -``` -```vb -MyUIElement.SetValue(ParallaxService.VerticalMultiplierProperty, 0.5) -MyUIElement.SetValue(ParallaxService.HorizontalMultiplierProperty, 0.5) -``` - -## Sample Output - -![ParallaxService](../resources/images/Animations/ParallaxService/Sample-Output.gif) - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| HorizontalMultiplier | double | Set HorizontalMultiplier | -| VerticalMultiplier | double | Get VerticalMultiplier | - -## Methods - -| Methods | Return Type | Description | -| -- | -- | -- | -| GetHorizontalMultiplier(UIElement) | double | Gets how fast the parallax effect should scroll horizontally | -| GetVerticalMultiplier(UIElement) | double | Gets how fast the parallax effect should scroll vertically | -| SetHorizontalMultiplier(UIElement, Double) | void | Sets how fast the parallax effect should scroll horizontally | -| SetVerticalMultiplier(UIElement, Double) | void | Sets how fast the parallax effect should scroll vertically | - -## Sample Project - -[ParallaxService Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/ParallaxService). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ) - -## Moving to ParallaxView -The Windows 10 Fall Creators Update SDK now includes the [ParallaxView](https://docs.microsoft.com/windows/uwp/style/parallax) control among other new controls and APIs. The ParallaxService and ParallaxView share the same concepts and provide the same functionality. In fact, the ParallaxView adds even more functionality and can be used in even more scenarios. - -However, the way the two are used is different. Unlike the ParallaxService, the ParallaxView is a control hosting the background element. This control ties the scroll position of a foreground element, such as a list, to a background element, such as an image. As you scroll through the foreground element, it animates the background element to create a parallax effect. To use the ParallaxView control, you provide a Source element, a background element, and set the VerticalShift (for vertical scrolling) and/or HorizontalShift (for horizontal scrolling) properties to a value greater than zero. To create a parallax effect, the ParallaxView must be behind the foreground element. - -Here is an example of using the ParallaxView - -```xaml - - - - - - - - - - - -``` - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| ---------------------------------------------------------------- | ----------------------------------- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Animations | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Animations](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Animations/) | - -## API - -* [ParallaxService source code](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.UI.Animations/ParallaxService.cs) diff --git a/docs/animations/ReorderGrid.md b/docs/animations/ReorderGrid.md deleted file mode 100644 index 92f65720e6d..00000000000 --- a/docs/animations/ReorderGrid.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -title: ReorderGridAnimation -author: nmetulev -description: The ReorderGridAnimation class allows your GridView controls to animate items into position when the size of the GridView changes. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, ReorderGridAnimation -dev_langs: - - csharp - - vb ---- - -# ReorderGridAnimation - -The [ReorderGridAnimation class](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.animations.reordergridanimation) allows your GridView controls to animate items into position when the size of the GridView changes. - -## Syntax - -```xaml - - -``` - -```csharp -MyGridView.SetValue(ReorderGridAnimation.DurationProperty, 250); -``` -```vb -MyGridView.SetValue(ReorderGridAnimation.DurationProperty, 250) -``` -## Sample Output - -![ReorderGridAnimation](../resources/images/Animations/ReorderGridAnimation/Sample-Output.gif) - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| Duration | double | The duration of the animation in milliseconds | - -## Sample Project - -[ReorderGridAnimation Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/ReorderGridAnimation). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ) - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| ---------------------------------------------------------------- | ----------------------------------- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Animations | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Animations](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Animations/) | - -## API - -* [ReorderGridAnimation source code](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.UI.Animations/ReorderGridAnimation.cs) diff --git a/docs/animations/Rotate.md b/docs/animations/Rotate.md deleted file mode 100644 index 2854c3616a6..00000000000 --- a/docs/animations/Rotate.md +++ /dev/null @@ -1,126 +0,0 @@ ---- -title: Rotate animation behavior -author: nmetulev -description: The Rotate animation behavior allows users to modify and animate the control's rotation. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, rotate, rotate animation -dev_langs: - - csharp - - vb ---- - -# Rotate - -The [Rotate animation](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.animations.animationextensions.rotate) allows users to modify and animate the control's rotation. Rotate animation is applied to all the XAML elements in its parent control/panel. Rotate animation doesn't affect the functionality of the control. - -## Syntax - -```xaml - - - - - - -``` - -```csharp -MyUIElement.Rotate(value: 50.0f, centerX: 0.0f, centerY: 0.0f, duration: 2500, delay: 250, easingType: EasingType.Default).Start(); -await MyUIElement.Rotate(value: 50.0f, centerX: 0.0f, centerY: 0.0f, duration: 2500, delay: 250, easingType: EasingType.Default).StartAsync(); //Rotate animation can be awaited -``` -```vb -MyUIElement.Rotate(value:=50.0F, centerX:=0F, centerY:=0F, duration:=2500, delay:=250, easingType:=EasingType.[Default]).Start() -Await MyUIElement.Rotate(value:=50.0F, centerX:=0F, centerY:=0F, duration:=2500, delay:=250, easingType:=EasingType.[Default]).StartAsync() ' Rotate animation can be awaited -``` - -## Sample Output - -![Rotate Behavior animation](../resources/images/Animations/Rotate/Sample-Output.gif) - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| Value | float | The value in degrees to rotate | -| CenterX | float | The center x in pixels | -| CenterY | float | The center y in pixels | -| Duration | double | The duration in milliseconds | -| Delay | double | The delay for the animation to begin | -| EasingType | EasingType | Used to describe how the animation interpolates between keyframes | - -### EasingType - -You can change the way how the animation interpolates between keyframes by defining the EasingType using an optional parameter. - -| EasingType | Explanation | Graphical Explanation | -| ---------- | ---------------------------------------------------------------------------------------------------------- | ------------------------------------------ | -| Default | Creates an animation that accelerates with the default EasingType which is specified in AnimationExtensions.DefaultEasingType which is by default Cubic | | -| Linear | Creates an animation that accelerates or decelerates linear | | -| Back | Retracts the motion of an animation slightly before it begins to animate in the path indicated | ![BackEase](https://docs.microsoft.com/dotnet/framework/wpf/graphics-multimedia/media/backease-graph.png) | -| Bounce | Creates a bouncing effect | ![BounceEase](https://docs.microsoft.com/dotnet/framework/wpf/graphics-multimedia/media/bounceease-graph.png) | -| Circle | Creates an animation that accelerates or decelerates using a circular function | ![CircleEase](https://docs.microsoft.com/dotnet/framework/wpf/graphics-multimedia/media/circleease-graph.png) | -| Cubic | Creates an animation that accelerates or decelerates using the formula f(t) = t3 | ![CubicEase](https://docs.microsoft.com/dotnet/framework/wpf/graphics-multimedia/media/cubicease-graph.png) | -| Elastic | Creates an animation that resembles a spring oscillating back and forth until it comes to rest | ![ElasticEase](https://docs.microsoft.com/dotnet/framework/wpf/graphics-multimedia/media/elasticease-graph.png) | -| Quadratic | Creates an animation that accelerates or decelerates using the formula f(t) = t2 | ![QuadraticEase](https://docs.microsoft.com/dotnet/framework/wpf/graphics-multimedia/media/quadraticease-graph.png) | -| Quartic | Creates an animation that accelerates or decelerates using the formula f(t) = t4 | ![QuarticEase](https://docs.microsoft.com/dotnet/framework/wpf/graphics-multimedia/media/quarticease-graph.png) | -| Quintic | Create an animation that accelerates or decelerates using the formula f(t) = t5 | ![QuinticEase](https://docs.microsoft.com/dotnet/framework/wpf/graphics-multimedia/media/quinticease-graph.png) | -| Sine | Creates an animation that accelerates or decelerates using a sine formula | ![SineEase](https://docs.microsoft.com/dotnet/framework/wpf/graphics-multimedia/media/sineease-graph.png) | - -## Methods - -| Methods | Return Type | Description | -| -- | -- | -- | -| Rotate(AnimationSet, Single, Single, Single, Double, Double, EasingType) | AnimationSet | Animates the rotation in degrees of the UIElement | -| Rotate(UIElement, Single, Single, Single, Double, Double, EasingType) | AnimationSet | Animates the rotation in degrees of the UIElement | - -## Examples - -- Use this to create chaining animations with other animations. Visit the [AnimationSet](AnimationSet.md) documentation for more information. - - **Sample Code** - - ```csharp - var anim = MyUIElement.Rotate(30).Fade(0.5f).Blur(5); - anim.SetDurationForAll(2500); - anim.SetDelay(250); - anim.Completed += animation_completed; - anim.Start(); - ``` - ```vb - Dim anim = MyUIElement.Rotate(30).Fade(0.5F).Blur(5) - anim.SetDurationForAll(2500) - anim.SetDelay(250) - AddHandler anim.Completed, AddressOf animation_completed - anim.Start() - ``` - - **Sample Output** - - ![Use Case 1 Output](../resources/images/Animations/Chaining-Animations-Blur-Fade-Rotate.gif) - -## Sample Project - -[Rotate Behavior Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Rotate). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| ---------------------------------------------------------------- | ----------------------------------- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Animations | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Animations](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Animations/) | - -## API - -* [Rotate source code](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors/Rotate.cs) - -## Related Topics - -- [AnimationSet Class](https://docs.microsoft.com/windows/communitytoolkit/animations/animationset) diff --git a/docs/animations/Saturation.md b/docs/animations/Saturation.md deleted file mode 100644 index 912eb2b181f..00000000000 --- a/docs/animations/Saturation.md +++ /dev/null @@ -1,131 +0,0 @@ ---- -title: Saturation animation behavior -author: nmetulev -description: The Saturation animation behavior selectively saturates a XAML element. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, saturation animation, saturation -dev_langs: - - csharp - - vb ---- - -# Saturation - -The [Saturation animation](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.animations.animationextensions.saturation) selectively saturates a XAML element. Saturation animation is applied to all the XAML elements in its parent control/panel. Saturation animation doesn't affect the functionality of the control. - -## Syntax - -```xaml - - - - - -``` - -```csharp -MyUIElement.Saturation(value: 0.5, duration: 500, delay: 250).Start(); -await MyUIElement.Saturation(value: 0.5, duration: 500, delay: 250).StartAsync(); //Saturation animation can be awaited -``` -```vb -ToolkitLogo.Saturation(value:=0, duration:=500, delay:=250) -``` - -## Sample Output - -![Saturation Behavior animation](../resources/images/Animations/Saturation/Sample-Output.gif) - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| Value | float | The value of saturation. 0 is desaturated, 1 is saturated. | -| Duration | double | The duration in milliseconds | -| Delay | double | The delay for the animation to begin | - -## Methods - -| Methods | Return Type | Description | -| -- | -- | -- | -| Saturation(AnimationSet, Double, Double, Double) | AnimationSet | Saturates the FrameworkElement | -| Saturation(FrameworkElement, Double, Double, Double) | AnimationSet | Saturates the FrameworkElement | - -## Examples - -- Sometimes you want an element to desaturate, a common example of this could be when you mouse over a UI Element, now you can apply a SaturationBehavior to the original element at run time. - - **Sample Code** - - ```csharp - private void MyUIElement_PointerEntered(object sender, PointerRoutedEventArgs e) - { - MyUIElement.Saturation(value: 1).Start(); - } - - private void MyUIElement_PointerExited(object sender, PointerRoutedEventArgs e) - { - MyUIElement.Saturation(value: 0).Start(); - } - ``` - ```vb - Private Sub MyUIElement_PointerEntered(sender As Object, e As PointerRoutedEventArgs) - MyUIElement.Saturation(value:=1).Start() - End Sub - - Private Sub MyUIElement_PointerExited(sender As Object, e As PointerRoutedEventArgs) - MyUIElement.Saturation(value:=0).Start() - End Sub - ``` - - **Sample Output** - - ![Use Case 1 Output](../resources/images/Animations/Saturation/Use-Case-1.gif) - -- Use this to create chaining animations with other animations. Visit the [AnimationSet](AnimationSet.md) documentation for more information. - - **Sample Code** - - ```csharp - var anim = MyUIElement.Light(5).Offset(offsetX: 100, offsetY: 100).Saturation(0.5).Scale(scaleX: 2, scaleY: 2); - anim.SetDurationForAll(2500); - anim.SetDelay(250); - anim.Completed += animation_completed; - anim.Start(); - ``` - ```vb - Dim anim = MyUIElement.Light(5).Offset(offsetX:=100, offsetY:=100).Saturation(0.5).Scale(scaleX:=2, scaleY:=2) - anim.SetDurationForAll(2500) - anim.SetDelay(250) - AddHandler anim.Completed, AddressOf animation_completed - anim.Start() - ``` - - **Sample Output** - - ![Use Case 2 Output](../resources/images/Animations/Chaining-Animations-Light-Offset-Saturation-Scale.gif) - -## Sample Project - -[Saturation Behavior Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Saturation). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| ---------------------------------------------------------------- | ----------------------------------- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Animations | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Animations](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Animations/) | - -## API - -* [Saturation source code](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors/Saturation.cs) - -## Related Topics - -- [AnimationSet Class](https://docs.microsoft.com/windows/communitytoolkit/animations/animationset) -- [SaturationEffect Class](http://microsoft.github.io/Win2D/html/T_Microsoft_Graphics_Canvas_Effects_SaturationEffect.htm) diff --git a/docs/animations/Scale.md b/docs/animations/Scale.md deleted file mode 100644 index 0d5eb78ca30..00000000000 --- a/docs/animations/Scale.md +++ /dev/null @@ -1,158 +0,0 @@ ---- -title: Scale animation behavior -author: nmetulev -description: The Scale animation behavior allows you to change a control's scale by increasing or decreasing the control through animation. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, scale animation, scale -dev_langs: - - csharp - - vb ---- - -# Scale - -The [Scale animation](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.animations.animationextensions.scale) allows you to change a control's scale by increasing or decreasing the control through animation. Scale animation is applied to all the XAML elements in its parent control/panel. Scale animation doesn't affect the functionality of the control. - -## Syntax - -```xaml - - - - - -``` - -```csharp -MyUIElement.Scale(scaleX: 2, scaleY: 2, centerX: 0, centerY: 0, duration: 2500, delay: 250, easingType: EasingType.Default).Start(); -``` -```vb -MyUIElement.Scale(scaleX:=2, scaleY:=2, centerX:=0, centerY:=0, duration:=2500, delay:=250, easingType:=EasingType.[Default]).Start() -``` - -## Sample Output - -![Scale Behavior animation](../resources/images/Animations/Scale/Sample-Output.gif) - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| ScaleX | float | The scale on the x axis | -| ScaleY | float | The scale on the y axis | -| CenterX | float | The center x in pixels | -| CenterY | float | The center y in pixels | -| Duration | double | The duration in milliseconds | -| Delay | double | The delay for the animation to begin | -| EasingType | EasingType | Used to describe how the animation interpolates between keyframes | - -### EasingType - -You can change the way how the animation interpolates between keyframes by defining the EasingType. - -| EasingType | Explanation | Graphical Explanation | -| ---------- | ---------------------------------------------------------------------------------------------------------- | ------------------------------------------ | -| Default | Creates an animation that accelerates with the default EasingType which is specified in AnimationExtensions.DefaultEasingType which is by default Cubic | | -| Linear | Creates an animation that accelerates or decelerates linear | | -| Back | Retracts the motion of an animation slightly before it begins to animate in the path indicated | ![BackEase](https://docs.microsoft.com/dotnet/framework/wpf/graphics-multimedia/media/backease-graph.png) | -| Bounce | Creates a bouncing effect | ![BounceEase](https://docs.microsoft.com/dotnet/framework/wpf/graphics-multimedia/media/bounceease-graph.png) | -| Circle | Creates an animation that accelerates or decelerates using a circular function | ![CircleEase](https://docs.microsoft.com/dotnet/framework/wpf/graphics-multimedia/media/circleease-graph.png) | -| Cubic | Creates an animation that accelerates or decelerates using the formula f(t) = t3 | ![CubicEase](https://docs.microsoft.com/dotnet/framework/wpf/graphics-multimedia/media/cubicease-graph.png) | -| Elastic | Creates an animation that resembles a spring oscillating back and forth until it comes to rest | ![ElasticEase](https://docs.microsoft.com/dotnet/framework/wpf/graphics-multimedia/media/elasticease-graph.png) | -| Quadratic | Creates an animation that accelerates or decelerates using the formula f(t) = t2 | ![QuadraticEase](https://docs.microsoft.com/dotnet/framework/wpf/graphics-multimedia/media/quadraticease-graph.png) | -| Quartic | Creates an animation that accelerates or decelerates using the formula f(t) = t4 | ![QuarticEase](https://docs.microsoft.com/dotnet/framework/wpf/graphics-multimedia/media/quarticease-graph.png) | -| Quintic | Create an animation that accelerates or decelerates using the formula f(t) = t5 | ![QuinticEase](https://docs.microsoft.com/dotnet/framework/wpf/graphics-multimedia/media/quinticease-graph.png) | -| Sine | Creates an animation that accelerates or decelerates using a sine formula | ![SineEase](https://docs.microsoft.com/dotnet/framework/wpf/graphics-multimedia/media/sineease-graph.png) | - -## Methods - -| Methods | Return Type | Description | -| -- | -- | -- | -| Scale(AnimationSet, Single, Single, Single, Single, Double, Double, EasingType) | AnimationSet | Animates the scale of the the specified UIElement | -| Scale(UIElement, Single, Single, Single, Single, Double, Double, EasingType) | AnimationSet | Animates the scale of the the specified UIElement | - -## Examples - -- Use this to create popup effect - - **Sample Code** - - ```csharp - UIElement lastTapped = null; - private void MyUIElement_Tapped(object sender, TappedRoutedEventArgs e) - { - if (lastTapped != null) - { - lastTapped.Scale(centerX: 50, centerY: 50).Start(); - Canvas.SetZIndex(lastTapped, 0); - } - lastTapped = sender as UIElement; - Canvas.SetZIndex(lastTapped, 1); - lastTapped.Scale(scaleX: 2, scaleY: 2, centerX: 50, centerY: 50).Start(); - } - ``` - ```vb - Private lastTapped As UIElement = Nothing - - Private Sub MyUIElement_Tapped(ByVal sender As Object, ByVal e As TappedRoutedEventArgs) - If lastTapped IsNot Nothing Then - lastTapped.Scale(centerX:=50, centerY:=50).Start() - Canvas.SetZIndex(lastTapped, 0) - End If - - lastTapped = TryCast(sender, UIElement) - Canvas.SetZIndex(lastTapped, 1) - lastTapped.Scale(scaleX:=2, scaleY:=2, centerX:=50, centerY:=50).Start() - End Sub - ``` - **Sample Output** - - ![Use Case 1 Output](../resources/images/Animations/Scale/Sample-Output.gif) - -- Use this to create chaining animations with other animations. Visit the [AnimationSet](AnimationSet.md) documentation for more information. - - **Sample Code** - - ```csharp - var anim = MyUIElement.Light(5).Offset(offsetX: 100, offsetY: 100).Saturation(0.5).Scale(scaleX: 2, scaleY: 2); - anim.SetDurationForAll(2500); - anim.SetDelay(250); - anim.Completed += animation_completed; - anim.Start(); - ``` - ```vb - Dim anim = MyUIElement.Light(5).Offset(offsetX:=100, offsetY:=100).Saturation(0.5).Scale(scaleX:=2, scaleY:=2) - anim.SetDurationForAll(2500) - anim.SetDelay(250) - AddHandler anim.Completed, AddressOf animation_completed - anim.Start() - ``` - - **Sample Output** - - ![Use Case 2 Output](../resources/images/Animations/Chaining-Animations-Light-Offset-Saturation-Scale.gif) - -## Sample Project - -[Scale Behavior Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Scale). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| ---------------------------------------------------------------- | ----------------------------------- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Animations | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Animations](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Animations/) | - -## API - -* [Scale source code](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors/Scale.cs) - -## Related Topics - -- [AnimationSet Class](https://docs.microsoft.com/windows/communitytoolkit/animations/animationset) -- [Storyboard Class](https://docs.microsoft.com/uwp/api/Windows.UI.Xaml.Media.Animation.Storyboard) diff --git a/docs/breadcrumb/toc.yml b/docs/breadcrumb/toc.yml deleted file mode 100644 index b03a34ec00a..00000000000 --- a/docs/breadcrumb/toc.yml +++ /dev/null @@ -1,11 +0,0 @@ -- name: Docs - tocHref: / - topicHref: / - items: - - name: Windows - tocHref: /windows/ - topicHref: /windows/ - items: - - name: Windows Community Toolkit - tocHref: /windows/communitytoolkit/ - topicHref: /windows/communitytoolkit diff --git a/docs/brushes/BackdropBlurBrush.md b/docs/brushes/BackdropBlurBrush.md deleted file mode 100644 index c9893c6c299..00000000000 --- a/docs/brushes/BackdropBlurBrush.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -title: BackdropBlurBrush -author: michael-hawker -description: The BackdropBlurBrush is a Brush that blurs whatever is behind it in the application. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, brush, backdrop, blur ---- - -# BackdropBlurBrush - -The [BackdropBlurBrush](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.media.backdropblurbrush) is a [Brush](https://docs.microsoft.com/uwp/api/windows.ui.xaml.media.brush) that blurs whatever is behind it in the application. - -## Syntax - -```xaml - - - - - -``` - -## Example Image - -![Backdrop Blur](../resources/images/Brushes/BackdropBlur.jpg "Backdrop Blur") - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| Amount | double | The `Amount` property specifies a double value for the amount of Gaussian blur to apply. | - -## Sample Code - -[BackdropBlurBrush sample page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/BackdropBlurBrush). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| --- | --- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Media | -| NuGet package | [Microsoft.Toolkit.Uwp.UI](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI/) | - -## API Source Code - -- [BackdropBlurBrush source code](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp/Media/BackdropBlurBrush.cs) - -## Related Topics - -- [Win2D GaussianBlurEffect reference](http://microsoft.github.io/Win2D/html/T_Microsoft_Graphics_Canvas_Effects_GaussianBlurEffect.htm) -- [XamlCompositionBrushBase Examples](https://docs.microsoft.com/uwp/api/windows.ui.xaml.media.xamlcompositionbrushbase#examples) diff --git a/docs/brushes/BackdropGammaTransferBrush.md b/docs/brushes/BackdropGammaTransferBrush.md deleted file mode 100644 index 7f1392683bd..00000000000 --- a/docs/brushes/BackdropGammaTransferBrush.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -title: BackdropGammaTransferBrush -author: michael-hawker -description: The BackdropBlurBrush is a Brush that blurs whatever is behind it in the application. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, brush, backdrop, gamma, color ---- - -# BackdropGammaTransferBrush - -The [BackdropGammaTransferBrush](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.media.backdropgammatransferbrush) is a [Brush](https://docs.microsoft.com/uwp/api/windows.ui.xaml.media.brush) which modifies the color values of whatever is behind it in the application. - -## Syntax - -To apply a red hue: - -```xaml - - - - - -``` - -## Example Image - -![Backdrop Gamma](../resources/images/Brushes/BackdropGamma.jpg "Backdrop Gamma") - -## Properties - -See the property reference for the [GammaTransferEffect](http://microsoft.github.io/Win2D/html/T_Microsoft_Graphics_Canvas_Effects_GammaTransferEffect.htm). - -All Amplitude, Disable, Exponent, and Offset properties are available for the Alpha, Red, Green, and Blue channels. - -## Sample Code - -[BackdropGammaTransferBrush sample page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/BackdropGammaTransferBrush). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| --- | --- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Media | -| NuGet package | [Microsoft.Toolkit.Uwp.UI](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI/) | - -## API Source Code - -- [BackdropGammaTransferBrush source code](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp/Media/BackdropGammaTransferBrush.cs) - -## Related Topics - -- [Win2D GammaTransferEffect reference](http://microsoft.github.io/Win2D/html/T_Microsoft_Graphics_Canvas_Effects_GammaTransferEffect.htm) diff --git a/docs/brushes/BackdropInvertBrush.md b/docs/brushes/BackdropInvertBrush.md deleted file mode 100644 index 42fffb0ae26..00000000000 --- a/docs/brushes/BackdropInvertBrush.md +++ /dev/null @@ -1,44 +0,0 @@ ---- -title: BackdropInvertBrush -author: michael-hawker -description: The BackdropInvertBrush is a Brush that inverts whatever is behind it in the application. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, brush, backdrop, invert ---- - -# BackdropInvertBrush - -The [BackdropInvertBrush](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.media.backdropinvertbrush) is a [Brush](https://docs.microsoft.com/uwp/api/windows.ui.xaml.media.brush) that inverts whatever is behind it in the application. - -## Syntax - -```xaml - - - - - -``` - -## Example Image - -![Backdrop Invert](../resources/images/Brushes/BackdropInvert.jpg "Backdrop Invert") - -## Sample Code - -[BackdropInvertBrush sample page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/BackdropInvertBrush). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| --- | --- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Media | -| NuGet package | [Microsoft.Toolkit.Uwp.UI](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI/) | - -## API Source Code - -- [BackdropInvertBrush source code](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp/Media/BackdropInvertBrush.cs) - -## Related Topics - -- [Win2D InvertEffect reference](http://microsoft.github.io/Win2D/html/T_Microsoft_Graphics_Canvas_Effects_InvertEffect.htm) -- [Working with Brushes and Content – XAML and Visual Layer Interop, Part One](https://blogs.windows.com/buildingapps/2017/07/18/working-brushes-content-xaml-visual-layer-interop-part-one/#c57zf3bW4ylLlSvJ.97) diff --git a/docs/brushes/BackdropSaturationBrush.md b/docs/brushes/BackdropSaturationBrush.md deleted file mode 100644 index f875e49fb22..00000000000 --- a/docs/brushes/BackdropSaturationBrush.md +++ /dev/null @@ -1,49 +0,0 @@ ---- -title: BackdropSaturationBrush -author: michael-hawker -description: The BackdropSaturationBrush is a Brush that applies a Saturation effect to whatever is behind it in the application. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, brush, backdrop, saturation ---- - -# BackdropSaturationBrush - -The [BackdropSaturationBrush](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.media.backdropsaturationbrush) is a [Brush](https://docs.microsoft.com/uwp/api/windows.ui.xaml.media.brush) that blurs whatever is behind it in the application. - -## Syntax - -```xaml - - - - - -``` - -## Example Image - -![Backdrop Saturation](../resources/images/Brushes/BackdropSaturation.jpg "Backdrop Saturation") - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| Saturation | double | The `Saturation` property specifies a double value for the amount of Saturation to apply from 0.0 - 1.0. Zero being monochrome, and one being fully saturated. The default is 0.5. | - -## Sample Code - -[BackdropSaturationBrush sample page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/BackdropSaturationBrush). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| --- | --- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Media | -| NuGet package | [Microsoft.Toolkit.Uwp.UI](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI/) | - -## API Source Code - -- [BackdropSaturationBrush source code](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp/Media/BackdropSaturationBrush.cs) - -## Related Topics - -- [Win2D SaturationEffect reference](http://microsoft.github.io/Win2D/html/T_Microsoft_Graphics_Canvas_Effects_SaturationEffect.htm) diff --git a/docs/brushes/BackdropSepiaBrush.md b/docs/brushes/BackdropSepiaBrush.md deleted file mode 100644 index c6de068001c..00000000000 --- a/docs/brushes/BackdropSepiaBrush.md +++ /dev/null @@ -1,49 +0,0 @@ ---- -title: BackdropSepiaBrush -author: michael-hawker -description: The BackdropSepiaBrush is a Brush that applies a Sepia effect to whatever is behind it in the application. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, brush, backdrop, sepia ---- - -# BackdropSepiaBrush - -The [BackdropSepiaBrush](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.media.backdropsepiabrush) is a [Brush](https://docs.microsoft.com/uwp/api/windows.ui.xaml.media.brush) that blurs whatever is behind it in the application. - -## Syntax - -```xaml - - - - - -``` - -## Example Image - -![Backdrop Sepia](../resources/images/Brushes/BackdropSepia.jpg "Backdrop Sepia") - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| Intensity | double | The `Intensity` property specifies a double value for the amount of Sepia to apply from 0.0 - 1.0. Zero being none, and one being full Sepia effect. The default is 0.5. | - -## Sample Code - -[BackdropSepiaBrush sample page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/BackdropSepiaBrush). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| --- | --- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Media | -| NuGet package | [Microsoft.Toolkit.Uwp.UI](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI/) | - -## API Source Code - -- [BackdropSepiaBrush source code](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp/Media/BackdropSepiaBrush.cs) - -## Related Topics - -- [Win2D SepiaEffect reference](http://microsoft.github.io/Win2D/html/T_Microsoft_Graphics_Canvas_Effects_SepiaEffect.htm) diff --git a/docs/brushes/ImageBlendBrush.md b/docs/brushes/ImageBlendBrush.md deleted file mode 100644 index 72169b1053b..00000000000 --- a/docs/brushes/ImageBlendBrush.md +++ /dev/null @@ -1,61 +0,0 @@ ---- -title: ImageBlendBrush -author: michael-hawker -description: The ImageBlendBrush is a Brush that inverts whatever is behind it in the application. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, brush, backdrop, image, blend ---- - -# ImageBlendBrush - -The [ImageBlendBrush](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.media.imageblendbrush) is a [Brush](https://docs.microsoft.com/uwp/api/windows.ui.xaml.media.brush) that blends the provided image with whatever is behind it in the application with the provided blend mode. - -## Syntax - -```xaml - - - - - -``` - -## Example Image - -![Image Blend](../resources/images/Brushes/ImageBlend.jpg "Image Blend") - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| Source | Windows.UI.Xaml.Media.ImageSource | The `ImageSource` property specifies which image to use for the effect. It is assumed it will resolve to a [BitmapImage](https://docs.microsoft.com/uwp/api/windows.ui.xaml.media.imaging.bitmapimage). | -| Stretch | Windows.UI.Xaml.Media.Stretch | The `Stretch` property specifies how the image should stretch to its container. Requires 10.0.16299 or higher for modes other than None (default). | -| Mode | [ImageBlendMode](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.media.imageblendmode) | The `ImageBlendMode` property specifies how the image should be blended with the backdrop. See the [BlendEffectMode](http://microsoft.github.io/Win2D/html/T_Microsoft_Graphics_Canvas_Effects_BlendEffectMode.htm) reference. The `Hue`, `Saturation`, `Color`, and `Luminosity` modes require a Windows version 10.0.16299 or higher. | - -> [!NOTE] -The `Stretch` property for values other than `None` requires a Windows version 10.0.16299 or higher. -In addition, the `Hue`, `Saturation`, `Color`, and `Luminosity` modes require a Windows version 10.0.16299 or higher. - -## Sample Code - -[ImageBlendBrush sample page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/ImageBlendBrush). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| --- | --- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Media | -| NuGet package | [Microsoft.Toolkit.Uwp.UI](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI/) | - -## API Source Code - -- [BackdropInvertBrush source code](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp/Media/ImageBlendBrush.cs) - -## Related Topics - -- [BitmapImage](https://docs.microsoft.com/uwp/api/windows.ui.xaml.media.imaging.bitmapimage) -- [Win2D BlendEffect reference](http://microsoft.github.io/Win2D/html/T_Microsoft_Graphics_Canvas_Effects_BlendEffect.htm) -- [BlendEffectMode reference](http://microsoft.github.io/Win2D/html/T_Microsoft_Graphics_Canvas_Effects_BlendEffectMode.htm) -- [Working with Brushes and Content – XAML and Visual Layer Interop, Part One](https://blogs.windows.com/buildingapps/2017/07/18/working-brushes-content-xaml-visual-layer-interop-part-one/#c57zf3bW4ylLlSvJ.97) diff --git a/docs/brushes/RadialGradientBrush.md b/docs/brushes/RadialGradientBrush.md deleted file mode 100644 index 562acb753b9..00000000000 --- a/docs/brushes/RadialGradientBrush.md +++ /dev/null @@ -1,81 +0,0 @@ ---- -title: RadialGradientBrush -author: michael-hawker -description: The RadialGradientBrush fills an area with a radial gradient. A focal point defines the beginning of the gradient, and a circle defines the end point of the gradient. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, brush, radial gradient, gradient ---- - -# RadialGradientBrush - -The [RadialGradientBrush](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.media.radialgradientbrush) is a [Brush](https://docs.microsoft.com/uwp/api/windows.ui.xaml.media.brush) that fills an area with a radial gradient. A focal point defines the beginning of the gradient, and a circle defines the end point of the gradient. It is a drop-in replacement for the [System.Windows.Media.RadialGradientBrush](https://msdn.microsoft.com/library/system.windows.media.radialgradientbrush(v=vs.110).aspx). However, the `Transform`, `RenderTransform`, and `MappingMode` properties aren't supported. - -## WPF Conversion Notes - -When porting your brush XAML from WPF, just add the `media:` namespace prefix to your `RadialGradientBrush` and add the `xmlns:media="using:Microsoft.Toolkit.Uwp.UI.Media"` to your XAML namespace list. - -If you used the `Absolute` *MappingMode* you'll need to convert to the `RelativeToBoundingBox` mode first and recalculate your `RadiusX`, `RadiusY`, `Center`, and `GradientOrigin` property values. - -The Animation or Binding of *GradientStop* `Offset` and `Color` properties is not supported. - -## Syntax - -```xaml - - - - - - - - - - - -``` - -## Example Image - -![Radial Gradient](../resources/images/Brushes/RadialGradient.jpg "Radial Gradient") - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| AlphaMode | [AlphaMode](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.media.alphamode) | Specifies how the alpha channel affects color channels. The default is `Straight` for compatibility with WPF; however, the `Premultiplied` value may provide a more natural transition to transparent values. -| Center | Windows.Foundation.Point | The center of the outermost circle of the radial gradient. The default is `0.5,0.5`. | -| ColorInterpolationMode | [ColorInteropolationMode](https://docs.microsoft.com/uwp/api/Windows.UI.Xaml.Media.ColorInterpolationMode) | Specifies how the gradient's colors are interpolated. The default is `SRgbLinearInterpolation`. | -| FallbackColor | Windows.UI.Color | The color to use for rendering in case the CompositionBrush can't be rendered. | -| GradientOrigin | Windows.Foundation.Point | The location of the two-dimensional focal point that defines the beginning of the gradient. The default is `0.5,0.5`. | -| GradientStops | Windows.UI.Xaml.Media.GradientStopCollection | The brush's gradient stops. *Indiviual GradientStop's `Offset` and `Color` properties can't be bound or animated.* | -| Opacity | double | Gets or sets the degree of opacity of a Brush. | -| RadiusX | double | The horizontal radius of the outermost circle of the radial gradient. The default is `0.5`. | -| RadiusY | double | The vertical radius of the outermost circle of the radial gradient. The default is `0.5`. | -| SpreadMethod | [GradientSpreadMethod](https://docs.microsoft.com/uwp/api/Windows.UI.Xaml.Media.GradientSpreadMethod) | The type of spread method that specifies how to draw a gradient that starts or ends inside the bounds of the object to be painted. The default is `Pad`. - -> [!NOTE] -The `Transform`, `RenderTransform`, and `MappingMode` properties aren't supported. -The Animation or Binding of *GradientStop* `Offset` and `Color` properties is not supported. - -## Sample Code - -[RadialGradientBrush sample page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/RadialGradientBrush). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| --- | --- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Media | -| NuGet package | [Microsoft.Toolkit.Uwp.UI](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI/) | - -## API Source Code - -- [RadialGradientBrush source code](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp/Media/RadialGradientBrush.cs) - -## Related Topics - -- [Brush](https://docs.microsoft.com/uwp/api/windows.ui.xaml.media.brush) -- [System.Windows.Media.RadialGradientBrush](https://msdn.microsoft.com/library/system.windows.media.radialgradientbrush(v=vs.110).aspx) -- [Win2D CanvasRadialGradientBrush reference](http://microsoft.github.io/Win2D/html/T_Microsoft_Graphics_Canvas_Brushes_CanvasRadialGradientBrush.htm) diff --git a/docs/controls/AdaptiveGridView.md b/docs/controls/AdaptiveGridView.md deleted file mode 100644 index e9d59639cf3..00000000000 --- a/docs/controls/AdaptiveGridView.md +++ /dev/null @@ -1,157 +0,0 @@ ---- -title: AdaptiveGridView XAML Control -author: nmetulev -description: The AdaptiveGridView Control presents items in a evenly-spaced set of columns to fill the total available display space. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, AdaptiveGridView, xaml control, xaml -dev_langs: - - csharp - - vb ---- - -# AdaptiveGridView XAML Control - -The [AdaptiveGridView Control](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.adaptivegridview) presents items in a evenly-spaced set of columns to fill the total available display space. It reacts to changes in the layout as well as the content so it can adapt to different form factors automatically. - -There are 3 ways to use this Control: - -1. You can set `DesiredWidth` and `ItemHeight`, which will scale the **width** of each item and adjust the number of columns on demand using all horizontal space. - -2. You can set `DesiredWidth` only. This will mean that rows will take up as much space as required, using all horizontal space. - -3. Using `OneRowModeEnabled`, you can set `DesiredWidth` and `ItemHeight` which will adjust the **width** of each item and the number of visible columns on demand, using all horizontal space. - -## Syntax - -```xaml - - - - -``` - -## Sample Output - -![AdaptiveGridView animation](../resources/images/Controls/AdaptiveGridView.gif) - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| DesiredWidth | double | Gets or sets the desired width of each item | -| ItemClickCommand | ICommand | Gets or sets the command to execute when an item is clicked and the IsItemClickEnabled property is true | -| ItemHeight | double | Gets or sets the height of each item in the grid | -| ItemsPanel | ItemsPanelTemplate | Gets the template that defines the panel that controls the layout of items | -| OneRowModeEnabled | Boolean | Gets or sets a value indicating whether only one row should be displayed | -| StretchContentForSingleRow | Boolean | Gets or sets a value indicating whether the control should stretch the content to fill at least one row | - -> [!IMPORTANT] -ItemHeight property must be set when OneRowModeEnabled property set as `true` - -## Examples - -1. Using `DesiredWidth` in combination with `ItemHeight`: - - ![AdaptiveGridView DesiredHeight and ItemHeight](../resources/images/Controls/AdaptiveGridView/AdaptiveGridView-DesiredWidthItemHeight.gif) - -2. Maintain aspect ratio by setting `DesiredWidth` with no `ItemHeight` set: - - ![AdaptiveGridView Viewbox scaled](../resources/images/Controls/AdaptiveGridView/AdaptiveGridView-ViewboxAspectRatio.gif) - - This still requires the `ItemTemplate` to contain some scaling logic, this can be done with Height and Width set on the content inside of a Viewbox, or using custom view logic. - - - Using a `Viewbox`: - - Using the `Height` and `Width` properties of content inside of a `Viewbox` means that the content inside will scale linearly when **Width** and **Height** changes, which causes a zoom-like effect. This might not be a desired effect, and it will also likely incur a slight performance penalty. - - _ItemTemplate implementation_ - - ```xaml - - - - - - - - ``` - - - To use custom view logic: - - Using `MeasureOverride` on a ContentControl allows you to specify the **Width** and **Height** of the content, which might reap better performance compared to a `Viewbox`. The dimensions of the content space will change uniformly, but the content will not zoom. - - _Custom logic implementation_ - - ```csharp - public class AspectContentControl : ContentControl - { - protected override Size MeasureOverride(Size availableSize) - { - return new Size(availableSize.Width, availableSize.Width * 1.6); - } - } - ``` - ```vb - Public Class AspectContentControl - Inherits ContentControl - - Protected Overrides Function MeasureOverride(ByVal availableSize As Size) As Size - Return New Size(availableSize.Width, availableSize.Width * 1.6) - End Function - End Class - ``` - - _ItemTemplate implementation_ - - ```xaml - - - - - - - - ``` - -3. Using `OneRowModeEnabled`: - - ![AdaptiveGridView OneRowMode](../resources/images/Controls/AdaptiveGridView/AdaptiveGridView-OneRowMode.gif) - - If there are not enough items to fill one row, the control will stretch the items until all available space is filled. This can result in much wider items than specified. If you prefer your items to always stay close to the DesiredWidth, you can set the **StretchContentForSingleRow** property to **false**, to prevent further stretching. - -## Sample Code - -[AdaptiveGridView Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/AdaptiveGridView). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| -- | -- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Controls | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Controls](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Controls/) | - -## API - -* [AdaptiveGridView source code](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.UI.Controls/AdaptiveGridView) - -## Related Topics - -- [GridView Class](https://docs.microsoft.com/uwp/api/Windows.UI.Xaml.Controls.GridView) diff --git a/docs/controls/BladeView.md b/docs/controls/BladeView.md deleted file mode 100644 index 1f7b0c79699..00000000000 --- a/docs/controls/BladeView.md +++ /dev/null @@ -1,112 +0,0 @@ ---- -title: BladeView XAML Control -author: nmetulev -description: The BladeView provides a container to host blades as extra detail pages in, for example, a master-detail scenario. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, BladeView, XAML Control, xaml -dev_langs: - - csharp - - vb ---- - -# BladeView XAML Control - -The [BladeView Control](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.bladeview) provides a container to host [BladeItem](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.bladeitem) as extra detail pages in, for example, a master-detail scenario. The control is based on how the Azure Portal works. - -## Syntax - -```xaml - - - - - - - - - - - -``` - -## Sample Output - -![BladeView animation](../resources/images/Controls/BladeView.gif) - -## Properties - -### BladeView Properties - -| Property | Type | Description | -| -- | -- | -- | -| ActiveBlades | IList<[BladeItem](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.bladeitem)> | Description | -| AutoCollapseCountThreshold | int | Gets or sets a value indicating what the overflow amount should be to start auto collapsing blade items | -| BladeMode | [BladeMode](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.blademode) | Gets or sets a value indicating whether blade mode (ex: whether blades are full screen or not) | - -### BladeItem Properties - -| Property | Type | Description | -| -- | -- | -- | -| CloseButtonBackground | Brush | Gets or sets the background color of the default close button in the title bar | -| CloseButtonForeground | Brush | Gets or sets the foreground color of the close button | -| IsOpen | bool | Gets or sets a value indicating whether this blade is opened | -| Title | string | Gets or sets the title to appear in the title bar | -| TitleBarBackground | Brush | Gets or sets the background color of the title bar | -| TitleBarForeground | Brush | Gets or sets the titlebar foreground color | -| TitleBarVisibility | Visibility | Gets or sets the visibility of the title bar for this blade | - -## Events - -### BladeView Events - -| Events | Description | -| -- | -- | -| BladeClosed | Fires whenever a BladeItem is closed | -| BladeOpened | Fires whenever a BladeItem is opened | - -### BladeItem Events - -| Events | Description | -| -- | -- | -| VisibilityChanged | Fires when the blade is opened or closed | - -## Examples - -- If you want to use the BladeView for handling a flow of actions, you can use the `AutoCollapseCountThreshold` property to tell it to start auto collapsing BladeItems after a certain threshold count has been reached. This will also help keep a clean, uncluttered screen real estate. - - For example: if you set `AutoCollapseCountThreshold` to 3, the BladeView will start counting all BladeItems that are open in the BladeView and have their `TitleBarVisibility` property set to Visible. When the n+1 BladeItem, in our case the 4th one, is being added, the BladeView will auto collapse all n BladeItems except for the last one. All additional BladeItems that are added afterwards will trigger the same effect; collapse all BladeItems except for the last open one. - - *Sample Code* - - ```xaml - - - - - - - - ..... - ..... - - ``` - -## Sample Code - -[BladeView Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/BladeView). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Default Template - -[BladeView XAML File](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.UI.Controls/BladeView/BladeView.xaml) is the XAML template used in the toolkit for the default styling. - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| -- | -- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Controls | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Controls](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Controls/) | - -## API - -* [BladeView source code](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.UI.Controls/BladeView) - diff --git a/docs/controls/CameraPreview.md b/docs/controls/CameraPreview.md deleted file mode 100644 index 78ac34ab718..00000000000 --- a/docs/controls/CameraPreview.md +++ /dev/null @@ -1,101 +0,0 @@ ---- -title: CameraPreview -author: skommireddi -description: The CameraPreview control allows to easily preview video in the MediaPlayerElement from available camera frame source groups. You can subscribe and get real time video frames and software bitmaps as they arrive from the selected camera source. It shows only frame sources that support color video preview or video record streams. -keywords: windows 10, uwp, windows community toolkit, windows toolkit, CameraPreview, Camera, Preview, Video Frame, Software Bitmap ---- - -# CameraPreview - -The **CameraPreview** control allows to easily preview video in the MediaPlayerElement from available camera frame source groups. You can subscribe and get real time video frames and software bitmaps as they arrive from the selected camera source. It shows only frame sources that support color video preview or video record streams. - -> [!IMPORTANT] -Make sure you have the [webcam capability](https://docs.microsoft.com/en-us/windows/uwp/packaging/app-capability-declarations#device-capabilities) enabled for your app to access the device's camera. - -## Syntax - -```xaml - - -``` - -```csharp - -CameraPreviewControl.PreviewFailed += CameraPreviewControl_PreviewFailed; -await CameraPreviewControl.StartAsync(); -CameraPreviewControl.CameraHelper.FrameArrived += CameraPreviewControl_FrameArrived; - - -private void CameraPreviewControl_FrameArrived(object sender, FrameEventArgs e) -{ - var videoFrame = e.VideoFrame; - var softwareBitmap = videoFrame.SoftwareBitmap; -} - -private void CameraPreviewControl_PreviewFailed(object sender, PreviewFailedEventArgs e) -{ - var errorMessage = e.Error; -} -``` - -> [!IMPORTANT] -As a developer, you will need to make sure the CameraHelper resources used by the control are cleaned up when appropriate. See [CameraHelper documentation](../helpers/CameraHelper.md) for more details - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| CameraHelper| [CameraHelper](../helpers/CameraHelper.md) | Gets the CameraHelper associated with the control. | -| IsFrameSourceGroupButtonVisible | bool| Set this property to hide or show Frame Source Group Button. Note: This button is conditionally visible based on more than one source being available. | - -```xaml - - -``` - -## Methods - -| Methods | Return Type | Description | -| -- | -- | -- | -| StartAsync() | Task | Initializes camera preview control with a default Camera Helper instance and starts preview and frame capture. | -| StartAsync(CameraHelper cameraHelper) | Task | Initializes camera preview control with provided Camera Helper instance. | -| Stop() | void | Stops camera preview and disposes MediaPlayer. | - -## Events - -| Events | Description | -| -- | -- | -| PreviewFailed | Fires when camera preview fails. You can get the error reason from the PreviewFailedEventArgs.| - -## Examples - -Demonstrates using the camera control and camera helper to preview video from a specific media frame source group. - -```csharp -var availableFrameSourceGroups = = await CameraHelper.GetFrameSourceGroupsAsync(); -if(availableFrameSourceGroups != null) -{ - CameraHelper cameraHelper = new CameraHelper() { FrameSourceGroup = availableFrameSourceGroups.FirstOrDefault() }; - _cameraPreviewControl.PreviewFailed += CameraPreviewControl_PreviewFailed; - await _cameraPreviewControl.StartAsync(cameraHelper); - _cameraPreviewControl.CameraHelper.FrameArrived += CameraPreviewControl_FrameArrived; -} -``` - -## Sample Code - -[CameraPreview Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/CameraPreview). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - - -## Requirements - -| [Device family] | Universal, 10.0.17134.0 or higher | -| --- | --- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Controls | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Controls](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Controls/) | - -## API Source Code - -- [CameraPreview source code](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.UI.Controls/CameraPreview) - - diff --git a/docs/controls/Carousel.md b/docs/controls/Carousel.md deleted file mode 100644 index 30f87b4e806..00000000000 --- a/docs/controls/Carousel.md +++ /dev/null @@ -1,82 +0,0 @@ ---- -title: Carousel XAML Control -author: nmetulev -description: The Carousel control inherits from ItemsControl, representing a nice and smooth carousel. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, carousel, xaml control, xaml -dev_langs: - - csharp - - vb ---- - -# Carousel XAML Control - -The [Carousel](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.carousel) control provides a new control, inherited from the [ItemsControl](https://docs.microsoft.com/uwp/api/Windows.UI.Xaml.Controls.ItemsControl), representing a nice and smooth carousel. -This control lets you specify a lot of properties for a flexible layouting. -The `Carousel` control works fine with mouse, touch, mouse and keyboard as well. - -## Syntax - -```xaml - - - - - - - - - - - - - -``` - -## Sample Output - -![Carousel Overview](../resources/images/Controls/Carousel-Overview.gif) - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| EasingFunction | EasingFunctionBase | Gets or sets easing function to apply for each Transition | -| InvertPositive | bool | Gets or sets a value indicating whether the items rendered transformations should be opposite compared to the selected item If false, all the items (except the selected item) will have the exact same transformations If true, all the items where index > selected index will have an opposite tranformation (Rotation X Y and Z will be multiply by -1) | -| ItemDepth | int | Gets or sets depth of non Selected Index Items | -| ItemMargin | int | Gets or sets the item margin | -| ItemRotationX | double | Gets or sets rotation angle on X | -| ItemRotationY | double | Gets or sets rotation angle on Y | -| ItemRotationZ | double | Gets or sets rotation angle on Z | -| Orientation | Orientation | Gets or sets the Carousel orientation. Horizontal or Vertical | -| SelectedIndex | int | Gets or sets selected Index | -| SelectedItem | object | Gets or sets the selected Item | -| TransitionDuration | int | Gets or sets duration of the easing function animation in ms | - -## Events - -| Events | Description | -| -- | -- | -| SelectionChanged | Occurs when the selected item has changed | - -## Sample Code - -[Carousel Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Carousel). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Default Template - -[Carousel XAML File](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.UI.Controls/Carousel/Carousel.xaml) is the XAML template used in the toolkit for the default styling. - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| -- | -- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Controls | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Controls](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Controls/) | - -## API - -* [Carousel source code](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.UI.Controls/Carousel) diff --git a/docs/controls/DataGrid.md b/docs/controls/DataGrid.md deleted file mode 100644 index f01fc20728d..00000000000 --- a/docs/controls/DataGrid.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -title: DataGrid XAML Control -author: harinikmsft -description: The DataGrid Control presents data in a customizable table of rows and columns. -keywords: windows 10, uwp, uwp community toolkit, uwp toolkit, DataGrid, xaml control, xaml ---- - -# DataGrid XAML control - -The DataGrid control provides a flexible way to display a collection of data in rows and columns. - -![DataGrid control](../resources/images/Controls/DataGrid/DataGrid.gif) - -The built-in column types include a text column, a check box column, and a template column for hosting custom content. The built-in row type includes a drop-down details section that you can use to display additional content below the cell values. - -The DataGrid control supports common table formatting options, such as alternating row backgrounds and foregrounds and the ability to show or hide headers, grid lines, and scroll bars. Additionally, the control provides several style and template properties that you can use to completely change the appearance of the control and its rows, columns, cells, and row or column headers. - -The DataGrid has built-in support for Narrator and Touch Narrator to help blind users to navigate and interact easily with the control. Additionally, the control has built-in support for extensive keyboard navigation through cells, headers, rows and columns. - -## How-Tos - -The following guidance sections describe the additional concepts and techniques that you can use to build DataGrid control features into your applications: -* [Add a DataGrid control to a page](datagrid_guidance/datagrid_basics.md) -* [Customize the DataGrid control using styling and formatting options](datagrid_guidance/styling_formatting_options.md) -* [Sizing options in the DataGrid control](datagrid_guidance/sizing_options.md) -* [Default keybaord navigation and selection patterns](datagrid_guidance/keyboard_navigation_selection.md) -* [Display and configure Row Details](datagrid_guidance/rowdetails.md) -* [Configure Auto-generated columns in the DataGrid control](datagrid_guidance/customize_autogenerated_columns.md) -* [Group, sort and filter data using LINQ and the DataGrid control](datagrid_guidance/group_sort_filter.md) -* [Editing and input validation in the DataGrid control](datagrid_guidance/editing_inputvalidation.md) - -## Sample Code - -[DataGrid Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/DataGrid). - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| -- | -- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Controls | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Controls.DataGrid](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/) | - -## API - -* [DataGrid source code](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/DataGrid) -* [Silverlight DataGrid API](https://docs.microsoft.com/en-us/previous-versions/windows/silverlight/dotnet-windows-silverlight/cc189753(v=vs.95)) diff --git a/docs/controls/DockPanel.md b/docs/controls/DockPanel.md deleted file mode 100644 index cbda522f0c6..00000000000 --- a/docs/controls/DockPanel.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -title: DockPanel XAML Control -author: IbraheemOsama -description: Defines an area where you can arrange child elements either horizontally or vertically, relative to each other. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, DockPanel, XAML Control, xaml ---- - -# DockPanel XAML Control - -The [DockPanel Control](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.dockpanel) defines an area where you can arrange child elements either horizontally or vertically, relative to each other. - -The DockPanel position child controls based on the child Dock property, you have 4 options to Dock, left (Default), right, top, bottom. -You can set DockPanel LastChildFill property to true if you want the last item added to the DockPanel to fill the rest empty space. - -## Syntax - -```xaml - - - - - - - - -``` - -## Sample Output - -![DockPanel animation](../resources/images/Controls/DockPanel.gif) - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| LastChildFill | bool | Gets or sets a value indicating whether the last child element within a DockPanel stretches to fill the remaining available space | -| Padding | Thickness | The dimensions of the space between the edge and its child as a Thickness value. Thickness is a structure that stores dimension values using pixel measures. | - -## Sample Code - -[DockPanel Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/DockPanel). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| -- | -- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Controls | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Controls](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Controls/) | - -## API Source Code - -* [DockPanel source code](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.UI.Controls/DockPanel) diff --git a/docs/controls/DropShadowPanel.md b/docs/controls/DropShadowPanel.md deleted file mode 100644 index b0059662f74..00000000000 --- a/docs/controls/DropShadowPanel.md +++ /dev/null @@ -1,73 +0,0 @@ ---- -title: DropShadowPanel XAML Control -author: nmetulev -description: The DropShadowPanel Control allows the creation of a drop shadow effect for any Xaml FrameworkElement in the markup. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, DropShadowPanel, DropShadow, xaml Control, xaml ---- - -# DropShadowPanel XAML Control - -The [DropShadowPanel Control](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.dropshadowpanel) allows the creation of a drop shadow effect for any Xaml FrameworkElement in the markup. - -## Syntax - -```xaml - - - - - -``` - -## Sample Output - -![DropShadowPanel animation](../resources/images/Controls/DropShadowPanel.png) - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| BlurRadius | double | Gets or sets the blur radius of the drop shadow | -| Color | Color | Gets or sets the color of the drop shadow | -| IsSupported | bool | Gets a value indicating whether the platform supports drop shadows | -| OffsetX | double | Gets or sets the x offset of the drop shadow | -| OffsetY | double | Gets or sets the y offset of the drop shadow | -| OffsetZ | double | Gets or sets the z offset of the drop shadow | -| ShadowOpacity | double | Gets or sets the opacity of the drop shadow | - -## Sample Code - -[DropShadowPanel Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/DropShadowPanel). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Examples - -- Use IsSupported property to verify the availability of drop shadow and take necessary action if not available - - ```csharp - if(!DropShadowPanel.IsSupported) - { - // Change something to counter the lack of drop shadow - } - ``` - ```vb - If Not DropShadowPanel.IsSupported Then - ' Change something to counter the lack of drop shadow - End If - ``` - -## Default Template - -[DropShadowPanel XAML File](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.UI.Controls/DropShadowPanel/DropShadowPanel.xaml) is the XAML template used in the toolkit for the default styling. - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| -- | -- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Controls | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Controls](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Controls/) | - -## API - -* [DropShadowPanel source code](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.UI.Controls/DropShadowPanel) diff --git a/docs/controls/Expander.md b/docs/controls/Expander.md deleted file mode 100644 index c44d1c49112..00000000000 --- a/docs/controls/Expander.md +++ /dev/null @@ -1,114 +0,0 @@ ---- -title: Expander Control -author: nmetulev -description: The Expander Control provides an expandable container to host any content. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, Expander, xaml Control, xaml ---- - -# Expander Control - -The [Expander Control](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.expander) provides an expandable container to host any content. It is a specialized form of a [HeaderedContentControl](HeaderedContentControl.md) -You can show or hide this content by interacting with the Header. - -## Syntax - -```xaml - - - - - -``` - -## Sample Output - -![Expander animation](../resources/images/Controls/Expander.gif) - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| ContentOverlay | UIElement | Specifies alternate content to show when the Expander is collapsed. | -| ExpandDirection | [ExpandDirection](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.expanddirection) | Specifies the direction of where expanded content should be displayed in relation to the header. | -| HeaderStyle | Style | Specifies an alternate style template for the `ToggleButton` header control. | -| IsExpanded | bool | Indicates if the Expander is currently open or closed. The default is `False`. | - -## Events - -| Events | Description | -| -- | -- | -| Collapsed | Fires when the expander is closed | -| Expanded | Fires when the expander is opened | - -## Examples - -### ContentOverlay - -The `ContentOverlay` property can be used to define the content to be shown when the Expander is collapsed - -```xaml - - - - - - - - - - - -``` - -### ExpandDirection - -The `ExpandDirection` property can take 4 values that will expand the content based on the selected direction: - -* `Down` - from top to bottom (default) -* `Up` - from bottom to top -* `Right` - from left to right -* `Left` - from right to left - -### HeaderStyle - -Allows creating an alternate style for the entire Expander header including the arrow symbol, in contrast to the `HeaderTemplate` which can control the content next to the arrow. - -For instance to remove the header entirely from the Expander: - -```xaml - - - - - - - -``` - -## Sample Code - -[Expander Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Expander). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Default Template - -[Expander XAML File](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.UI.Controls/Expander/Expander.xaml) is the XAML template used in the toolkit for the default styling. - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| -- | -- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Controls | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Controls](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Controls/) | - -## API - -- [Expander source code](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.UI.Controls/Expander) - -## Related Topics - -- [HeaderedControlControl](HeaderedContentControl.md) -- [ToggleButton](https://docs.microsoft.com/en-us/uwp/api/Windows.UI.Xaml.Controls.Primitives.ToggleButton) diff --git a/docs/controls/GridSplitter.md b/docs/controls/GridSplitter.md deleted file mode 100644 index 96ae942f90b..00000000000 --- a/docs/controls/GridSplitter.md +++ /dev/null @@ -1,116 +0,0 @@ ---- -title: GridSplitter XAML Control -author: nmetulev -description: The GridSplitter Control provides an easy-to-use Splitter that redistributes space between columns or rows of a Grid Control. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, GridSplitter, XAML Control, xaml ---- - -# GridSplitter XAML Control - -The [GridSplitter Control](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.gridsplitter) provides an easy-to-use Splitter that redistributes space between columns or rows of a Grid Control. By dragging the control, the control will resize the targeted columns or rows. - -The control automatically detects the targeted columns/rows to resize, while dragging the control it starts to resize the columns/rows and redistributes space between columns/rows, you can manually specify the Resize Direction Auto, Column, Row and the Resize Behavior to select which columns/rows to resize. - -> [!NOTE] -You can use the control to resize fixed and star (*) width/height columns/rows. - -## Syntax - -```xaml - - - - - - - - - -``` - -## Sample Output - -![GridSplitter animation](../resources/images/Controls/GridSplitter.png) - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| CursorBehavior | [GridSplitter.SplitterCursorBehavior](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.gridsplitter.splittercursorbehavior) | Gets or sets splitter cursor on hover behavior | -| Element | UIElement | Gets or sets the visual content of this Grid Splitter | -| GripperCursor | [GridSplitter.GripperCursorType](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.gridsplitter.grippercursortype) | Gets or sets the gripper Cursor type | -| GripperCustomCursorResource | int | Gets or sets the gripper Custom Cursor resource number | -| GripperForeground | Brush | Gets or sets the foreground color of grid splitter grip | -| ParentLevel | int | Gets or sets the level of the parent grid to resize | -| ResizeBehavior | [GridSplitter.GridResizeBehavior](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.gridsplitter.gridresizebehavior) | Gets or sets which Columns or Rows the Splitter resizes | -| ResizeDirection | [GridSplitter.GridResizeDirection](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.gridsplitter.gridresizedirection) | Gets or sets whether the Splitter resizes the Columns, Rows, or Both | - -## Examples - -The following sample demonstrates how to add Grid Splitter Control - -```xaml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -``` - -## Sample Code - -[GridSplitter Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/GridSplitter). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Default Template - -[GridSplitter XAML File](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.UI.Controls/GridSplitter/GridSplitter.xaml) is the XAML template used in the toolkit for the default styling. - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| -- | -- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Controls | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Controls](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Controls/) | - -## API - -* [GridSplitter source code](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.UI.Controls/GridSplitter) diff --git a/docs/controls/HamburgerMenu.md b/docs/controls/HamburgerMenu.md deleted file mode 100644 index 3671bfecb99..00000000000 --- a/docs/controls/HamburgerMenu.md +++ /dev/null @@ -1,281 +0,0 @@ ---- -title: HamburgerMenu XAML Control -author: nmetulev -description: The Hamburger Menu Control provides an easy-to-use, side-bar menu which users can show or hide by using a Hamburger button -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, HamburgerMenu, xaml control, xaml -dev_langs: - - csharp - - vb ---- - -# HamburgerMenu XAML Control - -> [!WARNING] -The HamburgerMenu is deprecated and will be removed in a future major release. Please use the [NavigationView](https://docs.microsoft.com/windows/uwp/controls-and-patterns/navigationview) available in the Fall Creators Update. Read the [Moving to NavigationView](#navview) section for more info. - -The [HamburgerMenu Control](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.hamburgermenu) provides an easy-to-use, side-bar menu which users can show or hide by using a Hamburger button. By tapping the icon, it opens up a side menu with a selection of options or additional pages. - -The 3-line menu icon, which resembles a Hamburger, allows developers to pack more features into their apps or navigation. The tiny icon takes up a minimal amount of screen real estate and creates a clean, minimalist look. - -Developers can place menu specific content, navigation, images, text or custom controls. An example of the HamburgerMenu is the *MSN Money App* included in Windows 10. When tapped, it displays additional feature pages, and user settings. - -## Syntax - -```xaml - - - -``` - -## Sample Output - -![HamburgerMenu animation](../resources/images/Controls/HamburgerMenu.gif) - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| CompactPaneLength | double | Gets or sets the width of the pane in its compact display mode | -| DisplayMode | [SplitViewDisplayMode](https://docs.microsoft.com/uwp/api/Windows.UI.Xaml.Controls.SplitViewDisplayMode) | Gets or sets a value that specifies how the pane and content areas are shown | -| HamburgerHeight | double | Gets or sets main button's height | -| HamburgerMargin | Thickness | Gets or sets main button's margin | -| HamburgerMenuTemplate | DataTemplate | Gets or sets a template for the hamburger icon | -| HamburgerVisibility | Visibility | Gets or sets main button's visibility | -| HamburgerWidth | double | Gets or sets main button's width | -| IsPaneOpen | bool | Gets or sets a value indicating whether gets or sets a value that specifies whether the pane is expanded to its full width | -| Items | ItemCollection | Gets the collection used to generate the content of the items list | -| ItemsSource | object | Gets or sets an object source used to generate the content of the menu | -| ItemTemplate | DataTemplate | Gets or sets the DataTemplate used to display each item | -| ItemTemplateSelector | DataTemplateSelector | Gets or sets the DataTemplateSelector used to display each item | -| OpenPaneLength | double | Gets or sets the width of the pane when it's fully expanded | -| OptionsItems | ItemCollection | Gets the collection used to generate the content of the option list | -| OptionsItemsSource | object | Gets or sets an object source used to generate the content of the options | -| OptionsItemTemplate | DataTemplate | Gets or sets the DataTemplate used to display each item in the options | -| OptionsItemTemplateSelector | DataTemplateSelector | Gets or sets the DataTemplateSelector used to display each item in the options | -| OptionsVisibility | Visibility | Gets or sets the visibility of the options menu | -| PaneBackground | Brush | Gets or sets the Brush to apply to the background of the Pane area of the control | -| PaneForeground | Brush | Gets or sets the Brush to apply to the foreground of the Pane area of the control (specifically, the hamburger button foreground) | -| PanePlacement | [SplitViewPanePlacement](https://docs.microsoft.com/uwp/api/windows.ui.xaml.controls.splitviewpaneplacement) | Gets or sets a value that specifies whether the pane is shown on the right or left side of the control | -| SelectedIndex | int | Gets or sets the selected menu index | -| SelectedItem | object | Gets or sets the selected menu item | -| SelectedOptionsIndex | int | Gets or sets the selected options menu index | -| SelectedOptionsItem | object | Gets or sets the selected options menu item | -| UseNavigationViewWhenPossible | bool | Set `true` to use a template based on the [NavigationView](https://docs.microsoft.com/en-us/windows/uwp/controls-and-patterns/navigationview) when running on the Fall Creators Update and above, and the regular template otherwise | - -## Events - -| Events | Description | -| -- | -- | -| ItemClick | Event raised when an item is clicked | -| OptionsItemClick | Event raised when an options' item is clicked | - -## Example Code - -This sample demonstrates how to add custom menu items to the HamburgerMenu control. - -```xaml - - - - - - - - - - - - - - - - - - - - - -``` - -As you can see below, we declared a Frame inside the HamburgerMenu control. Using this Frame object, you can navigate to your pages by using the following code. - -```csharp -using System; -using System.Collections.Generic; -using Windows.UI.Xaml.Controls; - -namespace HamburgerSample -{ - public sealed partial class MainPage : Page - { - public MainPage() - { - this.InitializeComponent(); - - hamburgerMenuControl.ItemsSource = MenuItem.GetMainItems(); - hamburgerMenuControl.OptionsItemsSource = MenuItem.GetOptionsItems(); - } - - private void OnMenuItemClick(object sender, ItemClickEventArgs e) - { - var menuItem = e.ClickedItem as MenuItem; - contentFrame.Navigate(menuItem.PageType); - } - } - - public class MenuItem - { - public Symbol Icon { get; set; } - public string Name { get; set; } - public Type PageType { get; set; } - - public static List GetMainItems() - { - var items = new List(); - items.Add(new MenuItem() { Icon = Symbol.Accept, Name = "MenuItem1", PageType = typeof(Views.BlankPage1) }); - items.Add(new MenuItem() { Icon = Symbol.Send, Name = "MenuItem2", PageType = typeof(Views.BlankPage1) }); - items.Add(new MenuItem() { Icon = Symbol.Shop, Name = "MenuItem3", PageType = typeof(Views.BlankPage1) }); - return items; - } - - public static List GetOptionsItems() - { - var items = new List(); - items.Add(new MenuItem() { Icon = Symbol.Setting, Name = "OptionItem1", PageType = typeof(Views.BlankPage1) }); - return items; - } - } -} -``` -```vb -Public NotInheritable Class MainPage - Inherits Page - - Sub New() - InitializeComponent() - - hamburgerMenuControl.ItemsSource = MenuItem.GetMainItems() - hamburgerMenuControl.OptionsItemsSource = MenuItem.GetOptionsItems() - End Sub - - Private Sub OnMenuItemClick(sender As Object, e As ItemClickEventArgs) - Dim menuItem = TryCast(e.ClickedItem, MenuItem) - contentFrame.Navigate(menuItem.PageType) - End Sub -End Class - -Public Class MenuItem - - Public Property Icon As Symbol - - Public Property Name As String - - Public Property PageType As Type - - Public Shared Function GetMainItems() As List(Of MenuItem) - Dim items = New List(Of MenuItem)() - items.Add(New MenuItem() With {.Icon = Symbol.Accept, .Name = "MenuItem1", .PageType = GetType(Views.BlankPage1)}) - items.Add(New MenuItem() With {.Icon = Symbol.Send, .Name = "MenuItem2", .PageType = GetType(Views.BlankPage1)}) - items.Add(New MenuItem() With {.Icon = Symbol.Shop, .Name = "MenuItem3", .PageType = GetType(Views.BlankPage1)}) - Return items - End Function - - Public Shared Function GetOptionsItems() As List(Of MenuItem) - Dim items = New List(Of MenuItem)() - items.Add(New MenuItem() With {.Icon = Symbol.Setting, .Name = "OptionItem1", .PageType = GetType(Views.BlankPage1)}) - Return items - End Function -End Class - -``` - -## Moving to NavigationView -The Windows 10 Fall Creators Update SDK now includes the [NavigationView](https://docs.microsoft.com/windows/uwp/controls-and-patterns/navigationview) control among other new controls and APIs. This is great news for the Windows Community Toolkit as it means that one of its most popular controls, the HamburgerMenu, has a comparable counterpart in the Windows SDK and it is very easy to transition to the NavigationView if you are already using the HamburgerMenu. - -The HamburgerMenu and NavigationView share the same concepts and provide the same functionality with one major exception being the NavigationView takes advantage of the new fluent design system. In fact, the NavigationView does everything the HamburgerMenu does and even more. - -### What developers need to know to move to NavigationView? - -- **Pane:** Both the NavigationView and HamburgerMenu are based on the SplitView, so the same properties exist in both controls. However, the NavigationView uses the new AcrylicBrush for the background which creates the semi-transparent material out of the box. Additionally, the navigation view automatically changes its display mode based on the amount of screen size available to it, so you are no longer required to write all that code. -- **NavigationViewItems and Item Templates:** The NavigationView uses a similar pattern to define the Menu Items, with some naming changes. Here is the mapping from some properties in the HamburgerMenu to the comparable properties in the NavigationView: - - | HamburgerMenu | NavigationView | - | --- | --- | - | ItemsSource | MenuItemsSource | - | ItemTemplate | MenuItemTemplate | - | ItemClick | ItemInvoked | - - The *OptionsItemsSource* and *OptionItemsTemplate* is not available in the NavigationView. Instead, the NavigationView has two additional new properties that provide a much more flexible way of handling settings and optional items: - - An optional property for app settings. Simply set the property *IsSettingsVisible* to true and the NavigationView will display the settings button at the bottom. You can even customize the settings item - - ```csharp - var settingsItem = HamburgerMenu.SettingsItem as NavigationViewItem; - settingsItem.Content = "About"; - settingsItem.Icon = new FontIcon() { Glyph = "?" }; - ``` - ```vb - Dim settingsItem = TryCast(HamburgerMenu.SettingsItem, NavigationViewItem) - settingsItem.Content = "About" - settingsItem.Icon = New FontIcon() With {.Glyph = "?"} - ``` - - - Free-form content in the pane's footer, by adding any content in the new *PaneFooter* property - - In addition, the NavigationView introduces new classes for quickly adding navigation items and grouping items. You can use the new NavigationViewItem, NavigationViewItemSeparator and NavigationViewItemHeader to directly populate the MenuItems and get the look you want - -* **Additional features in the NavigationView:** The navigation view also introduces several new features that are not available in the HamburgerMenu: - - * There is a new optional header area that is vertically aligned with the navigation button and has a fixed height. Its purpose is to hold the page title of the selected nav category. The header is docked to the top of the page and acts as a scroll clipping point for the content area. - * AutoSuggestBox property allows you to add a search box that integrates directly with the NavigationView. Some developers accomplished the same with the HamburgerMenu by re-templating it and writing a lot of custom code. That is not needed with the NavigationView - -### Making the transition even easier -Starting with v2.1 of the Windows Community Toolkit, the HamburgerMenu provides a new property called `UseNavigationViewWhenPossible`. Setting the value to true will force the HamburgerMenu to use a template based on the NavigationView when running on the Fall Creators Update and above, and the regular template otherwise. - -Using this property will enable you to take advantage of the NavigationView on devices that supported the NavigationView, while providing an experience based on HamburgerMenu on devices that have not yet updated to the Fall Creators Update. Make sure to test the experience on multiple OS releases and plan to fully transition to the NavigationView as the HamburgerMenu will be removed from the Windows Community Toolkit in a future major release. - -Version 3.0 of the Windows Community Toolkit adds another related property called **UseNavigationViewSettingsWhenPossible**. When this and UseNavigationViewWhenPossible are both set to true, the control will attempt to detect any of the OptionsItems that represent settings and map this to the built in Settings item in the NavigationView. If the control fails to detect the correct item, you can tell it which item to use by setting the Tag property of the OPtionsItem to the value "setting". - -> [!NOTE] -The `ItemClick` and `OptionsItemClick` events will continue to work but the EventArgs will be null when `UseNavigationViewWhenPossible` is set to true. There is a new event called `ItemInvoked` that should be used instead. This new event will include information about the clicked item and whether it is an item or options item. This event also works if UseNavigationViewWhenPossible is set to false. - -> [!NOTE] -The PaneBackground will not have any effect when `UseNavigationViewWhenPossible` is set to null. To change the pane background of the NavigationView, modify the two theme resources by overwriting them in your App.xaml. See the [NavigationVew documentation](https://docs.microsoft.com/en-us/windows/uwp/design/controls-and-patterns/navigationview#customizing-backgrounds) for more details. - -There are several HamburgerMenu properties that have no effect when the HamburgerMenu is using the NavigationView: - -* DisplayMode -* PanePlacement -* PaneBackground -* PaneForeground -* HamburgerWidth -* HamburgerHeight -* HamburgerMargin -* HamburgerMenuTemplate - -## Sample Code - -[HamburgerMenu Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/HamburgerMenu) -. You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Default Template - -[HamburgerMenu XAML File](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.UI.Controls/HamburgerMenu/HamburgerMenu.xaml) is the XAML template used in the toolkit for the default styling. - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| -- | -- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Controls | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Controls](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Controls/) | - -## API - -* [HamburgerMenu source code](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.UI.Controls/HamburgerMenu) diff --git a/docs/controls/HeaderedContentControl.md b/docs/controls/HeaderedContentControl.md deleted file mode 100644 index af3fcd281b7..00000000000 --- a/docs/controls/HeaderedContentControl.md +++ /dev/null @@ -1,83 +0,0 @@ ---- -title: HeaderedContentControl XAML Control -author: skendrot -description: The HeaderedContentControl allows content to be displayed with a specified header. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, HeaderedContentControl, XAML Control, xaml ---- - -# HeaderedContentControl XAML Control - -The [HeaderedContentControl](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.headeredcontentcontrol) is a UI control that allows content to be displayed with a specified header. The `Header` property can be any object and you can use the `HeaderTemplate` to specify a custom look to the header. Content for the HeaderedContentControl will align to the top left. This is to maintain the same functionality as the ContentControl. - -> [!NOTE] -Setting the `Background`, `BorderBrush` and `BorderThickness` properties will not have any effect on the HeaderedContentControl. This is to maintain the same functionality as the ContentControl. - -## Syntax - -```xaml - - - - - -``` - -## Sample Output - -![HeaderedContentControl](../resources/images/Controls/HeaderedContentControl.jpg) - -## Properties - -| Property | Type | Gets or sets the data used for the header of each control | -| -- | -- | -- | -| Header | object | Gets or sets the data used for the header of each control | -| HeaderTemplate | DataTemplate | Gets or sets the template used to display the content of the control's header | - -### Examples - -- The `Header` property can be set to a string, or any xaml elements. If binding the `Header` to an object that is not a string, use the `HeaderTemplate` to control how the content is rendered. - - *Sample Code* - - ```xaml - - - - - - - - - - ``` - -- Used to control the look of the header. The default value for the `HeaderTemplate` will display the string representation of the `Header`. Set this property if you need to bind the `Header` to an object. - - ```xaml - - - - - - - - ``` - -## Sample Code -[HeaderedContentControl Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/HeaderedContentControl). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Default Template - -[HeaderedContentControl XAML File](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.UI.Controls/HeaderedContentControl/HeaderedContentControl.xaml) is the XAML template used in the toolkit for the default styling. - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| -- | -- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Controls | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Controls](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Controls/) | - -## API - -* [HeaderedContentControl source code](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.UI.Controls/HeaderedContentControl) diff --git a/docs/controls/HeaderedItemsControl.md b/docs/controls/HeaderedItemsControl.md deleted file mode 100644 index 25cf42d3d77..00000000000 --- a/docs/controls/HeaderedItemsControl.md +++ /dev/null @@ -1,86 +0,0 @@ ---- -title: HeaderedItemsControl XAML Control -author: skendrot -description: The HeaderedItemsControl allows items to be displayed with a specified header. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, HeaderedItemsControl, XAML Control, xaml ---- - -# HeaderedItemsControl XAML Control - -The [HeaderedItemsControl](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.headereditemscontrol) is a UI control that allows content to be displayed with a specified header. The `Header` property can be any object and you can use the `HeaderTemplate` to specify a custom look to the header. - -> [!NOTE] -Setting the `Background`, `BorderBrush` and `BorderThickness` properties will not have any effect on the HeaderedItemsControl. This is to maintain the same functionality as the ItemsControl. - -## Syntax - -```xaml - - - - - -``` - -## Sample Output - -![HeaderedItemsControl](../resources/images/Controls/HeaderedItemsControl.jpg) - -## Properties - -| Property | Type | Gets or sets the data used for the header of each control | -| -- | -- | -- | -| Header | object | Gets or sets the data used for the header of each control | -| HeaderTemplate | DataTemplate | Gets or sets the template used to display the content of the control's header | - -### Examples - -- The `Header` property can be set to a string, or any xaml elements. If binding the `Header` to an object that is not a string, use the `HeaderTemplate` to control how the content is rendered. - - *Sample Code* - - ```xaml - - - - - - - - - - ``` - -- Used to control the look of the header. The default value for the `HeaderTemplate` will display the string representation of the `Header`. Set this property if you need to bind the `Header` to an object. - - *Sample Code* - - ```xaml - - - - - - - - ``` - -## Sample Code - -[HeaderedItemsControl Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/HeaderedItemsControl). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Default Template - -[HeaderedItemsControl XAML File](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.UI.Controls/HeaderedItemsControl/HeaderedItemsControl.xaml) is the XAML template used in the toolkit for the default styling. - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| -- | -- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Controls | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Controls](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Controls/) | - -## API - -* [HeaderedItemsControl source code](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.UI.Controls/HeaderedItemsControl) diff --git a/docs/controls/HeaderedTextBlock.md b/docs/controls/HeaderedTextBlock.md deleted file mode 100644 index 2ca8e6b094d..00000000000 --- a/docs/controls/HeaderedTextBlock.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -title: HeaderedTextBlock XAML Control -author: nmetulev -description: The HeaderedTextBlock Control provides a header for read-only text. This control is useful for displaying read-only forms, content, or a collection of items depending on the type. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, HeaderedTextBlock, XAML Control, xaml ---- - -# HeaderedTextBlock XAML Control - -The [HeaderedTextBlock Control](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.headeredtextblock) provides a header for read-only text. This control is useful for displaying read-only forms, content, or a collection of items depending on the type. - -## Syntax - -```xaml - -``` - -## Sample Output - -![HeaderedTextBlock animation](../resources/images/Controls/HeaderedTextBlock.png) - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| Header | object | Gets or sets the header | -| HeaderTemplate | DataTemplate | Gets or sets the header style | -| HideTextIfEmpty | bool | Gets or sets a value indicating whether the Text TextBlock is hidden if its value is empty | -| Orientation | Orientation | Gets or sets the orientation | -| Text | string | Gets or sets the text | -| TextStyle | Style | Gets or sets the text style | - -## Sample Code - -[HeaderedTextBlock Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/HeaderedTextBlock). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Default Template - -[HeaderedTextBlock XAML File](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.UI.Controls/HeaderedTextBlock/HeaderedTextBlock.xaml) is the XAML template used in the toolkit for the default styling. - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| -- | -- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Controls | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Controls](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Controls/) | - -## API - -* [HeaderedTextBlock source code](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.UI.Controls/HeaderedTextBlock) - diff --git a/docs/controls/ImageEx.md b/docs/controls/ImageEx.md deleted file mode 100644 index d02de0dec03..00000000000 --- a/docs/controls/ImageEx.md +++ /dev/null @@ -1,69 +0,0 @@ ---- -title: ImageEx XAML Control -author: nmetulev -description: The ImageEx Control and RoundImageEx Control downloads images asynchronously, while showing a loading indicator. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, ImageEx, RoundImageEx, xaml control, xaml ---- - -# ImageEx XAML Control - -The [ImageEx Control](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.imageex) and [RoundImageEx Control](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.roundimageex) downloads images asynchronously, while showing a loading indicator. Source images are then stored in the application's local cache to preserve resources and load time. ImageEx also extends the default *Image* and *ImageBrush* Platform controls respectively to improve performance through caching. You can also use a placeholder image that will be displayed while loading the main image. - -## Syntax - -```xaml - - - -``` - -> [!NOTE] -On Windows 10.0.16299.0 or higher, `CornerRadius` is supported on ImageEx. Use of this property will not cause an exception on downlevel platforms; however, the desired effect will not render. - -## Sample Output - -![ImageEx animation](../resources/images/Controls/ImageEx.gif) - -## ImageEx Properties - -| Property | Type | Description | -| -- | -- | -- | -| NineGrid | Thickness | Gets or sets the nine-grid used by the image | -| IsCacheEnabled | bool | Gets or sets a value indicating whether gets or sets cache state | -| ImageExCachingStrategy | enum | Gets or sets a value indicating how the Image will be cached | - -## RoundImageEx Properties - -| Property | Type | Description | -| -- | -- | -- | -| CornerRadius | double | Get or set the radius of round image corner | - -## Sample Code - -[ImageExControl Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/ImageEx). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Default Template - -ImageEx control supports use of Progress Indicator. This can be enabled by adding ImageEx template from previous release of the control. - -- [ImageEx Control with Progress Indicator XAML File](https://github.com/Microsoft/WindowsCommunityToolkit/blob/rel/2.2.0/Microsoft.Toolkit.Uwp.UI.Controls/ImageEx/ImageEx.xaml) is the XAML template used in v2.2.0.0 of toolkit. - -- [ImageEx Control XAML File](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.UI.Controls/ImageEx/ImageEx.xaml) is the XAML template used in the toolkit for the default styling. - -- [RoundImageEx Control XAML File](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.UI.Controls/ImageEx/RoundImageEx.xaml) is the XAML template used in the toolkit for the default styling of the Control that has Corner Rounding. - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| -- | -- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Controls | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Controls](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Controls/) | - -## API - -* [ImageEx source code](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.UI.Controls/ImageEx) - diff --git a/docs/controls/InAppNotification.md b/docs/controls/InAppNotification.md deleted file mode 100644 index 2becc247afb..00000000000 --- a/docs/controls/InAppNotification.md +++ /dev/null @@ -1,234 +0,0 @@ ---- -title: InAppNotification XAML Control -author: nmetulev -description: The InAppNotification control offers the ability to show local notifications in your application. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, InAppNotification, in app notification, xaml control, xaml -dev_langs: - - csharp - - vb ---- - -# InAppNotification - -The [InAppNotification](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.inappnotification) control offers the ability to show local notifications in your application. - -The control should be placed where you want your notification to be displayed in the page, generally in the root grid. - -> [!NOTE] -Since the control is part of the page visual tree, it will render in the order it was added in the parent control, and might be hidden by other elements. For the control to render on top of other elements, add it as the last child of the parent control or set the Canvas.ZIndex to a high number. - -## Syntax - -```xaml - - - -``` - -## Sample Output - -![InAppNotification animation](../resources/images/Controls/InAppNotification/InAppNotification.gif) - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| AnimationDuration | TimeSpan | Gets or sets a value indicating the duration of the popup animation (in milliseconds) | -| HorizontalOffset | double | Gets or sets a value indicating the horizontal offset of the popup animation | -| ShowDismissButton | bool | Gets or sets a value indicating whether to show the Dismiss button of the control | -| StackMode | StackMode | Gets or sets a value indicating the stack mode of the notifications | -| VerticalOffset | double | Gets or sets a value indicating the vertical offset of the popup animation | - -### StackMode - -By default, each time you display an in-app notification using the same control, each notification will replace the previous one. -You can change this behavior with one of these values: - -| StackMode properties | Description | -| -- | -- | -| Replace | Default mode, replace previous notification | -| QueueBehind | Store every notifications to show, when you dismiss a notification the remaining ones will be displayed successively | -| StackInFront | Store every notifications to show, when you show a notification it will be displayed in priority (in the reverse order of `QueueBehind` mode) | - -## Methods - -| Methods | Return Type | Description | -| -- | -- | -- | -| Dismiss() | void | Dismiss the notification | -| Show(int) | void | Show notification using the current template | -| Show(String, int) | void | Show notification using text as the content of the notification with a display duration | -| Show(DataTemplate, int) | void | Show notification using DataTemplate as the content of the notification with a display duration | -| Show(UIElement, int) | void | Show notification using UIElement as the content of the notification with a display duration | - -## Events - -| Events | Description | -| -- | -- | -| Closed | Event raised when the notification is closed | -| Closing | Event raised when the notification is closing | -| Opened | Event raised when the notification is opened | -| Opening | Event raised when the notification is opening | - -### Examples - -- You have multiple options to show an in-app notification. - - - By simply displaying the notification using the current template - - ```csharp - ExampleInAppNotification.Show(); - ``` - ```vb - ExampleInAppNotification.Show() - ``` - - - By using a simple text content. - - ```csharp - ExampleInAppNotification.Show("Some text."); - ``` - ```vb - ExampleInAppNotification.Show("Some text.") - ``` - - - By using a UIElement (with a container as parent, ex: Grid) - - ```csharp - var grid = new Grid(); - - // TODO : Construct the Grid in C# - ExampleInAppNotification.Show(grid); - ``` - ```vb - Dim grid = New Grid() - - ' TODO : Construct the Grid in code - ExampleInAppNotification.Show(grid) - ``` - - - By using a DataTemplate - - ```csharp - object inAppNotificationWithButtonsTemplate; - bool isTemplatePresent = Resources.TryGetValue("InAppNotificationWithButtonsTemplate", out inAppNotificationWithButtonsTemplate); - - if (isTemplatePresent && inAppNotificationWithButtonsTemplate is DataTemplate) - { - ExampleInAppNotification.Show(inAppNotificationWithButtonsTemplate as DataTemplate); - } - ``` - ```vb - Dim inAppNotificationWithButtonsTemplate As Object - Dim isTemplatePresent As Boolean = Resources.TryGetValue("InAppNotificationWithButtonsTemplate", inAppNotificationWithButtonsTemplate) - - If isTemplatePresent AndAlso TypeOf inAppNotificationWithButtonsTemplate Is DataTemplate Then - ExampleInAppNotification.Show(TryCast(inAppNotificationWithButtonsTemplate, DataTemplate)) - End If - ``` - -- By passing a second argument to the `Show()` method, you can set the duration of the notification (in milliseconds). - - ```csharp - ExampleInAppNotification.Show("Some text.", 2000); // the notification will appear for 2 seconds - ``` - ```vb - ExampleInAppNotification.Show("Some text.", 2000) ' The notification will appear for 2 seconds - ``` - -- Call Dismiss to dismiss the notification - - ```csharp - ExampleInAppNotification.Dismiss(); - ``` - ```vb - ExampleInAppNotification.Dismiss() - ``` - -- Use EventArgs to find the dismiss kind of the InAppNotification in and Closed - - ```csharp - private void InAppNotification_OnClosing(object sender, InAppNotificationDismissingEventArgs e) - { - if (e.DismissKind == InAppNotificationDismissKind.User) - { - // When the user asked to dismiss the notification - } - if (e.DismissKind == InAppNotificationDismissKind.Timeout) - { - // When the notification is dismissed after timeout - } - } - ``` - ```vb - Private Sub InAppNotification_OnClosing(ByVal sender As Object, ByVal e As InAppNotificationDismissingEventArgs) - If e.DismissKind = InAppNotificationDismissKind.User Then - ' When the user asked to dismiss the notification - End If - - If e.DismissKind = InAppNotificationDismissKind.Timeout Then - ' When the notification is dismissed after timeout - End If - End Sub - ``` - -- The in-app notification control is designed to support multiple styles. The default style applied is the Microsoft Edge-like notification. Other styles have been added to the Toolkit so you can easily switch to another of your favorite In App Notification styles. - - Here is the list of existing styles : - - - [Microsoft Edge notification style](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.UI.Controls/InAppNotification/Styles/MSEdgeNotificationStyle.xaml) - - ![Microsoft Edge notification style](../resources/images/Controls/InAppNotification/MicrosoftEdge-Notification-Style.png) - - - [Visual Studio Code notification style](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.UI.Controls/InAppNotification/Styles/VSCodeNotificationStyle.xaml) - - ![Visual Studio Code notification style](../resources/images/Controls/InAppNotification/VisualStudioCode-Notification-style.png) - - If you want to use another style than the default one, please follow the example below : - - - Import external styles in your resources - - ```xaml - - - - - - - - ``` - - - Apply the `Style` - - ```xaml - - ``` - -## Adding styles to Toolkit - -If you want to add styles to the Toolkit, please follow these steps : - -1. Create a `ResourceDictionary` file in [Microsoft.Toolkit.Uwp.UI.Controls/InAppNotification/Styles/](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.UI.Controls/InAppNotification/Styles) folder -2. Create a new `Style` with `TargetType="local:InAppNotification"` -3. Create a new `ControlTemplate` with `TargetType="local:InAppNotification"` and add a `ContentPresenter` inside the Template -4. Do not forget to set the `Template` property inside your `Style` resource - -## Sample Code - -[InAppNotification Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/InAppNotification). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Default Template - -[InAppNotification XAML File](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.UI.Controls/InAppNotification/InAppNotification.xaml) is the XAML template used in the toolkit for the default styling. - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| -- | -- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Controls | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Controls](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Controls/) | - -## API - -* [InAppNotification source code](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.UI.Controls/InAppNotification) diff --git a/docs/controls/InfiniteCanvas.md b/docs/controls/InfiniteCanvas.md deleted file mode 100644 index e3371fffe31..00000000000 --- a/docs/controls/InfiniteCanvas.md +++ /dev/null @@ -1,82 +0,0 @@ ---- -title: InfiniteCanvas XAML Control -author: IbraheemOsama -description: InfiniteCanvas is a canvas that supports Infinite Scrolling, Ink, Text, Format Text, Zoom in/out, Redo, Undo, Export canvas data, Import canvas data. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, InfiniteCanvas, XAML Control, xaml ---- - -# InfiniteCanvas XAML Control - -The [InfiniteCanvas Control](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.infinitecanvas) is a canvas that supports Infinite Scrolling, Ink, Text, Format Text, Zoom in/out, Redo, Undo, Export canvas data, Import canvas data. - -## Syntax - -```xaml - - - -``` - -## Sample Output - -![InfiniteCanvas animation](../resources/images/Controls/InfiniteCanvas.gif) - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| CanvasWidth | double | Gets or sets the width of the drawing area, default value is 2097152. This is different from the `Width` property which specifies the Width of the control | -| CanvasHeight | double | Gets or sets the height of the drawing area, default value is 2097152. This is different from the `Height` property which specifies the Height of the control | -| IsToolbarVisible | bool | Gets or sets a value indicating whether the toolbar is visible or not. | -| MaxZoomFactor | double | Gets or sets the MaxZoomFactor for the canvas, range between 1 to 10 and the default value is 4. | -| MinZoomFactor | double | Gets or sets the MinZoomFactor for the canvas, range between .1 to 1 the default value is .25. | - -## Methods - -| Method | Return Type | Description | -| -- | -- | -- | -| Redo() | void | Redo the last action. | -| Undo() | void | Undo the last action. | -| ExportAsJson() | string | Export the InfinitCanvas as json string. | -| ImportFromJson(string json) | void | Import InfiniteCanvas from json string and render the new canvas, this function will empty the Redo/Undo queue. | - -## Events - -### ReRenderCompleted - -This event triggered after each render happended because of any change in the canvas elements. -This event could be used to do the Auto Save functionality. - -## Examples - -The following sample demonstrates how to add InfiniteCanvas Control - -```xaml - - - - - - -``` - -## Sample Code - -[InfiniteCanvas Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/InfiniteCanvas). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Default Template - -[InfiniteCanvas XAML File](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.UI.Controls/InfiniteCanvas/InfiniteCanvas.xaml) is the XAML template used in the toolkit for the default styling. - -## Requirements - -| Device family | Universal, 10.0.16299.0 or higher | -| -- | -- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Controls | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Controls](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Controls/) | - -## API - -* [InfiniteCanvas source code](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.UI.Controls/InfiniteCanvas) diff --git a/docs/controls/LayoutTransformControl.md b/docs/controls/LayoutTransformControl.md deleted file mode 100644 index e1943ae9511..00000000000 --- a/docs/controls/LayoutTransformControl.md +++ /dev/null @@ -1,73 +0,0 @@ ---- -title: LayoutTransformControl -author: odonno -description: The LayoutTransformControl is a control that support transformations on FrameworkElement as if applied by LayoutTransform. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, LayoutTransformControl, RenderTransform, RotateTransform, ScaleTransform, SkewTransform ---- - -# LayoutTransformControl - -The [LayoutTransformControl](https://docs.microsoft.com/en-us/dotnet/api/microsoft.toolkit.uwp.ui.controls.layouttransformcontrol) is a control that applies Matrix transformations on any `FrameworkElement` of your application. - -The transformations that can be applied are one of the following: - -* [RotateTransform](https://docs.microsoft.com/uwp/api/windows.ui.xaml.media.rotatetransform) -* [ScaleTransform](https://docs.microsoft.com/uwp/api/windows.ui.xaml.media.scaletransform) -* [SkewTransform](https://docs.microsoft.com/uwp/api/windows.ui.xaml.media.skewtransform) -* [MatrixTransform](https://docs.microsoft.com/uwp/api/windows.ui.xaml.media.matrixtransform) -* [TransformGroup](https://docs.microsoft.com/uwp/api/windows.ui.xaml.media.transformgroup) - -## Syntax - -**XAML** - -```xaml - - - - - - - - - - - -``` - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| Child | FrameworkElement | The content of the control that will receive matrix transformations | -| Transform | Transform | The transformations to apply on the `Content`. It can be a single transformation like `RotateTransform`, `ScaleTransform` or `SkewTransform` or it can be a combo of multiple transformations using `TransformGroup` | - -## Sample Code - -[LayoutTransformControl Sample Page](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/LayoutTransformControl). You can see this in action in the Windows Community Toolkit Sample App. - -## Requirements - -| [Device family](http://go.microsoft.com/fwlink/p/?LinkID=526370#device-families) | Universal, 10.0.15063.0 or higher | -| -- | -- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Controls | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Controls](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Controls/) | - -## API Source Code - -- [LayoutTransformControl](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.UI.Controls/LayoutTransformControl) - -## Related Topics - -- [Expander](Expander.md) -- [MatrixTransform](https://docs.microsoft.com/uwp/api/windows.ui.xaml.media.matrixtransform) -- [TransformGroup](https://docs.microsoft.com/uwp/api/windows.ui.xaml.media.transformgroup) -- [RotateTransform](https://docs.microsoft.com/uwp/api/windows.ui.xaml.media.rotatetransform) -- [ScaleTransform](https://docs.microsoft.com/uwp/api/windows.ui.xaml.media.scaletransform) -- [SkewTransform](https://docs.microsoft.com/uwp/api/windows.ui.xaml.media.skewtransform) \ No newline at end of file diff --git a/docs/controls/Loading.md b/docs/controls/Loading.md deleted file mode 100644 index ef9ff674aa7..00000000000 --- a/docs/controls/Loading.md +++ /dev/null @@ -1,79 +0,0 @@ ---- -title: Loading XAML Control -author: nmetulev -description: The loading control is for showing an animation with some content when the user should wait in some tasks of the app. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, Loading, XAML Control , xaml ---- - -# Loading XAML Control - -The [loading control](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.loading) is for showing an animation with some content when the user should wait in some tasks of the app. - -## Syntax - -```xaml - - - - - -``` - -## Sample Output - -![Loading animation](../resources/images/Controls/LoadingXamlControl.gif) - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| IsLoading | bool | Gets or sets a value indicating whether the control is in the loading state | - -## Examples - -An example of how we can build the loading control. - -- `Background` and `Opacity` are for the panel who appears and disappears behind our custom control. -- Use the `LoadingControl` to show specialized content. -- You can also use `BorderBrush` and `BorderThickness` to change the `LoadingControl`. - -```xaml - - - - - - - - - -``` - -Finally that the loading control appears, we must set the `IsLoading` property to `true` - -```csharp -LoadingControl.IsLoading = true; -``` -```vb -LoadingControl.IsLoading = true -``` - -## Sample Code - -[Loading Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Loading). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Default Template - -[Loading XAML File](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.UI.Controls/Loading/Loading.xaml) is the XAML template used in the toolkit for the default styling. - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| -- | -- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Controls | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Controls](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Controls/) | - -## API - -* [Loading source code](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.UI.Controls/Loading) diff --git a/docs/controls/MarkdownTextBlock.md b/docs/controls/MarkdownTextBlock.md deleted file mode 100644 index c2bf4c0d188..00000000000 --- a/docs/controls/MarkdownTextBlock.md +++ /dev/null @@ -1,232 +0,0 @@ ---- -title: MarkdownTextBlock XAML Control -author: williamabradley -description: The MarkdownTextBlock control provides full markdown parsing and rendering for Universal Windows Apps. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, MarkdownTextBlock, xaml, xaml control ---- - -# MarkdownTextBlock XAML Control - -The [MarkdownTextBlock control](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.markdowntextblock) provides full markdown parsing and rendering for Universal Windows Apps. Originally created for the open source reddit app Baconit, the control was engineered to be simple to use and very efficient. One of the main design considerations for the control was it needed to be performant enough to provide a great user experience in virtualized lists. With the custom markdown parser and efficient XAML rendering, we were able to achieve excellent performance; providing a smooth UI experience even with complex Markdown on low end hardware. - -Under the hood, the control uses XAML sub elements to build the visual rendering tree for the Markdown input. We chose to use full XAML elements over using the RichEditTextBlock control because the RichEditTextBlock isn't flexible enough to correctly render all of the standard Markdown styles. - -## Syntax - -```xaml - - -``` - -## Limitations - -Here are some limitations you may encounter: - -- All images are stretched with the same stretch value (defined by ImageStretch property) -- Relative Links & Relative Images needs to be handled manually using `LinkClicked` event. - -## Sample Output - -Note: scrolling is smooth, the gif below is not. - -![MarkdownTextBlock animation](../resources/images/Controls-MarkdownTextBlock.gif "MarkdownTextBlock") - -## Properties - -The MarkdownTextBlock control is highly customizable to blend with any theme. Customizable properties include: - -| Property | Type | Description | -| -- | -- | -- | -| CodeBackground | Brush | Gets or sets the brush used to fill the background of a code block | -| CodeBorderBrush | Brush | Gets or sets the brush used to render the border fill of a code block | -| CodeBorderThickness | Thickness | Gets or sets the thickness of the border around code blocks | -| CodeFontFamily | FontFamily | Gets or sets the font used to display code. If this is `null`, then Windows.UI.Xaml.Media.FontFamily is used | -| CodeForeground | Brush | Gets or sets the brush used to render the text inside a code block. If this is `null`, then Foreground is used | -| CodeMargin | Thickness | Gets or sets the space between the code border and the text | -| CodePadding | Thickness | Gets or sets space between the code border and the text | -| CodeStyling | StyleDictionary | Gets or sets the Default Code Styling for Code Blocks | -| EmojiFontFamily | FontFamily | Gets or sets the font used to display emojis. If this is `null`, then Segoe UI Emoji font is used | -| Header1FontSize | double | Gets or sets the font size for level 1 headers | -| Header1FontWeight | FontWeight | Gets or sets the font weight to use for level 1 headers | -| Header1Foreground | Brush | Gets or sets the foreground brush for level 1 headers | -| Header1Margin | Thickness | Gets or sets the margin for level 1 headers | -| Header2FontSize | double | Gets or sets the font size for level 2 headers | -| Header2FontWeight | FontWeight | Gets or sets the font weight to use for level 2 headers | -| Header2Foreground | Brush | Gets or sets the foreground brush for level 2 headers | -| Header2Margin | Thickness | Gets or sets the margin for level 2 headers | -| Header3FontSize | double | Gets or sets the font size for level 3 headers | -| Header3FontWeight | FontWeight | Gets or sets the font weight to use for level 3 headers | -| Header3Foreground | Brush | Gets or sets the foreground brush for level 3 headers | -| Header3Margin | Thickness | Gets or sets the margin for level 3 headers | -| Header4FontSize | double | Gets or sets the font size for level 4 headers | -| Header4FontWeight | FontWeight | Gets or sets the font weight to use for level 4 headers | -| Header4Foreground | Brush | Gets or sets the foreground brush for level 4 headers | -| Header4Margin | Thickness | Gets or sets the margin for level 4 headers | -| Header5FontSize | double | Gets or sets the font size for level 5 headers | -| Header5FontWeight | FontWeight | Gets or sets the font weight to use for level 5 headers | -| Header5Foreground | Brush | Gets or sets the foreground brush for level 5 headers | -| Header5Margin | Thickness | Gets or sets the margin for level 5 headers | -| Header6FontSize | double | Gets or sets the font size for level 6 headers | -| Header6FontWeight | FontWeight | Gets or sets the font weight to use for level 6 headers | -| Header6Foreground | Brush | Gets or sets the foreground brush for level 6 headers | -| Header6Margin | Thickness | Gets or sets the margin for level 6 headers | -| HorizontalRuleBrush | Brush | Gets or sets the brush used to render a horizontal rule. If this is `null`, then HorizontalRuleBrush is used | -| HorizontalRuleMargin | Thickness | Gets or sets the margin used for horizontal rules | -| HorizontalRuleThickness | double | Gets or sets the vertical thickness of the horizontal rule | -| ImageMaxHeight | double | Gets or sets the MaxHeight for images | -| ImageMaxWidth | double | Gets or sets the MaxWidth for images | -| ImageStretch | Stretch | Gets or sets the stretch used for images | -| InlineCodeBackground | Brush | Gets or sets the foreground brush for inline code. | -| InlineCodeBorderBrush | Brush | Gets or sets the border brush for inline code | -| InlineCodeBorderThickness | Thickness | Gets or sets the thickness of the border for inline code | -| InlineCodeFontFamily | FontFamily | Gets or sets the font used to display code. If this is `null`, then `Windows.UI.Xaml.Media.FontFamily` is used | -| InlineCodePadding | Thickness | Gets or sets the foreground brush for inline code | -| IsTextSelectionEnabled | bool | Gets or sets a value indicating whether text selection is enabled | -| LinkForeground | Brush | Gets or sets the brush used to render links. If this is `null`, then Foreground is used | -| ListBulletSpacing | double | Gets or sets the space between the list item bullets/numbers and the list item content | -| ListGutterWidth | double | Gets or sets the width of the space used by list item bullets/numbers | -| ListMargin | Thickness | Gets or sets the margin used by lists | -| ParagraphMargin | Thickness | Gets or sets the margin used for paragraphs | -| QuoteBackground | Brush | Gets or sets the brush used to fill the background of a quote block | -| QuoteBorderBrush | Brush | Gets or sets the brush used to render a quote border. If this is null, then [QuoteBorderBrush](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.markdowntextblock.quoteborderbrush#Microsoft_Toolkit_Uwp_UI_Controls_MarkdownTextBlock_QuoteBorderBrush) is used | -| QuoteBorderThickness | Thickness | Gets or sets the thickness of quote borders. | -| QuoteForeground | Brush | Gets or sets the brush used to render the text inside a quote block. If this is `null`, then Foreground is used | -| QuoteMargin | Thickness | Gets or sets the space outside of quote borders | -| QuotePadding | Thickness | Gets or sets the space between the quote border and the text | -| SchemeList | string(separated by comma) | Gets or sets the custom SchemeList to render a URL. | -| TableBorderBrush | boBrushol | Gets or sets the brush used to render table borders. If this is null, then [TableBorderBrush](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.markdowntextblock.tableborderbrush#Microsoft_Toolkit_Uwp_UI_Controls_MarkdownTextBlock_TableBorderBrush) is used | -| TableBorderThickness | double | Gets or sets the thickness of any table borders | -| TableCellPadding | Thickness | Gets or sets the padding inside each cell | -| TableMargin | Thickness | Gets or sets the margin used by tables | -| Text | string | Gets or sets the markdown text to display | -| TextWrapping | TextWrapping | Gets or sets the word wrapping behavior | -| UriPrefix | string | Gets or sets the Prefix of Uri | -| UseSyntaxHighlighting | bool | Gets or sets a value indicating whether to use Syntax Highlighting on Code | -| WrapCodeBlock | bool | Gets or sets a value indicating whether to Wrap the Code Block or use a Horizontal Scroll | - -## Events - -| Events | Description | -| -- | -- | -| CodeBlockResolving | Fired when a Code Block is being Rendered. The default implementation is to output the CodeBlock as Plain Text. You must set `Handled` to `true` in order to process your changes | -| ImageClicked | Fired when an image element in the markdown was tapped | -| ImageResolving | Fired when an image from the markdown document needs to be resolved. The default implementation is basically. You must set `Handled` to `true` in order to process your changes | -| LinkClicked | Fired when a link element in the markdown was tapped | -| MarkdownRendered | Fired when the text is done parsing and formatting. Fires each time the markdown is rendered | - -### LinkClicked - -Use this event to handle clicking on links for Markdown, by default the MarkdownTextBlock does not handle Clicking on Links. - -```c# -private async void MarkdownText_LinkClicked(object sender, LinkClickedEventArgs e) -{ - if (Uri.TryCreate(e.Link, UriKind.Absolute, out Uri link)) - { - await Launcher.LaunchUriAsync(link); - } -} -``` - -### ImageClicked - -Use this event to handle clicking on images for Markdown, by default the MarkdownTextBlock does not handle Clicking on Images. - -```c# -private async void MarkdownText_ImageClicked(object sender, LinkClickedEventArgs e) -{ - if (Uri.TryCreate(e.Link, UriKind.Absolute, out Uri link)) - { - await Launcher.LaunchUriAsync(link); - } -} -``` - -### ImageResolving - -Use this event to customize how images in the markdown document are resolved. - -Set the ImageResolvingEventArgs.Image property to the image that should be shown in the rendered markdown document. -Also don't forget to set the ImageResolvingEventArgs.Handled flag to true, otherwise your custom image will not be used. - -```c# -private void MarkdownText_OnImageResolving(object sender, ImageResolvingEventArgs e) -{ - // This is basically the default implementation - e.Image = new BitmapImage(new Uri(e.Url)); - e.Handled = true; -} -``` - -This event also supports loading the image in an asynchronous way. -Just request a Deferral which you complete when you're done. - -```c# -private async void MarkdownText_OnImageResolving(object sender, ImageResolvingEventArgs e) -{ - var deferral = e.GetDeferral(); - - e.Image = await GetImageFromDatabaseAsync(e.Url); - e.Handled = true; - - deferral.Complete(); -} -``` - -### CodeBlockResolving - -Use this event to customise how Code Block text is rendered, this is useful for providing Cusom Syntax Highlighting. Built in Syntax Highlighting is already provided with `UseSyntaxHighlighting`. - -Manipulate the Inline Collection, and then set e.Handled to true, otherwise the changes won't be processed. - -```c# -private void MarkdownText_CodeBlockResolving(object sender, CodeBlockResolvingEventArgs e) -{ - if (e.CodeLanguage == "CUSTOM") - { - e.Handled = true; - e.InlineCollection.Add(new Run { Foreground = new SolidColorBrush(Colors.Red), Text = e.Text, FontWeight = FontWeights.Bold }); - } -} -``` - -## Rendering - -You can customise the rendering of the **MarkdownTextBlock**, by inheriting from `MarkdownRenderer` and setting it as the renderer: - -```c# -var block = new MarkdownTextBlock(); -block.SetRenderer(); -``` - -This will likely require intimate knowledge of the implementation of the `MarkdownRenderer`, take a look at the following: - -* [MarkdownRenderer and Helpers](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.UI.Controls/MarkdownTextBlock/Render) -* [Sample App custom markdown renderer](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.SampleApp/Controls/SampleAppMarkdownRenderer) - -## Sample Code - -[MarkdownTextBlock Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/MarkdownTextBlock). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Default Template - -[MarkdownTextBlock XAML File](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.UI.Controls/MarkdownTextBlock/MarkdownTextBlock.xaml) is the XAML template used in the toolkit for the default styling. - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| --- | --- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Controls | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Controls](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Controls/) | - -## API - -* [MarkdownTextBlock source code](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.UI.Controls/MarkdownTextBlock) - -## Related Topics - -* [Markdown Parser](https://docs.microsoft.com/en-us/windows/communitytoolkit/parsers/markdownparser) diff --git a/docs/controls/MasterDetailsView.md b/docs/controls/MasterDetailsView.md deleted file mode 100644 index 5e8376c55bf..00000000000 --- a/docs/controls/MasterDetailsView.md +++ /dev/null @@ -1,73 +0,0 @@ ---- -title: MasterDetailsView XAML Control -author: nmetulev -description: The MasterDetailsView Control presents items in a master/details pattern. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, MasterDetailsView, XAML Control, xaml ---- - -# MasterDetailsView XAML Control - -The [MasterDetailsView Control](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.masterdetailsview) presents items in a master/details pattern. It shows a collection of items within the "master panel" and the details for that item within the "details panel". The MasterDetailsView reacts to the width it is given to determine if it should show both the master and details or just one of the two. There is a dependency property `ViewState` or an event `ViewStateChanged` that can be used to track which state the control is in. - -## Syntax - -```xaml - - -``` - -## Sample Output - -![MasterDetailsView animation](../resources/images/Controls/MasterDetailsView.gif) - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| BackButtonBehavior | BackButtonBehavior | Gets or sets the behavior to use for the back button. | -| CompactModeThresholdWidth | double | If width of control is less than CompactModeThresholdWidth, the control will only display the master or details view - otherwise it will show both views. | -| DetailsCommandBar | CommandBar | Gets or sets the Windows.UI.Xaml.Controls.CommandBar for the details section | -| DetailsHeader | object | Gets or sets the content for the details pane's header | -| DetailsHeaderTemplate | DataTemplate | Gets or sets the DataTemplate used to display the content of the details pane's header | -| DetailsTemplate | DataTemplate | Gets or sets the DataTemplate used to display the details | -| MapDetails | Func | Gets or sets a function for mapping the selected item to a different model. This new model will be the DataContext of the Details area | -| MasterCommandBar | CommandBar | Gets or sets the Windows.UI.Xaml.Controls.CommandBar for the master section | -| MasterHeader | object | Gets or sets the content for the master pane's header | -| MasterHeaderTemplate | DataTemplate | Gets or sets the DataTemplate used to display the content of the master pane's header | -| MasterPaneBackground | Brush | Gets or sets the Brush to apply to the background of the list area of the control | -| MasterPaneWidth | double | Gets or sets the width of the master pane when the view is expanded | -| NoSelectionContent | object | Gets or sets the content to dsiplay when there is no item selected in the master list | -| NoSelectionContentTemplate | DataTemplate | Gets or sets the DataTemplate used to display the content when there is no selection | -| SelectedItem | object | Gets or sets the selected item | -| ViewState | [MasterDetailsViewState](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.masterdetailsviewstate) | Gets the current visual state of the control | - -## Events - -| Events | Description | -| -- | -- | -| SelectionChanged | Occurs when the currently selected item changes | -| ViewStateChanged | Occurs when the view state changes | - -## Sample Code - -[MasterDetailsView Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/MasterDetailsView). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Default Template - -[MasterDetailsView XAML File](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.UI.Controls/MasterDetailsView/MasterDetailsView.xaml) is the XAML template used in the toolkit for the default styling. - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| -- | -- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Controls | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Controls](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Controls/) | - -## API - -* [MasterDetailsView source code](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.UI.Controls/MasterDetailsView) diff --git a/docs/controls/Menu.md b/docs/controls/Menu.md deleted file mode 100644 index 2b348894fba..00000000000 --- a/docs/controls/Menu.md +++ /dev/null @@ -1,157 +0,0 @@ ---- -title: Menu Control -author: nmetulev -description: The Windows Community Toolkit Menu control defines a top level menu for commands, options, properties and much more within your UWP apps. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, Menu, xaml, xaml control ---- - -# Menu Control - -The [Menu Control](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.menu) defines a menu of choices for users to invoke, it is inheriting from `ItemsControl`. The default ItemsPanel for the menu control is `WrapPanel` and it only supports MenuItem as an item\children. - -The [Menu Control](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.menu) positions it's items the way the WrapPanel does based on the selected orientation Virtical\Horizontal (Developers can change the control ItemsPanel). The Menu items must be of type MenuItem, each MenuItem can be opened using keyboard or pointer. - -[MenuItem](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.menuitem) is inheriting from `ItemsControl` and the allowed controls must be derived from `MenuFlyoutItemBase` like `MenuFlyoutSubItem`, `MenuFlyoutItem`, etc... - -To invoke any command on any Menu, MenuItem or MenuFlyoutItem you must use property `InputGestureText` - -If the tooltip is allowed on the Menu control when clicking Alt a tooltip with the input gesture text will show\hide. - -## Syntax - -```xaml - - - - - - - - - - -``` - -## Sample Output - -![Menu Overview](../resources/images/Controls/Menu.gif) - -## Properties - -### Menu Properties - -| Property | Type | Description | -| -- | -- | -- | -| FlyoutPlacement | [FlyoutPlacementMode](https://docs.microsoft.com/uwp/api/Windows.UI.Xaml.Controls.Primitives.FlyoutPlacementMode) | Gets or sets the placement of the flyoutMenu (Auto, Top, Bottom, Left, Right and Full) | -| IsOpened | bool | Gets a value indicating whether the menu is opened or not | -| MenuFlyoutStyle | Style | Gets or sets the menu style for MenuItem | -| Orientation | Orientation | Gets or sets the orientation of the Menu, Horizontal or vertical means that child controls will be added horizontally until the width of the panel can't fit more control then a new row is added to fit new horizontal added child controls, vertical means that child will be added vertically until the height of the panel is received then a new column is added | -| SelectedMenuItem | MenuItem | Gets the current selected menu header item | -| TooltipPlacement | [PlacementMode](https://docs.microsoft.com/uwp/api/Windows.UI.Xaml.Controls.Primitives.PlacementMode) | Gets or sets the tooltip placement on menu | -| TooltipStyle | Style | Gets or sets the tooltip styles for menu | - -### External Properties - -| Property | Type | Description | -| -- | -- | -- | -| AllowTooltip | bool | Specify whether to allow tooltip on Alt click or not | -| InputGestureText | string | Sets the text describing an input gesture that will call the command tied to the specified item or to open the MenuItem FlyoutMenu. ex (Alt+F) | - -> [!NOTE] -InputGestureText supports Ctrl, Alt or Shift. - -### MenuItem Properties - -| Property | Type | Description | -| -- | -- | -- | -| Header | object | Gets or sets the header of the MenuItem. if you added '^' before any header character this character will be highlighted on pressing or holding Alt, this feature is used to visualize which character can be used beside Alt to open this MenuItem. | -| HeaderTemplate | DataTemplate | Gets or sets the data template that is used to display the content of the MenuItem | -| IsOpened | bool | Gets a value indicating whether the menu is opened or not | - -## Methods - -### Menu Methods - -| Methods | Return Type | Description | -| -- | -- | -- | -| static GetAllowTooltip(Menu) | bool | Gets AllowTooltip attached property | -| static GetInputGestureText(FrameworkElement) | string | Gets InputGestureText attached property | -| static SetAllowTooltip(Menu, Boolean) | void | Sets AllowTooltip attached property | -| static SetInputGestureText(FrameworkElement, String) | void | Sets InputGestureText attached property | - -### MenuItem Methods - -| Methods | Return Type | Description | -| -- | -- | -- | -| HideMenu() | void | This method is used to hide the menu for current item | -| static ShowMenu() | void | This method is used to show the menu for current item | - -## Example - -The following sample demonstrates how to add Menu Control. - -```xaml - - - - - - - - - - - - - - - - - - -``` - -``` CSharp -internal class NewProjectCommand : ICommand -{ - public bool CanExecute(object parameter) - { - return true; - } - - public async void Execute(object parameter) - { - var dialog = new MessageDialog("Create New Project"); - await dialog.ShowAsync(); - } - - public event EventHandler CanExecuteChanged; -} -``` - -## Sample Code - -[Menu Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Menu). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Default Template - -[Menu XAML File](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.UI.Controls/Menu/Menu.xaml) is the XAML template used in the toolkit for the default styling. - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| -- | -- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Controls | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Controls](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Controls/) | - -## API - -* [Menu source code](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.UI.Controls/Menu) diff --git a/docs/controls/OrbitView.md b/docs/controls/OrbitView.md deleted file mode 100644 index b530c9089a7..00000000000 --- a/docs/controls/OrbitView.md +++ /dev/null @@ -1,148 +0,0 @@ ---- -title: OrbitView XAML Control -author: nmetulev -description: The OrbitView is an ItemsControl where all items are arranged in circle around a center element -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, OrbitView, xaml control, xaml ---- - -# OrbitView XAML Control - -The [OrbitView control](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.orbitview) provides a new control, inherited from the `ItemsControl`. All items are arranged in circle around a center element - -[OrbitViewDataItem](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.orbitviewdataitem) is a helper class used for specifying size and distance of each item of the `OrbitView`. To work properly, the `ItemSource` of the `OrbitView` should be set to en `IEnumerable`. Objects extending OrbitViewDataItem will also work. Alternatively, OrbitViewDataItem has the `Item` object property that can be used to store additional objects and properties. - -## Syntax - -```xaml - - - - - - - - - - - - - - - - - - - -``` - -## Sample Output - -![OrbitView Overview](../resources/images/Controls/OrbitView.gif) - -## Properties - -### OrbitView Properties - -| Property | Type | Description | -| -- | -- | -- | -| AnchorColor | Brush | Gets or sets a value indicating the color of anchors | -| AnchorsEnabled | bool | Gets or sets a value indicating whether anchors are enabled | -| AnchorThickness | double | Gets or sets a value indicating the thickness of the anchors | -| CenterContent | object | Gets or sets a value representing the center element | -| IsItemClickEnabled | bool | Gets or sets a value indicating whether elements are clickable | -| MaxItemSize | double | Gets or sets a value indicating the maximum size of items | -| MinItemSize | double | Gets or sets a value indicating the minimum size of items Note: for this property to work, Data Context must be derived from OrbitViewItems and Diameter must be between 0 and 1 | -| OrbitColor | Brush | Gets or sets a value indicating the color of orbits | -| OrbitDashArray | DoubleCollection | Gets or sets a value indicating the dash array for the orbit | -| OrbitsEnabled | bool | Gets or sets a value indicating whether orbits are enabled or not | -| OrbitThickness | double | Gets or sets a value indicating the thickness of the orbits | - -> [!IMPORTANT] -For `MaxItemSize` and `MinItemSize` property to work, Data Context must be derived from OrbitViewItems and Diameter must be between 0 and 1 - -### OrbitViewDataItem Properties - -| Property | Type | Description | -| -- | -- | -- | -| Diameter | double | Gets or sets a value indicating the diameter of the item. Expected value betweeen 0 and 1 | -| Distance | double | Gets or sets a value indicating the distance from the center. Expected value betweeen 0 and 1 | -| Image | ImageSource | Gets or sets a value indicating the image of the item | -| Item | object | Gets or sets a value of an object that can be used to store model data | -| Label | string | Gets or sets a value indicating the name of the item. Used for [AutomationProperties](https://docs.microsoft.com/uwp/api/Windows.UI.Xaml.Automation.AutomationProperties) | - -## Events - -### OrbitView Events - -| Events | Description | -| -- | -- | -| ItemClick | Raised when an item has been clicked or activated with keyboard/controller | - -> [!IMPORTANT] -`IsItemClickedEnabled` should be true for this event to work - -## Examples - -The following sample demonstrates how to add OrbitView Control. - -```xaml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -``` - -## Sample Code - -[Carousel Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/OrbitView). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Default Template - -[OrbitView XAML File](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.UI.Controls/OrbitView/OrbitView.xaml) is the XAML template used in the toolkit for the default styling. - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| -- | -- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Controls | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Controls](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Controls/) | - -## API - -* [OrbitView source code](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.UI.Controls/OrbitView) diff --git a/docs/controls/PullToRefreshListview.md b/docs/controls/PullToRefreshListview.md deleted file mode 100644 index 2fbecc06c85..00000000000 --- a/docs/controls/PullToRefreshListview.md +++ /dev/null @@ -1,125 +0,0 @@ ---- -title: PullToRefreshListView XAML Control -author: nmetulev -description: The PullToRefreshListView Control lets the user pull down beyond the top limit on the listview to trigger a refresh of the content. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, PullToRefreshListView, XAML Control, xaml ---- - -# PullToRefreshListView XAML Control - -> [!NOTE] -The PullToRefreshListView is deprecated and will be removed in a future major release. Please use the [RefreshContainer](https://docs.microsoft.com/en-us/windows/uwp/design/controls-and-patterns/pull-to-refresh) available in the 1803 version of Windows. Read the [Moving to RefreshContainer](#refreshcontainer) section for more info. - -The [PullToRefreshListView Control](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.pulltorefreshlistview), is derived from the built-in List View in XAML. It lets the user pull down beyond the top limit on the listview to trigger a refresh of the content. This control can create rich, animations, and is easy to use. - -This control is very common on mobile devices, where the user can pull from the top to force a content refresh in applications like Twitter. - -This control uses the *PullToRefreshLabel* and *ReleaseToRefreshLabel* properties to provide a visual indication to the user. - -If you want more than a text to display, you can then use *PullToRefreshContent* and *ReleaseToRefreshContent*. In this case the *PullToRefreshLabel* and *ReleaseToRefreshLabel* properties will be ignored. - -The `RefreshIndicatorContent` can be used with the `PullProgressChanged` event to provide a custom visual for the user. - -To cancel a refresh request just slide back to a position prior to the *PullThreshold* position. Upon release the *RefreshIntentCanceled* event will -be raised and the *RefreshIntentCanceledCommand*, if any, will be executed. - -## Syntax - -```xaml - - - - - - - -``` - -## Sample Output - -![PullToRefreshListView animation](../resources/images/Controls/PullToRefreshListView.gif) - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| IsPullToRefreshWithMouseEnabled | bool | Gets or sets a value indicating whether PullToRefresh is enabled with a mouse | -| OverscrollLimit | double | Gets or sets the Overscroll Limit. Value between 0 and 1 where 1 is the height of the control. Default is 0.3 | -| PullThreshold | double | Gets or sets the PullThreshold in pixels for when Refresh should be Requested. Default is 100 | -| PullToRefreshContent | object | Gets or sets the content that will be shown when the user pulls down to refresh | -| PullToRefreshLabel | string | Gets or sets the label that will be shown when the user pulls down to refresh. Note: This label will only show up if `RefreshIndicatorContent` is null | -| RefreshCommand | ICommand | Gets or sets the Command that will be invoked when Refresh is requested | -| RefreshIndicatorContent | object | Gets or sets the Content of the Refresh Indicator | -| RefreshIntentCanceledCommand | ICommand | Gets or sets the Command that will be invoked when a refresh intent is cancled | -| ReleaseToRefreshContent | object | Gets or sets the content that will be shown when the user needs to release to refresh | -| ReleaseToRefreshLabel | string | Gets or sets the label that will be shown when the user needs to release to refresh. Note: This label will only show up if `RefreshIndicatorContent` is null | - -## Events - -| Events | Description | -| -- | -- | -| PullProgressChanged | Occurs when listview overscroll distance is changed | -| RefreshIntentCanceled | Occurs when the user has cancels an intent for the content to be refreshed | -| RefreshRequested | Occurs when the user has requested content to be refreshed | - -## Sample Code - -[PullToRefreshListView Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/PullToRefreshListView). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Moving to RefreshContainer -The 1803 version of Windows now includes its own implementation of [pull-to-refresh](https://docs.microsoft.com/en-us/windows/uwp/design/controls-and-patterns/pull-to-refresh) controls, having [RefreshContainer](https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.refreshcontainer) as the main control. - -The PullToRefreshListView and the RefreshContainer share the same concepts and provide mostly the same functionality, with the caveat that the RefreshContainer works only with a touch interface. - -### What developers need to know to move to RefreshContainer? - -* **XAML:** The RefreshContainer is very simple to use. Unlike the PullToRefreshListView, the RefreshContainer isn't based on the ListView control, so to use it you just need to add the XAML element as a parent of the element you'll use as your item container, like a ListView or a ScrollViewer. - -* **Code behind:** The RefreshContainer invokes the RefreshRequested event whenever a refresh is triggered. Unlike most event handlers, it has the peculiarity of coming with a [Deferral](https://docs.microsoft.com/en-us/uwp/api/windows.foundation.deferral) object, that you can get from the [RefreshRequestedEventArgs](https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.refreshrequestedeventargs) by calling [GetDeferral](https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.refreshrequestedeventargs.getdeferral#Windows_UI_Xaml_Controls_RefreshRequestedEventArgs_GetDeferral). -To notify that your refresh code has completed, you can mark the deferral as completed by calling its Complete method or wrap your refresh code with a using statement of the deferral. - -> [!NOTE] -Being a touch-only control, it's recommended that you also have a refresh button for users without a touch interface. You can trigger the RefreshRequested event by calling the RefreshContainer's RequestRefresh method. - -### Making the transition even easier -Starting with v3.0 of the Windows Community Toolkit, the PullToRefreshListView provides a new property called **UseRefreshContainerWhenPossible**. Setting the value to true will force the PullToRefreshListView to use a template based on the RefreshContainer when running on the 1803 version of Windows and above, and the regular template otherwise. - -Using this property will enable you to take advantage of the RefreshContainer on devices that support it, while providing an experience based on PullToRefreshListView on devices that have not yet updated to the 1803 version of Windows. Make sure to test the experience on multiple OS releases and plan to fully transition to the RefreshContainer as the PullToRefreshListView will be removed from the Windows Community Toolkit in a future major release. - -> [!NOTE] -When using the RefreshContainer, the RefreshIntentCanceled and the PullProgressChanged events are not invoked. In addition, the RefreshIntentCanceledCommand is not executed. - -There are several PullToRefreshListView properties that have no effect when the PullToRefreshListView is using the RefreshContainer: - -* OverscrollLimit -* PullThreshold -* RefreshIndicatorContent -* PullToRefreshLabel -* ReleaseToRefreshLabel -* PullToRefreshContent -* ReleaseToRefreshContent -* IsPullToRefreshWithMouseEnabled - - -## Default Template - -[PullToRefreshListView XAML File](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.UI.Controls/PullToRefreshListView/PullToRefreshListView.xaml) is the XAML template used in the toolkit for the default styling. - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| -- | -- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Controls | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Controls](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Controls/) | - -## API - -* [PullToRefreshListView source code](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.UI.Controls/PullToRefreshListView) diff --git a/docs/controls/RadialGauge.md b/docs/controls/RadialGauge.md deleted file mode 100644 index dbe321beb63..00000000000 --- a/docs/controls/RadialGauge.md +++ /dev/null @@ -1,95 +0,0 @@ ---- -title: RadialGauge XAML Control -author: nmetulev -description: The Radial Gauge Control displays a value in a certain range using a needle on a circular face. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, Radial Gauge, RadialGauge, xaml control, xaml ---- - -# RadialGauge XAML Control - -The [Radial Gauge Control](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.radialgauge) displays a value in a certain range using a needle on a circular face. This control will make data visualizations and dashboards more engaging with rich style and interactivity. -The round gauges are powerful, easy to use, and highly configurable to present dashboards capable of displaying clocks, industrial panels, automotive dashboards, and even aircraft cockpits. - -The Radial Gauge supports animated transitions between configuration states. The control gradually animates as it redraws changes to the needle, needle position, scale range, color range, and more. - -## Syntax - -```xaml - - - - -``` - -## Sample Output - -![RadialGauge animation](../resources/images/Controls/RadialGauge.gif) - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| IsInteractive | bool | Gets or sets a value indicating whether the control accepts setting its value through interaction | -| MaxAngle | int | Gets or sets the end angle of the scale, which corresponds with the Maximum value, in degrees | -| Maximum | double | Gets or sets the maximum value of the scale | -| MinAngle | int | Gets or sets the start angle of the scale, which corresponds with the Minimum value, in degrees | -| Minimum | double | Gets or sets the minimum value of the scale | -| NeedleBrush | SolidColorBrush | Gets or sets the needle brush | -| NeedleLength | double | Gets or sets the needle length, in percentage of the gauge radius | -| NeedleWidth | double | Gets or sets the needle width, in percentage of the gauge radius | -| NormalizedMaxAngle | double | Gets the normalized maximum angle | -| NormalizedMinAngle | double | Gets the normalized minimum angle | -| ScaleBrush | Brush | Gets or sets the scale brush | -| ScalePadding | double | Gets or sets the distance of the scale from the outside of the control, in percentage of the gauge radius | -| ScaleTickBrush | SolidColorBrush | Gets or sets the scale tick brush | -| ScaleTickWidth | double | Gets or sets the width of the scale ticks, in percentage of the gauge radius | -| ScaleWidth | double | Gets or sets the width of the scale, in percentage of the gauge radius | -| StepSize | double | Gets or sets the rounding interval for the Value | -| TickBrush | SolidColorBrush | Gets or sets the outer tick brush | -| TickLength | double | Gets or sets the length of the ticks, in percentage of the gauge radius | -| TickSpacing | int | Gets or sets the tick spacing, in units | -| TickWidth | double | Gets or sets the width of the ticks, in percentage of the gauge radius | -| TrailBrush | Brush | Gets or sets the trail brush | -| Unit | string | Gets or sets the displayed unit measure | -| UnitBrush | Brush | Gets or sets the brush for the displayed unit measure | -| Value | double | Gets or sets the current value | -| ValueAngle | double | Gets or sets the current angle of the needle (between MinAngle and MaxAngle). Setting the angle will update the Value | -| ValueBrush | Brush | Gets or sets the brush for the displayed value | -| ValueStringFormat | string | Gets or sets the value string format | - -## Control style and template - -You can modify the default [Style](https://docs.microsoft.com/uwp/api/windows.ui.xaml.style) and [ControlTemplate](https://docs.microsoft.com/uwp/api/windows.ui.xaml.controls.controltemplate) to give the control a unique appearance. For information about modifying a control's style and template, see [Styling controls](https://msdn.microsoft.com/windows/uwp/controls-and-patterns/styling-controls). The default style, template, and resources that define the look of the control are included in the RadialGauge.xaml file. For design purposes, RadialGauge.xaml is available on [GitHub](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.UI.Controls/RadialGauge/RadialGauge.xaml). Styles and resources from different versions of the SDK might have different values. - -Starting in Toolkit version 2.2, RadialGauge.xaml includes resources that you can use to modify the colors of a control in different visual states without modifying the control template. In apps that target this software development kit (SDK) or later, modifying these resources is preferred to setting properties such as Background and Foreground. For more info, see the Light-weight styling section of the Styling controls article. - -This table shows the resources used by the [RadialGauge](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.radialgauge) control. - -| Resource key | Description | -| -- | -- | -- | -| RadialGaugeForegroundBrush | Label text color for the value of the gauge | -| RadialGaugeAccentBrush | Label text color for the units of the gauge | - -## Sample Code - -[RadialGauge Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/RadialGauge). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Default Template - -[RadialGauge XAML File](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.UI.Controls/RadialGauge/RadialGauge.xaml) is the XAML template used in the toolkit for the default styling. - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| -- | -- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Controls | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Controls](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Controls/) | - -## API - -* [RadialGauge source code](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.UI.Controls/RadialGauge) - diff --git a/docs/controls/RadialProgressBar.md b/docs/controls/RadialProgressBar.md deleted file mode 100644 index 2cfde313139..00000000000 --- a/docs/controls/RadialProgressBar.md +++ /dev/null @@ -1,58 +0,0 @@ ---- -title: RadialProgressBar XAML Control -author: nmetulev -description: The Radial Progress Bar Control displays a value in a certain range using a cicular sector that grows clockwise until it becomes a full ring. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, Radial Progress Bar, RadialProgressBar, xaml control, xaml ---- - -# RadialProgressBar XAML Control - -The [Radial Progress Bar Control](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.radialprogressbar) displays a value in a certain range using a cicular sector that grows clockwise until it becomes a full ring. - -The control uses the same dependency properties as the standard Progress Bar, with the addition of: - -- A Thickness parameter, which sets the thickness of the circular sector and the outline it's drawn on -- An Outline property, which sets the brush of the circular outline - -## Syntax - -```xaml - - - - -``` - -## Sample Output - -![RadialProgressBar image](../resources/images/Controls/RadialProgressBar.png) - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| Outline | Brush | Gets or sets the color of the circular ouline on which the segment is drawn | -| Thickness | double | Gets or sets the thickness of the circular ouline and segment | - -## Sample Code - -[RadialProgressBar Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/RadialProgressBar). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Default Template - -[RadialProgressBar XAML File](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.UI.Controls/RadialProgressBar/RadialProgressBar.xaml) is the XAML template used in the toolkit for the default styling. - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| -- | -- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Controls | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Controls](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Controls/) | - -## API - -* [RadialProgressBar source code](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.UI.Controls/RadialProgressBar) - diff --git a/docs/controls/RangeSelector.md b/docs/controls/RangeSelector.md deleted file mode 100644 index 87057d7f55b..00000000000 --- a/docs/controls/RangeSelector.md +++ /dev/null @@ -1,96 +0,0 @@ ---- -title: RangeSelector XAML Control -author: nmetulev -description: The RangeSelector Control is a Double Slider control that allows the user to select a sub-range of values from a larger range of possible values. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, RangeSelector, XAML Control, xaml, double slider -dev_langs: - - csharp - - vb ---- - -# RangeSelector XAML Control - -The [RangeSelector Control](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.rangeselector) is a Double Slider control that allows the user to select a sub-range of values from a larger range of possible values. The user can slide from the left or right of the range. - -## Syntax - -```xaml - - - - -``` - -## Sample Output - -![RangeSelector animation](../resources/images/Controls/RangeSelector.gif) - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| IsTouchOptimized | bool | Gets or sets a value indicating whether the control is optimized for touch use | -| Maximum | double | Gets or sets the maximum value of the range | -| Minimum | double | Gets or sets the minimum value of the range | -| RangeMax | double | Gets or sets the current upper limit value of the range | -| RangeMin | double | Gets or sets the current lower limit value of the range | -| StepFrequency | int | Get or set the interval between the values on the RangeSelector. For example; if you set `StepFrequency` to 2, using Minimum at 0 and Maximum at 10, the range values you can set will be 0,2,4,6,8,10 | - -## Examples - -> [!NOTE] -If you are using a RangeSelector within a ScrollViewer you'll need to add some codes. This is because by default, the ScrollViewer will block the thumbs of the RangeSelector to capture the pointer. - -Here is an example of using RangeSelector within a ScrollViewer - -```xaml - -``` - -```csharp -private void Selector_OnDragStarted(object sender, DragStartedEventArgs e) -{ - ScrollViewer.HorizontalScrollMode = ScrollMode.Disabled; - ScrollViewer.VerticalScrollMode = ScrollMode.Disabled; -} - -private void Selector_OnDragCompleted(object sender, DragCompletedEventArgs e) -{ - ScrollViewer.HorizontalScrollMode = ScrollMode.Auto; - ScrollViewer.VerticalScrollMode = ScrollMode.Auto; -} -``` -```vb -Private Sub Selector_OnDragStarted(ByVal sender As Object, ByVal e As DragStartedEventArgs) - ScrollViewer.HorizontalScrollMode = ScrollMode.Disabled - ScrollViewer.VerticalScrollMode = ScrollMode.Disabled -End Sub - -Private Sub Selector_OnDragCompleted(ByVal sender As Object, ByVal e As DragCompletedEventArgs) - ScrollViewer.HorizontalScrollMode = ScrollMode.Auto - ScrollViewer.VerticalScrollMode = ScrollMode.Auto -End Sub -``` - -## Sample Code - -[RangeSelector Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/RangeSelector). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Default Template - -[RangeSelector XAML File](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.UI.Controls/RangeSelector/RangeSelector.xaml) is the XAML template used in the toolkit for the default styling. - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| -- | -- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Controls | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Controls](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Controls/) | - -## API - -* [RangeSelector source code](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.UI.Controls/RangeSelector) diff --git a/docs/controls/RotatorTile.md b/docs/controls/RotatorTile.md deleted file mode 100644 index 1a6326184f1..00000000000 --- a/docs/controls/RotatorTile.md +++ /dev/null @@ -1,59 +0,0 @@ ---- -title: Rotator Tile Control -author: nmetulev -description: The RotatorTile Control is an ItemsControl that rotates through a set of items one-by-one. It enables you to show multiple items of data in a live-tile like way. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, RotatorTile Control, xaml control, xaml ---- - -# RotatorTile XAML Control - -The [Rotator Tile Control](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.rotatortile) is an ItemsControl that rotates through a set of items one-by-one. It enables you to show multiple items of data in a live-tile like way. - -## Syntax - -```xaml - - - -``` - -## Example Image - -![RotatorTile animation](../resources/images/Controls/RotatorTile.gif) - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| CurrentItem | object | Gets or sets the currently selected visible item | -| Direction | [RotateDirection](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.rotatortile.rotatedirection) | Gets or sets the direction the tile slides in | -| ExtraRandomDuration | TimeSpan | Gets or sets the extra randomized duration to be added to the `RotationDelay` property. A value between zero and this value in seconds will be added to the `RotationDelay` | -| ItemsSource | object | Gets or sets the ItemsSource | -| ItemTemplate | DataTemplate | Gets or sets the item template | -| RotationDelay | TimeSpan | Gets or sets the duration for tile rotation | - -## Sample Code - -[RotatorTile Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/RotatorTile). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Default Template - -[RotatorTile XAML File](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.UI.Controls/RotatorTile/RotatorTile.xaml) is the XAML template used in the toolkit for the default styling. - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| -- | -- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Controls | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Controls](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Controls/) | - -## API - -* [RotatorTile source code](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.UI.Controls/RotatorTile) - diff --git a/docs/controls/ScrollHeader.md b/docs/controls/ScrollHeader.md deleted file mode 100644 index 7212d320add..00000000000 --- a/docs/controls/ScrollHeader.md +++ /dev/null @@ -1,56 +0,0 @@ ---- -title: ScrollHeader XAML Control -author: nmetulev -description: The ScrollHeader Control provides a header for ListViews or GridViews that adds the ability to keep its content visible or fade it out while scrolling down. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, ScrollHeader, XAML Control, xaml ---- - -# ScrollHeader XAML Control - -The [ScrollHeader Control](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.scrollheader) provides a header for ListViews or GridViews that adds the ability to keep its content visible or fade it out while scrolling down. It also has a quick return mode where the header hides when the ListView is scrolled down and reappears immediately as soon as the ListView is scrolled up again. - -## Syntax - -```xaml - - - - - - - - - -``` - -## Sample Output - -![ScrollHeader animation](../resources/images/Controls/ScrollHeader.gif) - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| Mode | [ScrollHeaderMode](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.scrollheadermode) | Gets or sets a value indicating whether the current mode. Default is none | -| TargetListViewBase | ListViewBase | Gets or sets the container this header belongs to | - -## Sample Code - -[ScrollHeader Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/ScrollHeader). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Default Template - -[ScrollHeader XAML File](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.UI.Controls/ScrollHeader/ScrollHeader.xaml) is the XAML template used in the toolkit for the default styling. - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| -- | -- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Controls | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Controls](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Controls/) | - -## API - -* [ScrollHeader source code](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.UI.Controls/ScrollHeader) - diff --git a/docs/controls/SlidableListItem.md b/docs/controls/SlidableListItem.md deleted file mode 100644 index 2de038e19be..00000000000 --- a/docs/controls/SlidableListItem.md +++ /dev/null @@ -1,188 +0,0 @@ ---- -title: SlidableListItem XAML Control -author: nmetulev -description: The SlidableListItem Control is a UI control that enables actions to be triggered by sliding the content left or right. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, SlidableListItem, XAML Control, xaml -dev_langs: - - csharp - - vb ---- - -# SlidableListItem XAML Control - -> [!WARNING] -The SlidableListItem is deprecated and will be removed in a future major release. Please use the [SwipeControl](https://docs.microsoft.com/en-us/windows/uwp/controls-and-patterns/swipe) available in the Fall Creators Update. Read the [Moving to SwipeControl](#swipe) section for more info. - -The [SlidableListItem Control](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.slidablelistitem) is a UI control that enables actions to be triggered by sliding the content left or right. This effect can be forced to ignore the mouse if only touch screen interaction is desired. - -This control can be used as a ListView Data Template root to create effects similar to those common in mobile email apps like Outlook. - -## Syntax - -```xaml - - - - - - - -``` - -## Sample Output - -![SlidableListItem animation](../resources/images/Controls/SlidableListItem.gif) - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| ActivationWidth | double | Gets or sets the amount of pixels the content needs to be swiped for an action to be requested | -| ExtraSwipeThreshold | int | Gets or sets the amount of extra pixels for swipe threshold when `IsOffsetLimited` is enabled | -| IsLeftCommandEnabled | bool | Gets or sets a value indicating whether left command is enabled or not | -| IsOffsetLimited | bool | Gets or sets a value indicating whether maximum swipe offset is limited or not | -| IsPointerReleasedOnSwipingHandled | bool | Gets or sets a value indicating whether the PointerReleased event is handled when swiping. Set this to true to prevent ItemClicked or selection to occur when swiping in a [ListView](https://docs.microsoft.com/uwp/api/Windows.UI.Xaml.Controls.ListView) | -| IsRightCommandEnabled | bool | Gets or sets a value indicating whether right command is enabled or not | -| LeftBackground | Brush | Gets or sets the left background color | -| LeftCommand | ICommand | Gets or sets the ICommand for left command request | -| LeftCommandParameter | object | Gets or sets the CommandParameter for left command request | -| LeftForeground | Brush | Gets or sets the left foreground color | -| LeftIcon | Symbol | Gets or sets the left icon symbol | -| LeftLabel | string | Gets or sets the left label | -| MouseSlidingEnabled | bool | Gets or sets a value indicating whether it has the ability to slide the control with the mouse. False by default | -| RightBackground | Brush | Gets or sets the right background color | -| RightCommand | ICommand | Gets or sets the ICommand for right command request | -| RightCommandParameter | object | Gets or sets the CommandParameter for right command request | -| RightForeground | Brush | Gets or sets the right foreground color | -| RightIcon | Symbol | Gets or sets the right icon symbol | -| RightLabel | string | Gets or sets the right label | -| SwipeStatus | SwipeStatus | Gets the SwipeStatus for current swipe status | -| UseSwipeControlWhenPossible | bool | Set `true` to use a template based on the SwipeControl when running on the Fall Creators Update and above, and the regular template otherwise. | - -## Events - -| Events | Description | -| -- | -- | -| LeftCommandRequested | Occurs when the user swipes to the right to activate the left action | -| RightCommandRequested | Occurs when the user swipes to the left to activate the right action | -| SwipeStatusChanged | Occurs when SwipeStatus has changed | - -## Examples - -The `LeftCommand` and the `LeftCommandRequested` event is executed when the control has been swiped to the right, and `RightCommand` and the `RightCommandRequested` event is executed when the control has been swiped to the left. If you need more detailed control you can subscribe to the `SwipeStatusChanged` event. This is triggered when swiping starts, stops, swiping below and above `ActivationWidth` and some other cases. The following code shows how to detect some important events: - -```csharp -private void SlidableListItem_SwipeStatusChanged(SlidableListItem sender, SwipeStatusChangedEventArgs args) -{ - if (args.NewValue == SwipeStatus.Starting) - { - // Swiping starting - } - else if (args.NewValue == SwipeStatus.Idle) - { - if (args.OldValue == SwipeStatus.SwipingPassedLeftThreshold) - { - // Swiping to the left completed - } - else if (args.OldValue == SwipeStatus.SwipingPassedRightThreshold) - { - // Swiping to the right completed - } - else - { - // Swiping cancelled - } - } -} -``` -```vb -Private Sub SlidableListItem_SwipeStatusChanged(ByVal sender As SlidableListItem, ByVal args As SwipeStatusChangedEventArgs) - If args.NewValue = SwipeStatus.Starting Then - ' Swiping starting - ElseIf args.NewValue = SwipeStatus.Idle Then - If args.OldValue = SwipeStatus.SwipingPassedLeftThreshold Then - ' Swiping to the left completed - ElseIf args.OldValue = SwipeStatus.SwipingPassedRightThreshold Then - ' Swiping to the right completed - Else - ' Swiping cancelled - End If - End If -End Sub -``` - -If you use `SlidableListItem` in a `ListView` with the `ItemClick` event, you need to be aware the `ItemClick` event is triggered by default when the control has been swiped. If you don't want this behavior you can set `IsPointerReleasedOnSwipingHandled` to `true` to suppress the `ItemClick` event. If you need more control you can instead check the `SwipeStatus` property in the `ItemClick` event. The following code shows how to do that: - -```csharp -private void ListView_ItemClick(object sender, ItemClickEventArgs e) -{ - var listView = sender as ListView; - var listViewItem = listView.ContainerFromItem(e.ClickedItem) as ListViewItem; - var slidableListItem = listViewItem.ContentTemplateRoot as SlidableListItem; - - // Don't do anything unless the SwipeStatus is Idle. - if (slidableListItem.SwipeStatus != SwipeStatus.Idle) - return; - - ... -} -``` -```vb -Private Sub ListView_ItemClick(ByVal sender As Object, ByVal e As ItemClickEventArgs) - Dim listView = TryCast(sender, ListView) - Dim listViewItem = TryCast(listView.ContainerFromItem(e.ClickedItem), ListViewItem) - Dim slidableListItem = TryCast(listViewItem.ContentTemplateRoot, SlidableListItem) - - ' Don't do anything unless the SwipeStatus is Idle. - If slidableListItem.SwipeStatus <> SwipeStatus.Idle Then Return - - ... -End Sub -``` - -## Moving to SwipeControl -The Windows 10 Fall Creators Update SDK now includes the [SwipeControl](https://docs.microsoft.com/en-us/windows/uwp/controls-and-patterns/swipe) control among other new controls and APIs. This is great news for the Windows Community Toolkit as it means that one of its most popular controls has a comparable counterpart in the Windows SDK and it is very easy to transition to the SwipeControl if you are already using the SlidableListItem. - -The SlidableListItem and SwipeControl share the same concepts and provide the same functionality. In fact, the SwipeControl adds even more functionality and can be used in even more scenarios. - -### What developers need to know to move to the SwipeControl? - -* **Two different modes:** The SwipeControl has two different modes of commanding: - * Execute mode - works the same way as the commanding on the SlidableListItem, where the user executes a command with a single swipe - * Reveal mode - the user swipes an item to open a menu where the commands can be executed by tapping them -* **Swipe direction:** SlidableListItem only supports left and right swiping while the SwipeControl supports all four directions (Up, Down, Left, Right) -* **SwipeItem:** The Fall Creators Update defines new objects to help define the swipe commands. Unlike the SlidableListItem where each command is defined through properties on the control itself, the SwipeControl accepts a collection of SwipeItems that define the commands. This is where you can specify properties such as background, foreground, icon, label, and invoked events. - -### Making the transition easier -Starting with v2.1 of the Windows Community Toolkit, the SwipeControl provides a new property called `UseSwipeControlWhenPossible`. Setting the value to true will force the SlidableListItem to use a template based on the SwipeControl when running on the Fall Creators Update and above, and the regular template otherwise. - -Using this property will enable you to take advantage of the SwipeControl on devices that supported it, while providing an experience based on SlidableListItem on devices that have not yet updated to the Fall Creators Update. Make sure to test the experience on multiple OS releases and plan to fully transition to the SwipeControl as the SlidableListItem will be removed from the Windows Community Toolkit in a future major release. - -There are several SlidableListItem properties that have no effect when the SlidableListItem is using the SwipeControl: - -* ActivationWidth -* IsOffsetLimited -* IsPointerReleasedOnSwipingHandled -* MouseSlidingEnabled - -## Sample Code - -[SlidableListItem Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/SlidableListItem). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Default Template - -[SlidableListItem XAML File](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.UI.Controls/SlidableListItem/SlidableListItem.xaml) is the XAML template used in the toolkit for the default styling. - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| -- | -- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Controls | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Controls](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Controls/) | - -## API - -* [SlidableListItem source code](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.UI.Controls/SlidableListItem) diff --git a/docs/controls/StaggeredPanel.md b/docs/controls/StaggeredPanel.md deleted file mode 100644 index 09eaebedbf9..00000000000 --- a/docs/controls/StaggeredPanel.md +++ /dev/null @@ -1,58 +0,0 @@ ---- -title: StaggeredPanel -author: skendrot -description: Arranges child elements into a staggered grid pattern. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, StaggeredPanel ---- - -# StaggeredPanel -The [StaggeredPanel](https://docs.microsoft.com/en-us/dotnet/api/microsoft.toolkit.uwp.ui.controls.staggeredpanel) allows for layout of items in a column approach where an item will be added to whichever column has used the least amount of space. - -## Syntax - -**XAML** - -```xaml - - - - - - - - - - - - -``` - -## Sample Output - -![StaggeredPanel](../resources/images/Controls-StaggeredPanel.jpg "StaggeredPanel") - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| DesiredColumnWidth | double | The desired width of each column. The width of columns can exceed the DesiredColumnWidth if the HorizontalAlignment is set to Stretch. | -| Padding | Thickness | The dimensions of the space between the edge and its child as a Thickness value. Thickness is a structure that stores dimension values using pixel measures. | - -## Sample Code - -[StaggeredPanel Sample Page](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/StaggeredPanel). You can see this in action in the Windows Community Toolkit Sample App. - -## Default Template - -[StaggeredPanel XAML File](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.UI.Controls/StaggeredPanel/StaggeredPanel.xaml) is the XAML template used in the toolkit for the default styling. - -## Requirements - -| [Device family](http://go.microsoft.com/fwlink/p/?LinkID=526370#device-families) | Universal, 10.0.15063.0 or higher | -| -- | -- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Controls | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Controls](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Controls/) | - -## API Source Code - -- [StaggeredPanel](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.UI.Controls/StaggeredPanel) \ No newline at end of file diff --git a/docs/controls/TextToolbar.md b/docs/controls/TextToolbar.md deleted file mode 100644 index 114f9e498c9..00000000000 --- a/docs/controls/TextToolbar.md +++ /dev/null @@ -1,121 +0,0 @@ ---- -title: TextToolbar XAML Control -author: williamabradley -description: The TextToolbar Control is a universal Text Editing Control for the RichEditBox Control. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, TextToolbar, RichEditBox, XAML Control, xaml ---- - -# TextToolbar XAML Control - -The [TextToolbar Control](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.texttoolbar) is a universal Text Editing Control for the [RichEditBox Control](https://docs.microsoft.com/uwp/api/Windows.UI.Xaml.Controls.RichEditBox). It can format with Markdown Formatting, Rich Text Format (RTF) Formatting, and it also allows you to implement your own Formatter, so you can edit Text for any other format using the Toolbar. -It supports Keyboard Shortcuts, Button Toggling for indicating whether a Format is enabled, such as putting the cursor on Bold Text in Rich Text Formatting. -You can also Remove Default Buttons from any format, or Add Custom buttons to any format, without restyling the whole control, or inheriting a Formatter Class. - -## Syntax - -```xaml - - -``` - -## Sample Output - -![TextToolbar](../resources/images/Controls/TextToolbar.png) - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| ButtonModifications | [DefaultButtonModificationList](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.texttoolbarbuttons.defaultbuttonmodificationlist) | Gets or sets a list of Default buttons to remove from the UI | -| ControlKeyDown | bool | Gets a value indicating whether Control is pressed down | -| CustomButtons | [ButtonMap](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.texttoolbarbuttons.buttonmap) | Gets or sets a list of buttons to add to the Default Button set | -| DefaultButtons | [ButtonMap](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.texttoolbarbuttons.buttonmap) | Gets the default buttons for this format | -| Editor | RichEditBox | Gets or sets the RichEditBox to Attach to, this is required for any formatting to work | -| Format | [Format](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.texttoolbarformats.format) | Gets or sets which formatter to use, and which buttons to provide | -| Formatter | [Formatter](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.texttoolbarformats.formatter) | Gets or sets the formatter which is used to format the text from the buttons | -| Labels | [TextToolbarStrings](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.texttoolbarstrings) | Gets or sets the default string Labels | -| LastKeyPress | [VirtualKey](https://docs.microsoft.com/uwp/api/Windows.System.VirtualKey) | Gets the last key pressed using the Editor | -| ShiftKeyDown | bool | Gets a value indicating whether Shift is pressed down | -| UseURIChecker | bool | Gets or sets a value indicating whether to enable use of URI Checker for Link Creator. This allows you to verify Absolute URIs, before creating the Link | - -## Create a Custom Formatter -In order to create your own Formatter, you need to Inherit from the **Formatter** Class. Then on the TextToolbar, Set the `Format` property to `Custom` and then Set the `Formatter` property with your instantiated Custom Formatter. - -When you create the Class, you will need to override the `DefaultButtons` Property. This will allow you to define what buttons you want your Format to display on the **Toolbar**. - -If you want to use a Common Button Template, such as Bold, Italics, etc. You can get those by Instantiating a `CommonButtons` Instance in your Formatter Class, however, you will need to implement the **ButtonActions** Class, and Instantiate it in your Formatter's `ButtonActions` property, or replace the `Action`/`Shift Action` Property on each button you use. - -_See the MarkDownFormatter Class for reference on how to create a Formatter:_ -[MarkDownFormatter Code](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.UI.Controls/TextToolbar/Formats/MarkDown) - -_See the Sample Formatter Class from the Sample App:_ -[SampleFormatter Code](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/TextToolbar/SampleFormatter.cs) - -_Available CommonButtons:_ -[CommonButton Definitions](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.UI.Controls/TextToolbar/ToolbarItems/Common) - -## Examples - -Example of adding Add/Remove Buttons - -**XAML** - -```xaml - - - - - - - - - - -``` - -**C#** - -```csharp -var button = Toolbar.GetDefaultButton(ButtonType.Headers); -button.Visibility = Windows.UI.Xaml.Visibility.Collapsed; -Toolbar.CustomButtons.Add(new ToolbarButton -{ - Name = "CustomButton", - Icon = new SymbolIcon(Symbol.ReportHacked), - Position = 1, - Activation = button => System.Diagnostics.Debug.WriteLine($"{button.Name} Activated"), - ShortcutKey = Windows.System.VirtualKey.H -}); -Toolbar.CustomButtons.Add(new ToolbarSeparator { Position = 2 }); -``` -```vb -Dim button = Toolbar.GetDefaultButton(ButtonType.Headers) -button.Visibility = Windows.UI.Xaml.Visibility.Collapsed -Toolbar.CustomButtons.Add(New ToolbarButton With { - .Name = "CustomButton", - .Icon = New SymbolIcon(Symbol.ReportHacked), - .Position = 1, - .Activation = Sub(btn) Debug.WriteLine($"{btn.Name} Activated"), - .ShortcutKey = Windows.System.VirtualKey.H}) -Toolbar.CustomButtons.Add(New ToolbarSeparator With {.Position = 2}) -``` - -## Sample Code - -[TextToolbar Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/TextToolbar). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| -- | -- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Controls | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Controls](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Controls/) | - -## API - -* [TextToolbar source code](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.UI.Controls/TextToolbar) \ No newline at end of file diff --git a/docs/controls/TileControl.md b/docs/controls/TileControl.md deleted file mode 100644 index 4c260718976..00000000000 --- a/docs/controls/TileControl.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -title: TileControl XAML Control -author: samoteph -description: The Tile Control is a control that repeats an image many times. It enables you to use animation and synchronization with a ScrollViewer to create parallax effect. XAML or Microsoft Composition are automatically used to render the control. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, TileControl, XAML Control, xaml ---- - -# TileControl XAML Control - -The [Tile Control](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.tilecontrol) is a control that repeats an image many times. It enables you to use animation and synchronization with a ScrollViewer to create parallax effect. XAML or Microsoft Composition are automatically used to render the control. - -## Syntax - -```xaml - -``` - -## Sample Output - -![TileControl animation](../resources/images/Controls/TileControl.gif) - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| AnimationDuration | double | Gets or sets a duration for the animation of the tile | -| AnimationStepX | double | Gets or sets the animation step of the OffsetX | -| AnimationStepY | double | Gets or sets the animation step of the OffsetY | -| ImageAlignment | [ImageAlignment](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.imagealignment) | Gets or sets the alignment of the tile when the `ScrollOrientation` is set to Vertical or Horizontal. Valid values are Left or Right for `ScrollOrientation` set to Horizontal and Top or Bottom for `ScrollOrientation` set to Vertical | -| ImageSource | Uri | Gets or sets the uri of the image to load | -| IsAnimated | bool | Gets or sets a value indicating whether the tile is animated or not | -| IsCompositionSupported | bool | Gets a value indicating whether the platform supports Composition | -| OffsetX | double | Gets or sets an X offset of the image | -| OffsetY | double | Gets or sets an Y offset of the image | -| ParallaxSpeedRatio | int | Gets or sets the speed ratio of the parallax effect with the `ScrollViewerContainer` | -| ScrollOrientation | [ScrollOrientation](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.scrollorientation) | Gets or sets the scroll orientation of the tile. Less images are drawn when you choose the Horizontal or Vertical value | -| ScrollViewerContainer | FrameworkElement | Gets or sets a ScrollViewer or a frameworkElement containing a ScrollViewer. The tile control is synchronized with the offset of the scrollviewer | - -## Events - -| Events | Description | -| -- | -- | -| ImageLoaded | The image loaded event | - -## Sample Code - -[TileControl Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/TileControl). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Default Template - -[TileControl XAML File](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.UI.Controls/TileControl/TileControl.xaml) is the XAML template used in the toolkit for the default styling. - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| -- | -- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Controls | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Controls](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Controls/) | - -## API - -* [TileControl source code](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.UI.Controls/TileControl) diff --git a/docs/controls/UniformGrid.md b/docs/controls/UniformGrid.md deleted file mode 100644 index 636e1eff6aa..00000000000 --- a/docs/controls/UniformGrid.md +++ /dev/null @@ -1,195 +0,0 @@ ---- -title: UniformGrid XAML Control -author: michael-hawker -description: The UniformGrid Control presents items in a evenly-spaced set of rows or columns to fill the total available display space. -keywords: windows 10, uwp, uwp community toolkit, uwp toolkit, UniformGrid, xaml control, xaml, grid, layout, responsive ---- - -# UniformGrid XAML Control - -The **UniformGrid Control** is a responsive layout control which arranges items in a evenly-spaced set of rows or columns to fill the total available display space. Each cell in the grid, by default, will be the same size. - -If no value for `Rows` and `Columns` are provided, the UniformGrid will create a square layout based on the total number of visible items. - -If a fixed size is provided for `Rows` and `Columns` then additional children that can't fit in the number of cells provided won't be displayed. - -It differs from the [AdaptiveGridView](https://docs.microsoft.com/en-us/windows/communitytoolkit/controls/adaptivegridview) which dictates -its layout based on item sizes to where as the UniformGrid maintains the specified number of Rows and/or Columns. -In addition, UniformGrid is a `Panel` instead of an `ItemsControl`. As such, it could be used as a Panel in such ItemsControls. - -The UWP UniformGrid now inherits from [Grid](https://docs.microsoft.com/en-us/uwp/api/Windows.UI.Xaml.Controls.Grid) and provides many additional features compared to its predecessor, see more below. - -## WPF Conversion Notes - -When porting your UniformGrid XAML from WPF, just add the `controls:` namespace prefix to your `UniformGrid` and add the `xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"` to your XAML namespace list. - -See further notes below on the additional features the UWP UniformGrid provides compared to the WPF UniformGrid. The behavior of `FirstColumn` has changed slightly, but only in cases where it was previously ignored in WPF. - -## Syntax - -```xaml - - - -``` - -```c# -private void OnInvokeProgress(object sender, GazeProgressEventArgs e) -{ - e.Handled = true; -} -``` - - - - - -## Sample Code - -[GazeInteractionPage](https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/GazeInteraction/). You can see all of this in action in the [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Requirements - -| Device family | Universal,10.0.17134.1 or higher | -| -- | -- | -| Namespace | Microsoft.Toolkit.Uwp.Input.GazeInteraction | -| NuGet package | [NuGet package](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.Input.GazeInteraction/) | - -## API Source Code - -* [Gaze Interaction Library source code](https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.Input.GazeInteraction) - -## Related Topics - -* [Windows 10 Gaze Input APIs](https://docs.microsoft.com/en-us/uwp/api/windows.devices.input.preview) diff --git a/docs/graph/AadLogin.md b/docs/graph/AadLogin.md deleted file mode 100644 index 6a4cdd52fe6..00000000000 --- a/docs/graph/AadLogin.md +++ /dev/null @@ -1,84 +0,0 @@ ---- -title: AadLogin Control -author: OGcanviz -description: The AadLogin Control leverages existing .NET login libraries to support basic AAD sign-in processes for Microsoft Graph. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, AadLogin Control ---- - -# AadLogin Control - -The [AadLogin Control](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.graph.aadlogin) leverages existing .NET login libraries to support basic AAD sign-in processes for Microsoft Graph, it relies on the [MicrosoftGraphService](../services/MicrosoftGraph.md) for authentication. - -## Syntax - -```xaml - - - -``` - -## Example Image - -![AadLogin animation](../resources/images/Graph/AadLogin.png) - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| RequiredDelegatedPermissions | String[] | Gets required delegated permissions for Graph API access | -| DefaultImage | BitmapImage | The default image displayed when no user is signed in | -| View | [ViewType](https://github.com/Microsoft/WindowsCommunityToolkit/blob/master/Microsoft.Toolkit.Uwp.UI.Controls.Graph/ProfileCard/ViewType.cs) | The visual layout of the control. Default is `PictureOnly` | -| AllowSignInAsDifferentUser | Boolean | Whether or not the menu item for `Sign in as a different user` is enabled, default value is true | -| SignInDefaultText | String | Default text for sign in button | -| SignOutDefaultText | String | Default text for sign out button | -| SignInAnotherUserDefaultText | String | Default text for `Sign in with another account` button | -| CurrentUserId | String | Gets the unique identifier for current signed in user | - -## Methods - -| Method | Return Type | Description | -| -- | -- | -- | -| SignInAsync | bool | Method to call when to trigger the user signin. UX of the control is updated if successful. Returns false if the user cancels sign in | -| SignOut | void | Method to call to signout the currently signed on user | - -## Events - -| Method | Type | Description | -| -- | -- | -- | -| SignInCompleted | EventHandler<SignInEventArgs> | Occurs when a user signs in | -| SignInFailed | EventHandler<SignInFailedEventArgs> | Obsolete. Occurs when sign in failed when attempting to sign in. Only fires when an exception occurs during the sign in process and not when the user cancels sign in. | -| SignOutCompleted | EventHandler | Occurs when the user clicks on SignOut, or the SignOut() method is called. Developers should clear any cached usage of GraphServiceClient objects they receive this event | - -## Sample Code - -First of all, initialize the [MicrosoftGraphService](../services/MicrosoftGraph.md) with your [Azure AD v2.0 app](https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-v2-app-registration), this should be done globally with the combined and unique [delegate permissions](https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-v2-scopes) required by all Graph controls and services used in your app. - -```c# -MicrosoftGraphService.Instance.AuthenticationModel = MicrosoftGraphEnums.AuthenticationModel.V2; - -MicrosoftGraphService.Instance.Initialize( - "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - MicrosoftGraphEnums.ServicesToInitialize.UserProfile, - AadLogin.RequiredDelegatedPermissions -); -``` - -[AadLogin Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/AadLogin). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Default Template - -[AadLogin XAML File](https://github.com/Microsoft/WindowsCommunityToolkit/blob/master/Microsoft.Toolkit.Uwp.UI.Controls.Graph/AadLogin/AadLogin.xaml) is the XAML template used in the toolkit for the default styling. - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| -- | -- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Controls.Graph | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Controls.Graph](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Controls.Graph/) | - -## API - -* [AadLogin source code](https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls.Graph/AadLogin) diff --git a/docs/graph/PeoplePicker.md b/docs/graph/PeoplePicker.md deleted file mode 100644 index dc4777ee7fd..00000000000 --- a/docs/graph/PeoplePicker.md +++ /dev/null @@ -1,72 +0,0 @@ ---- -title: PeoplePicker Control -author: OGcanviz -description: The PeoplePicker Control is a simple control that allows for selection of one or more users from an organizational AD. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, PeoplePicker Control ---- - -# PeoplePicker Control - -The [PeoplePicker Control](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.graph.peoplepicker) is a simple control that allows for selection of one or more users from an organizational AD, see more details [here](https://developer.microsoft.com/en-us/graph/docs/concepts/people_example), it relies on the [MicrosoftGraphService](../services/MicrosoftGraph.md) for authentication. - -## Syntax - -```xaml - - - -``` - -## Example Image - -![PeoplePicker animation](../resources/images/Graph/PeoplePicker.png) - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| RequiredDelegatedPermissions | String[] | Gets required delegated permissions for Graph API access | -| GroupId | String | Search people in this group if specified, otherwise, search the organizational AD | -| AllowMultiple | Boolean | Whether multiple people can be selected | -| SearchResultLimit | Int | Max person returned in the search results | -| PlaceholderText | String | Text to be displayed when no user is selected | -| Selections | ObservableCollection | The selected person list | - -## Sample Code - -First of all, initialize the [MicrosoftGraphService](../services/MicrosoftGraph.md) with your [Azure AD v2.0 app](https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-v2-app-registration), this should be done globally with the combined and unique [delegate permissions](https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-v2-scopes) required by all Graph controls and services used in your app. - -```c# -MicrosoftGraphService.Instance.AuthenticationModel = MicrosoftGraphEnums.AuthenticationModel.V2; - -MicrosoftGraphService.Instance.Initialize( - "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - MicrosoftGraphEnums.ServicesToInitialize.UserProfile, - PeoplePicker.RequiredDelegatedPermissions -); -``` - -The sign in will be processed by the [AadLogin](AadLogin.md) control, however, you could do sign in with the following alternatively. - -```c# -await MicrosoftGraphService.Instance.LoginAsync(); -``` - -[PeoplePicker Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/PeoplePicker). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Default Template - -[PeoplePicker XAML File](https://github.com/Microsoft/WindowsCommunityToolkit/blob/master/Microsoft.Toolkit.Uwp.UI.Controls.Graph/PeoplePicker/PeoplePicker.xaml) is the XAML template used in the toolkit for the default styling. - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| -- | -- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Controls.Graph | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Controls.Graph](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Controls.Graph/) | - -## API - -* [PeoplePicker source code](https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls.Graph/PeoplePicker) diff --git a/docs/graph/PlannerTaskList.md b/docs/graph/PlannerTaskList.md deleted file mode 100644 index 64e0890c3af..00000000000 --- a/docs/graph/PlannerTaskList.md +++ /dev/null @@ -1,74 +0,0 @@ ---- -title: PlannerTaskList Control -author: OGcanviz -description: The PlannerTaskList Control displays a simple list of Planner tasks. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, PlannerTaskList Control ---- - -# PlannerTaskList Control - -The [PlannerTaskList Control](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.graph.plannertasklist) displays a simple list of Planner tasks, it relies on the [MicrosoftGraphService](../services/MicrosoftGraph.md) for authentication. - -## Syntax - -```xaml - - - -``` - -## Example Image - -![PlannerTaskList animation](../resources/images/Graph/PlannerTaskList.png) - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| RequiredDelegatedPermissions | String[] | Gets required delegated permissions for Graph API access | -| PlanId | String | Gets or sets Id of Planner Plan to Display, this is optional. | -| DisplayPlanList | Boolean | Gets or sets a value indicating whether show plan list or not | -| DisplayBucketList | Boolean | Gets or sets a value indicating whether show bucket list or not | -| AllTasksLabel | String | Gets or sets label of all tasks | -| ClosedTasksLabel | String | Gets or sets label of closed tasks | - -## Sample Code - -First of all, initialize the [MicrosoftGraphService](../services/MicrosoftGraph.md) with your [Azure AD v2.0 app](https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-v2-app-registration), this should be done globally with the combined and unique [delegate permissions](https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-v2-scopes) required by all Graph controls and services used in your app. - -> Note: The permission `Group.ReadWrite.All` used in this control requires [admin consent](https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-v2-scopes#request-the-permissions-from-a-directory-admin), which could be done by opening URL like this in browser and sign in with your organization's admin. -> `https://login.microsoftonline.com/common/adminconsent?client_id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&state=12345` - -```c# -MicrosoftGraphService.Instance.AuthenticationModel = MicrosoftGraphEnums.AuthenticationModel.V2; - -MicrosoftGraphService.Instance.Initialize( - "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - MicrosoftGraphEnums.ServicesToInitialize.UserProfile, - PlannerTaskList.RequiredDelegatedPermissions -); -``` - -The sign in will be processed by the [AadLogin](AadLogin.md) control, however, you could do sign in with the following alternatively. - -```c# -await MicrosoftGraphService.Instance.LoginAsync(); -``` - -[PlannerTaskList Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/PlannerTaskList). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Default Template - -[PlannerTaskList XAML File](https://github.com/Microsoft/WindowsCommunityToolkit/blob/master/Microsoft.Toolkit.Uwp.UI.Controls.Graph/PlannerTaskList/PlannerTaskList.xaml) is the XAML template used in the toolkit for the default styling. - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| -- | -- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Controls.Graph | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Controls.Graph](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Controls.Graph/) | - -## API - -* [PlannerTaskList source code](https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls.Graph/PlannerTaskList) diff --git a/docs/graph/PowerBIEmbedded.md b/docs/graph/PowerBIEmbedded.md deleted file mode 100644 index 46e81a0d077..00000000000 --- a/docs/graph/PowerBIEmbedded.md +++ /dev/null @@ -1,88 +0,0 @@ ---- -title: PowerBIEmbedded Control -author: OGcanviz -description: The PowerBIEmbedded control is a simple wrapper to an IFRAME for a PowerBI embed. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, PowerBIEmbedded Control ---- - -# PowerBIEmbedded Control - -The [PowerBIEmbedded Control](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.graph.powerbiembedded) is a simple wrapper to an IFRAME for a PowerBI embed. - -## Syntax - -```xaml - - - -``` - -## Example Image - -![PowerBIEmbedded animation](../resources/images/Graph/PowerBIEmbedded.png) - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| ClientId | String | Gets or sets the client id of Azure AD app registration (v1) | -| GroupId | String | Gets or sets the identifier of a Group. Optional when EmbedUrl is specified, if this is used, a dropdown will appear that lets users select amongst different reports in a Group | -| EmbedUrl | String | Gets or sets the Url of the embed, optional when GroupId is specified | -| ShowFilter | Boolean | Gets or sets a value indicating whether show the filter pane | - -## Integration - -1. Follow the -[MicrosoftGraphService](../services/MicrosoftGraph.md#register-the-app-to-use-azure-ad-v1-endpoint) to create Azure AD app registration (v1), and grant the permissions below. - - * Microsoft Graph - - Sign in and read user profile - - Read all users' basic profiles - - Sign users in - - * Windows Azure Active Directory - - Sign in and read user profile - - * Power BI Service (Microsoft.Azure.AnalysisServices) - - - View all datapools - - View users Groups - - View all Groups - - View all Reports - - View all Datasets - - View all Dashboards - - View all workspaces - ![PowerBIEmbedded Permissions](../resources/images/Graph/PowerBIEmbedded-Permissions.png) - - -2. Follow this [article](https://docs.microsoft.com/en-us/power-bi/developer/embedding-content) to do the primary tasks below. - - * Create Power BI Pro user account - * Create app workspaces - * Create Power BI Embedded capacity - * Create and publish reports - - -3. For better report experience in mobile, that's recommended to [design phone layout for mobile portrait view in PowerBI desktop](https://docs.microsoft.com/en-us/power-bi/desktop-create-phone-report). - -## Sample Code - -[PowerBIEmbedded Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/PowerBIEmbedded). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Default Template - -[PowerBIEmbedded XAML File](https://github.com/Microsoft/WindowsCommunityToolkit/blob/master/Microsoft.Toolkit.Uwp.UI.Controls.Graph/PowerBIEmbedded/PowerBIEmbedded.xaml) is the XAML template used in the toolkit for the default styling. - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| -- | -- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Controls.Graph | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Controls.Graph](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Controls.Graph/) | - -## API - -* [PowerBIEmbedded source code](https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls.Graph/PowerBIEmbedded) diff --git a/docs/graph/ProfileCard.md b/docs/graph/ProfileCard.md deleted file mode 100644 index fb7e9c2dade..00000000000 --- a/docs/graph/ProfileCard.md +++ /dev/null @@ -1,74 +0,0 @@ ---- -title: ProfileCard Control -author: OGcanviz -description: The ProfileCard Control is a simple way to display a user in multiple different formats and mixes of name/image/e-mail. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, ProfileCard Control ---- - -# ProfileCard Control - -The [ProfileCard Control](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.graph.profilecard) is a simple way to display a user in multiple different formats and mixes of name/image/e-mail, it relies on the [MicrosoftGraphService](../services/MicrosoftGraph.md) for authentication. - -## Syntax - -```xaml - - - -``` - -## Example Image - -![ProfileCard animation](../resources/images/Graph/ProfileCard.png) - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| RequiredDelegatedPermissions | String[] | Gets required delegated permissions for Graph API access | -| UserId | String | Identifier of the user being displayed, this user id can come from the Graph APIs like `/me/people`, `/users`, etc. | -| DisplayMode | [ViewType](https://github.com/Microsoft/WindowsCommunityToolkit/blob/master/Microsoft.Toolkit.Uwp.UI.Controls.Graph/ProfileCard/ViewType.cs) | The visual layout of the control. Default is `PictureOnly` | -| DefaultImage | BitmapImage | The default image displayed when no user is signed in | -| LargeProfileTitleDefaultText | String | Default title text in LargeProfilePhotoLeft mode or LargeProfilePhotoRight mode when no user is signed in | -| LargeProfileMailDefaultText | String | Default secondary mail text in LargeProfilePhotoLeft mode or LargeProfilePhotoRight mode when no user is signed in | -| NormalMailDefaultText | String | Default mail text in EmailOnly mode when no user is signed in | - -## Sample Code - -First of all, initialize the [MicrosoftGraphService](../services/MicrosoftGraph.md) with your [Azure AD v2.0 app](https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-v2-app-registration), this should be done globally with the combined and unique [delegate permissions](https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-v2-scopes) required by all Graph controls and services used in your app. - -```c# -MicrosoftGraphService.Instance.AuthenticationModel = MicrosoftGraphEnums.AuthenticationModel.V2; - -MicrosoftGraphService.Instance.Initialize( - "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - MicrosoftGraphEnums.ServicesToInitialize.UserProfile, - ProfileCard.RequiredDelegatedPermissions -); -``` - -The sign in will be processed by the [AadLogin](AadLogin.md) control, however, you could do sign in with the following alternatively. - -```c# -await MicrosoftGraphService.Instance.LoginAsync(); -``` - -[ProfileCard Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/ProfileCard). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Default Template - -[ProfileCard XAML File](https://github.com/Microsoft/WindowsCommunityToolkit/blob/master/Microsoft.Toolkit.Uwp.UI.Controls.Graph/ProfileCard/ProfileCard.xaml) is the XAML template used in the toolkit for the default styling. - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| -- | -- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Controls.Graph | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Controls.Graph](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Controls.Graph/) | - -## API - -* [ProfileCard source code](https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls.Graph/ProfileCard) diff --git a/docs/graph/SharePointFileList.md b/docs/graph/SharePointFileList.md deleted file mode 100644 index 49ab8877dc3..00000000000 --- a/docs/graph/SharePointFileList.md +++ /dev/null @@ -1,89 +0,0 @@ ---- -title: SharePointFileList Control -author: OGcanviz -description: The SharePointFileList Control displays a simple list of SharePoint Files. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, SharePointFileList Control ---- - -# SharePointFileList Control - -The [SharePointFileList Control](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.controls.graph.sharepointfilelist) displays a simple list of SharePoint Files, it relies on the [MicrosoftGraphService](../services/MicrosoftGraph.md) for authentication. - -## Syntax - -```xaml - - - -``` - -## Example Image - -![SharePointFileList animation](../resources/images/Graph/SharePointFileList.png) - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| RequiredDelegatedPermissions | String[] | Gets required delegated permissions for Graph API access | -| DriveUrl | String | Full URL of the Drive being displayed | -| DetailPane | [DetailPaneDisplayMode](https://github.com/Microsoft/WindowsCommunityToolkit/blob/master/Microsoft.Toolkit.Uwp.UI.Controls.Graph/SharePointFileList/DetailPaneDisplayMode.cs) | Determines whether file details are displayed, when a file is selected | -| PageSize | Int | Page size of each request | -| ShareLinkCopiedMessage | String | The message when share link copied | -| AllFilesMessage | String | The label of All Files | -| DeleteConfirmMessage | String | The message of delete confirm dialog | -| DeleteConfirmOkMessage | String | The caption of ok button in delete confirm dialog | -| DeleteConfirmCancelMessage | String | The caption of cancel button in delete confirm dialog | -| UploadingFilesMessageTemplate | String | The template of uploading files | - -## Methods - -| Method | Return Type | Description | -| -- | -- | -- | -| GetDriveUrlFromSharePointUrlAsync | String | Retrieves an appropriate Drive URL from a SharePoint document library root URL | - -## Events - -| Event | Return Type | Description | -| -- | -- | -- | -| FileSelected | EventHandler<FileSelectedEventArgs> | Occurs when one of the menu items in the control is clicked | - -## Sample Code - -First of all, initialize the [MicrosoftGraphService](../services/MicrosoftGraph.md) with your [Azure AD v2.0 app](https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-v2-app-registration), this should be done globally with the combined and unique [delegate permissions](https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-v2-scopes) required by all Graph controls and services used in your app. - -```c# -MicrosoftGraphService.Instance.AuthenticationModel = MicrosoftGraphEnums.AuthenticationModel.V2; - -MicrosoftGraphService.Instance.Initialize( - "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - MicrosoftGraphEnums.ServicesToInitialize.UserProfile, - SharePointFileList.RequiredDelegatedPermissions -); -``` - -The sign in will be processed by the [AadLogin](AadLogin.md) control, however, you could do sign in with the following alternatively. - -```c# -await MicrosoftGraphService.Instance.LoginAsync(); -``` - -[SharePointFileList Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/SharePointFileList). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Default Template - -[SharePointFileList XAML File](https://github.com/Microsoft/WindowsCommunityToolkit/blob/master/Microsoft.Toolkit.Uwp.UI.Controls.Graph/SharePointFileList/SharePointFileList.xaml) is the XAML template used in the toolkit for the default styling. - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| -- | -- | -| Namespace | Microsoft.Toolkit.Uwp.UI.Controls.Graph | -| NuGet package | [Microsoft.Toolkit.Uwp.UI.Controls.Graph](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Controls.Graph/) | - -## API - -* [SharePointFileList source code](https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls.Graph/SharePointFileList) diff --git a/docs/helpers/AdvancedCollectionView.md b/docs/helpers/AdvancedCollectionView.md deleted file mode 100644 index dda9f73bb43..00000000000 --- a/docs/helpers/AdvancedCollectionView.md +++ /dev/null @@ -1,217 +0,0 @@ ---- -title: AdvancedCollectionView -author: nmetulev -description: The AdvancedCollectionView is a collection view implementation that support filtering, sorting and incremental loading. It's meant to be used in a viewmodel. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, AdvancedCollectionView -dev_langs: - - csharp - - vb ---- - -# AdvancedCollectionView - -The [AdvancedCollectionView](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.advancedcollectionview) is a collection view implementation that support filtering, sorting and incremental loading. It's meant to be used in a viewmodel. - -## Usage - -In your viewmodel instead of having a public [IEnumerable](https://docs.microsoft.com/dotnet/core/api/system.collections.generic.ienumerable-1) of some sort to be bound to an eg. [Listview](https://docs.microsoft.com/uwp/api/Windows.UI.Xaml.Controls.ListView), create a public AdvancedCollectionView and pass your list in the constructor to it. If you've done that you can use the many useful features it provides: - -* sorting your list using the `SortDirection` helper: specify any number of property names to sort on with the direction desired -* filtering your list using a [Predicate](https://docs.microsoft.com/dotnet/core/api/system.predicate-1): this will automatically filter your list only to the items that pass the check by the predicate provided -* deferring notifications using the `NotificationDeferrer` helper: with a convenient _using_ pattern you can increase performance while doing large-scale modifications in your list by waiting with updates until you've completed your work -* incremental loading: if your source collection supports the feature then AdvancedCollectionView will do as well (it simply forwards the calls) -* live shaping: when constructing the `AdvancedCollectionView` you may specify that the collection use live shaping. This means that the collection will re-filter or re-sort if there are changes to the sort properties or filter properties that are specified using `ObserveFilterProperty` - -## Example - -```csharp -using Microsoft.Toolkit.Uwp.UI; - -// Grab a sample type -public class Person -{ - public string Name { get; set; } -} - -// Set up the original list with a few sample items -var oc = new ObservableCollection -{ - new Person { Name = "Staff" }, - new Person { Name = "42" }, - new Person { Name = "Swan" }, - new Person { Name = "Orchid" }, - new Person { Name = "15" }, - new Person { Name = "Flame" }, - new Person { Name = "16" }, - new Person { Name = "Arrow" }, - new Person { Name = "Tempest" }, - new Person { Name = "23" }, - new Person { Name = "Pearl" }, - new Person { Name = "Hydra" }, - new Person { Name = "Lamp Post" }, - new Person { Name = "4" }, - new Person { Name = "Looking Glass" }, - new Person { Name = "8" }, -}; - -// Set up the AdvancedCollectionView with live shaping enabled to filter and sort the original list -var acv = new AdvancedCollectionView(oc, true); - -// Let's filter out the integers -int nul; -acv.Filter = x => !int.TryParse(((Person)x).Name, out nul); - -// And sort ascending by the property "Name" -acv.SortDescriptions.Add(new SortDescription("Name", SortDirection.Ascending)); - -// Let's add a Person to the observable collection -var person = new Person { Name = "Aardvark" }; -oc.Add(person); - -// Our added person is now at the top of the list, but if we rename this person, we can trigger a re-sort -person.Name = "Zaphod"; // Now a re-sort is triggered and person will be last in the list - -// AdvancedCollectionView can be bound to anything that uses collections. -YourListView.ItemsSource = acv; -``` -```vb -Imports Microsoft.Toolkit.Uwp.UI - -' Grab a sample type -Public Class Person - Public Property Name As String -End Class - -' Set up the original list with a few sample items -Dim oc = New ObservableCollection(Of Person) From { - New Person With {.Name = "Staff"}, - New Person With {.Name = "42"}, - New Person With {.Name = "Swan"}, - New Person With {.Name = "Orchid"}, - New Person With {.Name = "15"}, - New Person With {.Name = "Flame"}, - New Person With {.Name = "16"}, - New Person With {.Name = "Arrow"}, - New Person With {.Name = "Tempest"}, - New Person With {.Name = "23"}, - New Person With {.Name = "Pearl"}, - New Person With {.Name = "Hydra"}, - New Person With {.Name = "Lamp Post"}, - New Person With {.Name = "4"}, - New Person With {.Name = "Looking Glass"}, - New Person With {.Name = "8"} -} - -' Set up the AdvancedCollectionView with live shaping enabled to filter and sort the original list -Dim acv = New AdvancedCollectionView(oc, True) - -' Let's filter out the integers -Dim nul As Integer -acv.Filter = Function(x) Not Integer.TryParse((CType(x, Person)).Name, nul) - -' And sort ascending by the property "Name" -acv.SortDescriptions.Add(New SortDescription("Name", SortDirection.Ascending)) - -' Let's add a Person to the observable collection -Dim person = New Person With {.Name = "Aardvark"} -oc.Add(person) - -' Our added person is now at the top of the list, but if we rename this person, we can trigger a re-sort -person.Name = "Zaphod" ' Now a re-sort is triggered and person will be last in the list - -' AdvancedCollectionView can be bound to anything that uses collections. -YourListView.ItemsSource = acv -``` - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| CanFilter | bool | Gets a value indicating whether this CollectionView can filter its items | -| CanSort | bool | Gets a value indicating whether this CollectionView can sort its items | -| CollectionGroups | IObservableVector | Gets the groups in collection | -| Count | int | Get the count of items | -| CurrentItem | object | Gets or sets the current item | -| CurrentPosition | int | Gets the position of current item | -| Filter | Predicate | Gets or sets the predicate used to filter the visible items | -| HasMoreItems | bool | Gets a value indicating whether the source has more items | -| IsCurrentAfterLast | bool | Gets a value indicating whether the current item is after the last visible item | -| IsCurrentBeforeFirst | bool | Gets a value indicating whether the current item is before the first visible item | -| IsReadOnly | bool | Get a value indicating whether this CollectionView is read only | -| SortDescriptions | IList<[SortDescription](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.sortdescription)> | Gets SortDescriptions to sort the visible items | -| Source | IEnumerable | Gets or sets the source | -| SourceCollection | IEnumerable | Gets the source collection | -| this[int] | int | Gets or sets the element at the specified index | - -## Methods - -| Methods | Return Type | Description | -| -- | -- | -- | -| Add(Object) | void | Add item | -| Clear() | void | Clear item | -| Contains(Object) | bool | Returns `true` if the given item contained in CollectionView | -| B(float, string) | int | Description | -| DeferRefresh() | IDisposable | Stops refreshing until it is disposed | -| IndexOf(Object) | int | Return index of an item | -| Insert(Int32, Object) | void | Insert an item in a particular place | -| LoadMoreItemsAsync(UInt32) | IAsyncOperation<[LoadMoreItemsResult](https://docs.microsoft.com/uwp/api/Windows.UI.Xaml.Data.LoadMoreItemsResult)> | Load more items from the source | -| MoveCurrentTo(Object) | bool | Move current index to item. Returns success of operation | -| MoveCurrentToFirst() | bool | Move current item to first item. Returns success of operation | -| MoveCurrentToLast() | bool | Move current item to last item. Returns success of operation | -| MoveCurrentToNext() | bool | Move current item to next item | -| MoveCurrentToPosition(Int32) | bool | Moves selected item to position | -| MoveCurrentToPrevious() | bool | Move current item to previous item | -| Refresh() | void | Manually refresh the view | -| Remove(Object) | bool | Remove item | -| RemoveAt(Int32) | bool | Remove item with index | - -## Events - -| Events | Description | -| -- | -- | -| CurrentChanged | Current item changed event handler | -| CurrentChanging | Current item changing event handler | -| PropertyChanged | Occurs when a property value changes | -| VectorChanged | Occurs when the vector changes | - -## Remarks - -_What source can I use?_ - -It's not necessary to use an eg. [ObservableCollection](https://docs.microsoft.com/dotnet/core/api/system.collections.objectmodel.observablecollection-1) to use the AdvancedCollectionView. It works as expected even when providing a simple [List](https://docs.microsoft.com/dotnet/core/api/system.collections.generic.list-1) in the constructor. - -_Any performance guidelines?_ - -If you're removing, modifying or inserting large amounts of items while having filtering and/or sorting set up, it's recommended that you use the `NotificationDeferrer` helper provided. It skips any performance heavy logic while it's in use, and automatically calls the `Refresh` method when disposed. - -```csharp -using (acv.DeferRefresh()) -{ - for (var i = 0; i < 500; i++) - { - acv.Add(new Person { Name = "defer" }); - } -} // acv.Refresh() gets called here -``` -```vb -Using acv.DeferRefresh() - For i = 0 To 500 - 1 - acv.Add(New Person With {.Name = "defer"}) - Next -End Using ' acv.Refresh() gets called here -``` - -## Sample Code - -[AdvancedCollectionView sample page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/AdvancedCollectionView). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| --- | --- | -| Namespace | Microsoft.Toolkit.Uwp.UI | -| NuGet package | [Microsoft.Toolkit.Uwp.UI](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI/) | - -## API - -* [AdvancedCollectionView source code](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.UI/AdvancedCollectionView) diff --git a/docs/helpers/BackgroundTaskHelper.md b/docs/helpers/BackgroundTaskHelper.md deleted file mode 100644 index 432edc55583..00000000000 --- a/docs/helpers/BackgroundTaskHelper.md +++ /dev/null @@ -1,187 +0,0 @@ ---- -title: Background Task Helper -author: nmetulev -description: The Background Task Helper helps users interact with background tasks in an easier manner. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, Background Task Helper -dev_langs: - - csharp - - vb ---- - -# Background Task Helper - -The [Background Task Helper](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.helpers.backgroundtaskhelper) helps users interact with background tasks in an easier manner. - -## Syntax - -```csharp -using Microsoft.Toolkit.Uwp; - -BackgroundTaskRegistration registered = BackgroundTaskHelper.Register(typeof(BackgroundTaskClass), new TimeTrigger(15, true)); -BackgroundTaskRegistration registered = BackgroundTaskHelper.Register("TaskName", "TaskEntryPoint", new TimeTrigger(15, true)); -``` -```vb -Imports Microsoft.Toolkit.Uwp - -Dim registered As BackgroundTaskRegistration = BackgroundTaskHelper.Register(GetType(BackgroundTaskClass), New TimeTrigger(15, True)) -Dim registered As BackgroundTaskRegistration = BackgroundTaskHelper.Register("TaskName", "TaskEntryPoint", New TimeTrigger(15, True)) -``` - -## Methods - -| Methods | Return Type | Description | -| -- | -- | -- | -| GetBackgroundTask(String) | [IBackgroundTaskRegistration](https://docs.microsoft.com/uwp/api/Windows.ApplicationModel.Background.IBackgroundTaskRegistration) | Get the registered background task of the given type | -| GetBackgroundTask(Type) | IBackgroundTaskRegistration | Get the registered background task of the given type | -| IsBackgroundTaskRegistered(String) | bool | Check if a background task is registered | -| IsBackgroundTaskRegistered(Type) | bool | Check if a background task is registered | -| Register(String, IBackgroundTrigger, Boolean, Boolean, IBackgroundCondition[]) | [BackgroundTaskRegistration](https://docs.microsoft.com/uwp/api/Windows.ApplicationModel.Background.BackgroundTaskRegistration) | Registers under the Single Process Model | -| Register(Type, IBackgroundTrigger, Boolean, Boolean, IBackgroundCondition[]) | BackgroundTaskRegistration | Register a background task with conditions | -| Register(String, String, IBackgroundTrigger, Boolean, Boolean, IBackgroundCondition[]) | BackgroundTaskRegistration | Register a background task with conditions | -| Unregister(String, Boolean) | void | Unregister a background task | -| Unregister(Type, Boolean) | void | Unregister a background task | -| Unregister(IBackgroundTaskRegistration, Boolean) | void | Unregister a background task | - -## Example - -### Using Multi-Process Model - -Using MPM (Multi-Process Model) is the classic way of using Background Task. - -To make it work, you will need : - -* To create Background Tasks in a Windows Runtime Component -* To register the Background Tasks in the package manifest (appxmanifest file) - -Once it is done, you can register your Background Tasks. - -```csharp -// Be sure to include the using at the top of the file: -using Microsoft.Toolkit.Uwp; -using Windows.ApplicationModel.Background; - -// Register a normal, seperate process, background task -BackgroundTaskRegistration registered = BackgroundTaskHelper.Register("TaskName", "TaskEntryPoint", new TimeTrigger(15, true)); - -// This can also be written using the overload of Register with Type parameter. -BackgroundTaskRegistration registered = BackgroundTaskHelper.Register(typeof(BackgroundTaskClass), new TimeTrigger(15, true)); - -// With condition -BackgroundTaskRegistration registered = - BackgroundTaskHelper.Register(typeof(BackgroundTaskClass), - new TimeTrigger(15, true), - false, true, - new SystemCondition(SystemConditionType.InternetAvailable)); - -// 2 or more conditions -BackgroundTaskRegistration registered = - BackgroundTaskHelper.Register(typeof(BackgroundTaskClass), - new TimeTrigger(15, true), - false, true, - new SystemCondition(SystemConditionType.InternetAvailable), - new SystemCondition(SystemConditionType.UserPresent)); -``` -```vb -' Be sure to include the Imports at the top of the file: -Imports Microsoft.Toolkit.Uwp -Imports Windows.ApplicationModel.Background - -' Register a normal, seperate process, background task -Dim registered As BackgroundTaskRegistration = BackgroundTaskHelper.Register("TaskName", "TaskEntryPoint", New TimeTrigger(15, True)) - -' This can also be written using the overload of Register with Type parameter. -Dim registered As BackgroundTaskRegistration = BackgroundTaskHelper.Register(GetType(BackgroundTaskClass), New TimeTrigger(15, True)) - -' With condition -Dim registered As BackgroundTaskRegistration = BackgroundTaskHelper.Register(GetType(BackgroundTaskClass), - New TimeTrigger(15, True), - False, - True, - New SystemCondition(SystemConditionType.InternetAvailable)) - -' 2 or more conditions -Dim registered As BackgroundTaskRegistration = BackgroundTaskHelper.Register(GetType(BackgroundTaskClass), - New TimeTrigger(15, True), - False, - True, - New SystemCondition(SystemConditionType.InternetAvailable), - New SystemCondition(SystemConditionType.UserPresent)) -``` - -### Using Single-Process Model - -Using SPM (Single-Process Model) is the new and simple way of using Background Task. -It is required to target Anniversary Update (SDK 14393) or later. - -Using SPM, you can declare your Background Tasks inside your own project, no need to create a Windows Runtime Component. -Moreover, it is no longer required to register the Background Tasks in the package manifest (appxmanifest file). - -Once you have created the Background Task, you can register it by calling the `Register` method. - -```csharp -// Be sure to include the using at the top of the file: -using Microsoft.Toolkit.Uwp; -using Windows.ApplicationModel.Background; - -// Register a single process background task (Anniversary Update and later ONLY) -BackgroundTaskRegistration registered = BackgroundTaskHelper.Register("Name of the Background Task", new TimeTrigger(15, true)); -``` -```vb -' Be sure to include the imports at the top of the file: -Imports Microsoft.Toolkit.Uwp -Imports Windows.ApplicationModel.Background - -' Register a single process background task (Anniversary Update and later ONLY) -Dim registered As BackgroundTaskRegistration = BackgroundTaskHelper.Register("Name of the Background Task", New TimeTrigger(15, True)) -``` - -The other difference between SPM and MPM is that in SPM, you have to handle your Background Tasks inside the `OnBackgroundActivated` event of `App.xaml.cs` class. -Here is an example of how to handle Background Tasks in SPM. - -```csharp -// Event fired when a Background Task is activated (in Single Process Model) -protected override void OnBackgroundActivated(BackgroundActivatedEventArgs args) -{ - base.OnBackgroundActivated(args); - - var deferral = args.TaskInstance.GetDeferral(); - - switch (args.TaskInstance.Task.Name) - { - case "Name of the Background Task": - new TestBackgroundTask().Run(args.TaskInstance); - break; - } - - deferral.Complete(); -} -``` -```vb -Protected Overrides Sub OnBackgroundActivated(ByVal args As BackgroundActivatedEventArgs) - MyBase.OnBackgroundActivated(args) - - Dim deferral = args.TaskInstance.GetDeferral() - - Select Case args.TaskInstance.Task.Name - Case "Name of the Background Task" - New TestBackgroundTask().Run(args.TaskInstance) - End Select - - deferral.Complete() -End Sub -``` - -## Sample Code - -[Background Task Helper](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/BackgroundTaskHelper). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| --- | --- | -| Namespace | Microsoft.Toolkit.Uwp | -| NuGet package | [Microsoft.Toolkit.Uwp](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp/) | - -## API - -* [Background Task source code](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp/Helpers/BackgroundTaskHelper.cs) diff --git a/docs/helpers/BindableValueHolder.md b/docs/helpers/BindableValueHolder.md deleted file mode 100644 index b5fa4b79eec..00000000000 --- a/docs/helpers/BindableValueHolder.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -title: BindableValueHolder -author: nmetulev -description: The BindableValueHolder lets users change several objects' states at a time. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, BindableValueHolder ---- - -# BindableValueHolder - -The [BindableValueHolder](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.helpers.bindablevalueholder) lets users change several objects' states at a time. - -## Syntax - -```xaml - -``` - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| Value | object | Gets or sets the held value | - -## Example - -You can use it to switch several object states by declaring it as a Resource (either in a page or control): - -```xaml - -``` - -and using it like that: - -```xaml - - - -``` - -and switching it like that: - -```xaml - - - - - - - - - -``` - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| --- | --- | -| Namespace | Microsoft.Toolkit.Uwp.UI | -| NuGet package | [Microsoft.Toolkit.Uwp.UI](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI/) | - -## API - -* [BindableValueHolder source code](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.UI/Helpers/BindableValueHolder.cs) \ No newline at end of file diff --git a/docs/helpers/BluetoothLEHelper.md b/docs/helpers/BluetoothLEHelper.md deleted file mode 100644 index 27025cc1d77..00000000000 --- a/docs/helpers/BluetoothLEHelper.md +++ /dev/null @@ -1,162 +0,0 @@ ---- -title: BluetoothLEHelper -author: nmetulev -description: The BluetoothLEHelper class provides functionality to easily enumerate, connect to and interact with Bluetooth LE Peripherals. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, BluetoothLEHelper, bluetooth le, bluetooth -dev_langs: - - csharp - - vb ---- - -# BluetoothLEHelper - -The BluetoothLEHelper class provides functionality to easily enumerate, connect to and interact with Bluetooth LE Peripherals. - -## BluetoothLEHelper class - -### Properties - -| Property | Type | Description | -| -- | -- | -- | -| BluetoothLeDevices | ObservableCollection | Gets the list of available bluetooth devices | -| IsEnumerating | bool | Gets a value indicating whether app is currently enumerating | -| IsPeripheralRoleSupported | bool | Gets a value indicating whether peripheral mode is supported by this device | -| IsCentralRoleSupported | bool | Gets a value indicating whether central role is supported by this device | - -### Methods - -| Methods | Return Type | Description | -| -- | -- | -- | -| StartEnumeration() | void | Starts enumeration of bluetooth le devices | -| StopEnumeration() | void | Stops enumeration of bluetooth device | - -### Events - -| Events | Description | -| -- | -- | -| EnumerationCompleted | An event for when the enumeration is complete | - -## ObservableBluetoothLEDevice class - -### Properties - -| Property | Type | Description | -| -- | -- | -- | -| BluetoothAddressAsString | string | Gets the bluetooth address of this device as a string | -| BluetoothAddressAsUlong | ulong | Gets the bluetooth address of this device | -| BluetoothLEDevice | BluetoothLEDevice | Gets the base bluetooth device this class wraps | -| DeviceInfo | [DeviceInformation](https://docs.microsoft.com/uwp/api/Windows.Devices.Enumeration.DeviceInformation) | Gets the device information for the device this class wraps | -| ErrorText | string | Gets the error text when connecting to this device fails | -| Glyph | BitmapImage | Gets or sets the glyph of this bluetooth device | -| IsConnected | bool | Gets a value indicating whether this device is connected | -| IsPaired | bool | Gets a value indicating whether this device is paired | -| Name | string | Gets the name of this device | -| RSSI | int | Gets the RSSI value of this device | -| Services | ObservableCollection | Gets the services this device supports | -| ServiceCount | int | Gets or sets the number of services this device has | - -### Methods - -| Methods | Return Type | Description | -| -- | -- | -- | -| ConnectAsync() | Task | ConnectAsync to this bluetooth device | -| DoInAppPairingAsync() | Task | Does the in application pairing | -| UpdateAsync(DeviceInformationUpdate) | Task | Updates this device's deviceInformation | -| ToString() | string | Overrides the ToString function to return the name of the device | - -## ObservableGattDeviceService - -### Properties - -| Property | Type | Description | -| -- | -- | -- | -| Characteristics | ObservableCollection | Gets all the characteristics of this service | -| Name | string | Gets the name of this service | -| UUID | string | Gets the UUID of this service | -| Service | GattDeviceService | Gets the service this class wraps | - -## ObservableGattCharacteristics - -### Properties - -| Property | Type | Description | -| -- | -- | -- | -| Characteristic | GattCharacteristic | Gets or sets the characteristic this class wraps | -| IsIndicateSet | bool | Gets a value indicating whether indicate is set | -| IsNotifySet | bool | Gets a value indicating whether notify is set | -| Parent | ObservableGattDeviceService | Gets or sets the parent service of this characteristic | -| Name | string | Gets or sets the name of this characteristic | -| UUID | string | Gets or sets the UUID of this characteristic | -| Value | string | Gets the value of this characteristic | -| DisplayType | DisplayTypes | Gets or sets how this characteristic's value should be displayed | - -### Methods - -| Methods | Return Type | Description | -| -- | -- | -- | -| ReadValueAsync() | Task | Reads the value of the Characteristic | -| SetIndicateAsync() | Task | Set's the indicate descriptor | -| StopIndicateAsync() | Task | Unset the indicate descriptor | -| SetNotifyAsync() | Task | Sets the notify characteristic | -| StopNotifyAsync() | Task | Unsets the notify descriptor | - -## Example - -```csharp -// Get a local copy of the context for easier reading -BluetoothLEHelper bluetoothLEHelper = BluetoothLEHelper.Context; - -// check if BluetoothLE APIs are available -if (BluetoothLEHelper.IsBluetoothLESupported) -{ - // Start the Enumeration - bluetoothLEHelper.StartEnumeration(); - - // At this point the user needs to select a device they want to connect to. This can be done by - // creating a ListView and binding the bluetoothLEHelper collection to it. Once a device is found, - // the Connect() method can be called to connect to the device and start interacting with its services - - // Connect to a device if your choice - ObservableBluetoothLEDevice device = bluetoothLEHelper.BluetoothLeDevices[]; - await device.ConnectAsync(); - - // At this point the device is connected and the Services property is populated. - - // See all the services - var services = device.Services; -} -``` -```vb -' Get a local copy of the context for easier reading -Dim bluetoothLEHelper As BluetoothLEHelper = BluetoothLEHelper.Context - -' check if BluetoothLE APIs are available -If BluetoothLEHelper.IsBluetoothLESupported Then - ' Start the Enumeration - bluetoothLEHelper.StartEnumeration() - - ' At this point the user needs to select a device they want to connect to. This can be done by - ' creating a ListView and binding the bluetoothLEHelper collection to it. Once a device is found, - ' the Connect() method can be called to connect to the device and start interacting with its services - - ' Connect to a device if your choice - Dim device As ObservableBluetoothLEDevice = bluetoothLEHelper.BluetoothLeDevices() - Await device.ConnectAsync() - - ' At this point the device is connected and the Services property is populated. - - ' See all the services - Dim services = device.Services -End If -``` - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| --- | --- | -| Namespace | Microsoft.Toolkit.Uwp.Connectivity | -| NuGet package | [Microsoft.Toolkit.Uwp](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp/) | - -## API - -* [BluetoothLEHelper source code](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.Connectivity/BluetoothLEHelper) diff --git a/docs/helpers/CameraHelper.md b/docs/helpers/CameraHelper.md deleted file mode 100644 index 40c772dcd0c..00000000000 --- a/docs/helpers/CameraHelper.md +++ /dev/null @@ -1,122 +0,0 @@ ---- -title: CameraHelper -author: skommireddi -description: The CameraHelper provides helper methods to easily use the available camera frame sources to preview video, capture video frames and software bitmaps. -keywords: windows 10, uwp, windows community toolkit, windows toolkit, CameraHelper, Camera, Frame Source, Video Frame, Software Bitmap ---- - -# CameraHelper - -The **CameraHelper** provides helper methods to easily use the available camera frame sources to preview video, capture video frames and software bitmaps. The helper currently shows camera frame sources that support color video preview or video record streams. - -> [!IMPORTANT] -Make sure you have the [webcam capability](https://docs.microsoft.com/en-us/windows/uwp/packaging/app-capability-declarations#device-capabilities) enabled for your app to access the device's camera. - -## Syntax - -```csharp -// Creates a Camera Helper and gets video frames from an available frame source. -using Microsoft.Toolkit.Uwp.Helpers.CameraHelper; - -CameraHelper cameraHelper = new CameraHelper(); -var result = await _cameraHelper.InitializeAndStartCaptureAsync(); - -// Camera Initialization and Capture failed for some reason -if(result != CameraHelperResult.Success) -{ - // get error information - var errorMessage = result.ToString(); -} -else -{ - // Subscribe to get frames as they arrive - cameraHelper.FrameArrived += CameraHelper_FrameArrived; -} - -private void CameraHelper_FrameArrived(object sender, FrameEventArgs e) -{ - // Gets the current video frame - VideoFrame currentVideoFrame = e.VideoFrame; - - // Gets the software bitmap image - SoftwareBitmap softwareBitmap = currentVideoFrame.SoftwareBitmap; -} -``` - -## Cleaning up resources - -As a developer, you will need to make sure the CameraHelper resources are cleaned up when appropriate. For example, if the CameraHelper is only used on one page, make sure to clean up the CameraHelper when navigating away from the page. - -Likewise, make sure to handle app [suspending](https://docs.microsoft.com/windows/uwp/launch-resume/suspend-an-app) and [resuming](https://docs.microsoft.com/en-us/windows/uwp/launch-resume/resume-an-app) - CameraHelper should be cleaned up when suspending and re-initialized when resuming. - -Call `CameraHelper.CleanupAsync()` to clean up all internal resources. See the [CameraHelper sample page in the sample app](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/CameraHelper) for full example. - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| FrameSourceGroup | MediaFrameSourceGroup | Gets the currently selected MediaFrameSourceGroup for video preview. User can set this property to preview video from a specific source. If no MediaFrameSourceGroup is provided, Camera Helper selects the first available camera source to use for media capture. | -| FrameSource | MediaFrameSource | Gets the currently selected MediaFrameSource for video preview. | - -## Methods - -| Methods | Return Type | Description | -| -- | -- | -- | -| GetFrameSourceGroupsAsync() | Task> | Gets a read only list of MediaFrameSourceGroups that support color video record or video preview streams. -| InitializeAndStartCaptureAsync() | Task| Initializes Media Capture and Frame Reader for video preview and capture frames in real time. | -| CleanUpAsync() | Task | Use this asynchronous method to dispose Camera Helper resources | -| Dispose() | void | Use this method to dispose Camera Helper resources | - -## Events - -| Events | Description | -| -- | -- | -| FrameArrived| Fires when a new frame arrives.| - -## Examples - -Demonstrates using Camera Helper to get video frames from a specific media frame source group. - -```csharp - -using Microsoft.Toolkit.Uwp.Helpers.CameraHelper; - -var availableFrameSourceGroups = await CameraHelper.GetFrameSourceGroupsAsync(); -if(availableFrameSourceGroups != null) -{ - CameraHelper cameraHelper = new CameraHelper() { FrameSourceGroup = availableFrameSourceGroups.FirstOrDefault() }; - var result = await cameraHelper.InitializeAndStartCaptureAsync(); - - // Camera Initialization succeeded - if(result == CameraHelperResult.Success) - { - // Subscribe to get frames as they arrive - cameraHelper.FrameArrived += CameraHelper_FrameArrived; - - // Optionally set a different frame source format - var newFormat = cameraHelper.FrameFormatsAvailable.Find((format) => format.VideoFormat.Width == 640); - if (newFormat != null) - { - await cameraHelper.FrameSource.SetFormatAsync(newFormat); - } - } -} - -``` - -## Sample Code - -[CameraHelper Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/CameraHelper). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - - -## Requirements - -| Device family | Universal, 10.0.17134.0 or higher | -| --- | --- | -| Namespace | Microsoft.Toolkit.Uwp | -| NuGet package | [Microsoft.Toolkit.Uwp](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp/) | - -## API Source Code - -- [CameraHelper source code](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp/Helpers/CameraHelper) - diff --git a/docs/helpers/Colors.md b/docs/helpers/Colors.md deleted file mode 100644 index 9b9ca135a14..00000000000 --- a/docs/helpers/Colors.md +++ /dev/null @@ -1,69 +0,0 @@ ---- -title: Colors Helper -author: nmetulev -description: The Colors Helper lets users convert colors from text names, HTML hex, HSV, or HSL to Windows UI Colors -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, Colors Helper -dev_langs: - - csharp - - vb ---- - -# Colors Helper - -The [Colors Helper](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.helpers.colorhelper) lets users convert colors from text names, HTML hex, HSV, or HSL to Windows UI Colors (and back again of course). - -## Syntax - -```csharp -// Be sure to include the using at the top of the file: -using Microsoft.Toolkit.Uwp; - -// Given an HTML color, lets convert it to a Windows Color -Windows.UI.Color color = ColorHelper.ToColor("#3a4ab0"); - -// Also works with an Alpha code -Windows.UI.Color myColor = ColorHelper.ToColor("#ff3a4ab0"); - -// Given a color name, lets convert it to a Windows Color -Windows.UI.Color redColor = "Red".ToColor(); -``` -```vb -' Be sure to include the imports at the top of the file: -Imports Microsoft.Toolkit.Uwp - -' Given an HTML color, lets convert it to a Windows Color -Dim color As Windows.UI.Color = ColorHelper.ToColor("#3a4ab0") - -' Also works with an Alpha code -Dim myColor As Windows.UI.Color = ColorHelper.ToColor("#ff3a4ab0") - -' Given a color name, lets convert it to a Windows Color -Dim redColor As Windows.UI.Color = "Red".ToColor() -``` - -## Methods - -| Methods | Return Type | Description | -| -- | -- | -- | -| FromHsl(Double, Double, Double, Double) | Color | Returns a Color struct based on HSL model. Hue: 0-360, Saturation: 0-1, Lightness: 0-1, Alpha: 0-1 | -| FromHsv(Double, Double, Double, Double) | int | Returns a Color struct based on HSV model. Hue: 0-360, Saturation: 0-1, Lightness: 0-1, Alpha: 0-1 | -| ToColor(String) | Color | Returns a color based on XAML color string | -| ToHex(Color) | string | Converts a Color value to a string representation of the value in hexadecimal | -| ToHsl(Color) | [HslColor](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.hslcolor) | Converts an RGBA Color the HSL representation | -| ToHsv(Color) | [HsvColor](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.hsvcolor) | Converts an RGBA Color the HSV representation | -| ToInt(Color) | int | Returns the color value as a premultiplied Int32 - 4 byte ARGB structure | - -## Sample Code - -You can find more examples in our [unit tests](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/UnitTests/Helpers/Test_ColorHelper.cs) - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| --- | --- | -| Namespace | Microsoft.Toolkit.Uwp | -| NuGet package | [Microsoft.Toolkit.Uwp](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp/) | - -## API - -* [Color Helper source code](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp/Helpers/ColorHelper.cs) diff --git a/docs/helpers/Converters.md b/docs/helpers/Converters.md deleted file mode 100644 index e0c26b4de2a..00000000000 --- a/docs/helpers/Converters.md +++ /dev/null @@ -1,164 +0,0 @@ ---- -title: Converters -author: nmetulev -description: Commonly used converters that allow the data to be modified as it passes through the binding engine. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, BoolToObjectConverter, BoolToVisibilityConverter, CollectionVisibilityConverter, EmptyCollectionToObjectConverter, EmptyStringToObjectConverter, StringFormatConverter, StringVisibilityConverter ---- - -# Converters - -Commonly used **converters** that allow the data to be modified as it passes through the binding engine. - -| Converter | Purpose | -| --- | --- | -| [BoolNegationConverter](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.converters.boolnegationconverter?view=uwp-toolkit-dotnet) | Converts a boolean to the inverse value (True to False and vice versa) | -| [BoolToObjectConverter](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.converters.booltoobjectconverter?view=uwp-toolkit-dotnet) | Converts a boolean value into an object. The converted value is selected between the values of TrueValue and FalseValue properties | -| [BoolToVisibilityConverter](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.converters.booltovisibilityconverter?view=uwp-toolkit-dotnet) | Converts a boolean value into a Visibility enumeration | -| [CollectionVisibilityConverter](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.converters.collectionvisibilityconverter?view=uwp-toolkit-dotnet) | Converts a collection into a Visibility enumeration (Collapsed if the given collection is empty or null) | -| [EmptyCollectionToObjectConverter](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.converters.emptycollectiontoobjectconverter?view=uwp-toolkit-dotnet) | Converts a collection into an object. The converted value is selected between the values of EmptyValue and NotEmptyValue properties | -| [EmptyObjectToObjectConverter](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.converters.emptyobjecttoobjectconverter?view=uwp-toolkit-dotnet) | Converts a check on a null value into an object. The converted value is selected between the values of EmptyValue and NonEmptyValue properties | -| [EmptyStringToObjectConverter](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.converters.emptystringtoobjectconverter?view=uwp-toolkit-dotnet) | Converts a string into an object. The converted value is selected between the values of EmptyValue and NotEmptyValue properties | -| [FormatStringConverter](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.converters.formatstringconverter?view=uwp-toolkit-dotnet) | Converts an [IFormattable](https://docs.microsoft.com/dotnet/api/system.string.format?view=netframework-4.7) value into a string. The ConverterParameter provides the string format | -| [ResourceNameToResourceStringConverter](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.converters.resourcenametoresourcestringconverter?view=uwp-toolkit-dotnet) | Converter to look up the source string in the App Resources strings and returns its value, if found | -| [StringFormatConverter](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.converters.stringformatconverter?view=uwp-toolkit-dotnet) | Converts a source object to the formatted string version using [string.Format](https://docs.microsoft.com/dotnet/api/system.string.format?view=netframework-4.7). The ConverterParameter provides the string format | -| [StringVisibilityConverter](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.converters.stringvisibilityconverter?view=uwp-toolkit-dotnet) | Converts a string value into a Visibility enumeration (if the value is null or empty returns a collapsed value) | -| [ToolbarFormatActiveConverter](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.converters.toolbarformatactiveconverter?view=uwp-toolkit-dotnet) | Compares if Formats are equal and returns bool | -| [VisibilityToBoolConverter](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.converters.visibilitytoboolconverter?view=uwp-toolkit-dotnet) | This class converts a Visibility enumeration to a boolean value | - -## BoolToObjectConverter Examples - -`BoolToObjectConverter` can be used to generalize the behavior of `BoolToVisibilityConverter` by allowing to pass the two values it can return. -You can use it to switch Visibility by declaring it : - -```xaml - - - - - -``` - -and using it like that : - -```xaml - -``` - -It can also be used to switch between two values of brush. - -Note : you can use a resource for the brush or pass the color string and have it converted to a brush automatically. - -```xaml - - - -``` - -and using it like that : - -```xaml - -``` - -An other example is to switch between two images by specifying their source : - -```xaml - - - -``` - -and using it like that : - -```xaml - -``` - - -## BoolToVisibilityConverter Examples - -`BoolToVisibilityConverter` can be used to easily change a boolean value to a Visibility based one. -If targeting 14393 or later, this is done automatically through [x:Bind](https://docs.microsoft.com/windows/uwp/xaml-platform/x-bind-markup-extension). First, declare the converter in your resources: - -```xaml - - - -``` - -and use it like this : - -```xaml - -``` - -you can also invert the boolean as a ConverterParameter: - -```xaml - -``` - -or if you want to not pass a parameter, you can use `BoolToObjectConverter` to create an `InverseBoolToVisibilityConveter`: - -```xaml - - - -``` - - -## EmptyObjectToObjectConverter Examples - -`EmptyObjectToObjectConverter`, `EmptyCollectionToObjectConverter`, and `EmptyStringToObjectConverter` work similarly to the `BoolToObjectConverter` except using `EmptyValue` and `NotEmptyValue` instead of `TrueValue`/`FalseValue`. - -They inspect the type of 'empty'/null object value and return the specific value `EmptyValue` or `NotEmptyValue` based on the result. -That result can also be inverted withe a ConverterParameter. - -For instance you can generalize the `CollectionVisibilityConverter` using the `EmptyCollectionToObjectConverter`: - -```xaml - - - -``` - -this can be used as follows to hide a list with no items and instead show text through inversion with the ConverterParameter: - -```xaml - - - -``` - - -## StringFormatConverter Examples - -`StringFormatConverter` allows you to format a string property upon binding wrapping [string.Format](https://docs.microsoft.com/dotnet/api/system.string.format?view=netframework-4.7). -It only allows for a single input value (the binding string), but can be formatted with the regular string.Format -methods. First, add it to your page resources: - -```xaml - - - -``` - -then use it like so: - -```xaml - - - - inheriting object that provides an additional .Root property to pull the base path of the URI -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, DeepLinkParser -dev_langs: - - csharp - - vb ---- - -# DeepLinkParser - -The [DeepLinkParser Class](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.helpers.deeplinkparser) provides a way to create, from `IActivatedEventArgs` a `Dictionary`-inheriting object that provides an additional `.Root` property to pull the base path of the URI (eg: in `MainPage/Options?option1=value1`, `.Root` would be `MainPage/Options`. -Once you have an instance, simply saying `instance["optionName"]` will pull the value from the querystring for that option. - -### Properties - -| Property | Type | Description | -| -- | -- | -- | -| Root | string | Gets or sets the root path of the Deep link URI | - -## Methods - -| Methods | Return Type | Description | -| -- | -- | -- | -| Create(String) | DeepLinkParser | Creates an instance of `DeepLinkParser` for the given `string` | -| Create(Uri) | DeepLinkParser | Creates an instance of DeepLinkParser for the given Uri | -| Create(IActivatedEventArgs) | DeepLinkParser | Creates an instance of DeepLinkParser for the given [IActivatedEventArgs](https://docs.microsoft.com/uwp/api/Windows.ApplicationModel.Activation.IActivatedEventArgs) | -| ValidateSourceUri(String) | Uri | Validates the source URI | - -### Example - -In OnLaunched of App.xaml.cs: - -```csharp -if (e.PrelaunchActivated == false) -{ - if (rootFrame.Content == null) - { - var parser = DeepLinkParser.Create(args); - if (parser["username"] == "John Doe") - { - // do work here - } - if (parser.Root == "Signup") - { - rootFrame.Navigate(typeof(Signup)); - } -... -``` -```vb -If e.PrelaunchActivated = False Then - If rootFrame.Content Is Nothing Then - Dim parser = DeepLinkParser.Create(args) - If parser("username") = "John Doe" Then - ' do work here - End If - - If parser.Root = "Signup" Then - rootFrame.Navigate(GetType(Signup)) - End If -... -``` - -## CollectionFormingDeepLinkParser - -The [CollectionFormingDeepLinkParser Class](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.helpers.collectionformingdeeplinkparser) will to be able to do something like `?pref=this&pref=that&pref=theOther` and have a pull of `pref` come back with `this,that,theOther` as its value. This derivative of `DeepLinkParser` provides this functionality. - -### Example - -in OnLaunched of App.xaml.cs: - -```csharp -if (e.PrelaunchActivated == false) -{ - if (rootFrame.Content == null) - { - var parser = CollectionFormingDeepLinkParser.Create(args); - if (parser["username"] == "John Doe") - { - // do work here - } - if (parser.Root == "Signup") - { - var preferences = parser["pref"].Split(','); // now a string[] of all 'pref' querystring values passed in URI - rootFrame.Navigate(typeof(Signup)); - } -... -``` -```vb -If e.PrelaunchActivated = False Then - If rootFrame.Content Is Nothing Then - Dim parser = CollectionFormingDeepLinkParser.Create(args) - If parser("username") = "John Doe" Then - ' do work here - End If - - If parser.Root = "Signup" Then - Dim preferences = parser("pref").Split(","c) ' now a string[] of all 'pref' querystring values passed in URI - rootFrame.Navigate(GetType(Signup)) - End If -... -``` - -Both of these are createable using a `.Create(IActivatedEventArgs)` method. Should you wish to create one in a different manner, the default constructor is `protected` so inheriting from either of these can provide extensibility. -The method that does the heavy lifting of parsing in to the `Dictionary` (`ParseUriString`) is also `protected` and `virtual` so can be used/overridden by any inheriting class. - -## QueryParameterCollection - -The [QueryParameterCollection](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.helpers.queryparametercollection) helper class aids in the creation of a `Collection>` populated with they key-value pairs of all parameters in a query string. - -### Example - -```csharp -var myUrl = "http://microsoft.com/?user=fooUser&email=fooUser@outlook.com&firstName=John&lastName=Doe" -var paramCollection = new QueryParameterCollection(myUrl); -foreach (var pair in paramCollection) -{ - Console.WriteLine($"{pair.Key} - {pair.Value}"); -} -``` -```vb -Dim myUrl = "http://microsoft.com/?user=fooUser&email=fooUser@outlook.com&firstName=John&lastName=Doe" -Dim paramCollection = New QueryParameterCollection(myUrl) -For Each pair In paramCollection - Console.WriteLine($"{pair.Key} - {pair.Value}") -Next -``` - -### Output - -``` -user - fooUser -email - fooUser@outlook.com -firstname - John -lastName - Doe -``` - -### Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| --- | --- | -| Namespace | Microsoft.Toolkit.Uwp | -| NuGet package | [Microsoft.Toolkit.Uwp](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp/) | - -### API - -* [DeepLinkParser source code](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp/Helpers/DeepLinkParser) \ No newline at end of file diff --git a/docs/helpers/DispatcherHelper.md b/docs/helpers/DispatcherHelper.md deleted file mode 100644 index b2913c6fb5a..00000000000 --- a/docs/helpers/DispatcherHelper.md +++ /dev/null @@ -1,108 +0,0 @@ ---- -title: DispatcherHelper -author: nmetulev -description: The DispatcherHelper class enables easy interaction with CoreDispatcher, mainly in the case of executing a block of code on the UI thread from a non-UI thread. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, DispatcherHelper -dev_langs: - - csharp - - vb ---- - -# DispatcherHelper - -The DispatcherHelper class enables easy interaction with [CoreDispatcher](https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.core.coredispatcher.aspx), mainly in the case of executing a block of code on the UI thread from a non-UI thread. - -_What is included in the helper?_ - -- Extension method with overloads for [CoreDispatcher](https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.core.coredispatcher.aspx) class. - -- Extension method with overloads for [CoreApplicationView](https://msdn.microsoft.com/en-us/library/windows/apps/windows.applicationmodel.core.coreapplicationview.aspx) (for multi window applications). - -- Static helper methods for executing a specific function on the UI thread of the current application's main window. - -## Syntax - -```csharp -DispatcherHelper.ExecuteOnUIThreadAsync(() => -{ - // Code to execute on main window's UI thread -}); - -await CoreApplication.MainView.Dispatcher.AwaitableRunAsync( () => -{ - -}); -``` -```vb -DispatcherHelper.ExecuteOnUIThreadAsync(Of T)(Function() - ' Code to execute on main window's UI thread -End Function) - -Await CoreApplication.MainView.Dispatcher.AwaitableRunAsync(Of T)(Function() - -End Function) -``` - -## Methods - -| Methods | Return Type | Description | -| -- | -- | -- | -| AwaitableRunAsync(CoreDispatcher, Action, CoreDispatcherPriority) | Task | Extension method for CoreDispatcher. Offering an actual awaitable Task with optional result that will be executed on the given dispatcher | -| AwaitableRunAsync(CoreDispatcher, Func, CoreDispatcherPriority) | Task | Extension method for CoreDispatcher. Offering an actual awaitable Task with optional result that will be executed on the given dispatcher | -| AwaitableRunAsync(CoreDispatcher, Func>, CoreDispatcherPriority) | Task | Extension method for CoreDispatcher. Offering an actual awaitable Task with optional result that will be executed on the given dispatcher | -| AwaitableRunAsync(CoreDispatcher, Func, CoreDispatcherPriority) | Task | Extension method for CoreDispatcher. Offering an actual awaitable Task with optional result that will be executed on the given dispatcher | -| ExecuteOnUIThreadAsync(Action, CoreDispatcherPriority) | Task | Execute the given function asynchronously on given view's UI thread. Default view is the main view | -| ExecuteOnUIThreadAsync(Func, CoreDispatcherPriority) | Task | Execute the given function asynchronously on UI thread of the main view | -| ExecuteOnUIThreadAsync(CoreApplicationView, Action, CoreDispatcherPriority) | Task | Execute the given function asynchronously on given view's UI thread. Default view is the main view | -| ExecuteOnUIThreadAsync(CoreApplicationView, Func, CoreDispatcherPriority) | Task | Execute the given function asynchronously on given view's UI thread. Default view is the main view | -| ExecuteOnUIThreadAsync(Func>, CoreDispatcherPriority) | Task | Execute the given function asynchronously on UI thread of the main view | -| ExecuteOnUIThreadAsync(Func, CoreDispatcherPriority) | Task | Execute the given function asynchronously on given view's UI thread. Default view is the main view | -| ExecuteOnUIThreadAsync(CoreApplicationView, Func>, CoreDispatcherPriority) | Task | Execute the given function asynchronously on given view's UI thread. Default view is the main view | -| ExecuteOnUIThreadAsync(CoreApplicationView, Func, CoreDispatcherPriority) | Task | Execute the given function asynchronously on given view's UI thread. Default view is the main view | - -## Example - -```csharp -// Executing from a non-UI thread with helper method -int returnedFromUIThread = await DispatcherHelper.ExecuteOnUIThreadAsync(() => -{ - // Code to execute on main window's UI thread - NormalTextBlock.Text = "Updated from a random thread!"; - return 1; -}); - -// returnedFromUIThread now is 1, execution can go on from the non-UI thread - -// Or update it manually via the Extension method for CoreDispatcher -returnedFromUIThread = await CoreApplication.MainView.Dispatcher.AwaitableRunAsync(() => -{ - NormalTextBlock.Text = "Updated from a random thread with extension method!"; - return 1; -}); -``` -```vb -' Executing from a non-UI thread with helper method -Dim returnedFromUIThread As Integer = Await DispatcherHelper.ExecuteOnUIThreadAsync(Of Integer)(Function() - ' Code to execute on main window's UI thread - NormalTextBlock.Text = "Updated from a random thread!" - Return 1 -End Function) - -' returnedFromUIThread now is 1, execution can go on from the non-UI thread - -' Or update it manually via the Extension method for CoreDispatcher -returnedFromUIThread = Await CoreApplication.MainView.Dispatcher.AwaitableRunAsync(Of Integer)(Function() - NormalTextBlock.Text = "Updated from a random thread with extension method!" - Return 1 -End Function) -``` - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| --- | --- | -| Namespace | Microsoft.Toolkit.Uwp | - -## API - -* [DispatcherHelper source code](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp/Helpers/DispatcherHelper.cs) diff --git a/docs/helpers/HttpHelper.md b/docs/helpers/HttpHelper.md deleted file mode 100644 index 4d4edf3f474..00000000000 --- a/docs/helpers/HttpHelper.md +++ /dev/null @@ -1,82 +0,0 @@ ---- -title: HttpHelper -author: nmetulev -description: HttpHelper is a Windows Community Toolkit helper class used to assist in common http and networking scenarios. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, HttpHelper -dev_langs: - - csharp - - vb ---- - -# HttpHelper - -> [!WARNING] -(This API is obsolete and will be removed in the future. Please use [System.Net.Http.HttpClient](https://msdn.microsoft.com/library/system.net.http.httpclient(v=vs.110).aspx) or [Windows.Web.Http.HttpClient](https://docs.microsoft.com/uwp/api/Windows.Web.Http.HttpClient) directly) - -The [HttpHelper](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.httphelper) represents an HTTP request message including headers. - -## Syntax - -```csharp -var request = new HttpHelperRequest(new Uri("URI"), HttpMethod.Post); - -var response = await HttpHelper.Instance.SendRequestAsync(request); -``` -```vb -Private request = New HttpHelperRequest(New Uri("URI"), HttpMethod.Post) - -Private response = Await HttpHelper.Instance.SendRequestAsync(request) -``` - -## Properties - -The **HttpHelper** class has these properties. - -| Property | Type | Description | -| -------- | ----------- | ----------- | -| Instance ![Static](https://i-msdn.sec.s-msft.com/dynimg/IC64394.jpeg) | HttpHelper | Gets the instance of HTTPHelper exposed as singleton. | - -## Methods - -The **HttpHelper** class has these methods. It also inherits from **Object** class. - -| Methods | Return Type | Description | -| -- | -- | -- | -| GetInputStreamAsync(HttpHelperRequest, CancellationToken) | Task<[HttpHelperResponse](HttpHelperResponse.md)> | Process Http Request using instance of HttpClient | -| SendRequestAsync(HttpHelperRequest, CancellationToken) | Task<[HttpHelperResponse](HttpHelperResponse.md)> | Takes an instance of HttpHelperRequest as a parameter and passes it to server. It turns server response as HttpHelperResponse | -| ToString() | string | Returns a string that represents the current HttpHelper object | - -## Remarks - -The **HttpHelper** class exposes an instance of the class as a static property. -It additionally has one method - **SendRequestAsync**. This method requires an instance of **HttpHelperRequest** as an input parameter and returns an instance of **HttpHelperResponse** - -## Example - -```csharp -using (var request = new HttpHelperRequest(new Uri(twitterUrl), HttpMethod.Post)) -{ - using (var response = await HttpHelper.Instance.SendRequestAsync(request)) - { - return await response.GetTextResultAsync(); - } -} -``` -```vb -Using request = New HttpHelperRequest(New Uri(twitterUrl), HttpMethod.Post) - Using response = Await HttpHelper.Instance.SendRequestAsync(request) - Return Await response.GetTextResultAsync() - End Using -End Using -``` - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| --- | --- | -| Namespace | Microsoft.Toolkit.Uwp | -| NuGet package | [Microsoft.Toolkit.Uwp](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp/) | - -## API - -* [HttpHelper source code](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp/Helpers/HttpHelper/HttpHelper.cs) diff --git a/docs/helpers/HttpHelperRequest.md b/docs/helpers/HttpHelperRequest.md deleted file mode 100644 index 6e30fe1941a..00000000000 --- a/docs/helpers/HttpHelperRequest.md +++ /dev/null @@ -1,81 +0,0 @@ ---- -title: HttpHelperRequest -author: nmetulev -description: HttpHelperRequest is a Windows Community Toolkit helper class used with the HttpHelper class to create http requests. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, HttpHelperRequest -dev_langs: - - csharp - - vb ---- - -# HttpHelperRequest - -> [!WARNING] -(This API is obsolete and will be removed in the future. Please use [System.Net.Http.HttpRequestMessage](https://msdn.microsoft.com/library/system.net.http.httprequestmessage(v=vs.110).aspx) -or [Windows.Web.Http.HttpRequestMessage](https://docs.microsoft.com/uwp/api/windows.web.http.httprequestmessage) directly) - -The [HttpHelperRequest](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.httphelperrequest) represents an HTTP request message including headers. - -```csharp -var request = new HttpHelperRequest(uri, HttpMethod.Get); -``` -```vb -Dim request = New HttpHelperRequest(uri, HttpMethod.[Get]) -``` - -## Constructors - -The **HttpHelperRequest** class has these constructors. - -| Constructor | Description | -| ---------- | ----------- | -| HttpHelperRequest([Uri](https://msdn.microsoft.com/library/system.uri.aspx)) | Initializes a new instance of the HttpHelperRequest class with an HTTP Get method and a request Uri.| -| HttpHelperRequest([HttpMethod](https://msdn.microsoft.com/en-us/library/windows/apps/windows.web.http.httpmethod.aspx), [Uri](https://msdn.microsoft.com/library/system.uri.aspx)) | Initializes a new instance of the HttpRequestMessage class with an HTTP method and a request Uri.| - -## Methods - -The **HttpHelperRequest** class has these methods. It also inherits from **Object** class. - -| Method | Description | -| ------ | ----------- | -| ToHttpRequestMessage() | Returns an instance of [**HttpRequestMessage**](https://msdn.microsoft.com/en-us/library/windows/apps/windows.web.http.httprequestmessage.aspx) representing current HttpHelperRequest object. | -| Dispose() | Performs tasks associated with freeing, releasing, or resetting unmanaged resources. | -| ToString() | Returns a string that represents the current HttpHelperRequest object. | - -## Properties - -The **HttpHelperRequest** class has these properties. - -| Property | Type | Description | -| -------- | ----------- | ----------- | -| Content | IHttpContent | Gets or sets the HTTP content to send to the server on the HTTP request | -| Headers | HttpRequestHeaderCollection | Gets the collection of the HTTP request headers associated with the request | -| Method | HttpMethod | Gets the HTTP method to be performed on the request URI | -| RequestUri | Uri | Gets the Uri used for the HTTP request | - -## Remarks - -The **HttpHelperRequest** class contains headers, the HTTP verb, and potentially data. -An app starts by using one of the **HttpHelperRequest** constructors to create an **HttpRequestHelper** instance. The app then sets various properties on the **HttpRequestHelper** as needed. Then the **HttpRequestHelper** is passed as a parameter to the HttpHelper.SendRequestAsync method. - -## Example - -```csharp -var request = new HttpHelperRequest(uri, HttpMethod.Get); -request.Headers.Authorization = new Windows.Web.Http.Headers.HttpCredentialsHeaderValue("OAuth", authorizationHeaderParams); -``` -```vb -Dim request = New HttpHelperRequest(uri, HttpMethod.[Get]) -request.Headers.Authorization = New Windows.Web.Http.Headers.HttpCredentialsHeaderValue("OAuth", authorizationHeaderParams) -``` - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| --- | --- | -| Namespace | Microsoft.Toolkit.Uwp | -| NuGet package | [Microsoft.Toolkit.Uwp](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp/) | - -## API - -* [HttpHelperRequest source code](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp/Helpers/HttpHelper/HttpHelperRequest.cs) diff --git a/docs/helpers/HttpHelperResponse.md b/docs/helpers/HttpHelperResponse.md deleted file mode 100644 index 95d6221a146..00000000000 --- a/docs/helpers/HttpHelperResponse.md +++ /dev/null @@ -1,92 +0,0 @@ ---- -title: HttpHelperResponse -author: nmetulev -description: HttpHelperResponse is a Windows Community Toolkit helper class used with the HttpHelper class to read http responses. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, HttpHelperResponse -dev_langs: - - csharp - - vb ---- - -# HttpHelperResponse - -> [!WARNING] -(This API is obsolete and will be removed in the future. Please use [System.Net.Http.HttpResponseMessage](https://msdn.microsoft.com/library/system.net.http.httpresponsemessage(v=vs.110).aspx) -or [Windows.Web.Http.HttpResponseMessage](https://docs.microsoft.com/uwp/api/Windows.Web.Http.HttpResponseMessage) directly) - -[HttpHelperResponse](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.httphelperresponse) represents an HTTP response message including headers. - -## Example - -```csharp -using (HttpHelperResponse response = await HttpHelper.Instance.SendRequestAsync(request)) -{ - await response.GetTextResultAsync(); -} -``` -```vb -Using response = Await HttpHelper.Instance.SendRequestAsync(request) - Await response.GetTextResultAsync() -End Using -``` - -## Constructors - -The **HttpHelperResponse** class has these constructors. - -| Constructor | Description | -| ---------- | ----------- | -| HttpHelperResponse([HttpResponseMessage](https://msdn.microsoft.com/en-us/library/windows/apps/windows.web.http.httpresponsemessage.aspx)) | Initializes an instance of the HttpHelperRequest class with supplied HttpHelperResponse. | - -## Properties - -| Property | Type | Description | -| -------- | ----------- | ----------- | -| Content | IHttpContent | Gets the HTTP content return from the server | -| Headers | HttpResponseHeaderCollection | Gets the collection of HTTP response headers associated with the response that were sent by the server | -| StatusCode | HttpStatusCode | Gets the status code of the response | -| Success | bool | Gets a value that indicates whether the response was successful | - -## Methods - -| Methods | Return Type | Description | -| -- | -- | -- | -| Dispose() | void | Performs tasks associated with freeing, releasing, or resetting unmanaged resources | -| GetStreamResultAsync() | Task | Reads the Content as stream and returns it to the caller | -| GetTextResultAsync() | Task | Serialize the HTTP content to a String as an asynchronous operation | -| ToString() | string | Returns a string that represents the current HttpHelperResponse object | - -## Remarks - -The **HttpHelperResponse** class contains headers and potentially data. -An app receives an instance of **HttpHelperResponse** when it creates an instance of **HttpHelperRequest** and passes it to the **HttpHelper.SendRequestAsync** method. - -## Example - -```csharp -using (var request = new HttpHelperRequest(new Uri(twitterUrl), HttpMethod.Post)) -{ - using (var response = await HttpHelper.Instance.SendRequestAsync(request)) - { - return await response.GetTextResultAsync(); - } -} -``` -```vb -Using request = New HttpHelperRequest(New Uri(twitterUrl), HttpMethod.Post) - Using response = Await HttpHelper.Instance.SendRequestAsync(request) - Return Await response.GetTextResultAsync() - End Using -End Using -``` - -## Requirements - -| [Device family | Universal, 10.0.15063.0 or higher | -| --- | --- | -| Namespace | Microsoft.Toolkit.Uwp | -| NuGet package | [Microsoft.Toolkit.Uwp](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp/) | - -## API - -* [HttpHelperResponse source code](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp/Helpers/HttpHelper/HttpHelperResponse.cs) diff --git a/docs/helpers/ImageCache.md b/docs/helpers/ImageCache.md deleted file mode 100644 index 94db867205d..00000000000 --- a/docs/helpers/ImageCache.md +++ /dev/null @@ -1,81 +0,0 @@ ---- -title: ImageCache -author: nmetulev -description: The ImageCache provides methods and tools to cache images in a temporary local folder. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, ImageCache -dev_langs: - - csharp - - vb ---- - -# ImageCache - -The [ImageCache](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.imagecache) provides methods and tools to cache images in a temporary local folder. ImageCache also supports optional in-memory layer of caching, that provides better performance when same images are requested multiple times (like in long virtualized lists of images). This type of caching is disabled by default, but can be enabled by setting MaxMemoryCacheSize to desired size. For example: setting MaxMemoryCacheSize to 100 means that 100 last requested images will be held in memory to be instantly available, without disk reads. - -## Syntax - -```csharp -// Set cache duration -ImageCache.Instance.CacheDuration = TimeSpan.FromHours(24); - -// Enable in-memory caching -ImageCache.Instance.MaxMemoryCacheCount = 100; - -var distantUri = new Uri("http://www.myserver.com/image.jpg"); - -// Load a specific image from the cache. If the image is not in the cache, ImageCache will try to download and store it -var bitmapImage = await ImageCache.Instance.GetFromCacheAsync(distantUri); - -// Clear the cache. Please note that you can provide a parameter to define a timespan from now to select cache entries to delete. -await ImageCache.Instance.ClearAsync(); -``` -```vb -' Set cache duration -ImageCache.Instance.CacheDuration = TimeSpan.FromHours(24) - -' Enable in-memory caching -ImageCache.Instance.MaxMemoryCacheCount = 100 - -Dim distantUri = New Uri("http://www.myserver.com/image.jpg") - -' Load a specific image from the cache. If the image is not in the cache, ImageCache will try to download and store it -Dim bitmapImage = Await ImageCache.Instance.GetFromCacheAsync(distantUri) - -' Clear the cache. Please note that you can provide a parameter to define a timespan from now to select cache entries to delete. -Await ImageCache.Instance.ClearAsync() -``` - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| CacheDuration | TimeSpan | Gets or sets the life duration of every cache entry | -| HttpClient | HttpClient | Gets instance of HttpClient | -| Instance | ImageCache | Gets public singleton property | -| MaintainContext | bool | Gets or sets a value indicating whether context should be maintained until type has been instantiated or not | -| MaxMemoryCacheCount | int | Gets or sets max in-memory item storage count | -| RetryCount | uint | Gets or sets the number of retries trying to ensure the file is cached | - -## Methods - -| Methods | Return Type | Description | -| -- | -- | -- | -| ClearAsync() | Task | Clears all files in the cache | -| ClearAsync(TimeSpan) | Task | Clears file if it has expired | -| GetFileFromCacheAsync(Uri) | Task | Gets the StorageFile containing cached item for given Uri | -| GetFromCacheAsync(Uri, Boolean, CancellationToken, List>) | Task | Retrieves item represented by Uri from the cache. If the item is not found in the cache, it will try to downloaded and saved before returning it to the caller | -| GetFromMemoryCache(Uri) | T | Retrieves item represented by Uri from the in-memory cache if it exists and is not out of date. If item is not found or is out of date, default instance of the generic type is returned | -| PreCacheAsync(Uri, Boolean, Boolean, CancellationToken) | Task | Assures that item represented by Uri is cached | -| RemoveAsync(IEnumerable) | Task | Removed items based on uri list passed | -| RemoveExpiredAsync(Nullable) | Task | Removes cached files that have expired | - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| --- | --- | -| Namespace | Microsoft.Toolkit.Uwp | -| NuGet package | [Microsoft.Toolkit.Uwp](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp/) | - -## API - -* [ImageCache source code](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.UI/Cache/ImageCache.cs) diff --git a/docs/helpers/IncrementalLoadingCollection.md b/docs/helpers/IncrementalLoadingCollection.md deleted file mode 100644 index 3c938c5c5b8..00000000000 --- a/docs/helpers/IncrementalLoadingCollection.md +++ /dev/null @@ -1,139 +0,0 @@ ---- -title: Incremental Loading Collection Helpers -author: nmetulev -description: The IncrementalLoadingCollection helpers greatly simplify the definition and usage of collections whose items can be loaded incrementally only when needed by the view -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, IncrementalLoadingCollection -dev_langs: - - csharp - - vb ---- - -# Incremental Loading Collection Helpers - -The **IncrementalLoadingCollection** helpers greatly simplify the definition and usage of collections whose items can be loaded incrementally only when needed by the view, i.e., when user scrolls a [ListView](https://msdn.microsoft.com/library/windows/apps/windows.ui.xaml.controls.listview.aspx) or a [GridView](https://msdn.microsoft.com/library/windows/apps/windows.ui.xaml.controls.gridview.aspx). - -| Helper | Purpose | -| --- | --- | -|[IIncrementalSource](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.iincrementalsource-1) | An interface that represents a data source whose items can be loaded incrementally. | -|[IncrementalLoadingCollection](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.incrementalloadingcollection-2) | An extension of [ObservableCollection](https://msdn.microsoft.com/library/ms668604.aspx) such that its items are loaded only when needed. | - -## IncrementalLoadingCollection Properties - -| Property | Type | Description | -| -- | -- | -- | -| CurrentPageIndex | int | Gets or sets a value indicating The zero-based index of the current items page | -| HasMoreItems | bool | Gets a value indicating whether the collection contains more items to retrieve | -| IsLoading | bool | Gets a value indicating whether new items are being loaded | -| ItemsPerPage | int | Gets a value indicating how many items that must be retrieved for each incremental call | -| OnEndLoading | [Action](https://msdn.microsoft.com/library/system.action(v=vs.110).aspx) | Gets or sets an Action that is called when a retrieval operation ends | -| OnError | Action | Gets or sets an Action that is called if an error occours during data retrieval. The actual Exception is passed as an argument | -| OnStartLoading | Action | Gets or sets an Action that is called when a retrieval operation begins | - -## IncrementalLoadingCollection Methods - -| Methods | Return Type | Description | -| -- | -- | -- | -| LoadDataAsync(CancellationToken) | Task> | Actually performs the incremental loading | -| LoadMoreItemsAsync(UInt32) | IAsyncOperation | Initializes incremental loading from the view | -| Refresh() | void | Clears the collection and resets the page index which triggers an automatic reload of the first page | -| RefreshAsync() | Task | Clears the collection and reloads data from the source | - -## Example - -`IIncrementalSource` allows to define the data source: - -```csharp -// Be sure to include the using at the top of the file: -//using Microsoft.Toolkit.Uwp; - -public class Person -{ - public string Name { get; set; } -} - -public class PeopleSource : IIncrementalSource -{ - private readonly List people; - - public PeopleSource() - { - // Creates an example collection. - people = new List(); - - for (int i = 1; i <= 200; i++) - { - var p = new Person { Name = "Person " + i }; - people.Add(p); - } - } - - public async Task> GetPagedItemsAsync(int pageIndex, int pageSize) - { - // Gets items from the collection according to pageIndex and pageSize parameters. - var result = (from p in people - select p).Skip(pageIndex * pageSize).Take(pageSize); - - // Simulates a longer request... - await Task.Delay(1000); - - return result; - } -} -``` -```vb -' Be sure to include the using at the top of the file: -'Imports Microsoft.Toolkit.Uwp - -Public Class Person - - Public Property Name As String -End Class - -Public Class PeopleSource - Implements IIncrementalSource(Of Person) - - Private ReadOnly people As List(Of Person) - - Public Sub New() - ' Creates an example collection. - people = New List(Of Person)() - For i As Integer = 1 To 200 - Dim p = New Person With {.Name = "Person " & i} - people.Add(p) - Next - End Sub - - Public Async Function GetPagedItemsAsync(pageIndex As Integer, pageSize As Integer, Optional cancellationToken As CancellationToken = Nothing) As Task(Of IEnumerable(Of Person)) Implements Microsoft.Toolkit.Collections.IIncrementalSource(Of Person).GetPagedItemsAsync - ' Gets items from the collection according to pageIndex and pageSize parameters. - Dim result = (From p In people Select p).Skip(pageIndex * pageSize).Take(pageSize) - - ' Simulates a longer request... - Await Task.Delay(1000) - Return result - End Function -End Class -``` - -The *GetPagedItemsAsync* method is invoked everytime the view need to show more items. - -`IncrementalLoadingCollection` can then be bound to a [ListView](https://msdn.microsoft.com/library/windows/apps/windows.ui.xaml.controls.listview.aspx) or a [GridView-like](https://msdn.microsoft.com/library/windows/apps/windows.ui.xaml.controls.gridview.aspx) control: - -```csharp -var collection = new IncrementalLoadingCollection(); -PeopleListView.ItemsSource = collection; -``` -```vb -Dim collection = New IncrementalLoadingCollection(Of PeopleSource, Person)() -PeopleListView.ItemsSource = collection -``` - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| --- | --- | -| Namespace | Microsoft.Toolkit.Uwp | -| NuGet package | [Microsoft.Toolkit.Uwp](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp/) | - -## API - -* [IncrementalLoadingCollection source code](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp/IncrementalLoadingCollection) diff --git a/docs/helpers/NetworkHelper.md b/docs/helpers/NetworkHelper.md deleted file mode 100644 index 346477da145..00000000000 --- a/docs/helpers/NetworkHelper.md +++ /dev/null @@ -1,119 +0,0 @@ ---- -title: NetworkHelper -author: nmetulev -description: he NetworkHelper class provides functionality to monitor changes in network connection and allows users to query for network information without additional lookups. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, NetworkHelper -dev_langs: - - csharp - - vb ---- - -# NetworkHelper - -The [NetworkHelper](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.connectivity.networkhelper) class provides functionality to monitor changes in network connection and allows users to query for network information without additional lookups. - -It exposes network information though a property called ConnectionInformation. The [ConnectionInformation](https://docs.microsoft.comdotnet/api/microsoft.toolkit.uwp.connectivity.connectioninformation) holds information about ConnectionType, ConnectivityLevel, ConnectionCost, SignalStrength, Internet Connectivity and more. - -**_What is a metered connection?_** -A metered connection is an Internet connection that has a data limit or cost associated with it. Cellular data connections are set as metered by default. Wi-Fi network connections can be set to metered, but aren't by default. Application developers should take metered nature of connection into account and reduce data usage. - -## NetworkHelper Properties - -| Property | Type | Description | -| -- | -- | -- | -| ConnectionInformation | [ConnectionInformation](https://docs.microsoft.comdotnet/api/microsoft.toolkit.uwp.connectivity.connectioninformation) | Gets instance of ConnectionInformation | -| Instance | NetworkHelper | Gets public singleton property | - -## ConnectionInformation Properties - -| Property | Type | Description | -| -- | -- | -- | -| ConnectionCost | [ConnectionCost](https://docs.microsoft.com/uwp/api/Windows.Networking.Connectivity.ConnectionCost) | Gets connection cost for the current Internet Connection Profile | -| ConnectionType | [ConnectionType](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.connectivity.connectiontype)] | Gets connection type for the current Internet Connection Profile | -| ConnectivityLevel | [NetworkConnectivityLevel](https://docs.microsoft.com/uwp/api/Windows.Networking.Connectivity.NetworkConnectivityLevel) | Gets connectivity level for the current Internet Connection Profile | -| IsInternetAvailable | bool | Gets a value indicating whether internet is available across all connections | -| IsInternetOnMeteredConnection | bool | Gets a value indicating whether if the current internet connection is metered | -| NetworkNames | IReadOnlyList | Gets signal strength for the current Internet Connection Profile | -| SignalStrength | Nullable | Gets signal strength for the current Internet Connection Profile | - -## ConnectionInformation Methods - -| Methods | Return Type | Description | -| -- | -- | -- | -| UpdateConnectionInformation(ConnectionProfile) | void | Updates the current object based on profile passed | - -## NetworkHelper Events - -| Events | Description | -| -- | -- | -| NetworkChanged | Event raised when the network changes | - -## Example - -```csharp -// Detect if Internet can be reached -if (NetworkHelper.Instance.ConnectionInformation.IsInternetAvailable) -{ -} - -// Detect if the connection is metered -if (NetworkHelper.Instance.ConnectionInformation.IsInternetOnMeteredConnection) -{ -} - -// Get precise connection type -switch(NetworkHelper.Instance.ConnectionInformation.ConnectionType) -{ - case ConnectionType.Ethernet: - // Ethernet - break; - case ConnectionType.WiFi: - // WiFi - break; - case ConnectionType.Data: - // Data - break; - case ConnectionType.Unknown: - // Unknown - break; -} -``` -```vb -' Detect if Internet can be reached -If NetworkHelper.Instance.ConnectionInformation.IsInternetAvailable Then - ... -End If - -' Detect if the connection is metered -If NetworkHelper.Instance.ConnectionInformation.IsInternetOnMeteredConnection Then - ... -End If - -' Get precise connection type -Select Case NetworkHelper.Instance.ConnectionInformation.ConnectionType - Case ConnectionType.Ethernet - ' Ethernet - Case ConnectionType.WiFi - ' WiFi - Case ConnectionType.Data - ' Data - Case ConnectionType.Unknown - ' Unknown -End Select -``` - -## Sample Code - -[NetworkHelper sample page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/NetworkHelper). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| --- | --- | -| Namespace | Microsoft.Toolkit.Uwp.Connectivity | -| NuGet package | [Microsoft.Toolkit.Uwp.Connectivity](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.Connectivity/) | - -## API - -* [NetworkHelper source code](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.Connectivity/Network/NetworkHelper.cs) - diff --git a/docs/helpers/ObjectStorage.md b/docs/helpers/ObjectStorage.md deleted file mode 100644 index 2f0d1cd491d..00000000000 --- a/docs/helpers/ObjectStorage.md +++ /dev/null @@ -1,218 +0,0 @@ ---- -title: Object Storage -author: nmetulev -description: The Object Storage Helper will help you handle storage of generic objects within UWP applications, both locally and across all devices (roaming). -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, Object Storage, local storage, roaming storage -dev_langs: - - csharp - - vb ---- - -# Object Storage - -The Object Storage Helper will help you handle storage of generic objects within UWP applications, both locally and across all devices (roaming). - -- [LocalObjectStorageHelper Class](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.helpers.localobjectstoragehelper) store data in the Local environment (only on the current device) -- [RoamingObjectStorageHelper Class](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.helpers.roamingobjectstoragehelper) - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| Folder | StorageFolder | Gets or sets storage folder | -| Settings | ApplicationDataContainer | Gets or sets settings container | - -## Methods - -| Methods | Return Type | Description | -| -- | -- | -- | -| FileExistsAsync(String) | Task | Detect if a file already exists | -| KeyExists(String) | bool | Detect if a setting already exists | -| KeyExists(String, String) | bool | Detect if a setting already exists in composite | -| Read(String, T) | T | Retrieve single item by its key | -| Read(String, String, T) | T | Retrieve single item by its key in composite | -| ReadFileAsync(String, T) | Task | Retrieve object from file | -| Save(String, IDictionary) | void | Save a group of items by its key in a composite. This method should be considered for objects that do not exceed 8k bytes during the lifetime of the application (refers to SaveFileAsync(String, T) for complex/large objects) and for groups of settings which need to be treated in an atomic way | -| Save(String, T) | void | Save single item by its key. This method should be considered for objects that do not exceed 8k bytes during the lifetime of the application (refers to SaveFileAsync(String, T) for complex/large objects) | -| SaveFileAsync(String, T) | Task | Save object inside file. There is no limitation to use this method (refers to Save(String, T) method for simple objects) | - -## Example - -### Local Storage - -If you need to handle local saves of any object (generic), you can use [LocalObjectStorageHelper](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.helpers.localobjectstoragehelper). - -```csharp -var helper = new LocalObjectStorageHelper(); - -// Read simple objects -string keySimpleObject = "simple"; -if (helper.KeyExists(keySimpleObject)) -{ - string result = helper.Read(keySimpleObject); -} - -// Read simple objects in a composite -string keyCompositeObject = "composite"; -if (helper.KeyExists(keyCompositeObject, keySimpleObject)) -{ - string result = helper.Read(keyCompositeObject, keySimpleObject); -} - -// Save simple objects -helper.Save(keySimpleObject, 47); - -// Save simple objects in a composite -Dictionary() simpleObjects = new Dictionary(); -simpleObjects.add("simpleObjectValueOne", 47); -simpleObjects.add("simpleObjectValueTwo", "hello!"); -helper.Save(keyCompositeObject, simpleObjects); - -// Read complex/large objects -string keyLargeObject = "large"; -if (await helper.FileExistsAsync(keyLargeObject)) -{ - var result = await helper.ReadFileAsync(keyLargeObject); -} - -// Save complex/large objects -var o = new MyLargeObject -{ - ... -}; -await helper.SaveFileAsync(keySimpleObject, o); -``` -```vb -Dim helper = New LocalObjectStorageHelper() - -' Read simple objects -Dim keySimpleObject As String = "simple" -If helper.KeyExists(keySimpleObject) Then - Dim result As String = helper.Read(Of String)(keySimpleObject) -End If - -' Read simple objects in a composite -Dim keyCompositeObject As String = "composite" -If helper.KeyExists(keyCompositeObject, keySimpleObject) Then - Dim result As String = helper.Read(Of String)(keyCompositeObject, keySimpleObject) -End If - -' Save simple objects -helper.Save(keySimpleObject, 47) - -' Save simple objects in a composite -Dictionary(Of String, Object)() simpleObjects = New Dictionary(Of String, Object)() -simpleObjects.add("simpleObjectValueOne", 47) -simpleObjects.add("simpleObjectValueTwo", "hello!") -helper.Save(keyCompositeObject, simpleObjects) - -' Read complex/large objects -Dim keyLargeObject As String = "large" -If Await helper.FileExistsAsync(keyLargeObject) Then - Dim result = Await helper.ReadFileAsync(Of MyLargeObject)(keyLargeObject) -End If - -' Save complex/large objects -Dim o = New MyLargeObject With { - ... -} -Await helper.SaveFileAsync(keySimpleObject, o) -``` - -### Roaming Storage - -In the same way, if you need to handle roaming saves across all of user devices, you can use `RoamingObjectStorageHelper`. -The implementation of the `RoamingObjectStorageHelper` is absolutely similar to `LocalObjectStorageHelper`. - -```csharp -var helper = new RoamingObjectStorageHelper(); - -// Read simple objects -string keySimpleObject = "simple"; -if (helper.KeyExists(keySimpleObject)) -{ - string result = helper.Read(keySimpleObject); -} - -// Read simple objects in a composite -string keyCompositeObject = "composite"; -if (helper.KeyExists(keyCompositeObject, keySimpleObject)) -{ - string result = helper.Read(keyCompositeObject, keySimpleObject); -} - -// Save simple objects -helper.Save(keySimpleObject, 47); - -// Save simple objects in a composite -Dictionary() simpleObjects = new Dictionary(); -simpleObjects.add("simpleObjectValueOne", 47); -simpleObjects.add("simpleObjectValueTwo", "hello!"); -helper.Save(keyCompositeObject, simpleObjects); - -// Read complex/large objects -string keyLargeObject = "large"; -if (await helper.FileExistsAsync(keyLargeObject)) -{ - var result = await helper.ReadFileAsync(keyLargeObject); -} - -// Save complex/large objects -var o = new MyLargeObject -{ - ... -}; -await helper.SaveFileAsync(keySimpleObject, o); -``` -```vb -Dim helper = New RoamingObjectStorageHelper() - -' Read simple objects -Dim keySimpleObject As String = "simple" -If helper.KeyExists(keySimpleObject) Then - Dim result As String = helper.Read(Of String)(keySimpleObject) -End If - -' Read simple objects in a composite -Dim keyCompositeObject As String = "composite" -If helper.KeyExists(keyCompositeObject, keySimpleObject) Then - Dim result As String = helper.Read(Of String)(keyCompositeObject, keySimpleObject) -End If - -' Save simple objects -helper.Save(keySimpleObject, 47) - -' Save simple objects in a composite -Dictionary(Of String, Object)() simpleObjects = New Dictionary(Of String, Object)() -simpleObjects.add("simpleObjectValueOne", 47) -simpleObjects.add("simpleObjectValueTwo", "hello!") -helper.Save(keyCompositeObject, simpleObjects) - -' Read complex/large objects -Dim keyLargeObject As String = "large" -If Await helper.FileExistsAsync(keyLargeObject) Then - Dim result = Await helper.ReadFileAsync(Of MyLargeObject)(keyLargeObject) -End If - -' Save complex/large objects -Dim o = New MyLargeObject With { - ... -} -Await helper.SaveFileAsync(keySimpleObject, o) -``` - -## Sample Code - -[Object Storage sample page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Object%20Storage). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| --- | --- | -| Namespace | Microsoft.Toolkit.Uwp | -| NuGet package | [Microsoft.Toolkit.Uwp](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp/) | - -## API - -* [LocalObjectStorageHelper source code](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp/Helpers/ObjectStorage/LocalObjectStorageHelper.cs) -* [RoamingObjectStorageHelper source code](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp/Helpers/ObjectStorage/RoamingObjectStorageHelper.cs) diff --git a/docs/helpers/PrintHelper.md b/docs/helpers/PrintHelper.md deleted file mode 100644 index 22477f44f8f..00000000000 --- a/docs/helpers/PrintHelper.md +++ /dev/null @@ -1,308 +0,0 @@ ---- -title: Print Helper -author: nmetulev -description: The PrintHelper is a Windows Community Toolkit helper class that enables the rendering of a framework element per page for printing purposes -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, PrintHelper -dev_langs: - - csharp - - vb ---- - -# Print Helper - -The PrintHelper is a class used to simplify document printing. -It allows you to render a framework element per page. - -To use it, you only have to instantiate a `PrintHelper` object and call `AddFrameworkElementToPrint` method to add the XAML controls you want to print. -Please note that controls cannot be linked to a visual tree. This means that their parent property has to be null. -If you want to use a control from your current XAML page, you can disconnect it before sending it to print (by removing it from its container) or you can create just create a new one from scratch. - -Please check the sample app code to see how to disconnect/reconnect a control that you want to print: -https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/PrintHelper/PrintHelperPage.xaml.cs - -Several events are available to control the printing process: - -* OnPrintFailed will be triggered if the user cancels the print or if something goes wrong -* OnPrintSucceeded will be triggered after a successful print -* OnPreviewPagesCreated will be triggered after print preview pages are generated. This allows you to control the look and feel of your page before they are sent to the spooler. - -In addition, you can customize the printing dialog using the `PrintHelperOptions` class. To use it, create an instance of the class, add the options you'd like to display on the printing dialog and set the default options. Then, you can use it as a parameter in the `PrintHelper` class constructor to set them as the default for the instance, or send them as parameters to `ShowPrintUIAsync` to use them for a single print job. - -You can call `ShowPrintUIAsync` with a second parameter to determine that the list of controls to print should directly be taken from the content of the container passed to the PrintHelper constructor. In this mode you are responsible for the sizing and the layout. - -> [!IMPORTANT] -Printing in Dark Theme will likely print white text, which won't be visible. To fix this, ensure the text is a visible color before printing, then restore the original color. - -## Syntax - -```csharp -var printHelper = new PrintHelper(container); - -printHelper.AddFrameworkElementToPrint(frameworkElement); - -await printHelper.ShowPrintUIAsync("Title"); -``` -```vb -Dim printHelper = New PrintHelper(container) - -printHelper.AddFrameworkElementToPrint(frameworkElement) - -Await printHelper.ShowPrintUIAsync("Title") -``` - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| ApplicationContentMarginLeft | double | Gets or sets the percent of app's margin width | -| ApplicationContentMarginTop | double | Gets or sets the percent of app's margin height | - -## Methods - -| Methods | Return Type | Description | -| -- | -- | -- | -| AddFrameworkElementToPrint(FrameworkElement) | void | Add an element to the list of printable elements | -| ClearListOfPrintableFrameworkElements() | void | Empties the list of printable elements | -| Dispose() | void | Release associated resources | -| RemoveFrameworkElementToPrint(FrameworkElement) | void | Remove an element from the list of printable elements | -| ShowPrintUIAsync(String, Boolean) | Task | Start the print task | - -## Events - -| Events | Description | -| -- | -- | -| OnPreviewPagesCreated | Event which is called after print preview pages are generated | -| OnPrintCanceled | Event raised when print is cancelled by the user | -| OnPrintFailed | Event raised when print failed | -| OnPrintSucceeded | Event raised when print was successful | - -## Example - -```csharp -// Create a new PrintHelper instance -// "container" is a XAML panel that will be used to host printable control. -// It needs to be in your visual tree but can be hidden with Opacity = 0 -var printHelper = new PrintHelper(container); - -// Add controls that you want to print -printHelper.AddFrameworkElementToPrint(await PrepareWebViewForPrintingAsync()); - -// Connect to relevant events -printHelper.OnPrintFailed += PrintHelper_OnPrintFailed; -printHelper.OnPrintSucceeded += PrintHelper_OnPrintSucceeded; - -// Start printing process -await printHelper.ShowPrintUIAsync("Windows Community Toolkit Sample App"); - -// Event handlers - -private async void PrintHelper_OnPrintSucceeded() -{ - printHelper.Dispose(); - var dialog = new MessageDialog("Printing done."); - await dialog.ShowAsync(); -} - -private async void PrintHelper_OnPrintFailed() -{ - printHelper.Dispose(); - var dialog = new MessageDialog("Printing failed."); - await dialog.ShowAsync(); -} -``` -```vb -' Create a new PrintHelper instance -' "container" is a XAML panel that will be used to host printable control. -' It needs to be in your visual tree but can be hidden with Opacity = 0 -Dim printHelper = New PrintHelper(container) - -' Add controls that you want to print -printHelper.AddFrameworkElementToPrint(Await PrepareWebViewForPrintingAsync()) - -' Connect to relevant events -printHelper.OnPrintFailed += PrintHelper_OnPrintFailed -printHelper.OnPrintSucceeded += PrintHelper_OnPrintSucceeded - -' Start printing process -Await printHelper.ShowPrintUIAsync("Windows Community Toolkit Sample App") - -' Event handlers - -Private Async Sub PrintHelper_OnPrintSucceeded() - printHelper.Dispose() - Dim dialog = New MessageDialog("Printing done.") - Await dialog.ShowAsync() -End Sub - -Private Async Sub PrintHelper_OnPrintFailed() - printHelper.Dispose() - Dim dialog = New MessageDialog("Printing failed.") - Await dialog.ShowAsync() -End Sub -``` - -**Direct print example:** - -```csharp -// Create a new PrintHelper instance -// "container" is a XAML panel that will be used to get the list of printable controls. -var printHelper = new PrintHelper(container); - -// Start printing process -await printHelper.ShowPrintUIAsync("Windows Community Toolkit Sample App", true); -``` -```vb -' Create a new PrintHelper instance -' "container" is a XAML panel that will be used to get the list of printable controls. -Dim printHelper = New PrintHelper(container) - -' Start printing process -Await printHelper.ShowPrintUIAsync("Windows Community Toolkit Sample App", True) -``` - -**Using custom default settings:** - -```csharp -// Create a new PrintHelperOptions instance -var defaultPrintHelperOptions = new PrintHelperOptions(); - -//Add options that you want to be displayed on the print dialog -defaultPrintHelperOptions.AddDisplayOption(StandardPrintTaskOptions.Orientation); - -//Set preselected settings -defaultPrintHelperOptions.Orientation = PrintOrientation.Landscape; - -// Create a new PrintHelper instance -// "container" is a XAML panel that will be used to get the list of printable controls. -var printHelper = new PrintHelper(container, defaultPrintHelperOptions); -``` -```vb -' Create a new PrintHelperOptions instance -Dim defaultPrintHelperOptions = New PrintHelperOptions() - -' Add options that you want to be displayed on the print dialog -defaultPrintHelperOptions.AddDisplayOption(StandardPrintTaskOptions.Orientation) - -' Set preselected settings -defaultPrintHelperOptions.Orientation = PrintOrientation.Landscape - -' Create a new PrintHelper instance -' "container" is a XAML panel that will be used to get the list of printable controls. -Dim printHelper = New PrintHelper(container, defaultPrintHelperOptions) -``` - -**Using custom settings for one print job:** - -```csharp -// Create a new PrintHelper instance -// "container" is a XAML panel that will be used to get the list of printable controls. -// "defaultPrintHelperOptions" is a PrintHelperOptions instance that will be used to get the default options for printing. -var printHelper = new PrintHelper(container, defaultPrintHelperOptions); - -// Create a new PrintHelperOptions instance -var printHelperOptions = new PrintHelperOptions(); - -//Add options that you want to be displayed on the print dialog -printHelperOptions.AddDisplayOption(StandardPrintTaskOptions.Orientation); - -//Set preselected settings -printHelperOptions.Orientation = PrintOrientation.Landscape; - -// Start printing process -await _printHelper.ShowPrintUIAsync("Windows Community Toolkit Sample App", printHelperOptions); -``` -```vb -' Create a new PrintHelper instance -' "container" is a XAML panel that will be used to get the list of printable controls. -' "defaultPrintHelperOptions" is a PrintHelperOptions instance that will be used to get the default options for printing. -Dim printHelper = New PrintHelper(container, defaultPrintHelperOptions) - -' Create a new PrintHelperOptions instance -Dim printHelperOptions = New PrintHelperOptions() - -' Add options that you want to be displayed on the print dialog -printHelperOptions.AddDisplayOption(StandardPrintTaskOptions.Orientation) - -' Set preselected settings -printHelperOptions.Orientation = PrintOrientation.Landscape - -' Start printing process -Await _printHelper.ShowPrintUIAsync("Windows Community Toolkit Sample App", printHelperOptions) -``` - -**Print a list with each item on a separate page with static header and page number:** - -```csharp -// Create a new PrintHelper instance -// "container" is a XAML panel that will be used to get the list of printable controls. -var printHelper = new PrintHelper(container); - -var pageNumber = 0; - -foreach (var item in PrintSampleItems) -{ - var grid = new Grid(); - grid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); - grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) }); - grid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); - - // Static header - var header = new TextBlock { Text = "Windows Community Toolkit Sample App - Print Helper - Custom Print", Margin = new Thickness(0, 0, 0, 20) }; - Grid.SetRow(header, 0); - grid.Children.Add(header); - - // Main content with layout from data template - var cont = new ContentControl(); - cont.ContentTemplate = Resources["CustomPrintTemplate"] as DataTemplate; - cont.DataContext = item; - Grid.SetRow(cont, 1); - grid.Children.Add(cont); - - // Footer with page number - pageNumber++; - var footer = new TextBlock { Text = string.Format("page {0}", pageNumber), Margin = new Thickness(0, 20, 0, 0) }; - Grid.SetRow(footer, 2); - grid.Children.Add(footer); - - printHelper.AddFrameworkElementToPrint(grid); -} - -// Start printing process -await printHelper.ShowPrintUIAsync("Windows Community Toolkit Sample App", printHelperOptions); -``` -```vb - Dim printHelper = New PrintHelper(container) - Dim pageNumber = 0 - For Each item In PrintSampleItems - Dim grid = New Grid() - grid.RowDefinitions.Add(New RowDefinition() With {.Height = GridLength.Auto}) - grid.RowDefinitions.Add(New RowDefinition() With {.Height = New GridLength(1, GridUnitType.Star)}) - grid.RowDefinitions.Add(New RowDefinition() With {.Height = GridLength.Auto}) - Dim header = New TextBlock With {.Text = "Windows Community Toolkit Sample App - Print Helper - Custom Print", .Margin = New Thickness(0, 0, 0, 20)} - Grid.SetRow(header, 0) - grid.Children.Add(header) - Dim cont = New ContentControl() - cont.ContentTemplate = TryCast(Resources("CustomPrintTemplate"), DataTemplate) - cont.DataContext = item - Grid.SetRow(cont, 1) - grid.Children.Add(cont) - pageNumber += 1 - Dim footer = New TextBlock With {.Text = String.Format("page {0}", pageNumber), .Margin = New Thickness(0, 20, 0, 0)} - Grid.SetRow(footer, 2) - grid.Children.Add(footer) - printHelper.AddFrameworkElementToPrint(grid) - Next - - Await printHelper.ShowPrintUIAsync("Windows Community Toolkit Sample App", printHelperOptions) -``` - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| --- | --- | -| Namespace | Microsoft.Toolkit.Uwp | -| NuGet package | [Microsoft.Toolkit.Uwp](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp/) | - -## API - -* [Print Helper source code](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp/Helpers/PrintHelper/) diff --git a/docs/helpers/StorageFiles.md b/docs/helpers/StorageFiles.md deleted file mode 100644 index ea4ac01b908..00000000000 --- a/docs/helpers/StorageFiles.md +++ /dev/null @@ -1,116 +0,0 @@ ---- -title: StorageFileHelper -author: nmetulev -description: The StorageFileHelper is a static utility class that provides functions to help with reading and writing of text and bytes to the disk. These functions are all wrapped into Async tasks. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, StorageFileHelper -dev_langs: - - csharp - - vb ---- - -# StorageFileHelper - -The [StorageFileHelper](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.helpers.storagefilehelper) is a static utility class that provides functions to help with reading and writing of text and bytes to the disk. These functions are all wrapped into Async tasks. - -## Syntax - -```csharp -// NOTE This must be used from an async function -string myText = "Great information that the users wants to keep"; -StorageFolder localFolder = Windows.Storage.ApplicationData.Current.LocalFolder; - -// Save some text to a file named appFilename.txt (in the local cache folder) -var storageFile = await StorageFileHelper.WriteTextToLocalCacheFileAsync(myText, "appFilename.txt"); - -// Load some text from a file named appFilename.txt in the local cache folder -string loadedText = await StorageFileHelper.ReadTextFromLocalCacheFileAsync("appFilename.txt"); - -// Save some text to a file named appFilename.txt (in the local folder) -storageFile = await StorageFileHelper.WriteTextToLocalFileAsync(myText, "appFilename.txt"); - -// Load some text from a file named appFilename.txt in the local folder -loadedText = await StorageFileHelper.ReadTextFromLocalFileAsync("appFilename.txt"); - -// Check if a file exists in a specific folder -bool exists = await localFolder.FileExistsAsync("appFilename.txt"); - -// Check if a file exists in a specific folder or in one of its subfolders -bool exists = await localFolder.FileExistsAsync("appFilename.txt", true); - -// Check if a file name is valid or not -bool isFileNameValid = StorageFileHelper.IsFileNameValid("appFilename.txt"); - -// Check if a file path is valid or not -bool isFilePathValid = StorageFileHelper.IsFilePathValid("folder/appFilename.txt"); -``` -```vb -' NOTE This must be used from an async function -Dim myText As String = "Great information that the users wants to keep" -Dim localFolder As StorageFolder = Windows.Storage.ApplicationData.Current.LocalFolder - -' Save some text to a file named appFilename.txt (in the local cache folder) -Dim storageFile = Await StorageFileHelper.WriteTextToLocalCacheFileAsync(myText, "appFilename.txt") - -' Load some text from a file named appFilename.txt in the local cache folder -Dim loadedText As String = Await StorageFileHelper.ReadTextFromLocalCacheFileAsync("appFilename.txt") - -' Save some text to a file named appFilename.txt (in the local folder) -storageFile = Await StorageFileHelper.WriteTextToLocalFileAsync(myText, "appFilename.txt") - -' Load some text from a file named appFilename.txt in the local folder -loadedText = Await StorageFileHelper.ReadTextFromLocalFileAsync("appFilename.txt") - -' Check if a file exists in a specific folder -Dim exists As Boolean = Await localFolder.FileExistsAsync("appFilename.txt") - -' Check if a file exists in a specific folder or in one of its subfolders -Dim exists As Boolean = Await localFolder.FileExistsAsync("appFilename.txt", True) - -' Check if a file name is valid or not -Dim isFileNameValid As Boolean = StorageFileHelper.IsFileNameValid("appFilename.txt") - -' Check if a file path is valid or not -Dim isFilePathValid As Boolean = StorageFileHelper.IsFilePathValid("folder/appFilename.txt") -``` - -## Methods - -| Methods | Return Type | Description | -| -- | -- | -- | -| FileExistsAsync(StorageFolder, String, Boolean) | Task | Gets a value indicating whether a file exists in the current folder | -| IsFileNameValid(String) | bool | Gets a value indicating whether a filename is correct or not using the Storage feature | -| IsFilePathValid(String) | bool | Gets a value indicating whether a file path is correct or not using the Storage feature | -| ReadBytesAsync(StorageFile) | Task | Gets an array of bytes from a `StorageFile` | -| ReadBytesFromFileAsync(StorageFolder, String) | Task | Gets an array of bytes from a `StorageFile` located in the given `StorageFolder` | -| ReadBytesFromKnownFoldersFileAsync(KnownFolderId, String) | Task | Gets an array of bytes from a `StorageFile` located in a well known folder | -| ReadBytesFromLocalCacheFileAsync(String) | Task | Gets an array of bytes from a `StorageFile` located in the application local cache folder | -| ReadBytesFromLocalFileAsync(String) | Task | Gets an array of bytes from a `StorageFile` located in the application local folder | -| ReadBytesFromPackagedFileAsync(String) | Task | Gets an array of bytes from a `StorageFile` located in the application installation folder | -| ReadTextFromFileAsync(StorageFolder, String) | Task | Gets a string value from a `StorageFile` located in the given `StorageFolder` | -| ReadTextFromKnownFoldersFileAsync(KnownFolderId, String) | Task | Gets a string value from a `StorageFile` located in a well known folder | -| ReadTextFromLocalCacheFileAsync(String) | Task | Gets a string value from a `StorageFile` located in the application local cache folder | -| ReadTextFromLocalFileAsync(String) | Task | Gets a string value from a `StorageFile` located in the application local folder | -| ReadTextFromPackagedFileAsync(String) | Task | Gets a string value from a `StorageFile` located in the application installation folder | -| WriteBytesToFileAsync(StorageFolder, Byte[], String, CreationCollisionOption) | Task | Saves an array of bytes to a `StorageFile` in the given `StorageFolder` | -| WriteBytesToKnownFolderFileAsync(KnownFolderId, Byte[], String, CreationCollisionOption) | Task | Saves an array of bytes to a `StorageFile` to well known folder | -| WriteBytesToLocalCacheFileAsync(Byte[], String, CreationCollisionOption) | Task | Saves an array of bytes to a `StorageFile` to application local cache folder | -| WriteBytesToLocalFileAsync(Byte[], String, CreationCollisionOption) | Task | Saves an array of bytes to a `StorageFile` to application local folder | -| WriteTextToFileAsync(StorageFolder, String, String, CreationCollisionOption) | Task | Saves a string value to a `StorageFile` in the given `StorageFolder` | -| WriteTextToKnownFolderFileAsync(KnownFolderId, String, String, CreationCollisionOption) | Task | Saves a string value to a Windows.Storage.StorageFile in well known folder | -| WriteTextToLocalCacheFileAsync(String, String, CreationCollisionOption) | Task | Saves a string value to a Windows.Storage.StorageFile in application local cache folder | -| WriteTextToLocalFileAsync(String, String, CreationCollisionOption) | Task | Saves a string value to a Windows.Storage.StorageFile in application local folder | - -## Sample Code - -You can find more examples in our [unit tests](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/UnitTests/Helpers/Test_StorageFileHelper.cs) - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| --- | --- | -| Namespace | Microsoft.Toolkit.Uwp | -| NuGet package | [Microsoft.Toolkit.Uwp](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp/) | - -## API - -* [Storage File Helper source code](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp/Helpers/StorageFileHelper.cs) diff --git a/docs/helpers/Streams.md b/docs/helpers/Streams.md deleted file mode 100644 index a940148ee19..00000000000 --- a/docs/helpers/Streams.md +++ /dev/null @@ -1,83 +0,0 @@ ---- -title: Streams Helper -author: nmetulev -description: There are several operations that apps need commonly to do against their APPX, or from the Internet that are not easy. This helper class wraps up some of the most common operations we need in multiple apps. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, Streams -dev_langs: - - csharp - - vb ---- - -# Streams Helper - -There are several operations that apps need commonly to do against their APPX, or from the Internet that are not easy. [Streams helper](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.helpers.streamhelper) class wraps up some of the most common operations we need in multiple apps. - -## Some common scenarios - -* Get a stream from a URI using an in memory stream (rather than needing to download it first). -* Download a URI and write it to a local storage file. -* Get a packaged file stream (files included in the APPX as *Content - do not copy*). -* Does a file exist local folder? -* Read text from a file using ASCII or specified encoding. - -## Methods - -| Methods | Return Type | Description | -| -- | -- | -- | -| GetHttpStreamAsync(Uri, CancellationToken) | Task | Get the response stream returned by a HTTP get request | -| GetHttpStreamToStorageFileAsync(Uri, StorageFile) | Task | Get the response stream returned by a HTTP get request and save it to a local file | -| GetKnowFoldersFileStreamAsync(KnownFolderId, String, FileAccessMode) | Task | Return a stream to a specified file from the application local cache folder | -| GetLocalCacheFileStreamAsync(String, FileAccessMode) | Task | Return a stream to a specified file from the application local cache folder | -| GetLocalFileStreamAsync(String, FileAccessMode) | Task | Return a stream to a specified file from the application local folder | -| GetPackagedFileStreamAsync(String, FileAccessMode) | Task | Return a stream to a specified file from the installation folder | -| IsFileExistsAsync(StorageFolder, String) | Task | Test if a file exists in the application local folder | -| IsKnownFolderFileExistsAsync(KnownFolderId, String) | Task | Test if a file exists in the application local cache folder | -| IsLocalCacheFileExistsAsync(String) | Task | Test if a file exists in the application local cache folder | -| IsLocalFileExistsAsync(String) | Task | Test if a file exists in the application local folder | -| IsPackagedFileExistsAsync(String) | Task | Test if a file exists in the application installation folder | -| ReadTextAsync(IRandomAccessStream, Encoding) | Task | Read stream content as a string | - -## Example - -```csharp -// Get access to a text file that was included in solution as Content | do not copy local -using (var stream = await StreamHelper.GetPackagedFileStreamAsync("Assets/Sub/test.txt")) -{ - // Read the contents as ASCII text - var readText = await stream.ReadTextAsync(); -} - -// Get access to a HTTP resource -using (var stream = await StreamHelper.GetHttpStreamAsync(new Uri("http://dev.windows.com"))) -{ - ... -} -``` -```vb -' Get access to a text file that was included in solution as Content | do not copy local -Using stream = Await StreamHelper.GetPackagedFileStreamAsync("Assets/Sub/test.txt") - ' Read the contents as ASCII text - Dim readText = Await stream.ReadTextAsync() - ... -End Using - -' // Get access to a HTTP resource -Using stream = Await StreamHelper.GetHttpStreamAsync(New Uri("http://dev.windows.com")) - ... -End Using -``` - -## Sample Code - -You can find more examples in our [unit tests](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/UnitTests/Helpers/Test_StreamHelper.cs) - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| --- | --- | -| Namespace | Microsoft.Toolkit.Uwp | -| NuGet package | [Microsoft.Toolkit.Uwp](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp/) | - -## API Source Code - -* [Stream Helper source code](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp/Helpers/StreamHelper.cs) diff --git a/docs/helpers/SystemInformation.md b/docs/helpers/SystemInformation.md deleted file mode 100644 index c7036929415..00000000000 --- a/docs/helpers/SystemInformation.md +++ /dev/null @@ -1,55 +0,0 @@ ---- -title: SystemInformation -author: nmetulev -description: The SystemInformation class is a static utility class that provides properties with some system, application and device information. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, SystemInformation ---- - -# SystemInformation - -The [SystemInformation](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.helpers.systeminformation?view=uwp-toolkit-dotnet) class is a static utility class that provides properties with some system, application and device information. - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| ApplicationName | string | Gets the application's name as a `string` | -| ApplicationVersion | [PackageVersion](https://docs.microsoft.com/uwp/api/Windows.ApplicationModel.PackageVersion) | Gets the application's version as a [PackageVersion](https://msdn.microsoft.com/library/windows/apps/xaml/windows.applicationmodel.packageversion.aspx) | -| AppUptime | TimeSpan | Gets the length of time this instance of the app has been running. | -| AvailableMemory | float | Gets the available memory in _MB_ as a `float` | -| Culture | CultureInfo | Gets the most preferred language by the user as a [CultureInfo](https://msdn.microsoft.com/library/windows/apps/xaml/system.globalization.cultureinfo(v=vs.105).aspx) | -| DeviceFamily | string | Gets the family of used device as a `string`. Common `DeviceFamily` values include: Windows.Desktop, Windows.Mobile, Windows.Xbox, Windows.Holographic, Windows.Team, Windows.IoT. Prepare your code for other values | -| DeviceManufacturer | string | Gets the name of device manufacturer as a `string`. The value will be empty if the device manufacturer couldn't be determined (ex: when running in a virtual machine). | -| DeviceModel | string | Gets the model of the device as a `string`. The value will be empty if the device model couldn't be determined (ex: when running in a virtual machine). | -| FirstUseTime | DateTime | Gets the DateTime (in UTC) that the app as first used. | -| FirstVersionInstalled | [PackageVersion](https://docs.microsoft.com/uwp/api/Windows.ApplicationModel.PackageVersion) | Gets the first version of the app that was installed. | -| IsFirstRun | bool | Gets a value indicating whether the app is being used for the first time since it was installed. | -| IsAppUpdated | bool | Gets a value indicating whether the app is being used for the first time since being upgraded from an older version. | -| LastLaunchTime | DateTime | Gets the DateTime (in UTC) that this was previously launched. | -| LastResetTime | DateTime | Gets the DateTime (in UTC) when the launch count was previously reset. | -| LaunchCount | long | Gets the number of times the app has been launched since the last reset. | -| LaunchTime | DateTime | Gets the DateTime (in UTC) that this instance of the app was launched. | -| OperatingSystem | string | Gets the operating system as a `string` | -| OperatingSystemArchitecture | [ProcessorArchitecture](https://msdn.microsoft.com/library/windows/apps/windows.system.processorarchitecture) | Gets used processor architecture as `ProcessorArchitecture` | -| OperatingSystemVersion | [OSVersion](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.helpers.osversion) | Gets the operating system version (for example 10.0.10586.0) as `OSVersion` structure | -| TotalLaunchCount | long | Gets the number of times the app has been launched. | - -## Methods - -| Method | Return Type | Description | -| ------ | ----------- | -- | -| AddToAppUptime(TimeSpan) | void | Add to the record of how long the app has been running. Use this to optionally include time spent in background tasks or extended execution | -| LaunchStoreForReviewAsync() | Task | Launch the store app so the user can leave a review. | -| ResetLaunchCount() | void | Reset launch count so you can get launch count from a new perspective | -| TrackAppUse() | void | Track app launch time and count. | - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| --- | --- | -| Namespace | Microsoft.Toolkit.Uwp | -| NuGet package | [Microsoft.Toolkit.Uwp](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp/) | - -## API - -* [SystemInformation source code](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp/Helpers/SystemInformation.cs) diff --git a/docs/helpers/ThemeListener.md b/docs/helpers/ThemeListener.md deleted file mode 100644 index 997d7fbe23a..00000000000 --- a/docs/helpers/ThemeListener.md +++ /dev/null @@ -1,66 +0,0 @@ ---- -title: Theme Listener -author: williamabradley -description: The Theme Listener allows you to determine the current Application Theme, and when it is changed via System Theme changes. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, theme listener, themeing, themes, system theme, helpers -dev_langs: - - csharp - - vb ---- - -# Theme Listener - -The [Theme Listener](https://docs.microsoft.com/en-us/dotnet/api/microsoft.toolkit.uwp.ui.themelistener) class allows you to determine the current Application Theme, and when it is changed via System Theme changes. - -## Syntax - -```csharp -var Listener = new ThemeListener(); -Listener.ThemeChanged += Listener_ThemeChanged; - -private void Listener_ThemeChanged(ThemeListener sender) -{ - var theme = sender.CurrentTheme; - // Use theme dependent code. -} -``` -```vb -Dim listener = New ThemeListener() -AddHandler listener.ThemeChanged, AddressOf Listener_ThemeChanged - -Private Sub Listener_ThemeChanged(ByVal sender As ThemeListener) - Dim theme = sender.CurrentTheme - ' Use theme dependent code. -End Sub -``` - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| CurrentTheme | [ApplicationTheme](https://docs.microsoft.com/uwp/api/Windows.UI.Xaml.ApplicationTheme) | Gets or sets the Current Theme. | -| CurrentThemeName | string | Gets the Name of the Current Theme. | -| IsHighContrast | bool | Gets or sets a value indicating whether the current theme is high contrast. | - -## Events - -| Events | Description | -| -- | -- | -| ThemeChanged | An event that fires if the Theme changes. | - -## Sample Code - -[Theme Listener Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/ThemeListener/ThemeListenerPage.xaml.cs). - -You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| --- | --- | -| Namespace | Microsoft.Toolkit.Uwp.UI | -| NuGet package | [Microsoft.Toolkit.Uwp.UI](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI/) | - -## API Source Code - -- [Theme Listener source code](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.UI/Helpers/ThemeListener.cs) \ No newline at end of file diff --git a/docs/helpers/WeakEventListener.md b/docs/helpers/WeakEventListener.md deleted file mode 100644 index dfc18a514c2..00000000000 --- a/docs/helpers/WeakEventListener.md +++ /dev/null @@ -1,39 +0,0 @@ ---- -title: WeakEventListener -author: nmetulev -description: The WeakEventListener allows the owner to be garbage collected if its only remaining link is an event handler. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, WeakEventListener ---- - -# WeakEventListener - -The [WeakEventListener](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.helpers.weakeventlistener-3) allows the owner to be garbage collected if its only remaining link is an event handler. - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| OnDetachAction | WeakEventListener> | Gets or sets the method to call when detaching from the event | -| OnEventAction | Action | Gets or sets the method to call when the event fires | - -## Methods - -| Methods | Return Type | Description | -| -- | -- | -- | -| Detach() | void | Detaches from the subscribed event | -| OnEvent(TSource, TEventArgs) | void | Handler for the subscribed event calls OnEventAction to handle it | - -## Sample Code - -You can find examples of WeakEventListener in our [unit tests](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/UnitTests/Helpers/Test_WeakEventListener.cs) - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| --- | --- | -| Namespace | Microsoft.Toolkit.Uwp | -| NuGet package | [Microsoft.Toolkit.Uwp](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp/) | - -## API Source Code - -* [WeakEventListener source code](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp/Helpers/WeakEventListener.cs) diff --git a/docs/index.md b/docs/index.md deleted file mode 100644 index 134aeef215a..00000000000 --- a/docs/index.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -title: Windows Community Toolkit Documentation -author: nmetulev -ms.topic: overview -description: The Windows Community Toolkit is a collection of helper functions, custom controls, and app services. It simplifies and demonstrates common developer tasks building UWP apps for Windows 10. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit ---- - -# Windows Community Toolkit Documentation - -The Windows Community Toolkit is a collection of helper functions, custom controls, and app services. It simplifies and demonstrates common developer tasks building UWP apps for Windows 10. - -The toolkit can be used to build apps for any Windows 10 device, including PC, Mobile, Xbox, IoT and HoloLens. You can also use the toolkit with an existing desktop app converted to UWP using the Desktop Bridge. - -The Windows Community Toolkit is available as a Visual Studio NuGet package for new or existing C# and VB.NET projects. Read the [Getting Started](Getting-Started.md) page for all the details. - -You can also preview the capabilities of the toolkit by downloading the [Windows Community Toolkit Sample App](http://aka.ms/uwptoolkitapp) in the Windows Store. - -Feel free to browse the documentation using the table of contents on the left side of this page. - -## Open Source - -[Windows Community Toolkit Source Code ](http://aka.ms/uwptoolkit) - -Built as an open source project hosted on GitHub with support from the community. diff --git a/docs/knownissues.md b/docs/knownissues.md deleted file mode 100644 index ea378d68ced..00000000000 --- a/docs/knownissues.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -title: Windows Community Toolkit Known Issues -author: nmetulev -description: The Windows Community Toolkit is a collection of helper functions, custom controls, and app services. It simplifies and demonstrates common developer tasks building UWP apps for Windows 10. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, known issues ---- - -# Windows Community Toolkit Known Issues - -> [!NOTE] -For an accurate list of known bugs and issues, take a look at the [issues on GitHub](https://github.com/Microsoft/WindowsCommunityToolkit//issues) - - -## Controls - -### InfiniteCanvas -* InfiniteCanvas is not supported on Creators Update - [see issue for details](https://github.com/Microsoft/WindowsCommunityToolkit/issues/2162) - -### ScrollHeader -* ScrollHeader with `Mode="Sticky"` inside a ListView with grouped items causes the groups' headers to be displayed in front of the header - [see issue for details](https://github.com/Microsoft/WindowsCommunityToolkit//issues/1446) - -### WebView -For the complete list of issues and limitations in this release of the **WebView** control, see [Known Issues of the WebView control for Windows Forms and WPF applications](controls/wpf-winforms/WebView-known-issues.md). - -## Extensions - -### TextBoxRegEx -* Some phone number formats are not supported - [see issue for details](https://github.com/Microsoft/WindowsCommunityToolkit//issues/1821) - -## Xaml Islands - -### WindowsXamlHost (Windows Forms) -* Windows Forms app using WindowsXamlHost crashes when focus is changed away and back to the app - [see issue for details](https://github.com/Microsoft/WindowsCommunityToolkit/issues/2491) \ No newline at end of file diff --git a/docs/license.md b/docs/license.md deleted file mode 100644 index 5cc93eb771e..00000000000 --- a/docs/license.md +++ /dev/null @@ -1,12 +0,0 @@ - -#The MIT License (MIT) - -Copyright (c) .NET Foundation and Contributors - -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/docs/notifications/NotificationsOverview.md b/docs/notifications/NotificationsOverview.md deleted file mode 100644 index 057b48b0f3d..00000000000 --- a/docs/notifications/NotificationsOverview.md +++ /dev/null @@ -1,44 +0,0 @@ ---- -title: Notifications Overview -author: nmetulev -description: Instead of having to deal with XML, you can now use Windows Community toolkit and its notification extensions to work with Tiles and notifications using a complete object model. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, adaptive live tiles, interactive toast, tiles, notifications ---- - -# Notifications Overview - -Adaptive Live Tiles and interactive Toasts are key engagement components of a UWP Application on Windows 10. -Instead of having to deal with XML, you can now use Windows Community toolkit and its notification extensions to work with Tiles and notifications using a complete object model. - -## Tiles - -| Documentation | -| --- | -| [Adaptive Tile Notifications](https://blogs.msdn.microsoft.com/tiles_and_toasts/2015/06/30/adaptive-tile-templates-schema-and-documentation/) | -| [Quickstart: Sending a local Tile notification](https://blogs.msdn.microsoft.com/tiles_and_toasts/2015/10/05/quickstart-sending-a-local-tile-notification-in-windows-10/) | - -## Sample Output - -![LiveTile](../resources/images/Notifications/LiveTile.gif) - -## Toasts - -| Documentation | -| --- | -| [Interactive Toast Notifications](https://blogs.msdn.microsoft.com/tiles_and_toasts/2015/07/02/adaptive-and-interactive-toast-notifications-for-windows-10/) | -| [Quickstart: Sending a local Toast notification](https://blogs.msdn.microsoft.com/tiles_and_toasts/2015/07/08/quickstart-sending-a-local-toast-notification-and-handling-activations-from-it-windows-10/) | - -## Sample Output - -![Toast](../resources/images/Notifications/PopToast.gif "Toast") - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| --- | --- | -| Namespace for C# | Microsoft.Toolkit.Uwp.Notifications | -| Namespace for JavaScript | Microsoft.Toolkit.Uwp.Notifications.Javascript | - -## API - -* [Notifications source code](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Notifications/Microsoft.Toolkit.Uwp.Notifications.UWP) diff --git a/docs/parsers/MarkdownParser.md b/docs/parsers/MarkdownParser.md deleted file mode 100644 index 96059af2721..00000000000 --- a/docs/parsers/MarkdownParser.md +++ /dev/null @@ -1,89 +0,0 @@ ---- -title: Markdown Parser -author: williamabradley -description: The Markdown Parser allows you to parse a Markdown String into a Markdown Document, and then Render it with a Markdown Renderer. -keywords: windows community toolkit, uwp community toolkit, uwp toolkit, microsoft community toolkit, microsoft toolkit, markdown, markdown parsing, parser, markdown rendering -dev_langs: - - csharp - - vb ---- - -# Markdown Parser - -The [MarkdownDocument](https://docs.microsoft.com/en-us/dotnet/api/microsoft.toolkit.parsers.markdown.markdowndocument) class allows you to parse a Markdown String into a Markdown Document, and then Render it with a Markdown Renderer. - -## Example - -```csharp -string md = "This is **Markdown**"; -MarkdownDocument document = new MarkdownDocument(); -document.Parse(md); - -// Takes note of all of the Top Level Headers. -foreach (var element in document.Blocks) -{ - if (element is HeaderBlock header) - { - Console.WriteLine($"Header: {header.ToString()}"); - } -} -``` -```vb -Dim md As String = "This is **Markdown**" -Dim document As MarkdownDocument = New MarkdownDocument() -document.Parse(md) - -For Each element In document.Blocks - If TypeOf element Is HeaderBlock Then - Console.WriteLine($"Header: {element.ToString()}") - End If -Next -End Sub -``` - -## Classes - -| Class | Purpose | -| --- | --- | -| **Microsoft.Toolkit.Parsers.Markdown.MarkdownDocument** | Represents a Markdown Document. | -| **Microsoft.Toolkit.Parsers.Markdown.Render.MarkdownRendererBase** | A base renderer for Rendering Markdown into Controls. | - -### MarkdownDocument - -#### Properties - -| Property | Type | Description | -| -- | -- | -- | -| Blocks | IList\ | Gets or sets the list of block elements. | - -#### Methods - -| Methods | Return Type | Description | -| -- | -- | -- | -| Parse(string) | void | Parses markdown document text. | -| LookUpReference(string) | LinkReferenceBlock | Looks up a reference using the ID. | - -## Create a Markdown Renderer - -In order to create a Markdown Renderer, you can either implement your own, or inherit from `MarkdownRenderBase`, this class already has all the required methods, and some assistive code to make implementing a Renderer easy, all you have to do is implement the Block and Inline Rendering, and the output. - -This requires an inherited `IRenderContext`, which allows you to keep track of the Context of the rendering. - -The best way to figure out how to create a Renderer, is to look at the [implementation](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.UI.Controls/MarkdownTextBlock/Render) for the UWP MarkdownTextBlock control. - -## Sample Code - -[Markdown Parser Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/MarkdownParser/MarkdownParserPage.xaml.cs). - -You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Requirements - -| Implementation | .NET Standard 1.4. | -| -- | -- | -| Namespace | Microsoft.Toolkit.Parsers | -| NuGet package | [Microsoft.Toolkit.Parsers](https://www.nuget.org/packages/Microsoft.Toolkit.Parsers/) | - -## API Source Code - -- [Markdown Parser source code](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Parsers/Markdown) \ No newline at end of file diff --git a/docs/parsers/RSSParser.md b/docs/parsers/RSSParser.md deleted file mode 100644 index 92fa9aad73a..00000000000 --- a/docs/parsers/RSSParser.md +++ /dev/null @@ -1,95 +0,0 @@ ---- -title: RSS Parser -author: williamabradley -description: The RSS Parser allows you to parse an RSS content String into an RSS Schema. -keywords: windows community toolkit, uwp community toolkit, uwp toolkit, microsoft community toolkit, microsoft toolkit, rss, rss parsing, parser -dev_langs: - - csharp - - vb ---- - -# RSS Parser - -The [RssParser](https://docs.microsoft.com/en-us/dotnet/api/microsoft.toolkit.parsers.rss.rssparser) class allows you to parse an RSS content String into an RSS Schema. - -## Example - -```csharp -public async void ParseRSS() -{ - string feed = null; - - using (var client = new HttpClient()) - { - try - { - feed = await client.GetStringAsync("https://visualstudiomagazine.com/rss-feeds/news.aspx"); - } - catch { } - } - - if (feed != null) - { - var parser = new RssParser(); - var rss = parser.Parse(feed); - - foreach (var element in rss) - { - Console.WriteLine($"Title: {element.Title}"); - Console.WriteLine($"Summary: {element.Summary}"); - } - } -} -``` -```vb -Public Async Sub ParseRSS() - Dim feed As String = Nothing - Using client = New HttpClient() - Try - feed = Await client.GetStringAsync("https://visualstudiomagazine.com/rss-feeds/news.aspx") - Catch - End Try - End Using - - If feed IsNot Nothing Then - Dim parser = New RssParser() - Dim rss = parser.Parse(feed) - For Each element In rss - Console.WriteLine($"Title: {element.Title}") - Console.WriteLine($"Summary: {element.Summary}") - Next - End If -End Sub -``` - -## Classes - -| Class | Purpose | -| --- | --- | -| **Microsoft.Toolkit.Parsers.Rss.RssParser** | Parser for Parsing RSS Strings into RSS Schema. | -| **Microsoft.Toolkit.Parsers.Rss.RssSchema** | Schema for Parsing RSS. | - -### RssParser - -#### Methods - -| Methods | Return Type | Description | -| -- | -- | -- | -| Parse(string) | IEnumerable\ | Parse an RSS content string into RSS Schema. | - -## Sample Code - -[RSS Parser Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit//blob/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/RssParser/RssParserPage.xaml.cs). - -You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Requirements - -| Implementation | .NET Standard 1.4. | -| -- | -- | -| Namespace | Microsoft.Toolkit.Parsers | -| NuGet package | [Microsoft.Toolkit.Parsers](https://www.nuget.org/packages/Microsoft.Toolkit.Parsers/) | - -## API Source Code - -- [RSS Parser source code](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Parsers/Rss) \ No newline at end of file diff --git a/docs/platform-specific/PlatformSpecificAnalyzer.md b/docs/platform-specific/PlatformSpecificAnalyzer.md deleted file mode 100644 index 1f5ca2b7cee..00000000000 --- a/docs/platform-specific/PlatformSpecificAnalyzer.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -title: UWP Platform Specific Analyzer -author: hermitdave -description: Platform Specific Analyzer is a Roslyn analyzer that analyzes and suggests code fixes to ensure that any version / platform specific API are guarded by correct runtime checks -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, platform specific, platform specific analyzer, roslyn analyzer -dev_langs: - - csharp - - visualbasic ---- - -# Platform Specific Analyzer - -When writing [version](https://docs.microsoft.com/windows/uwp/debug-test-perf/version-adaptive-code) or platform adaptive code, the developers should ensure that code checks for presence of API before calling it. -The platform specific analyzer is a Roslyn Analyzer that can parse through code and suggest fixes where appropriate. - -## Installation - -The analyzer is available both as a nuget package - -* References > Manage NuGet References > install [Microsoft.Toolkit.Uwp.PlatformSpecificAnalyzer](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.PlatformSpecificAnalyzer) - - -## Sample Output - -The analyzer automatically kicks in when code is opened in Visual Studio and supports both C# and Visual Basic - -C# -![Code Analysis](../resources/images/CodeAnalysis.png) - -![Code Analysis](../resources/images/CodeFixSuggestion.png) - -Visual Basic -![Code Analysis](../resources/images/CodeAnalysisVB.png) - -![Code Analysis](../resources/images/CodeFixSuggestionVB.png) - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| ---------------------------------------------------------------- | ----------------------------------- | -| Namespace | Microsoft.Toolkit.Uwp.PlatformSpecificAnalyzer | -| NuGet package | [Microsoft.Toolkit.Uwp.PlatformSpecificAnalyzer](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.PlatformSpecificAnalyzer/) | - -## API Source Code - -- [Platform Specific Analyzer](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.PlatformSpecificAnalyzer) - -## Related Topics - - - -- [Platform Specific Differences Generator](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.platformspecificanalyzerdifferencesgen) diff --git a/docs/platform-specific/PlatformSpecificDifferencesGenerator.md b/docs/platform-specific/PlatformSpecificDifferencesGenerator.md deleted file mode 100644 index 3299f37da53..00000000000 --- a/docs/platform-specific/PlatformSpecificDifferencesGenerator.md +++ /dev/null @@ -1,49 +0,0 @@ ---- -title: UWP Platform Specific Differences Generator -author: hermitdave -description: Given the min and max SDK versions, the generator loads the appropriate Windows.Foundation.UniversalApiContract.winmd and builds differences in terms of new types and new members. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, platform specific, platform specific differences, platform specific differences generator -dev_langs: - - csharp ---- - -# Platform Specific Differences Generator - -A Platform Specific Analyzer would require to know the differences between various versions of UWP SDK. The Differences Generator provides a means of generating a differences dataset that can then be embedded in the analyzer. - -## Usage - -```cmd -DifferencesGen /min:4.0.0.0 /max:6.0.0.0 -``` - -## Sample Output - -Differences-6.0.0.0.gz - -Differences-5.0.0.0.gz - -## Data format - -All types are fully qualified - -##### Namespace.Type -*Windows.Management.Update.PreviewBuildsState* - -*Windows.Management.Update.PreviewBuildsManager* - -A new type does not have additional methods and properties listed. - -For a type that has additions, the additions are listed alongside -##### Namespace.Type:Method#ParamCount,Property -*Windows.Networking.NetworkOperators.MobileBroadbandModem:TryGetPcoAsync#0,IsInEmergencyCallMode* - -## API Source Code - -- [DifferencesGen](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.PlatformDifferencesGen/Program.cs) - -## Related Topics - - - -- [Platform Specific Analyzer](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.ui.platformspecificanalyzer) diff --git a/docs/resources/css/main.css b/docs/resources/css/main.css deleted file mode 100644 index 6c084f2df0e..00000000000 --- a/docs/resources/css/main.css +++ /dev/null @@ -1,1524 +0,0 @@ -body { - - font-size: 11pt; - - margin: 0; - - padding: 0; - - font-weight: 400; - -} - -h1 { - - font-size: 2.87em; - - font-weight: 100; - - margin-bottom: 32px; - - margin-top: 44px; - -} - - - -h2 { - - font-size: 1.9em; - - font-weight: 100; - -} - - - -h2 .step { - - border: 1px solid #505050; - - border-radius: 50%; - - display: inline-block; - - height: 1.5em; - - width: 1.5em; - - line-height: 1.4; - - margin-right: 10px; - - text-align: center; - -} - - - -h3 { - - font-size: 1.5em; - - margin-bottom: 20px; - -} - - - -h4 { - - font-size: 1.17em; - -} - - - -p { - - margin-bottom: 20px; - -} - - - -li { - - margin-bottom: 20px; - -} - - - -.hidden { - - display: none; - -} - - - -.default-body { - - background-color: #fff; - -} - - - -.default-main { - - width: 100%; - -} - - - -.default-max-width { - - max-width: 1440px; - - margin: 0 auto; - -} - - - -.content-container, .content-container > .row > h1 + div { - - padding-left: 0; - - padding-right: 0; - -} - - - - .content-container > .row { - - margin-left: 0; - - margin-right: 0; - - } - - -.chrome-header-wrapper .shell-header-wrapper, .chrome-footer-wrapper .shell-footer-wrapper, .shell-category-nav { - - max-width: 1440px !important; - -} - - -.btn { - - border-radius: 0; - -} - - - -a:link else, a:visited { - - color: #0078D7; - -} - - - -a:link { - - color: #006cd8; - -} - - - -.bold { - - font-weight: bold; - - font-size: 18px; - -} - - -a:hover { - - text-decoration: none; - -} - - - -.image-border { - - border: 1px solid rgb(225,225,225); - -} - - - -.device { - - padding-left: 0; - -} - - - -.section-heading { - - margin-bottom: 50px; - -} - -.faq-h2 { - - background-color: #9E9E9E; - - color: #fff; - - padding: 10px; - - margin-bottom: 20px; - -} - - - -.faq-nav { - - position: fixed; - -} - - - - .faq-nav > a > h4 { - - margin-bottom: 20px; - - } - - -.highlight { - - background-color: #9E9E9E; - - color: #fff; - - padding: 10px; - - margin-top: 20px; - - margin-bottom: 20px; - - border-radius: 0; - -} - - - -.inactive { - - color: #BFBFBF; - -} - -.active { - - color: #000; - -} - -.steps { - - font-weight: lighter; - -} - - - -h4.steps:hover { - - color: #000; - -} - - - -h3.steps:hover { - - color: #000; - -} - - - -h2.steps:hover { - - color: #000; - -} - - - -.downloads-background { - - background-color: #f1f1f1; - - width: 100%; - - margin-left: 0; - - margin-right: 0; - - margin-bottom: 50px; - - padding: 20px; - -} - - - -.standardTH { - - width: 40%; - -} - - - -.largeTH { - - width: 85% !important; - -} - - - -.table-striped > tbody > tr > th { - - border-color: transparent; - -} - - - -.table-striped > tbody > tr > td { - - border-color: transparent; - -} - - - -.bottom-border { - - border-bottom: 1px solid rgb(230,230,230); - - padding-bottom: 10px; - -} - - - -h1.thin-header { - - font-weight: 100; - - font-size: 40px; - - margin-bottom: 20px; - -} - - - -h2.thin-header { - - font-weight: lighter; - - font-size: 32px; - -} - - - -h3.thin-header { - - font-weight: lighter; - - border-bottom: 1px solid rgb(230,230,230); - - padding-bottom: 10px; - - margin-top: 10px; - - margin-bottom: 20px; - - font-size: 32px; - -} - - - -h4.thin-header { - - font-weight: lighter; - - font-size: 32px; - - border-top: 1px solid rgb(230,230,230); - - padding-top: 20px; - - margin-top: 20px; - -} - - - -p.thin-header { - - font-size: 18px; - - margin-bottom: 20px; - -} - - - -table.maker-kit > tbody > tr:nth-of-type(odd) { - - background-color: rgb(241,241,242); - -} - - - -table.maker-kit > tbody > tr > th { - - font-weight: 200; - - color: rgb(000,000,000); - -} - - - -ul.maker-kit > li > a > h3 { - - text-align: left; - -} - - - -.floatTop { - - margin-top: 16%; - -} - - - -ul.maker-kit > li > a { - - padding-left: 0; - -} - - - -img.maker-kit { - - margin-bottom: 20px; - - max-width: 100%; - - max-height: 100%; - -} - - - -.lineTop { - - border-top: 1px solid rgb(230,230,230); - -} - - - -iframe.maker-kit { - - padding-left: 15px; - - padding-right: 15px; - - border: none; - - overflow: hidden; - -} - - - -.col-3-image { - - height: 147px; - - margin-left: auto; - - margin-right: auto; - -} - - - - - -.projectRow { - - margin-top: 20px; - - margin-bottom: 20px; - -} - - - - .projectRow > div > h2 { - - margin-top: 30%; - - } - - - -.button-flat { - - border-radius: 0; - - display: inline-block; - - font-size: 1em; - - font-weight: 400; - - line-height: normal; - - padding: .5em 1.5em; - - margin-right: 0.8em; - - min-width: 100%; - - margin-bottom: 0.8em; - - text-align: center; - -} - - - -.button-blue { - - border-style: solid; - - border-width: 2px; - - border-color: #0078d7; - - background-color: #0078d7; - - color: #fff !important; - -} - - - -.button-flat:hover { - - border-color: #004E8C; - - cursor: pointer; - -} - - - -.button-flat:active { - - background-color: gray !important; - - border-color: gray !important; - -} - - - -.section-title { - - margin-top: 0px; - -} - - - -.comparison-picture { - - width: 324px; - - height: 231px; - -} - - - -.subtext { - - color: gray; - - margin-bottom: 64px; - - margin-top: 0; - -} - - - -.divider { - - border-bottom-style: solid; - - padding-bottom: 10px; - - border-bottom-width: 2px; - - border-bottom-color: #0078d7; - -} - - - -div.preview { - - height: 150px; - -} - - - -#hth-welcome { - - color: black; - - font-family: 'Segoe UI', Frutiger, 'Frutiger Linotype', 'Dejavu Sans', 'Helvetica Neue', Arial, sans-serif; - - background: -webkit-linear-gradient(white,white,rgb(230,230,230)); /* For Safari 5.1 to 6.0 */ - - background: -o-linear-gradient(white,white,rgb(230,230,230)); /* For Opera 11.1 to 12.0 */ - - background: -moz-linear-gradient(white,white,rgb(230,230,230)); /* For Firefox 3.6 to 15 */ - - background: linear-gradient(white,white,rgb(230,230,230)); /* Standard syntax */ - -} - - - - #hth-welcome > .row > h1 { - - color: rgb(0,120,215); - - font-size: 75px; - - margin-top: 40px; - - text-align: left; - - } - - - - #hth-welcome > .row > h4 { - - text-align: left; - - } - - - -.hth-major-text { - - font-weight: lighter; - - font-size: 22px; - -} - - - -#hth-feature-block { - - font-family: 'Segoe UI', Frutiger, 'Frutiger Linotype', 'Dejavu Sans', 'Helvetica Neue', Arial, sans-serif; - - background: -webkit-linear-gradient(rgb(230,230,230),white); /* For Safari 5.1 to 6.0 */ - - background: -o-linear-gradient(rgb(230,230,230),white); /* For Opera 11.1 to 12.0 */ - - background: -moz-linear-gradient(rgb(230,230,230),white); /* For Firefox 3.6 to 15 */ - - background: linear-gradient(rgb(230,230,230),white); /* Standard syntax */ - - margin-top: -20px; - - text-align: justify; - - padding-bottom: 30px; - -} - - - - #hth-feature-block > .row > .col-md-8 > .hth-major-text { - - font-family: "Segoe UI Light","Segoe UI Web Light","Segoe UI Web Regular","Segoe UI","Segoe UI Symbol","HelveticaNeue-Light","Helvetica Neue",Arial,sans-serif; - - } - - - - #hth-feature-block > h1 { - - color: rgb(0,120,215); - - font-size: 60px; - - padding-top: 20px; - - } - - - -.featured-project { - - font-size: 72px; - -} - - - -.featured-image { - - margin-top: 20px; - - margin-bottom: 30px; - -} - - - -.hth-project-image { - - margin-left: 25px; - - max-height: 220px; - -} - - - -#hth-list-block > h1 { - - text-align: center; - - font-family: 'Segoe UI', Frutiger, 'Frutiger Linotype', 'Dejavu Sans', 'Helvetica Neue', Arial, sans-serif; - - color: rgb(0,120,215); - - font-size: 60px; - -} - - - -#hth-list-block > .row > .col-sm-4 > p { - - display: block; - -} - - - -.row-inline { - - white-space: nowrap; - - overflow: scroll; - - display: inline-block; - -} - - - -.card { - - background-color: rgb(245,245,245); - - margin-bottom: 12px; - - margin-top: 18px; - - box-shadow: 1px 2px 1px .5px rgba(0, 0, 0, 0.2); - - border: 1px solid rgb(190,190,190); - - border-bottom-left-radius: 2px; - - border-bottom-right-radius: 2px; - -} - - - -.block-image { - - width: inherit; - -} - - - -.card > .block-image > img { - - margin-left: auto; - - margin-right: auto; - - max-height: 250px; - - max-width: 100%; - - display: block; - - width: 100%; - -} - - - -.card-body { - - padding: 5px; - -} - - - - .card-body > .row > .col-xs-4 { - - padding-left: 0; - - padding-right: 0; - - } - - - -.center { - - margin-left: auto; - - margin-right: auto; - - display: block; - -} - - - -.tile-display { - - margin-top: 15px; - - border: 1px solid rgb(210,210,210); - - background-color: rgb(230,230,230); - - border-radius: 3px; - - padding: 10px; - - height: 100%; - - padding-left: 10px; - - padding-right: 10px; - -} - - - - .tile-display > .row { - - margin-left: 0; - - margin-right: 0; - - } - - - -.authors { - - color: rgb(165,165,165); - -} - - - -.devices-row { - - margin-bottom: 20px; - - margin-top: 10px; - -} - - - -.row-no-margin { - - margin-left: 0; - - margin-right: 0; - -} - - - -.btn-group-justified { - - margin-left: auto; - - margin-right: auto; - - display: block; - -} - - - - .btn-group-justified > .btn { - - width: 30%; - - margin: 2px; - - } - - - -.filter-button { - - margin: 10px; - -} - - - - .filter-button > .dropdown-menu { - - padding: 5px; - - } - - - - .filter-button > .dropdown-menu > li { - - cursor: pointer; - - } - - - -#device-center-link { - - margin-top: 4px; - - margin-bottom: 24px; - -} - - - -.col-no-padding { - - padding-left: 0; - - padding-right: 0; - -} - - - -.breadcrumb { - - background-color: transparent; - - margin-top: 32px; - - padding-left: 0; - - margin-bottom: 0; - - padding-top: 0; - - padding-bottom: 0; - -} - - - - .breadcrumb > .active { - - color: inherit; - - } - - - - .breadcrumb > li + li:before { - - content: ">\00a0"; - - color: inherit; - - } - - - - .breadcrumb > li { - - margin-bottom: 0; - - } - - - -/*.setup-content-list { - - padding-left: 0; - -}*/ - - - -/*.setup-content-list > .row > .col-md-6 { - - padding-left: 0; - - }*/ - - - -#app-content > .row { - - margin-left: 0; - - margin-right: 0; - -} - - - -#pc-content > .row { - - padding-left: 0; - - margin-left: 0; - - margin-right: 0; - -} - - - -.inline-list { - - padding-left: 20px; - -} - - - -.toggle-button { - - cursor: pointer; - -} - - - -.maker-image { - - max-height: 205px; - -} - - - -@media (max-width: 800px) { - - .hth-project-image { - - max-height: 100%; - - } - - - - .featured-project { - - font-size: 60px; - - } - - - - .steps { - - font-size: 24px; - - } - - - - h2.maker-kit { - - font-size: 24px; - - } - - - - h3.maker-kit { - - font-size: 24px; - - } - - - - .tile-display { - - border: none; - - background-color: transparent; - - } - - - - #device-center-link { - - width: 100%; - - } - - - - img { - - margin-left: auto; - - margin-right: auto; - - border:1px solid #6c6c6c; - - } - - - - .col-3-image { - - height: 100%; - - width: 100%; - - } - -} - - - -.condensed-list > li { - - margin-bottom: 5px; - -} - - - -#iot_iot_home { - - background-color: #0060AC; - - font-weight: 600; - -} - - - -@font-face{ - - font-family: IOTMDL2Font; - - src: url(https://halcyon-img-int.azurewebsites.net/sites/iot/resources/fonts/IOTMDL2.1.68.tff); - -} - - - -@font-face{ - - font-family: SegMDL2Font; - - src: url(https://halcyon-img-int.azurewebsites.net/sites/iot/resources/fonts/SegMDL2.1.54.tff); - -} - - - - - -/* [BUGFIXES] */ - - - -/* From bootstrap - this broad style will be overridden by more specific styles below in some cases */ - -body h1, body h2, body h3 { - - margin-top: 20px; - - margin-bottom: 10px; - -} - - - - - - - - /* Targeted fix to replace the broad "h1" rule in main.css which applies to page titles. The style previously in place gets overridden by WebCore's default styles */ - - body h1.page-title { - - margin-top: 44px; - - } - - - -/* This strips the h1 margin-top applied in the class if it falls within .spacer-84-top */ - -/* Not working correctly for all pages, makes some worse */ - -/*body .container.spacer-84-top h1:first-of-type{ - - margin-top: 0px; - -}*/ - - - -/* Spacing issues */ - -body p { - - margin-bottom: 20px; - -} - - - -body h1 { - - margin-bottom: 32px; - - margin-top: 44px; - -} - - -body h3 { - - margin-bottom: 20px; - -} - - - -body h4, body h5, body h6 { - - margin-top: 10px; - - margin-bottom: 10px; - -} - - - -/* List style issues */ - -body ul, body ol { - - padding-left: 40px; - -} - - - -body ul { - - list-style: disc; - -} - - - - body ul ul, body ol ul { - - list-style: circle; - - } - - - - body ul ul ul, body ul ol ul, body ol ul ul, body ol ol ul { - - list-style: square; - - } - - - - body ul li { - - margin-bottom: 20px; - - } - - - - - -/* override */ - -body code { - - color: #c7254e; - - background-color: #f9f2f4; - - font-size: 90%; - -} - - - -/* Bug #5779524: Issue 2 */ - -body dt { - - font-weight: bold; - -} - - - -/* Bug #5811636: override */ - -body kbd { - - background-color: #333; - - color: #fff; - - font-size: 90%; - - border-radius: 3px; - - -webkit-box-shadow: inset 0 -1px 0 rgba(0,0,0, .25); - - box-shadow: inset 0px -1px 0px rgba(0,0,0,0.25); - -} - - - -/* Table header alignment (Bug 5802138) */ - -body th { - - text-align: left; - -} - - - -/* Breadcrumb alignment (Bug 5754552) - - Removed top: auto style because it crowded the UHF affecting all pages with the breadcrumb */ - -body .breadcrumb { - - position: relative; - -} - - - -/* Bug #5782289: Device image max-width override */ - -body .device-images { - - max-width: 600px; - -} - - - -/* Define custom alerts */ - -body .alert { - - padding-right: 1em; - - padding-left: 1em; - - margin-top: 0.6em; - - margin-bottom: 1.2em; - - border-width: 1px; - - border-style: solid; - - border-radius: 2px; - - font-size: 0.9em; - - line-height: 1.6em; - - border-color: rgba(0, 0, 0, .05); - - background: #f5f5f5; - - color: #333; - -} - - - -body .alert h5 { - - font-weight: bolder; - - line-height: 1.2; - -} - - - - - -body .alert-note { - - border-color: rgba(0, 0, 0, .05); - - background: #f3fbff; - - color: #0070a7; - -} - - - -span.win-icon { - - margin-right: 8px; - -} - - - -body .alert-warning { - - border-color: rgba(0, 0, 0, .05); - - background: #f2dede; - - color: #a94442; - -} - - - -body .alert-tip { - - border-color: rgba(0, 0, 0, .05); - - background: #dff0d8; - - color: #3c763d; - -} diff --git a/docs/resources/css/pygments.css b/docs/resources/css/pygments.css deleted file mode 100644 index ddd096953c1..00000000000 --- a/docs/resources/css/pygments.css +++ /dev/null @@ -1,115 +0,0 @@ -.hll { background-color: #ffffcc } - -.c { color: #aaaaaa; font-style: italic } /* Comment */ - -.err { color: #FF0000; background-color: #FFAAAA } /* Error */ - -.k { color: #0000aa } /* Keyword */ - -.cm { color: #aaaaaa; font-style: italic } /* Comment.Multiline */ - -.cp { color: #4c8317 } /* Comment.Preproc */ - -.c1 { color: #aaaaaa; font-style: italic } /* Comment.Single */ - -.cs { color: #0000aa; font-style: italic } /* Comment.Special */ - -.gd { color: #aa0000 } /* Generic.Deleted */ - -.ge { font-style: italic } /* Generic.Emph */ - -.gr { color: #aa0000 } /* Generic.Error */ - -.gh { color: #000080; font-weight: bold } /* Generic.Heading */ - -.gi { color: #00aa00 } /* Generic.Inserted */ - -.go { color: #888888 } /* Generic.Output */ - -.gp { color: #555555 } /* Generic.Prompt */ - -.gs { font-weight: bold } /* Generic.Strong */ - -.gu { color: #800080; font-weight: bold } /* Generic.Subheading */ - -.gt { color: #aa0000 } /* Generic.Traceback */ - -.kc { color: #0000aa } /* Keyword.Constant */ - -.kd { color: #0000aa } /* Keyword.Declaration */ - -.kn { color: #0000aa } /* Keyword.Namespace */ - -.kp { color: #0000aa } /* Keyword.Pseudo */ - -.kr { color: #0000aa } /* Keyword.Reserved */ - -.kt { color: #00aaaa } /* Keyword.Type */ - -.m { color: #009999 } /* Literal.Number */ - -.s { color: #aa5500 } /* Literal.String */ - -.na { color: #1e90ff } /* Name.Attribute */ - -.nb { color: #00aaaa } /* Name.Builtin */ - -.nc { color: #00aa00; text-decoration: underline } /* Name.Class */ - -.no { color: #aa0000 } /* Name.Constant */ - -.nd { color: #888888 } /* Name.Decorator */ - -.ni { color: #880000; font-weight: bold } /* Name.Entity */ - -.nf { color: #00aa00 } /* Name.Function */ - -.nn { color: #00aaaa; text-decoration: underline } /* Name.Namespace */ - -.nt { color: #1e90ff; font-weight: bold } /* Name.Tag */ - -.nv { color: #aa0000 } /* Name.Variable */ - -.ow { color: #0000aa } /* Operator.Word */ - -.w { color: #bbbbbb } /* Text.Whitespace */ - -.mf { color: #009999 } /* Literal.Number.Float */ - -.mh { color: #009999 } /* Literal.Number.Hex */ - -.mi { color: #009999 } /* Literal.Number.Integer */ - -.mo { color: #009999 } /* Literal.Number.Oct */ - -.sb { color: #aa5500 } /* Literal.String.Backtick */ - -.sc { color: #aa5500 } /* Literal.String.Char */ - -.sd { color: #aa5500 } /* Literal.String.Doc */ - -.s2 { color: #aa5500 } /* Literal.String.Double */ - -.se { color: #aa5500 } /* Literal.String.Escape */ - -.sh { color: #aa5500 } /* Literal.String.Heredoc */ - -.si { color: #aa5500 } /* Literal.String.Interpol */ - -.sx { color: #aa5500 } /* Literal.String.Other */ - -.sr { color: #009999 } /* Literal.String.Regex */ - -.s1 { color: #aa5500 } /* Literal.String.Single */ - -.ss { color: #0000aa } /* Literal.String.Symbol */ - -.bp { color: #00aaaa } /* Name.Builtin.Pseudo */ - -.vc { color: #aa0000 } /* Name.Variable.Class */ - -.vg { color: #aa0000 } /* Name.Variable.Global */ - -.vi { color: #aa0000 } /* Name.Variable.Instance */ - -.il { color: #009999 } /* Literal.Number.Integer.Long */ \ No newline at end of file diff --git a/docs/resources/images/AddNugetServices.png b/docs/resources/images/AddNugetServices.png deleted file mode 100644 index 88ab8f26106..00000000000 Binary files a/docs/resources/images/AddNugetServices.png and /dev/null differ diff --git a/docs/resources/images/Animations/AnimationSet/Use-Case-1.gif b/docs/resources/images/Animations/AnimationSet/Use-Case-1.gif deleted file mode 100644 index 3bcbc50267d..00000000000 Binary files a/docs/resources/images/Animations/AnimationSet/Use-Case-1.gif and /dev/null differ diff --git a/docs/resources/images/Animations/AnimationSet/Use-Case-2.gif b/docs/resources/images/Animations/AnimationSet/Use-Case-2.gif deleted file mode 100644 index 35bd326444e..00000000000 Binary files a/docs/resources/images/Animations/AnimationSet/Use-Case-2.gif and /dev/null differ diff --git a/docs/resources/images/Animations/Blur/Sample-Output.gif b/docs/resources/images/Animations/Blur/Sample-Output.gif deleted file mode 100644 index d0b9627f4a8..00000000000 Binary files a/docs/resources/images/Animations/Blur/Sample-Output.gif and /dev/null differ diff --git a/docs/resources/images/Animations/Blur/Use-Case-1.gif b/docs/resources/images/Animations/Blur/Use-Case-1.gif deleted file mode 100644 index 0a9a78cf8c7..00000000000 Binary files a/docs/resources/images/Animations/Blur/Use-Case-1.gif and /dev/null differ diff --git a/docs/resources/images/Animations/Chaining-Animations-Blur-Fade-Rotate.gif b/docs/resources/images/Animations/Chaining-Animations-Blur-Fade-Rotate.gif deleted file mode 100644 index c4cc244be64..00000000000 Binary files a/docs/resources/images/Animations/Chaining-Animations-Blur-Fade-Rotate.gif and /dev/null differ diff --git a/docs/resources/images/Animations/Chaining-Animations-Light-Offset-Saturation-Scale.gif b/docs/resources/images/Animations/Chaining-Animations-Light-Offset-Saturation-Scale.gif deleted file mode 100644 index a41b24ad78d..00000000000 Binary files a/docs/resources/images/Animations/Chaining-Animations-Light-Offset-Saturation-Scale.gif and /dev/null differ diff --git a/docs/resources/images/Animations/CompositionAnimations/Example-Output-1.gif b/docs/resources/images/Animations/CompositionAnimations/Example-Output-1.gif deleted file mode 100644 index 225ad2a2493..00000000000 Binary files a/docs/resources/images/Animations/CompositionAnimations/Example-Output-1.gif and /dev/null differ diff --git a/docs/resources/images/Animations/Fade/Sample-Output.gif b/docs/resources/images/Animations/Fade/Sample-Output.gif deleted file mode 100644 index 17df0102624..00000000000 Binary files a/docs/resources/images/Animations/Fade/Sample-Output.gif and /dev/null differ diff --git a/docs/resources/images/Animations/FadeHeader/Sample-Output.gif b/docs/resources/images/Animations/FadeHeader/Sample-Output.gif deleted file mode 100644 index d2403fadf25..00000000000 Binary files a/docs/resources/images/Animations/FadeHeader/Sample-Output.gif and /dev/null differ diff --git a/docs/resources/images/Animations/ImplicitAnimations/Example-Output-1.gif b/docs/resources/images/Animations/ImplicitAnimations/Example-Output-1.gif deleted file mode 100644 index 3e60c85d77c..00000000000 Binary files a/docs/resources/images/Animations/ImplicitAnimations/Example-Output-1.gif and /dev/null differ diff --git a/docs/resources/images/Animations/ImplicitAnimations/Example-Output-2.gif b/docs/resources/images/Animations/ImplicitAnimations/Example-Output-2.gif deleted file mode 100644 index 8921844f03b..00000000000 Binary files a/docs/resources/images/Animations/ImplicitAnimations/Example-Output-2.gif and /dev/null differ diff --git a/docs/resources/images/Animations/ImplicitAnimations/Example-Output-3.gif b/docs/resources/images/Animations/ImplicitAnimations/Example-Output-3.gif deleted file mode 100644 index ec5ddee08e2..00000000000 Binary files a/docs/resources/images/Animations/ImplicitAnimations/Example-Output-3.gif and /dev/null differ diff --git a/docs/resources/images/Animations/Light/Sample-Output.gif b/docs/resources/images/Animations/Light/Sample-Output.gif deleted file mode 100644 index 0d389967b7d..00000000000 Binary files a/docs/resources/images/Animations/Light/Sample-Output.gif and /dev/null differ diff --git a/docs/resources/images/Animations/Offset/Sample-Output.gif b/docs/resources/images/Animations/Offset/Sample-Output.gif deleted file mode 100644 index bb2dffd0cd2..00000000000 Binary files a/docs/resources/images/Animations/Offset/Sample-Output.gif and /dev/null differ diff --git a/docs/resources/images/Animations/Offset/Use-Case-1.gif b/docs/resources/images/Animations/Offset/Use-Case-1.gif deleted file mode 100644 index ea55338134f..00000000000 Binary files a/docs/resources/images/Animations/Offset/Use-Case-1.gif and /dev/null differ diff --git a/docs/resources/images/Animations/ParallaxService/Sample-Output.gif b/docs/resources/images/Animations/ParallaxService/Sample-Output.gif deleted file mode 100644 index 3bfbcbd7414..00000000000 Binary files a/docs/resources/images/Animations/ParallaxService/Sample-Output.gif and /dev/null differ diff --git a/docs/resources/images/Animations/ReorderGridAnimation/Sample-Output.gif b/docs/resources/images/Animations/ReorderGridAnimation/Sample-Output.gif deleted file mode 100644 index f112a9f08f7..00000000000 Binary files a/docs/resources/images/Animations/ReorderGridAnimation/Sample-Output.gif and /dev/null differ diff --git a/docs/resources/images/Animations/Rotate/Sample-Output.gif b/docs/resources/images/Animations/Rotate/Sample-Output.gif deleted file mode 100644 index 93bebde02f7..00000000000 Binary files a/docs/resources/images/Animations/Rotate/Sample-Output.gif and /dev/null differ diff --git a/docs/resources/images/Animations/Saturation/Sample-Output.gif b/docs/resources/images/Animations/Saturation/Sample-Output.gif deleted file mode 100644 index ed901107269..00000000000 Binary files a/docs/resources/images/Animations/Saturation/Sample-Output.gif and /dev/null differ diff --git a/docs/resources/images/Animations/Saturation/Use-Case-1.gif b/docs/resources/images/Animations/Saturation/Use-Case-1.gif deleted file mode 100644 index 851ecbfd089..00000000000 Binary files a/docs/resources/images/Animations/Saturation/Use-Case-1.gif and /dev/null differ diff --git a/docs/resources/images/Animations/Scale/Sample-Output.gif b/docs/resources/images/Animations/Scale/Sample-Output.gif deleted file mode 100644 index 2a3633ba669..00000000000 Binary files a/docs/resources/images/Animations/Scale/Sample-Output.gif and /dev/null differ diff --git a/docs/resources/images/Animations/Scale/Use-Case-1.gif b/docs/resources/images/Animations/Scale/Use-Case-1.gif deleted file mode 100644 index 9483e61405e..00000000000 Binary files a/docs/resources/images/Animations/Scale/Use-Case-1.gif and /dev/null differ diff --git a/docs/resources/images/Animations/connected.gif b/docs/resources/images/Animations/connected.gif deleted file mode 100644 index d58227670b3..00000000000 Binary files a/docs/resources/images/Animations/connected.gif and /dev/null differ diff --git a/docs/resources/images/Brushes/BackdropBlur.jpg b/docs/resources/images/Brushes/BackdropBlur.jpg deleted file mode 100644 index 2d2bf85e899..00000000000 Binary files a/docs/resources/images/Brushes/BackdropBlur.jpg and /dev/null differ diff --git a/docs/resources/images/Brushes/BackdropGamma.jpg b/docs/resources/images/Brushes/BackdropGamma.jpg deleted file mode 100644 index 6a194f45d64..00000000000 Binary files a/docs/resources/images/Brushes/BackdropGamma.jpg and /dev/null differ diff --git a/docs/resources/images/Brushes/BackdropInvert.jpg b/docs/resources/images/Brushes/BackdropInvert.jpg deleted file mode 100644 index e58925eb7eb..00000000000 Binary files a/docs/resources/images/Brushes/BackdropInvert.jpg and /dev/null differ diff --git a/docs/resources/images/Brushes/BackdropSaturation.jpg b/docs/resources/images/Brushes/BackdropSaturation.jpg deleted file mode 100644 index aee907e4f5d..00000000000 Binary files a/docs/resources/images/Brushes/BackdropSaturation.jpg and /dev/null differ diff --git a/docs/resources/images/Brushes/BackdropSepia.jpg b/docs/resources/images/Brushes/BackdropSepia.jpg deleted file mode 100644 index a2814b46ce2..00000000000 Binary files a/docs/resources/images/Brushes/BackdropSepia.jpg and /dev/null differ diff --git a/docs/resources/images/Brushes/ImageBlend.jpg b/docs/resources/images/Brushes/ImageBlend.jpg deleted file mode 100644 index fb365b6bbe6..00000000000 Binary files a/docs/resources/images/Brushes/ImageBlend.jpg and /dev/null differ diff --git a/docs/resources/images/Brushes/RadialGradient.jpg b/docs/resources/images/Brushes/RadialGradient.jpg deleted file mode 100644 index 1b4228b8c38..00000000000 Binary files a/docs/resources/images/Brushes/RadialGradient.jpg and /dev/null differ diff --git a/docs/resources/images/CodeAnalysis.png b/docs/resources/images/CodeAnalysis.png deleted file mode 100644 index 35934078659..00000000000 Binary files a/docs/resources/images/CodeAnalysis.png and /dev/null differ diff --git a/docs/resources/images/CodeAnalysisVB.png b/docs/resources/images/CodeAnalysisVB.png deleted file mode 100644 index 5611a431ac7..00000000000 Binary files a/docs/resources/images/CodeAnalysisVB.png and /dev/null differ diff --git a/docs/resources/images/CodeFixSuggestion.png b/docs/resources/images/CodeFixSuggestion.png deleted file mode 100644 index 6771fbf8d78..00000000000 Binary files a/docs/resources/images/CodeFixSuggestion.png and /dev/null differ diff --git a/docs/resources/images/CodeFixSuggestionVB.png b/docs/resources/images/CodeFixSuggestionVB.png deleted file mode 100644 index ff4385b5376..00000000000 Binary files a/docs/resources/images/CodeFixSuggestionVB.png and /dev/null differ diff --git a/docs/resources/images/Controls-MarkdownTextBlock.gif b/docs/resources/images/Controls-MarkdownTextBlock.gif deleted file mode 100644 index 531d1074b14..00000000000 Binary files a/docs/resources/images/Controls-MarkdownTextBlock.gif and /dev/null differ diff --git a/docs/resources/images/Controls-StaggeredPanel.jpg b/docs/resources/images/Controls-StaggeredPanel.jpg deleted file mode 100644 index 2b6545c9450..00000000000 Binary files a/docs/resources/images/Controls-StaggeredPanel.jpg and /dev/null differ diff --git a/docs/resources/images/Controls/AdaptiveGridView.gif b/docs/resources/images/Controls/AdaptiveGridView.gif deleted file mode 100644 index 0aebdbe1197..00000000000 Binary files a/docs/resources/images/Controls/AdaptiveGridView.gif and /dev/null differ diff --git a/docs/resources/images/Controls/AdaptiveGridView/AdaptiveGridView-DesiredWidthItemHeight.gif b/docs/resources/images/Controls/AdaptiveGridView/AdaptiveGridView-DesiredWidthItemHeight.gif deleted file mode 100644 index 0aebdbe1197..00000000000 Binary files a/docs/resources/images/Controls/AdaptiveGridView/AdaptiveGridView-DesiredWidthItemHeight.gif and /dev/null differ diff --git a/docs/resources/images/Controls/AdaptiveGridView/AdaptiveGridView-OneRowMode.gif b/docs/resources/images/Controls/AdaptiveGridView/AdaptiveGridView-OneRowMode.gif deleted file mode 100644 index 8efd9b0ee9b..00000000000 Binary files a/docs/resources/images/Controls/AdaptiveGridView/AdaptiveGridView-OneRowMode.gif and /dev/null differ diff --git a/docs/resources/images/Controls/AdaptiveGridView/AdaptiveGridView-ViewboxAspectRatio.gif b/docs/resources/images/Controls/AdaptiveGridView/AdaptiveGridView-ViewboxAspectRatio.gif deleted file mode 100644 index 14c7eda64fe..00000000000 Binary files a/docs/resources/images/Controls/AdaptiveGridView/AdaptiveGridView-ViewboxAspectRatio.gif and /dev/null differ diff --git a/docs/resources/images/Controls/BladeView.gif b/docs/resources/images/Controls/BladeView.gif deleted file mode 100644 index d0e12c6db5d..00000000000 Binary files a/docs/resources/images/Controls/BladeView.gif and /dev/null differ diff --git a/docs/resources/images/Controls/Carousel-Overview.gif b/docs/resources/images/Controls/Carousel-Overview.gif deleted file mode 100644 index 13b07c7ab53..00000000000 Binary files a/docs/resources/images/Controls/Carousel-Overview.gif and /dev/null differ diff --git a/docs/resources/images/Controls/DataGrid/DataGrid.gif b/docs/resources/images/Controls/DataGrid/DataGrid.gif deleted file mode 100644 index dea049e93ca..00000000000 Binary files a/docs/resources/images/Controls/DataGrid/DataGrid.gif and /dev/null differ diff --git a/docs/resources/images/Controls/DataGrid/alternaterowbackground.png b/docs/resources/images/Controls/DataGrid/alternaterowbackground.png deleted file mode 100644 index 51d500ba31d..00000000000 Binary files a/docs/resources/images/Controls/DataGrid/alternaterowbackground.png and /dev/null differ diff --git a/docs/resources/images/Controls/DataGrid/editing.png b/docs/resources/images/Controls/DataGrid/editing.png deleted file mode 100644 index dd8ebcd2275..00000000000 Binary files a/docs/resources/images/Controls/DataGrid/editing.png and /dev/null differ diff --git a/docs/resources/images/Controls/DataGrid/frozencolumns.png b/docs/resources/images/Controls/DataGrid/frozencolumns.png deleted file mode 100644 index 22761138a21..00000000000 Binary files a/docs/resources/images/Controls/DataGrid/frozencolumns.png and /dev/null differ diff --git a/docs/resources/images/Controls/DataGrid/gridlines.png b/docs/resources/images/Controls/DataGrid/gridlines.png deleted file mode 100644 index fcfb251aec6..00000000000 Binary files a/docs/resources/images/Controls/DataGrid/gridlines.png and /dev/null differ diff --git a/docs/resources/images/Controls/DataGrid/grouping.png b/docs/resources/images/Controls/DataGrid/grouping.png deleted file mode 100644 index 35a39086a16..00000000000 Binary files a/docs/resources/images/Controls/DataGrid/grouping.png and /dev/null differ diff --git a/docs/resources/images/Controls/DataGrid/resizecolumns.png b/docs/resources/images/Controls/DataGrid/resizecolumns.png deleted file mode 100644 index f6d5239c8d6..00000000000 Binary files a/docs/resources/images/Controls/DataGrid/resizecolumns.png and /dev/null differ diff --git a/docs/resources/images/Controls/DataGrid/rowdetails.png b/docs/resources/images/Controls/DataGrid/rowdetails.png deleted file mode 100644 index 814ef3578f7..00000000000 Binary files a/docs/resources/images/Controls/DataGrid/rowdetails.png and /dev/null differ diff --git a/docs/resources/images/Controls/DataGrid/selection.png b/docs/resources/images/Controls/DataGrid/selection.png deleted file mode 100644 index d751df3f9a9..00000000000 Binary files a/docs/resources/images/Controls/DataGrid/selection.png and /dev/null differ diff --git a/docs/resources/images/Controls/DataGrid/sorting.png b/docs/resources/images/Controls/DataGrid/sorting.png deleted file mode 100644 index 3e34631341d..00000000000 Binary files a/docs/resources/images/Controls/DataGrid/sorting.png and /dev/null differ diff --git a/docs/resources/images/Controls/DataGrid/validation.png b/docs/resources/images/Controls/DataGrid/validation.png deleted file mode 100644 index b122a22c488..00000000000 Binary files a/docs/resources/images/Controls/DataGrid/validation.png and /dev/null differ diff --git a/docs/resources/images/Controls/DockPanel.gif b/docs/resources/images/Controls/DockPanel.gif deleted file mode 100644 index 18fc943f506..00000000000 Binary files a/docs/resources/images/Controls/DockPanel.gif and /dev/null differ diff --git a/docs/resources/images/Controls/DropShadowPanel.png b/docs/resources/images/Controls/DropShadowPanel.png deleted file mode 100644 index f857b3895ae..00000000000 Binary files a/docs/resources/images/Controls/DropShadowPanel.png and /dev/null differ diff --git a/docs/resources/images/Controls/Expander.gif b/docs/resources/images/Controls/Expander.gif deleted file mode 100644 index 722848fd62e..00000000000 Binary files a/docs/resources/images/Controls/Expander.gif and /dev/null differ diff --git a/docs/resources/images/Controls/GridSplitter.png b/docs/resources/images/Controls/GridSplitter.png deleted file mode 100644 index dfaa879eb6f..00000000000 Binary files a/docs/resources/images/Controls/GridSplitter.png and /dev/null differ diff --git a/docs/resources/images/Controls/HamburgerMenu.gif b/docs/resources/images/Controls/HamburgerMenu.gif deleted file mode 100644 index 5476a8878cc..00000000000 Binary files a/docs/resources/images/Controls/HamburgerMenu.gif and /dev/null differ diff --git a/docs/resources/images/Controls/HeaderedContentControl.jpg b/docs/resources/images/Controls/HeaderedContentControl.jpg deleted file mode 100644 index c2ce86d0cf8..00000000000 Binary files a/docs/resources/images/Controls/HeaderedContentControl.jpg and /dev/null differ diff --git a/docs/resources/images/Controls/HeaderedItemsControl.jpg b/docs/resources/images/Controls/HeaderedItemsControl.jpg deleted file mode 100644 index 202ecdd7113..00000000000 Binary files a/docs/resources/images/Controls/HeaderedItemsControl.jpg and /dev/null differ diff --git a/docs/resources/images/Controls/HeaderedTextBlock.png b/docs/resources/images/Controls/HeaderedTextBlock.png deleted file mode 100644 index d0a4d775c3b..00000000000 Binary files a/docs/resources/images/Controls/HeaderedTextBlock.png and /dev/null differ diff --git a/docs/resources/images/Controls/ImageEx.gif b/docs/resources/images/Controls/ImageEx.gif deleted file mode 100644 index 1613f532861..00000000000 Binary files a/docs/resources/images/Controls/ImageEx.gif and /dev/null differ diff --git a/docs/resources/images/Controls/InAppNotification/InAppNotification.gif b/docs/resources/images/Controls/InAppNotification/InAppNotification.gif deleted file mode 100644 index ec7bbaa0f43..00000000000 Binary files a/docs/resources/images/Controls/InAppNotification/InAppNotification.gif and /dev/null differ diff --git a/docs/resources/images/Controls/InAppNotification/MicrosoftEdge-Notification-Style.png b/docs/resources/images/Controls/InAppNotification/MicrosoftEdge-Notification-Style.png deleted file mode 100644 index 1bf5c54b022..00000000000 Binary files a/docs/resources/images/Controls/InAppNotification/MicrosoftEdge-Notification-Style.png and /dev/null differ diff --git a/docs/resources/images/Controls/InAppNotification/VisualStudioCode-Notification-style.png b/docs/resources/images/Controls/InAppNotification/VisualStudioCode-Notification-style.png deleted file mode 100644 index e7a3520153b..00000000000 Binary files a/docs/resources/images/Controls/InAppNotification/VisualStudioCode-Notification-style.png and /dev/null differ diff --git a/docs/resources/images/Controls/InfiniteCanvas.gif b/docs/resources/images/Controls/InfiniteCanvas.gif deleted file mode 100644 index eb9f1ba5331..00000000000 Binary files a/docs/resources/images/Controls/InfiniteCanvas.gif and /dev/null differ diff --git a/docs/resources/images/Controls/InkCanvas.png b/docs/resources/images/Controls/InkCanvas.png deleted file mode 100644 index 8532597530f..00000000000 Binary files a/docs/resources/images/Controls/InkCanvas.png and /dev/null differ diff --git a/docs/resources/images/Controls/LoadingXamlControl.gif b/docs/resources/images/Controls/LoadingXamlControl.gif deleted file mode 100644 index 18fc431a6ce..00000000000 Binary files a/docs/resources/images/Controls/LoadingXamlControl.gif and /dev/null differ diff --git a/docs/resources/images/Controls/MasterDetailsView.gif b/docs/resources/images/Controls/MasterDetailsView.gif deleted file mode 100644 index 79f479babab..00000000000 Binary files a/docs/resources/images/Controls/MasterDetailsView.gif and /dev/null differ diff --git a/docs/resources/images/Controls/MediaPlayerElement.png b/docs/resources/images/Controls/MediaPlayerElement.png deleted file mode 100644 index 8841f14534b..00000000000 Binary files a/docs/resources/images/Controls/MediaPlayerElement.png and /dev/null differ diff --git a/docs/resources/images/Controls/Menu.gif b/docs/resources/images/Controls/Menu.gif deleted file mode 100644 index f4e6690d805..00000000000 Binary files a/docs/resources/images/Controls/Menu.gif and /dev/null differ diff --git a/docs/resources/images/Controls/OrbitView.gif b/docs/resources/images/Controls/OrbitView.gif deleted file mode 100644 index 94d76610863..00000000000 Binary files a/docs/resources/images/Controls/OrbitView.gif and /dev/null differ diff --git a/docs/resources/images/Controls/PullToRefreshListView.gif b/docs/resources/images/Controls/PullToRefreshListView.gif deleted file mode 100644 index 19e120d45c7..00000000000 Binary files a/docs/resources/images/Controls/PullToRefreshListView.gif and /dev/null differ diff --git a/docs/resources/images/Controls/RadialGauge.gif b/docs/resources/images/Controls/RadialGauge.gif deleted file mode 100644 index 47f517cd493..00000000000 Binary files a/docs/resources/images/Controls/RadialGauge.gif and /dev/null differ diff --git a/docs/resources/images/Controls/RadialProgressBar.png b/docs/resources/images/Controls/RadialProgressBar.png deleted file mode 100644 index 3e08d3482f8..00000000000 Binary files a/docs/resources/images/Controls/RadialProgressBar.png and /dev/null differ diff --git a/docs/resources/images/Controls/RangeSelector.gif b/docs/resources/images/Controls/RangeSelector.gif deleted file mode 100644 index 68011d2849c..00000000000 Binary files a/docs/resources/images/Controls/RangeSelector.gif and /dev/null differ diff --git a/docs/resources/images/Controls/RotatorTile.gif b/docs/resources/images/Controls/RotatorTile.gif deleted file mode 100644 index a05031cde5c..00000000000 Binary files a/docs/resources/images/Controls/RotatorTile.gif and /dev/null differ diff --git a/docs/resources/images/Controls/ScrollHeader.gif b/docs/resources/images/Controls/ScrollHeader.gif deleted file mode 100644 index 694ff9747b2..00000000000 Binary files a/docs/resources/images/Controls/ScrollHeader.gif and /dev/null differ diff --git a/docs/resources/images/Controls/SlidableListItem.gif b/docs/resources/images/Controls/SlidableListItem.gif deleted file mode 100644 index 543a0742d87..00000000000 Binary files a/docs/resources/images/Controls/SlidableListItem.gif and /dev/null differ diff --git a/docs/resources/images/Controls/TextToolbar.png b/docs/resources/images/Controls/TextToolbar.png deleted file mode 100644 index b30e91253ad..00000000000 Binary files a/docs/resources/images/Controls/TextToolbar.png and /dev/null differ diff --git a/docs/resources/images/Controls/TileControl.gif b/docs/resources/images/Controls/TileControl.gif deleted file mode 100644 index 1be12cdbe07..00000000000 Binary files a/docs/resources/images/Controls/TileControl.gif and /dev/null differ diff --git a/docs/resources/images/Controls/UniformGrid/DialogButtons.png b/docs/resources/images/Controls/UniformGrid/DialogButtons.png deleted file mode 100644 index 1a09103fa08..00000000000 Binary files a/docs/resources/images/Controls/UniformGrid/DialogButtons.png and /dev/null differ diff --git a/docs/resources/images/Controls/UniformGrid/FixedChild.png b/docs/resources/images/Controls/UniformGrid/FixedChild.png deleted file mode 100644 index 58897a4f800..00000000000 Binary files a/docs/resources/images/Controls/UniformGrid/FixedChild.png and /dev/null differ diff --git a/docs/resources/images/Controls/UniformGrid/Orientation.png b/docs/resources/images/Controls/UniformGrid/Orientation.png deleted file mode 100644 index e64f481c17d..00000000000 Binary files a/docs/resources/images/Controls/UniformGrid/Orientation.png and /dev/null differ diff --git a/docs/resources/images/Controls/UniformGrid/SizedChild.png b/docs/resources/images/Controls/UniformGrid/SizedChild.png deleted file mode 100644 index 21754da717e..00000000000 Binary files a/docs/resources/images/Controls/UniformGrid/SizedChild.png and /dev/null differ diff --git a/docs/resources/images/Controls/UniformGrid/SizedRowCol.png b/docs/resources/images/Controls/UniformGrid/SizedRowCol.png deleted file mode 100644 index af5c5ff67ee..00000000000 Binary files a/docs/resources/images/Controls/UniformGrid/SizedRowCol.png and /dev/null differ diff --git a/docs/resources/images/Controls/UniformGrid/Spacing.png b/docs/resources/images/Controls/UniformGrid/Spacing.png deleted file mode 100644 index 18b9127c9c8..00000000000 Binary files a/docs/resources/images/Controls/UniformGrid/Spacing.png and /dev/null differ diff --git a/docs/resources/images/Controls/WebView/web-view-samples.png b/docs/resources/images/Controls/WebView/web-view-samples.png deleted file mode 100644 index 96e9197ff1d..00000000000 Binary files a/docs/resources/images/Controls/WebView/web-view-samples.png and /dev/null differ diff --git a/docs/resources/images/Controls/WindowsXAMLHost/add-files-to-folder.png b/docs/resources/images/Controls/WindowsXAMLHost/add-files-to-folder.png deleted file mode 100644 index 4367bd170d1..00000000000 Binary files a/docs/resources/images/Controls/WindowsXAMLHost/add-files-to-folder.png and /dev/null differ diff --git a/docs/resources/images/Controls/WindowsXAMLHost/class-library-project.png b/docs/resources/images/Controls/WindowsXAMLHost/class-library-project.png deleted file mode 100644 index 73ac2bd90bd..00000000000 Binary files a/docs/resources/images/Controls/WindowsXAMLHost/class-library-project.png and /dev/null differ diff --git a/docs/resources/images/Controls/WindowsXAMLHost/code-behind-file-uwp-class.png b/docs/resources/images/Controls/WindowsXAMLHost/code-behind-file-uwp-class.png deleted file mode 100644 index 59f4b578477..00000000000 Binary files a/docs/resources/images/Controls/WindowsXAMLHost/code-behind-file-uwp-class.png and /dev/null differ diff --git a/docs/resources/images/Controls/WindowsXAMLHost/edit-project.png b/docs/resources/images/Controls/WindowsXAMLHost/edit-project.png deleted file mode 100644 index 3aef8d4d6c3..00000000000 Binary files a/docs/resources/images/Controls/WindowsXAMLHost/edit-project.png and /dev/null differ diff --git a/docs/resources/images/Controls/WindowsXAMLHost/folder-to-project.png b/docs/resources/images/Controls/WindowsXAMLHost/folder-to-project.png deleted file mode 100644 index e44b703d4f8..00000000000 Binary files a/docs/resources/images/Controls/WindowsXAMLHost/folder-to-project.png and /dev/null differ diff --git a/docs/resources/images/Controls/WindowsXAMLHost/host-controls.png b/docs/resources/images/Controls/WindowsXAMLHost/host-controls.png deleted file mode 100644 index cb808df4833..00000000000 Binary files a/docs/resources/images/Controls/WindowsXAMLHost/host-controls.png and /dev/null differ diff --git a/docs/resources/images/Controls/WindowsXAMLHost/type-name-property-windows-forms.png b/docs/resources/images/Controls/WindowsXAMLHost/type-name-property-windows-forms.png deleted file mode 100644 index 4b3d88cca85..00000000000 Binary files a/docs/resources/images/Controls/WindowsXAMLHost/type-name-property-windows-forms.png and /dev/null differ diff --git a/docs/resources/images/Controls/WindowsXAMLHost/type-name-property-wpf-custom.png b/docs/resources/images/Controls/WindowsXAMLHost/type-name-property-wpf-custom.png deleted file mode 100644 index 4a496c1846b..00000000000 Binary files a/docs/resources/images/Controls/WindowsXAMLHost/type-name-property-wpf-custom.png and /dev/null differ diff --git a/docs/resources/images/Controls/WindowsXAMLHost/type-name-property-wpf.png b/docs/resources/images/Controls/WindowsXAMLHost/type-name-property-wpf.png deleted file mode 100644 index 8c5fe9352ef..00000000000 Binary files a/docs/resources/images/Controls/WindowsXAMLHost/type-name-property-wpf.png and /dev/null differ diff --git a/docs/resources/images/Controls/WindowsXAMLHost/windows-forms-control-toolbox.png b/docs/resources/images/Controls/WindowsXAMLHost/windows-forms-control-toolbox.png deleted file mode 100644 index 07ee6ba5519..00000000000 Binary files a/docs/resources/images/Controls/WindowsXAMLHost/windows-forms-control-toolbox.png and /dev/null differ diff --git a/docs/resources/images/Controls/WindowsXAMLHost/windows-xaml-control-toolbox.png b/docs/resources/images/Controls/WindowsXAMLHost/windows-xaml-control-toolbox.png deleted file mode 100644 index d3707c3725d..00000000000 Binary files a/docs/resources/images/Controls/WindowsXAMLHost/windows-xaml-control-toolbox.png and /dev/null differ diff --git a/docs/resources/images/Controls/WindowsXAMLHost/xaml-content-updated-event-windows-forms.png b/docs/resources/images/Controls/WindowsXAMLHost/xaml-content-updated-event-windows-forms.png deleted file mode 100644 index 5bd2d096aa1..00000000000 Binary files a/docs/resources/images/Controls/WindowsXAMLHost/xaml-content-updated-event-windows-forms.png and /dev/null differ diff --git a/docs/resources/images/Controls/WindowsXAMLHost/xaml-content-updated-event-wpf-custom.png b/docs/resources/images/Controls/WindowsXAMLHost/xaml-content-updated-event-wpf-custom.png deleted file mode 100644 index 9d59f57b208..00000000000 Binary files a/docs/resources/images/Controls/WindowsXAMLHost/xaml-content-updated-event-wpf-custom.png and /dev/null differ diff --git a/docs/resources/images/Controls/WindowsXAMLHost/xaml-content-updated-event-wpf.png b/docs/resources/images/Controls/WindowsXAMLHost/xaml-content-updated-event-wpf.png deleted file mode 100644 index dbdf4a465db..00000000000 Binary files a/docs/resources/images/Controls/WindowsXAMLHost/xaml-content-updated-event-wpf.png and /dev/null differ diff --git a/docs/resources/images/Controls/WrapPanel.gif b/docs/resources/images/Controls/WrapPanel.gif deleted file mode 100644 index 103172f0616..00000000000 Binary files a/docs/resources/images/Controls/WrapPanel.gif and /dev/null differ diff --git a/docs/resources/images/DeveloperTools/AlignmentGrid.jpg b/docs/resources/images/DeveloperTools/AlignmentGrid.jpg deleted file mode 100644 index 86374b0d7cb..00000000000 Binary files a/docs/resources/images/DeveloperTools/AlignmentGrid.jpg and /dev/null differ diff --git a/docs/resources/images/DeveloperTools/FocusTracker.jpg b/docs/resources/images/DeveloperTools/FocusTracker.jpg deleted file mode 100644 index a95799d325d..00000000000 Binary files a/docs/resources/images/DeveloperTools/FocusTracker.jpg and /dev/null differ diff --git a/docs/resources/images/Extensions/MiddleClickScrolling.gif b/docs/resources/images/Extensions/MiddleClickScrolling.gif deleted file mode 100644 index d4616ef1471..00000000000 Binary files a/docs/resources/images/Extensions/MiddleClickScrolling.gif and /dev/null differ diff --git a/docs/resources/images/Extensions/SurfaceDialTextbox.gif b/docs/resources/images/Extensions/SurfaceDialTextbox.gif deleted file mode 100644 index b2f92a60f55..00000000000 Binary files a/docs/resources/images/Extensions/SurfaceDialTextbox.gif and /dev/null differ diff --git a/docs/resources/images/Extensions/TextBoxMask.gif b/docs/resources/images/Extensions/TextBoxMask.gif deleted file mode 100644 index aae831544b8..00000000000 Binary files a/docs/resources/images/Extensions/TextBoxMask.gif and /dev/null differ diff --git a/docs/resources/images/Extensions/TextBoxRegex.gif b/docs/resources/images/Extensions/TextBoxRegex.gif deleted file mode 100644 index d87126e479b..00000000000 Binary files a/docs/resources/images/Extensions/TextBoxRegex.gif and /dev/null differ diff --git a/docs/resources/images/Graph/AadLogin.png b/docs/resources/images/Graph/AadLogin.png deleted file mode 100644 index ab920baf113..00000000000 Binary files a/docs/resources/images/Graph/AadLogin.png and /dev/null differ diff --git a/docs/resources/images/Graph/PeoplePicker.png b/docs/resources/images/Graph/PeoplePicker.png deleted file mode 100644 index 924f4ef5a2d..00000000000 Binary files a/docs/resources/images/Graph/PeoplePicker.png and /dev/null differ diff --git a/docs/resources/images/Graph/PlannerTaskList.png b/docs/resources/images/Graph/PlannerTaskList.png deleted file mode 100644 index ceaba823046..00000000000 Binary files a/docs/resources/images/Graph/PlannerTaskList.png and /dev/null differ diff --git a/docs/resources/images/Graph/PowerBIEmbedded-Permissions.png b/docs/resources/images/Graph/PowerBIEmbedded-Permissions.png deleted file mode 100644 index 3ced937cce8..00000000000 Binary files a/docs/resources/images/Graph/PowerBIEmbedded-Permissions.png and /dev/null differ diff --git a/docs/resources/images/Graph/PowerBIEmbedded.png b/docs/resources/images/Graph/PowerBIEmbedded.png deleted file mode 100644 index 84adcf40d0a..00000000000 Binary files a/docs/resources/images/Graph/PowerBIEmbedded.png and /dev/null differ diff --git a/docs/resources/images/Graph/ProfileCard.png b/docs/resources/images/Graph/ProfileCard.png deleted file mode 100644 index 906dfb40575..00000000000 Binary files a/docs/resources/images/Graph/ProfileCard.png and /dev/null differ diff --git a/docs/resources/images/Graph/SharePointFileList.png b/docs/resources/images/Graph/SharePointFileList.png deleted file mode 100644 index 4768cf5c717..00000000000 Binary files a/docs/resources/images/Graph/SharePointFileList.png and /dev/null differ diff --git a/docs/resources/images/ManageNugetPackages.png b/docs/resources/images/ManageNugetPackages.png deleted file mode 100644 index c5f10b29ece..00000000000 Binary files a/docs/resources/images/ManageNugetPackages.png and /dev/null differ diff --git a/docs/resources/images/Menu.png b/docs/resources/images/Menu.png deleted file mode 100644 index 61179a3e5c8..00000000000 Binary files a/docs/resources/images/Menu.png and /dev/null differ diff --git a/docs/resources/images/Notifications-WeatherLiveTileAndToast.png b/docs/resources/images/Notifications-WeatherLiveTileAndToast.png deleted file mode 100644 index 01e34eff76f..00000000000 Binary files a/docs/resources/images/Notifications-WeatherLiveTileAndToast.png and /dev/null differ diff --git a/docs/resources/images/Notifications/LiveTile.gif b/docs/resources/images/Notifications/LiveTile.gif deleted file mode 100644 index c4a4b0b37db..00000000000 Binary files a/docs/resources/images/Notifications/LiveTile.gif and /dev/null differ diff --git a/docs/resources/images/Notifications/PopToast.gif b/docs/resources/images/Notifications/PopToast.gif deleted file mode 100644 index 0456e52a9ea..00000000000 Binary files a/docs/resources/images/Notifications/PopToast.gif and /dev/null differ diff --git a/docs/resources/images/NugetPackages.png b/docs/resources/images/NugetPackages.png deleted file mode 100644 index 46f17b22b4d..00000000000 Binary files a/docs/resources/images/NugetPackages.png and /dev/null differ diff --git a/docs/resources/images/ParallaxService.gif b/docs/resources/images/ParallaxService.gif deleted file mode 100644 index 3bfbcbd7414..00000000000 Binary files a/docs/resources/images/ParallaxService.gif and /dev/null differ diff --git a/docs/resources/images/ReorderGrid.gif b/docs/resources/images/ReorderGrid.gif deleted file mode 100644 index d7b6bf750b3..00000000000 Binary files a/docs/resources/images/ReorderGrid.gif and /dev/null differ diff --git a/docs/resources/images/Styles-NavigationView.gif b/docs/resources/images/Styles-NavigationView.gif deleted file mode 100644 index 6e3f4f3aeb6..00000000000 Binary files a/docs/resources/images/Styles-NavigationView.gif and /dev/null differ diff --git a/docs/resources/images/SurfaeDial.jpg b/docs/resources/images/SurfaeDial.jpg deleted file mode 100644 index 925b3f6a72b..00000000000 Binary files a/docs/resources/images/SurfaeDial.jpg and /dev/null differ diff --git a/docs/resources/images/Toolkit_Responsive_Behavior_v01_img-MD-SM.png b/docs/resources/images/Toolkit_Responsive_Behavior_v01_img-MD-SM.png deleted file mode 100644 index 1bc59a841a6..00000000000 Binary files a/docs/resources/images/Toolkit_Responsive_Behavior_v01_img-MD-SM.png and /dev/null differ diff --git a/docs/resources/images/Toolkit_Responsive_Behavior_v01_img-XL.png b/docs/resources/images/Toolkit_Responsive_Behavior_v01_img-XL.png deleted file mode 100644 index 27a4b7e332b..00000000000 Binary files a/docs/resources/images/Toolkit_Responsive_Behavior_v01_img-XL.png and /dev/null differ diff --git a/docs/resources/images/Toolkit_Responsive_Behavior_v01_img-XS.png b/docs/resources/images/Toolkit_Responsive_Behavior_v01_img-XS.png deleted file mode 100644 index a53ecc931a8..00000000000 Binary files a/docs/resources/images/Toolkit_Responsive_Behavior_v01_img-XS.png and /dev/null differ diff --git a/docs/resources/images/WinSDKFBInstall.png b/docs/resources/images/WinSDKFBInstall.png deleted file mode 100644 index 92fb0b21bc0..00000000000 Binary files a/docs/resources/images/WinSDKFBInstall.png and /dev/null differ diff --git a/docs/resources/images/adaptive.GIF b/docs/resources/images/adaptive.GIF deleted file mode 100644 index 9418097d1b0..00000000000 Binary files a/docs/resources/images/adaptive.GIF and /dev/null differ diff --git a/docs/resources/images/choosetoolboxitems.png b/docs/resources/images/choosetoolboxitems.png deleted file mode 100644 index b13b90178b7..00000000000 Binary files a/docs/resources/images/choosetoolboxitems.png and /dev/null differ diff --git a/docs/resources/images/hamburgermenu.gif b/docs/resources/images/hamburgermenu.gif deleted file mode 100644 index 55e1a3e99d5..00000000000 Binary files a/docs/resources/images/hamburgermenu.gif and /dev/null differ diff --git a/docs/resources/images/head.GIF b/docs/resources/images/head.GIF deleted file mode 100644 index 0d2eea73d4f..00000000000 Binary files a/docs/resources/images/head.GIF and /dev/null differ diff --git a/docs/resources/images/herotile.png b/docs/resources/images/herotile.png deleted file mode 100644 index 275e212c62e..00000000000 Binary files a/docs/resources/images/herotile.png and /dev/null differ diff --git a/docs/resources/images/imageex.GIF b/docs/resources/images/imageex.GIF deleted file mode 100644 index 9fcce7e3de2..00000000000 Binary files a/docs/resources/images/imageex.GIF and /dev/null differ diff --git a/docs/resources/images/radial.GIF b/docs/resources/images/radial.GIF deleted file mode 100644 index 37862c4722e..00000000000 Binary files a/docs/resources/images/radial.GIF and /dev/null differ diff --git a/docs/resources/images/range.GIF b/docs/resources/images/range.GIF deleted file mode 100644 index 4124a659b3b..00000000000 Binary files a/docs/resources/images/range.GIF and /dev/null differ diff --git a/docs/resources/images/sampleapp-small.png b/docs/resources/images/sampleapp-small.png deleted file mode 100644 index caad5d1dcca..00000000000 Binary files a/docs/resources/images/sampleapp-small.png and /dev/null differ diff --git a/docs/resources/images/sampleapp.png b/docs/resources/images/sampleapp.png deleted file mode 100644 index 4b260b35e14..00000000000 Binary files a/docs/resources/images/sampleapp.png and /dev/null differ diff --git a/docs/resources/images/slideable.GIF b/docs/resources/images/slideable.GIF deleted file mode 100644 index abf5d372586..00000000000 Binary files a/docs/resources/images/slideable.GIF and /dev/null differ diff --git a/docs/resources/images/toolboxfinal.png b/docs/resources/images/toolboxfinal.png deleted file mode 100644 index b034d33e34e..00000000000 Binary files a/docs/resources/images/toolboxfinal.png and /dev/null differ diff --git a/docs/resources/images/weatherlivetilentoastNotification.GIF b/docs/resources/images/weatherlivetilentoastNotification.GIF deleted file mode 100644 index 0e92b79c00a..00000000000 Binary files a/docs/resources/images/weatherlivetilentoastNotification.GIF and /dev/null differ diff --git a/docs/services/Bing.md b/docs/services/Bing.md deleted file mode 100644 index f02048a4a05..00000000000 --- a/docs/services/Bing.md +++ /dev/null @@ -1,133 +0,0 @@ ---- -title: Bing Service -author: nmetulev -description: The Bing Service allows you to retrieve Bing results. Bing can return web and news results in your language, images, and videos for many countries/regions around the world. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, bing -dev_langs: - - csharp - - vb ---- - -# Bing Service - -> [!NOTE] -The Bing Service is deprecated and will be removed in a future major release. Please use the [Cognitive Services SDKs](https://aka.ms/AA209h0). - -The **Bing Service** allows you to retrieve Bing results. Bing can return web and news results in your language, images, and videos for many countries/regions around the world. - -## Set up Bing API - -> [!NOTE] -The current version does not require the API key and is using the rate limited public access point. The ability to specify your own key to remove the rate limits is on our backlog for a future release. - -[Signup for API Access](https://www.microsoft.com/cognitive-services/sign-up) using your Microsoft account. There is a free trial option for all of the Bing services (fully functional, just with API rate limits or capacity limits). - -Choose the *Bing Search - Free* option. After selecting this and agreeing to the terms of service you will be issued two keys that are limited to 5,000 queries per month. - -## Syntax - -```csharp -using Microsoft.Toolkit.Services.Bing; - -var searchConfig = new BingSearchConfig -{ - Country = BingCountry.UnitedStates, - Language = BingLanguage.English, - Query = SearchText.Text, - QueryType = BingQueryType.Search -}; - -ListView.ItemsSource = await BingService.Instance.RequestAsync(searchConfig, 50); -``` -```vb -Imports using Microsoft.Toolkit.Services.Bing - -Dim searchConfig = New BingSearchConfig With { - .Country = BingCountry.UnitedStates, - .Language = BingLanguage.English, - .Query = SearchText.Text, - .QueryType = BingQueryType.Search -} -ListView.ItemsSource = Await BingService.Instance.RequestAsync(searchConfig, 50) -``` - -## BingDataProvider Class - -**BingDataProvider** is a Data Provider for connecting to Bing service - -### Methods - -| Methods | Return Type | Description | -| -- | -- | -- | -| GetDataAsync(BingSearchConfig, Int32, Int32, IParser) | Task> | Wrapper around REST API for making data request | -| GetDefaultParser(BingSearchConfig) | IParser<[BingResult](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.services.bing.bingresult)> | Returns parser implementation for specified configuration | - -## BingParser Class - -**BingParser** parse Bing results into strong type - -### Methods - -| Methods | Return Type | Description | -| -- | -- | -- | -| Parse(String) | IEnumerable<[BingResult](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.services.bing.bingresult)> | Take string data and parse into strong data type | - -## BingResult Class - -**BingResult** is a implementation of the Bing result class. - -### Properties - -| Property | Type | Description | -| -- | -- | -- | -| InternalID | string | Gets or sets identifier for strong typed record | -| Link | string | Description | -| Published | DateTime | Description | -| Summary | string | Description | -| Title | string | Gets or sets title of the search result | - -## BingSearchConfig Class - -**BingSearchConfig** configures the search query - -### Properties - -| Property | Type | Description | -| -- | -- | -- | -| Country | [BingCountry](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.services.bing.bingcountry) | Description | -| Language | [BingLanguage](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.services.bing.binglanguage) | Gets or sets search query language | -| Query | string | Gets or sets search query | -| QueryType | [BingQueryType](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.services.bing.bingquerytype) | Gets or sets search query type | - -## BingService Class - -**BingService** Class for connecting to Bing - -### Properties - -| Property | Type | Description | -| -- | -- | -- | -| Instance | [BingService](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.services.bing.bingservice) | Gets public singleton property | -| Provider | [BingDataProvider](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.services.bing.bingdataprovider) | Gets a reference to an instance of the underlying data provider | - -### Methods - -| Methods | Return Type | Description | -| -- | -- | -- | -| GetPagedItemsAsync(Int32, Int32, CancellationToken) | Task> | Retrieves items based on `pageIndex` and `pageSize` arguments | -| RequestAsync(BingSearchConfig, Int32, Int32) | Task> | Request list data from service provider based upon a given config / query | - -## Sample Code - -[Bing Service Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Bing%20Service). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| --- | --- | -| Namespace | Microsoft.Toolkit.Services | -| NuGet package | [Microsoft.Toolkit.Services](https://www.nuget.org/packages/Microsoft.Toolkit.Services/) | - -## API - -* [Bing Service source code](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Services/Services/Bing) diff --git a/docs/services/Facebook.md b/docs/services/Facebook.md deleted file mode 100644 index 2899aada228..00000000000 --- a/docs/services/Facebook.md +++ /dev/null @@ -1,287 +0,0 @@ ---- -title: Facebook Service -author: nmetulev -description: The Facebook Service allows you to retrieve or publish data to the Facebook graph. Examples of the types of objects you can work with are Posts, Tagged Objects, and the primary user feed. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, Facebook Service -dev_langs: - - csharp - - vb ---- - -# Facebook Service - -The Facebook Service allows you to retrieve or publish data to the Facebook graph. Examples of the types of objects you can work with are Posts, Tagged Objects, and the primary user feed. - -## Getting Windows Store SID - -The Windows Store SID is a unique value per application generated, and it not tied to the actual store publication. Creating a local application will give you a valid SID that you can use for debugging against Facebook. - -```csharp -// Put the following code in your mainform loaded event -// Note that this will not work in the App.xaml.cs Loaded -#if DEBUG - System.Diagnostics.Debug.WriteLine("Windows Store SID = " + Microsoft.Toolkit.Uwp.Services.Facebook.FacebookService.Instance.WindowsStoreId); -#endif -``` -```vb -' Put the following code in your mainform loaded event -' Note that this will not work in the App.xaml.cs Loaded -#If DEBUG Then - System.Diagnostics.Debug.WriteLine("Windows Store SID = " & Microsoft.Toolkit.Uwp.Services.Facebook.FacebookService.Instance.WindowsStoreId) -#End If -``` - -> [!NOTE] -You may have to turn on the Output window in Visual Studio to see this debug writeline. - -The above code will output something like this: - -``` -Windows Store SID = ms-app://s-1-15-2-12341451-1486691014-2395677208-123421631-1234998043-1234490472-123452499/ -``` - -When entering the value into the Facebook Developer site you must strip the ms-app:// and the trailing / off the string. - -## Creating a new Application on Facebook Developer Site - -1. To get a **Facebook.WindowsStoreID**, go to: https://developers.facebook.com/apps. -2. Select **Create a New App ID**, to start integration Facebook into your app or website. -3. Click, **Create a New App** -4. From the app Dashboard choose the **Settings** item on the left. It should select the *Basic* item under it by default. -5. **+Add Platform** choose Windows App. Leave the *Namespace* and *App Domains* entries blank. -6. Enter the **Windows Store SID** from within your app (see *Getting Windows Store SID* section) -7. From left side menu choose **+Add Product** Click to add *Facebook Login*. Ensure you set the following options in the UI: - -| Setting | Value | -|----------|------:| -| Client OAuth Login | Yes | -| Web OAuth Login | No | -| Embedded Browser OAuth Login | Yes | -| Force Web OAuth Redirection | No | -| Login from Devices | No | -| Valid OAuth redirect URIs | Blank | - -## Syntax - -```csharp -// Initialize service -FacebookService.Instance.Initialize(AppIDText.Text); - -// Login to Facebook -if (!await FacebookService.Instance.LoginAsync()) -{ - return; -} - -// Get user's feed -ListView.ItemsSource = await FacebookService.Instance.RequestAsync(FacebookDataConfig.MyFeed, 50); - -// Get current user profile picture -ProfileImage.DataContext = await FacebookService.Instance.GetUserPictureInfoAsync(); - -// Post a message on your wall using Facebook Dialog -await FacebookService.Instance.PostToFeedWithDialogAsync(TitleText.Text, DescriptionText.Text, UrlText.Text); - -// Get current user's photo albums -await FacebookService.Instance.GetUserAlbumsAsync(); - -// Get current user's photos by album Id -await FacebookService.Instance.GetUserPhotosByAlbumIdAsync(addedItem.Id); -``` -```vb -' Initialize service -FacebookService.Instance.Initialize(AppIDText.Text) - -' Login to Facebook -If Not Await FacebookService.Instance.LoginAsync() Then - Return -End If - -' Get user's feed -ListView.ItemsSource = Await FacebookService.Instance.RequestAsync(FacebookDataConfig.MyFeed, 50) - -' Get current user profile picture -ProfileImage.DataContext = Await FacebookService.Instance.GetUserPictureInfoAsync() - -' Post a message on your wall using Facebook Dialog -Await FacebookService.Instance.PostToFeedWithDialogAsync(TitleText.Text, DescriptionText.Text, UrlText.Text) - -' Get current user's photo albums -Await FacebookService.Instance.GetUserAlbumsAsync() - -' Get current user's photos by album Id -Await FacebookService.Instance.GetUserPhotosByAlbumIdAsync(addedItem.Id) -``` - -## FacebookAlbum Class - -FacebookAlbum has properties to hold album details - -### Properties - -| Property | Type | Description | -| -- | -- | -- | -| Cover_Photo | FacebookPhoto | Gets or sets cover_photo property | -| Description | string | Gets or sets description property | -| Id | string | Gets or sets id property | -| Name | string | Gets or sets name property | -| Picture | FacebookPictureData | Gets or sets picture property | - -## FacebookDataConfig Class - -Configuration object for specifying richer query information - -### Fields - -| Field | Type | Description | -| -- | -- | -- | -| MyFeed | FacebookDataConfig | Gets a predefined config to get user feed. The feed of posts (including status updates) and links published by this person, or by others on this person's profile | -| MyPosts | FacebookDataConfig | Gets a predefined config to show only the posts that were published by this person | -| MyTagged | FacebookDataConfig | Gets a predefined config to show only the posts that this person was tagged in | - -### Properties - -| Property | Type | Description | -| -- | -- | -- | -| Query | string | Gets or sets the query string for filtering service results | - -## FacebookOAuthTokens Class - -Facebook OAuth tokens - -### Properties - -| Property | Type | Description | -| -- | -- | -- | -| AppId | string | Gets or sets facebook AppId | -| WindowsStoreId | string | Gets or sets Windows Store ID | - -## FacebookPhoto Class - -FacebookAlbum has properties to hold photo details - -### Properties - -| Property | Type | Description | -| -- | -- | -- | -| Album | int | Gets or sets album property | -| Created_Time | int | Gets or sets time the entity instance was created | -| Id | string | Gets or sets id property | -| Images | int | Gets or sets images property | -| Link | string | Gets or sets a link to the entity instance | -| Name | string | Gets or sets name property | -| Picture | string | Gets or sets picture property | - -## FacebookPicture Class - -Class for presenting picture data returned from service provider - -### Properties - -| Property | Type | Description | -| -- | -- | -- | -| Id | string | Gets or sets the ID of the picture | -| Is_Silhouette | bool | Gets or sets a value indicating whether the picture is a silhouette or not | -| Link | string | Gets or sets the url of the page with the picture | -| Url | string | Gets or sets an url to the picture | - -## FacebookPictureData Class - -Holds picture data - -### Properties - -| Property | Type | Description | -| -- | -- | -- | -| Data | FacebookPicture | Gets or sets data property | - -## FacebookPlatformImageSource Class - -Holds image details - -### Properties - -| Property | Type | Description | -| -- | -- | -- | -| Height | string | Gets or sets height property | -| Source | string | Gets or sets source property | -| Width | string | Gets or sets width property | - -## FacebookPost Class - -Holds facebook post data - -### Properties - -| Property | Type | Description | -| -- | -- | -- | -| Id | string | Gets or sets id property | -| Message | string | Gets or sets message or post text | -| Created_Time | DateTime | Gets or sets time the entity instance was created | -| Link | string | Gets or sets a link to the entity instance | -| Full_Picture | string | Gets or sets a link to the accompanying image | - -## FacebookRequestSource Class - -Type to handle paged requests to Facebook Graph - -### Constructor - -| Constructor | Description | -| -- | -- | -| FacebookRequestSource(FacebookDataConfig, string, string, int) | Initializes a new instance of the `FacebookRequestSource` class | - -### Methods - -| Methods | Return Type | Description | -| -- | -- | -- | -| GetPagedItemsAsync(int, int, CancellationToken) | Task> | Returns strong typed page of data | - -## FacebookService Class - -Class for connecting to Facebook - -### Properties - -| Property | Type | Description | -| -- | -- | -- | -| WindowsStoreId | string | Gets a Windows Store ID associated with the current app | -| Instance | FacebookService | Gets public singleton property | -| LoggedUser | string | Gets the current logged user name | -| Provider | FBSession | Gets a reference to an instance of the underlying data provider | -| B | int | Description | -| B | int | Description | - -### Methods - -| Methods | Return Type | Description | -| -- | -- | -- | -| Initialize(FacebookOAuthTokens, FacebookPermissions) | bool | Initialize underlying provider with relevant token information | -| LoginAsync() | Task | Login with set of required requiredPermissions | -| LogoutAsync() | Task | Log out of the underlying service instance | -| RequestAsync(FacebookDataConfig, int) | Task> | Request list data from service provider based upon a given config / query | -| RequestAsync(FacebookDataConfig, int, string) | Task> | Request list data from service provider based upon a given config / query | -| RequestAsync(FacebookDataConfig, int, int) | Task, FacebookPost>> | Request list data from service provider based upon a given config / query | -| RequestAsync(FacebookDataConfig, int, int, string) | Task, T>> | Request generic list data from service provider based upon a given config / query | -| GetUserPictureInfoAsync() | Task | Returns the `FacebookPicture` object associated with the logged user | -| GetUserAlbumsAsync(int, string) | Task> | Retrieves list of user photo albums | -| GetUserAlbumsAsync(int, int, string) | Task, FacebookAlbum>> | Retrieves list of user photo albums | -| GetUserPhotosByAlbumIdAsync(string, int, string) | Task> | Retrieves list of user photos by album id | -| GetUserPhotosByAlbumIdAsync(string, int, int, string) | Task, FacebookPhoto>> | Retrieves list of user photos by album id | -| GetPhotoByPhotoIdAsync(string) | Task | Retrieves a photo by id | -| PostToFeedWithDialogAsync(string) | Task | Enables posting data to the timeline using Facebook dialog | - -## Sample Code - -[Facebook Service Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Facebook%20Service). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| --- | --- | -| Namespace | Microsoft.Toolkit.Uwp.Services | -| NuGet package | [Microsoft.Toolkit.Uwp.Services](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.Services/) | - -## API - -* [Facebook Service source code](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.Services/Services/Facebook) diff --git a/docs/services/GraphLogin.md b/docs/services/GraphLogin.md deleted file mode 100644 index 5c8dec81029..00000000000 --- a/docs/services/GraphLogin.md +++ /dev/null @@ -1,107 +0,0 @@ ---- -title: GraphLogin Component -author: AdamBraden -description: Windows Forms component to authenticate with Azure AD v2 and the Microsoft Graph -keywords: windows 10, uwp, uwp community toolkit, uwp toolkit, Windows Forms, GraphLogin ---- - -# GraphLogin Component - -The [GraphLogin component](https://docs.microsoft.com/dotnet/api/microsoft.toolkit.win32.ui.controls.winforms.graphlogin) is a Windows Forms component that provides an easy to use experience for authenticating with Azure AD and the Microsoft Graph. This component is being provided for Windows Forms developers that need a Microsoft Graph authentication solution on Windows 10 builds 1803 and earlier and on Windows 7. - -This component wraps the Toolkit's **MicrosoftGraphService** for an easy to use Login experience. The control then provides read-only properties about the logged on user and an instance of the **GraphServiceClient** which can be used for additional calls with the Microsoft Graph SDK. - -> [!IMPORTANT] -Before using this component, the application must be registered in the Azure AD v2 endpoint. For more information on registering your app see https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-v2-app-registration. - - -## Syntax -To use this sample code in a Windows Forms application, install the Microsoft.Toolkit.Win32.UI.Controls nuget package, and add a button, 2 labels, and a picturebox on the form. Then drag a GraphLogin component from the toolbox on to the form, and enter the following code: - -```csharp - - using Microsoft.Toolkit.Services.Services.MicrosoftGraph; - - - // Instance of Microsoft Graph - private GraphServiceClient graphClient = null; - - public Form1() - { - InitializeComponent(); - - // values to connect to Microsoft Graph - graphLoginComponent1.ClientId = "{your app's clientid}"; - graphLoginComponent1.Scopes = new string[] { MicrosoftGraphScope.UserRead }; - } - - private async void button1_Click(object sender, EventArgs e) - { - if (!await graphLoginComponent1.LoginAsync()) - { - return; - } - - //update the user's display fields - label1.Text = graphLoginComponent1.DisplayName; - label2.Text = graphLoginComponent1.JobTitle; - pictureBox1.Image = graphLoginComponent1.Photo; - - // Do more things with the graph - graphClient = graphLoginComponent1.GraphServiceClient; - } -``` - - - - - -## Add the GraphLogin component to the Visual Studio Toolbox - - -1. Open the Visual Studio **Toolbox**, then right-click anywhere in the toolbox, and select the **Choose Items** option. - -2. In the **.NET Framework Components** tab of the **Choose Toolbox Items** dialog box. - -3. Use the **Browse** button to locate the **Microsoft.Toolkit.Services.dll** in your NuGet package folder (choose the *net461* folder). - - For help finding that folder, see [Managing the global packages, cache, and temp folders](https://docs.microsoft.com/nuget/consume-packages/managing-the-global-packages-and-cache-folders). - -4. Add that file to the list of Toolbox controls, and then close the **Choose Toolbox Items** dialog box. - - The **GraphLoginComponent** appears in the **General** section of the **Toolbox**. - -## Properties - -| Property | Type | Description | -| -- | -- | -- | -| ClientId | string| The ClientId of the application as registered with Azure AD v2 | -| Scopes | string[]| An array of scopes requested for the Microsoft Graph. Use values from the MicrosoftGraphScope enum | -| DisplayName | string | Display name for the logged on user from the Microsoft Graph | -| JobTitle | string | Job title for the logged on user from the Microsoft Graph | -| Email | string | Email address (UPN) for the logged on user from the Microsoft Graph | -| Photo | System.Drawing.Image | Profile picture for the logged on user from the Microsoft Graph | -| GraphServiceClient | Microsoft.Graph.GraphServiceClient | The GraphServiceClient instance for the logged on user from the Microsoft Graph | - - - - -## Methods - - - -| Methods | Return Type | Description | -| -- | -- | -- | -| LoginAsync | bool | Returns true of success, false otherwise | - - -## Requirements - -| Device family | .NetFramework 4.6.1 or higher | -| -- | -- | -| Namespace | Microsoft.Toolkit.Services.WinForms | -| NuGet package | [Microsoft.Toolkit.Services](https://www.nuget.org/packages/Microsoft.Toolkit.Services) | - -## API Source Code - -- [WinForms.GraphLogin](/Microsoft.Toolkit.Services/Services/MicrosoftGraph/WinForms) diff --git a/docs/services/Linkedin.md b/docs/services/Linkedin.md deleted file mode 100644 index 760ff1a116a..00000000000 --- a/docs/services/Linkedin.md +++ /dev/null @@ -1,98 +0,0 @@ ---- -title: LinkedIn Service -author: nmetulev -description: The LinkedIn Service allows you to retrieve or publish data to the LinkedIn graph. Examples of the types of objects you can work with are User profile data and sharing Activity. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, LinkedIn Service -dev_langs: - - csharp - - vb ---- - -# LinkedIn Service - -The **LinkedIn Service** allows you to retrieve or publish data to the LinkedIn graph. Examples of the types of objects you can work with are User profile data and sharing Activity. - -## Creating a new Application on LinkedIn Developer Site - -1. Go to: https://www.linkedin.com/developer/apps. -2. Select **Create Application**, to start integrating LinkedIn into your app. -3. Complete all mandatory fields signified by the red star. If you agree to the terms and conditions, hit **Submit**. -4. Make a note of the **Client Id** and **Client Secret** for your app - you will need to supply these in your code. -5. Take note of the **Default Application Permissions**. You can either set these in this portal or via code. These are the permissions your user will need to agree to for you to make calls on their behalf. -6. Under **OAuth 2.0** you will need to enter a **Authorized Redirect URLs**. For UWP app development purposes this is arbitrary, but it will need to match what you have in your code (e.g. https://github.com/Microsoft/WindowsCommunityToolkit/). -7. Once you have done, hit **Update**. - -## Syntax - -```csharp -// Initialize service - use overload if you need to supply additional permissions -LinkedInService.Instance.Initialize(ClientId.Text, ClientSecret.Text, CallbackUri.Text); - -// Login to LinkedIn -if (!await LinkedInService.Instance.LoginAsync()) -{ - return; -} - -// Get current user's profile details -await LinkedInService.Instance.GetUserProfileAsync(); - -// Share message to LinkedIn (text should include a Url so LinkedIn can scrape preview information) -await LinkedInService.Instance.ShareActivityAsync(ShareText.Text); -``` -```vb -' Initialize service - use overload if you need to supply additional permissions -LinkedInService.Instance.Initialize(ClientId.Text, ClientSecret.Text, CallbackUri.Text) - -' Login to LinkedIn -If Not Await LinkedInService.Instance.LoginAsync() Then - Return -End If - -' Get current user's profile details -Await LinkedInService.Instance.GetUserProfileAsync() - -' Share message to LinkedIn (text should include a Url so LinkedIn can scrape preview information) -Await LinkedInService.Instance.ShareActivityAsync(ShareText.Text) -``` - -[LinkedIn Service Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/LinkedIn%20Service). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Using the service on non-UWP platforms - -To use the service outside the UWP platform, you'll need to implement some interfaces. These interfaces are the IAuthenticationBroker, IPasswordManager and IStorageManager. - -**IAuthenticationBroker** - -The IAuthenticationBroker only has the Authenticate method. This method receives a request uri and a callback uri, which you'll use to authenticate with the API. The method returns an AuthenticationResult that tells the service the authentication result. - -**IPasswordManager** - -The IPasswordManager will allow the service to manage passwords. The methods you'll have to implement are Get, Store and Remove. - -The Get method receives a string key and returns a PasswordCredential. - -The Store method receives a string resource and a PasswordCredential. - -The Remove method receives a string key. - -**IStorageManager** - -Finally, the IStorageManager will allow the service to store application data. The methods you'll have to implement are Get and Set. - -The Get method receives a string key and returns the saved string. - -The Set method receives a string key and a string value. - -The toolkit has implementations of each of them for UWP. You can find them as UwpAuthenticationBroker, UwpPasswordManager and UwpStorageManager. - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| --- | --- | -| Namespace | Microsoft.Toolkit.Services | -| NuGet package | [Microsoft.Toolkit.Services](https://www.nuget.org/packages/Microsoft.Toolkit.Services/) | - -## API - -* [LinkedIn Service source code](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.Services/Services/LinkedIn) diff --git a/docs/services/MicrosoftGraph.md b/docs/services/MicrosoftGraph.md deleted file mode 100644 index 6ecb0742f20..00000000000 --- a/docs/services/MicrosoftGraph.md +++ /dev/null @@ -1,339 +0,0 @@ ---- -title: MicrosoftGraph Service -author: nmetulev -description: The MicrosoftGraph Service aim to easily logon to Microsoft Graph service in order to Retrieve User Information, Retrieve and Send emails, Retrieve User events -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, MicrosoftGraph Service -dev_langs: - - csharp - - vb ---- - -# MicrosoftGraph Service - -The **MicrosoftGraph** Service allows easy access to the Microsoft Graph in order to: - -* Retrieve User Information -* Retrieve and Send emails -* Retrieve User events - -> [!NOTE] -This API will not work on an Xbox UWP Application - -## Get a Client Id - -To authenticate your app, you need to register your app with Azure AD, and provide some details about your app. - - -### Register the App to use Azure AD v2 Endpoint - -1. Go to the [App Registration Portal](https://apps.dev.microsoft.com) -2. Click in the "Add an app" button. -3. Enter the app name and click "create" -4. Once the App is created, copy the Application Id to use it later. -5. Next, add a Platform to the App clicking in "Add Platform" and select "Native Application" tile. -6. Scroll to the Microsoft Graph Permissions section (by default the User.Read permission is added). Add the following permissions: Sign in and read user profile, Read user mail, Send mail as a user, Read user calendars. -7. Finally, save your changes. - -### Register the App to use Azure AD v1 Endpoint - -You can register your app manually by using the [Azure Management Portal](http://portal.azure.com), or by using Visual Studio: -1. To register your app by using Visual Studio, see [Using Visual Studio to register your app and add Office 365 APIs.](https://msdn.microsoft.com/office/office365/HowTo/adding-service-to-your-Visual-Studio-project) -2. To register your app manually, see [Manually register your app with Azure AD so it can access Office 365 APIs.](https://msdn.microsoft.com/en-us/office/office365/howto/add-common-consent-manually). Here is a summary to register your App manually: - - Go to the [Azure Management Portal](http://portal.azure.com) - - Go to the "Azure Active Directory" option - - Go to "App Registrations" option - - Click on the "New application registration" button - - Enter a name for your App - - Specify your application as a **Native** - - Specify the Redirect Uri as **urn:ietf:wg:oauth:2.0:oob** - - Click "Create" button - -After you've registered your app, Azure AD will generate a client ID for your app. You'll need to use this client ID to get your access token. - -When you register your app in the [Azure Management Portal](http://portal.azure.com), you will need to configure details about your application with the following steps: - -1. Click "Settings" button -2. Go to "Required permissions" option -3. Add Application: Choose **Microsoft Graph** API -4. Specify the permission levels the MicrosoftGraph Service requires from the Office 365 API (Microsoft Graph). Choose at least: - * **Sign in and read user profile** to access user's profile. - * **Read user mail and Send mail as user** to retrieve/send messages. - * **Read user calendars** to retrieve events. - -**Note:** Once register copy and save the Client ID for future use. - -|Setting|Value| -|----------|:-------------:| -|Native application|Yes| -|Redirect Uri|urn:ietf:wg:oauth:2.0:oob| -|Resource to Add|Microsoft Graph| -|Delegate Permissions |Sign in and read user profile, Read user mail, Send mail as a user, Read user calendars| - -### Testing access to the Graph API -Using ADAL, v1 authentication, registering your application creates an App ID/Client and you can simply paste that into the Client Id field inside of the Microsoft Graph services page. - -Using MSAL, v2 (default) authentication, you can use the same App ID to paste to the Client Id field. You can also optionally provide different permission scopes and a login hint (suggested user name). - - -### Get an Office 365 Subscription - -If you don't have one, you need to create an Office 365 Developer Site. There are several ways to create one: - -* [An MSDN subscription](https://msdn.microsoft.com/subscriptions/manage/default.aspx) - This is available to MSDN subscribers with Visual Studio Ultimate and Visual Studio Premium. -* [An existing Office 365 subscription](https://msdn.microsoft.com/library/2ec857d5-dc6f-4cf6-ba45-adc845ef2a25%28Office.15%29.aspx) - You can use an existing Office 365 subscription, which can be any of the following: Office 365 Midsize Business, Office 365 Enterprise, Office 365 Education, Office 365 Government. -* [Free O365 trial](https://portal.office.com/Signup?OfferId=6881A1CB-F4EB-4db3-9F18-388898DAF510&DL=DEVELOPERPACK&ali=1) - You can start with a free 30-day trial, or buy an Office 365 developer subscription. -* [Free O365 Developer](http://dev.office.com/devprogram) - Or Get a One year free Office 365 Developer account - -## Syntax - -### Sign in with an AAD account - -```csharp -// Initialize the service -if (!MicrosoftGraphService.Instance.Initialize(ClientId.Text)) -{ - return; -} -// Login via Azure Active Directory -if (!await MicrosoftGraphService.Instance.LoginAsync()) -{ - return; -} - -// Create a instance of the service -var msg = new MicrosoftGraphService(ClientId.Text); -// Login via Azure Active Directory -if (!await msg.LoginAsync()) -{ - return; -} - -``` -```vb -' Initialize the service -If Not MicrosoftGraphService.Instance.Initialize(ClientId.Text) Then - Return -End If - -' Login via Azure Active Directory -If Not Await MicrosoftGraphService.Instance.LoginAsync() Then - Return -End If -``` - -```csharp -// Register event handler to capture authentication state changes -MicrosoftGraphService.Instance.IsAuthenticatedChanged += (sender, e) => -{ - // do something -}; -// Register event handler to capture sign in exceptions -MicrosoftGraphService.Instance.SignInFailed += (sender, e) => -{ - // do something -}; -``` - -### Get the connected user's info - -```csharp -// Retrieve user's info from Azure Active Directory -var user = await MicrosoftGraphService.Instance.User.GetProfileAsync(); -UserPanel.DataContext = user; - -// You can also select any fields you want in the response -MicrosoftGraphUserFields[] selectedFields = -{ - MicrosoftGraphUserFields.Id, - MicrosoftGraphUserFields.DisplayName, - MicrosoftGraphUserFields.JobTitle, - MicrosoftGraphUserFields.Mail, - MicrosoftGraphUserFields.Department, - MicrosoftGraphUserFields.PreferredLanguage -}; - -var user =await MicrosoftGraphService.Instance.User.GetProfileAsync(selectedFields); -UserPanel.DataContext = user; - -// Retrieve the user's photo -using (IRandomAccessStream photoStream = await MicrosoftGraphService.Instance.User.GetPhotoAsync()) -{ - BitmapImage photo = new BitmapImage(); - if (photoStream != null) - { - await photo.SetSourceAsync(photoStream); - } - else - { - photo.UriSource = new Uri("ms-appx:///SamplePages/MicrosoftGraph Service/user.png"); - } - - this.Photo.Source = photo; -} -``` -```vb -' Retrieve user's info from Azure Active Directory -Dim user = Await MicrosoftGraphService.Instance.User.GetProfileAsync() -UserPanel.DataContext = user - -' You can also select any fields you want in the response -Dim selectedFields As MicrosoftGraphUserFields() = { - MicrosoftGraphUserFields.Id, - MicrosoftGraphUserFields.DisplayName, - MicrosoftGraphUserFields.JobTitle, - MicrosoftGraphUserFields.Mail, - MicrosoftGraphUserFields.Department, - MicrosoftGraphUserFields.PreferredLanguage -} - -Dim user = Await MicrosoftGraphService.Instance.User.GetProfileAsync(selectedFields) -UserPanel.DataContext = user - -' Retrieve the user's photo -Using photoStream As IRandomAccessStream = Await MicrosoftGraphService.Instance.User.PhotosService.GetPhotoAsync() - Dim photo As BitmapImage = New BitmapImage() - If photoStream IsNot Nothing Then - Await photo.SetSourceAsync(photoStream) - Else - photo.UriSource = New Uri("ms-appx:///SamplePages/MicrosoftGraph Service/user.png") - End If - - Me.Photo.Source = photo -End Using -``` - -### Retrieve/Send messages - -```csharp -// Get the top 10 messages -messages = await MicrosoftGraphService.Instance.User.Message.GetEmailsAsync(10); -MessagesList.ItemsSource = messages; - -// You can also select any fields you want in the response -MicrosoftGraphMessageFields[] selectedFields = -{ - MicrosoftGraphMessageFields.Id, - MicrosoftGraphMessageFields.From, - MicrosoftGraphMessageFields.Subject, - MicrosoftGraphMessageFields.BodyPreview -}; - -messages = await MicrosoftGraphService.Instance.User.Message.GetEmailsAsync(10,selectedFields); -MessagesList.ItemsSource = messages; - -// Request the next 10 messages -messages = await MicrosoftGraphService.Instance.User.Message.NextPageEmailsAsync(); -if (messages == null) -{ - // no more messages -} - -// Send a message -string[] toRecipients = { "user1@contoso.com", "user2@contoso.com" }; -string subject = "This is the subject of my message; -string content = "This is the content of my message"; - -await MicrosoftGraphService.Instance.User.Message.SendEmailAsync(subject, content, BodyType.Text, toRecipients); - -// You can also send a message in html format -string content = GetHtmlMessage(); -await MicrosoftGraphService.Instance.User.Message.SendEmailAsync(subject, content, BodyType.Html, toRecipients); -``` -```vb -' Get the top 10 messages -messages = Await MicrosoftGraphService.Instance.User.Message.GetEmailsAsync(10) -MessagesList.ItemsSource = messages - -' You can also select any fields you want in the response -Dim selectedFields As MicrosoftGraphMessageFields() = { - MicrosoftGraphMessageFields.Id, - MicrosoftGraphMessageFields.From, - MicrosoftGraphMessageFields.Subject, - MicrosoftGraphMessageFields.BodyPreview -} -messages = Await MicrosoftGraphService.Instance.User.Message.GetEmailsAsync(10, selectedFields) -MessagesList.ItemsSource = messages - -' Request the next 10 messages -messages = Await MicrosoftGraphService.Instance.User.Message.NextPageEmailsAsync() -If messages Is Nothing Then - ' no more messages -End If - -' Send a message -Dim toRecipients As String() = {"user1@contoso.com", "user2@contoso.com"} -Dim subject As String = "This is the subject of my message;" -Dim content As String = "This is the content of my message" -Await MicrosoftGraphService.Instance.User.Message.SendEmailAsync(subject, content, BodyType.Text, toRecipients) - -' You can also send a message in html format -Dim content As String = GetHtmlMessage() -Await MicrosoftGraphService.Instance.User.Message.SendEmailAsync(subject, content, BodyType.Html, toRecipients) -``` - -### Retrieve calendar events - -```csharp -// Get the top 10 events -events = await MicrosoftGraphService.Instance.User.Event.GetEventsAsync(10); -EventsList.ItemsSource = events; - -// You can also select any fields you want in the response -MicrosoftGraphEventFields[] selectedFields = -{ - MicrosoftGraphEventFields.Id, - MicrosoftGraphEventFields.Attendees, - MicrosoftGraphEventFields.Start, - MicrosoftGraphEventFields.HasAttachments, - MicrosoftGraphEventFields.Subject, - MicrosoftGraphEventFields.BodyPreview -}; - -events = await MicrosoftGraphService.Instance.User.Event.GetEventsAsync(10,selectedFields); -EventsList.ItemsSource = events; - -// Request the next 10 events -events = await MicrosoftGraphService.Instance.User.Event.NextPageEventsAsync(); -if (events == null) -{ - // no more events -} -``` -```vb -' Get the top 10 events -events = Await MicrosoftGraphService.Instance.User.[Event].GetEventsAsync(10) -EventsList.ItemsSource = events - -' You can also select any fields you want in the response -Dim selectedFields As MicrosoftGraphEventFields() = { - MicrosoftGraphEventFields.Id, - MicrosoftGraphEventFields.Attendees, - MicrosoftGraphEventFields.Start, - MicrosoftGraphEventFields.HasAttachments, - MicrosoftGraphEventFields.Subject, - MicrosoftGraphEventFields.BodyPreview -} -events = Await MicrosoftGraphService.Instance.User.[Event].GetEventsAsync(10, selectedFields) -EventsList.ItemsSource = events - -' Request the next 10 events -events = Await MicrosoftGraphService.Instance.User.[Event].NextPageEventsAsync() -If events Is Nothing Then - ' no more events -End If -``` - -## Sample Code - -[MicrosoftGraph Service Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Microsoft%20Graph%20Service). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -### Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| --- | --- | -| Namespace | Microsoft.Toolkit.Services | -| NuGet package | [Microsoft.Toolkit.Services](https://www.nuget.org/packages/Microsoft.Toolkit.Services/) | - -### API - -* [MicrosoftGraph Service source code](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Services/Services/MicrosoftGraph) diff --git a/docs/services/MicrosoftTranslator.md b/docs/services/MicrosoftTranslator.md deleted file mode 100644 index ae01d7a48d6..00000000000 --- a/docs/services/MicrosoftTranslator.md +++ /dev/null @@ -1,65 +0,0 @@ ---- -title: Microsoft Translator Service -author: nmetulev -description: The Microsoft Translator Service allows you to translate text to various supported languages. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, MicrosoftTranslator -dev_langs: - - csharp - - vb ---- - -# Microsoft Translator Service - -The **Microsoft Translator Service** allows you to translate text to various supported languages. - -## Set up Microsoft Translator Service - -[Signup for Microsoft Translator Service](https://portal.azure.com/#create/Microsoft.CognitiveServices/apitype/TextTranslation) using your Microsoft Azure subscription account. There is a free trial option for that allows you to translate up to 2,000,000 characters per month. - -## Example Syntax - -```csharp -// using Microsoft.Toolkit.Uwp.Services.MicrosoftTranslator; - -await TranslatorService.Instance.InitializeAsync(" - -to your application manifest to enable AAD authentication. Capabilities in the manifest are described in more detail in this document [Capability](https://docs.microsoft.com/en-us/uwp/schemas/appxpackage/appxmanifestschema/element-capability) - -Authentication, sign-in and permission scopes are discussed in more detail in this document, [Authorization and sign-in for OneDrive in Microsoft Graph](https://docs.microsoft.com/en-us/onedrive/developer/rest-api/getting-started/graph-oauth) - -### Testing access to the OneDrive API -Registering your applicatioin creates an App ID/Client and you can simply paste that into the Client Id field inside of the OneDrive services page. - -## Syntax - -### Initialization - -```csharp -// Using the new converged authentication of the Microsoft Graph we can simply -// call the Initialize method on the OneDriveService singleton when initializing -// in UWP applications -Microsoft.Toolkit.Services.OneDrive.OneDriveService.Instance.Initialize - (appClientId, - scopes, - null, - null); -``` -```vb -' Using the new converged authentication of the Microsoft Graph we can simply -' call the Initialize method on the OneDriveService singleton when initializing -' in UWP applications -Microsoft.Toolkit.Services.OneDrive.OneDriveService.Instance.Initialize(appClientId, scopes, Nothing, Nothing) -``` - -### Defining scopes -More information on scopes can be found in this document [Authentication scopes](https://docs.microsoft.com/en-us/onedrive/developer/rest-api/getting-started/msa-oauth#authentication-scopes) - -```csharp -// If the user hasn't selected a scope then set it to FilesReadAll -if (scopes == null) -{ - scopes = new string[] { MicrosoftGraphScope.FilesReadAll }; -} -``` -```vb -' If the user hasn't selected a scope then set it to FilesReadAll -If scopes Is Nothing Then - scopes = New String() {MicrosoftGraphScope.FilesReadAll} -End If -``` - -### Login -```csharp -// Login -if (!await OneDriveService.Instance.LoginAsync()) -{ - throw new Exception("Unable to sign in"); -} -``` -```vb -' Login -If Not Await OneDriveService.Instance.LoginAsync() Then - Throw New Exception("Unable to sign in") -End If -``` - -### Retrieve the root of your OneDrive - -```csharp -var folder = await OneDriveService.Instance.RootFolderForMeAsync(); -``` -```vb -Dim folder = Await OneDriveService.Instance.RootFolderForMeAsync() -``` - -### Retrieving files - -```csharp -// Once you have a reference to the Root Folder you can get a list of all items -// List the Items from the current folder -var OneDriveItems = await folder.GetItemsAsync(); -do -{ - // Get the next page of items - OneDriveItems = await folder.NextItemsAsync(); -} -while (OneDriveItems != null); -``` -```vb -' Once you have a reference to the Root Folder you can get a list of all items -' List the Items from the current folder -Dim OneDriveItems = Await folder.GetItemsAsync() -Do - ' Get the next page of items - OneDriveItems = Await folder.NextItemsAsync() -Loop While OneDriveItems IsNot Nothing -``` - -### Creating folders - -```csharp -// Then from there you can play with folders and files -// Create Folder -string newFolderName = await OneDriveSampleHelpers.InputTextDialogAsync("New Folder Name"); -if (!string.IsNullOrEmpty(newFolderName)) -{ - await folder.StorageFolderPlatformService.CreateFolderAsync(newFolderName, CreationCollisionOption.GenerateUniqueName); -} -``` -```vb -' Then from there you can play with folders and files -' Create Folder -Dim newFolderName As String = Await OneDriveSampleHelpers.InputTextDialogAsync("New Folder Name") -If Not String.IsNullOrEmpty(newFolderName) Then - Await folder.StorageFolderPlatformService.CreateFolderAsync(newFolderName, CreationCollisionOption.GenerateUniqueName) -End If -``` - -### Navigating subfolders - -```csharp -var currentFolder = await _graphCurrentFolder.GetFolderAsync(item.Name); -OneDriveItemsList.ItemsSource = await currentFolder.GetItemsAsync(20); -_graphCurrentFolder = currentFolder; -``` -```vb -Dim currentFolder = Await _graphCurrentFolder.GetFolderAsync(item.Name) -OneDriveItemsList.ItemsSource = Await currentFolder.GetItemsAsync(20) -_graphCurrentFolder = currentFolder -``` - -### Moving, copying and renaming items - -```csharp -// OneDrive API treats all items the same whether file, folder, etc. -// Move item -await _onedriveStorageItem.MoveAsync(targetonedriveStorageFolder); - -// Copy Folder -await _onedriveStorageItem.CopyAsync(targetonedriveStorageFolder); - -// Rename Folder -await _onedriveStorageItem.RenameAsync("NewLevel3"); -``` -```vb -' OneDrive API treats all items the same whether file, folder, etc. -' Move Folder -Await _onedriveStorageItem.MoveAsync(targetonedriveStorageFolder) - -' Copy Folder -Await _onedriveStorageItem.CopyAsync(targetonedriveStorageFolder) - -' Rename Folder -Await _onedriveStorageItem.RenameAsync("NewLevel3") -``` - -### Creating or uploading files less than 4MB - -```csharp -// Open the local file or create a local file if brand new -var selectedFile = await OpenLocalFileAsync(); -if (selectedFile != null) -{ - using (var localStream = await selectedFile.OpenReadAsync()) - { - var fileCreated = await folder.StorageFolderPlatformService.CreateFileAsync(selectedFile.Name, CreationCollisionOption.GenerateUniqueName, localStream); - } -} -``` -```vb -' Open the local file or create a local file if brand new -Dim selectedFile = Await OpenLocalFileAsync() -If selectedFile IsNot Nothing Then - Using localStream = Await selectedFile.OpenReadAsync() - Dim fileCreated = Await level3Folder.CreateFileAsync(selectedFile.Name, CreationCollisionOption.GenerateUniqueName, localStream) - End Using -End If -``` - -### Creating or uploading files - that exceed 4MB - -```csharp -var selectedFile = await OpenLocalFileAsync(); -if (selectedFile != null) - { - using (var localStream = await selectedFile.OpenReadAsync()) - { - Shell.Current.DisplayWaitRing = true; - - // If the file exceed the Maximum size (ie 4MB) - var largeFileCreated = await folder.StorageFolderPlatformService.UploadFileAsync(selectedFile.Name, localStream, CreationCollisionOption.GenerateUniqueName, 320 * 1024); - } - } -} -``` -```vb -Dim selectedFile = Await OpenLocalFileAsync() -If selectedFile IsNot Nothing Then - Using localStream = Await selectedFile.OpenReadAsync() - Shell.Current.DisplayWaitRing = True - - ' If the file exceed the Maximum size (ie 4MB) - Dim largeFileCreated = Await folder.StorageFolderPlatformService.UploadFileAsync(selectedFile.Name, localStream, CreationCollisionOption.GenerateUniqueName, 320 * 1024) - End Using -End If -``` - -### Downloading files - -```csharp -// Download a file and save the content in a local file -// Convert the storage item to a storage file -var oneDriveFile = (Toolkit.Services.OneDrive.OneDriveStorageFile)item; -using (var remoteStream = (await oneDriveFile.StorageFilePlatformService.OpenAsync()) as IRandomAccessStream) -{ - // Use a helper method to open local filestream and write to it - await SaveToLocalFolder(remoteStream, oneDriveFile.Name); -} -``` -```vb -' Download a file and save the content in a local file -' Convert the storage item to a storage file -Dim oneDriveFile = CType(item, Toolkit.Services.OneDrive.OneDriveStorageFile) -Using remoteStream = TryCast((Await oneDriveFile.StorageFilePlatformService.OpenAsync()), IRandomAccessStream) - ' Use a helper method to open local filestream and write to it - Await SaveToLocalFolder(remoteStream, oneDriveFile.Name) -End Using -``` - -### Retrieving file thumbnails - -```csharp -var file = (Toolkit.Services.OneDrive.OneDriveStorageItem)((AppBarButton)e.OriginalSource).DataContext; -using (var stream = (await file.StorageItemPlatformService.GetThumbnailAsync(Toolkit.Services.MicrosoftGraph.MicrosoftGraphEnums.ThumbnailSize.Large)) as IRandomAccessStream) -{ - // Use a helper method to display the images on the xaml view - await OneDriveSampleHelpers.DisplayThumbnail(stream, "thumbnail"); -} -``` -```vb -Dim file = CType((CType(e.OriginalSource, AppBarButton)).DataContext, Toolkit.Services.OneDrive.OneDriveStorageItem) -Using stream = TryCast((Await file.StorageItemPlatformService.GetThumbnailAsync(Toolkit.Services.MicrosoftGraph.MicrosoftGraphEnums.ThumbnailSize.Large)), IRandomAccessStream) - ' Use a helper method to display the images on the xaml view - Await OneDriveSampleHelpers.DisplayThumbnail(stream, "thumbnail") -End Using -``` - -## Sample Code - -[OneDrive Service Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/OneDrive%20Service). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| --- | --- | -| Namespace | Microsoft.Toolkit.Services | -| NuGet package | [Microsoft.Toolkit.Services](https://www.nuget.org/packages/Microsoft.Toolkit.Services/) | - -## API - -* [OneDrive Service source code](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Services/Services/OneDrive) diff --git a/docs/services/Twitter.md b/docs/services/Twitter.md deleted file mode 100644 index 09662f92971..00000000000 --- a/docs/services/Twitter.md +++ /dev/null @@ -1,214 +0,0 @@ ---- -title: Twitter Service -author: nmetulev -description: The Twitter Service allows users to retrieve or publish data to Twitter. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, Twitter -dev_langs: - - csharp - - vb ---- - -# Twitter Service - -The **Twitter Service** allows users to retrieve or publish data to Twitter. - -[Twitter Developer Site](https://dev.twitter.com) is the main content site for all twitter developers. Visit the [Twitter Apps List](https://apps.twitter.com/) to manage existing apps. - -[Create new Twitter App](https://apps.twitter.com/app) can be used to create a new app within the Twitter portal. - -## App Setup - -**Consumer Key** -Copy this from the *Keys and Access Tokens* tab on your application page. - -**Consumer Secret** -Copy this from the *Keys and Access Tokens* tab on your application page. - -**Callback URI** Enter a unique URI for your application. This must match the *Callback URL* field on the *Application Details* tab in Twitter. -*Example*: http://myapp.company.com - (this does not have to be a working URL) - -## Overview - -In the code section below the GetUserTimeLineAsync method returns some Tweet objects. The Tweet class returns some basic information along with the tweet text itself. - -| Property | Type | Description | -| -- | -- | -- | -| **CreatedAt** | string | The date and time of the Tweet formatted by Twitter | -| **Text** | string | The text of the Tweet (if retweet, the text might not be complete - use the RetweetedStatus object for the original tweet)| -| **Id** | string | The Twitter status identifier | -| **GeoData** | TwitterGeoData | A class containing the latitude and longitude of the Tweet | -| **User** | TwitterUser | A class containing the user ID, Name, ScreenName, and ProfileImageUrl | -| **RetweetedStatus** | Tweet | if this tweet is a retweet, this object will contain the original tweet | - -## Syntax - -```csharp -// Initialize service -TwitterService.Instance.Initialize(ConsumerKey.Text, ConsumerSecret.Text, CallbackUri.Text); - -// Login to Twitter -if (!await TwitterService.Instance.LoginAsync()) -{ - return; -} - -// Get current user info -var user = await TwitterService.Instance.GetUserAsync(); -ProfileImage.DataContext = user; - -// Get user time line -ListView.ItemsSource = await TwitterService.Instance.GetUserTimeLineAsync(user.ScreenName, 50); - -// Post a tweet -await TwitterService.Instance.TweetStatusAsync(TweetText.Text); - -var status = new TwitterStatus - { - Message = TweetText.Text, - - // Optional parameters defined by the Twitter "update" API (they may all be null or false) - - DisplayCoordinates = true, - InReplyToStatusId = "@ValidAccount", - Latitude = validLatitude, - Longitude = validLongitude, - PlaceId = "df51dec6f4ee2b2c", // As defined by Twitter - PossiblySensitive = true, // As defined by Twitter (nudity, violence, or medical procedures) - TrimUser = true - } - -await TwitterService.Instance.TweetStatusAsync(status); - -// Post a tweet with a picture -await TwitterService.Instance.TweetStatusAsync(TweetText.Text, stream); - -await TwitterService.Instance.TweetStatusAsync(status, stream); - -// Search for a specific tag -ListView.ItemsSource = await TwitterService.Instance.SearchAsync(TagText.Text, 50); - -// Open a connection with the stream service in order to receive live tweets and events -ListView.ItemsSource = _tweets; -await TwitterService.Instance.StartUserStreamAsync(async tweet => -{ - await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => - { - if (tweet != null) - { - _tweets.Insert(0, tweet); - } - }); -}); - -// Stop receiving live tweets and events -TwitterService.Instance.StopUserStream(); -``` -```vb -' Initialize service -TwitterService.Instance.Initialize(ConsumerKey.Text, ConsumerSecret.Text, CallbackUri.Text) - -' Login to Twitter -If Not Await TwitterService.Instance.LoginAsync() Then - Return -End If - -' Get current user info -Dim user = Await TwitterService.Instance.GetUserAsync() -ProfileImage.DataContext = user - -' Get user time line -ListView.ItemsSource = Await TwitterService.Instance.GetUserTimeLineAsync(user.ScreenName, 50) - -' Post a tweet -Await TwitterService.Instance.TweetStatusAsync(TweetText.Text) -Dim status = New TwitterStatus With { - .Message = TweetText.Text, - - ' Optional parameters defined by the Twitter "update" API (they may all be null or false) - - .DisplayCoordinates = True, - .InReplyToStatusId = "@ValidAccount", - .Latitude = validLatitude, - .Longitude = validLongitude, - .PlaceId = "df51dec6f4ee2b2c", ' As defined by Twitter - .PossiblySensitive = True, ' As defined by Twitter (nudity, violence, or medical procedures) - .TrimUser = True -} -Await TwitterService.Instance.TweetStatusAsync(status) - -' Post a tweet with a picture -Await TwitterService.Instance.TweetStatusAsync(TweetText.Text, stream) -Await TwitterService.Instance.TweetStatusAsync(status, stream) - -' Search for a specific tag -ListView.ItemsSource = Await TwitterService.Instance.SearchAsync(TagText.Text, 50) - -' Open a connection with the stream service in order to receive live tweets and events -ListView.ItemsSource = _tweets -Await TwitterService.Instance.StartUserStreamAsync( - Async Sub(tweet) - Await Dispatcher.RunAsync( - CoreDispatcherPriority.Normal, - Sub() - If tweet IsNot Nothing Then - _tweets.Insert(0, tweet) - End If - End Sub) - End Sub) - -' Stop receiving live tweets and events -TwitterService.Instance.StopUserStream() -``` - -## Posting to timeline fails to appear - -Twitter app models allows for read only applications. If the app is tagged as Readonly, but attempts to post there is *no error returned*. The post is just eaten by the service. - -If you are posting from your app and never seeing them show up in the timeline check the *Permissions* tab on the app page. You want to ensure that you have *Read and Write* checked on that tab. - -## Using the service on non-UWP platforms - -To use the service outside the UWP platform, you'll need to implement some interfaces. These interfaces are the IAuthenticationBroker, IPasswordManager, IStorageManager and ISignatureManager. - -**IAuthenticationBroker** - -The IAuthenticationBroker only has the Authenticate method. This method receives a request uri and a callback uri, which you'll use to authenticate with the API. The method returns an AuthenticationResult that tells the service the authentication result. - -**IPasswordManager** - -The IPasswordManager will allow the service to manage passwords. The methods you'll have to implement are Get, Store and Remove. - -The Get method receives a string key and returns a PasswordCredential. - -The Store method receives a string resource and a PasswordCredential. - -The Remove method receives a string key. - -**IStorageManager** - -The IStorageManager will allow the service to store application data. The methods you'll have to implement are Get and Set. - -The Get method receives a string key and returns the saved string. - -The Set method receives a string key and a string value. - -**ISignatureManager** - -Finally, the ISignatureManager will provide a GetSignature method, to sign an OAuth request. This method receives a baseString, a secret string and an append boolean. In return, you'll get the signed baseString. In case the append boolean is true, the final string will have a `&` at the end. - -The toolkit has implementations of each of them for UWP. You can find them as UwpAuthenticationBroker, UwpPasswordManager, UwpStorageManager and UwpSignatureManager. - -## Sample Code - -[Twitter Service Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Twitter%20Service). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| --- | --- | -| Namespace | Microsoft.Toolkit.Uwp.Services | -| NuGet package | [Microsoft.Toolkit.Uwp.Services](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.Services/) | - -## API - -* [Twitter Service source code](https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Services/Services/Twitter) diff --git a/docs/services/Weibo.md b/docs/services/Weibo.md deleted file mode 100644 index b166ea13e9a..00000000000 --- a/docs/services/Weibo.md +++ /dev/null @@ -1,81 +0,0 @@ ---- -title: -author: validvoid -description: The Weibo Service allows users to retrieve or publish data to Weibo. -keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, Weibo -dev_langs: - - csharp ---- - -# Weibo Service - -The **Weibo Service** allows users to retrieve or publish data to Weibo. Visit [http://open.weibo.com](http://open.weibo.com) to create a new app or manage existing apps. - -## App Setup - -Go to [我的应用(my apps)](http://open.weibo.com/apps) and select your app. Then click the *应用信息*(app info) tab on the left sidebar you will be able to find the following fields: - -**App Key** -Copy this from the *应用基本信息*(basic information) section on your application page. - -**App Secret** -Copy this from the *应用基本信息*(basic information) section on your application page. - -**Secure Domains** -Due to the restriction by Weibo API, a status you post must include a url which starts with "http"/"https". You can add a url to the list of secure domains in the *应用基本信息*(basic information) section on your application page. - -**Redirect URI** Enter a unique URI for your application. This must match the *Redirect URL* field in the *OAuth2.0 授权设置*(OAuth 2.0 Authorization Settings) section on the *高级信息*(advanced Info) page. You can visit the page by clicking on the left sidebar. -*Example*: http://myapp.company.com - (this does not have to be a working URL) - -## Syntax - -```csharp -// Initialize service -WeiboService.Instance.Initialize(AppKey, AppSecret, RedirectUri); - -// Login to Weibo -if (!await WeiboService.Instance.LoginAsync()) -{ - return; -} - -// Get current user info -var user = await WeiboService.Instance.GetUserAsync(); -ProfileImage.DataContext = user; - -// Get user timeline -ListView.ItemsSource = await WeiboService.Instance.GetUserTimeLineAsync(user.ScreenName, 50); - -// Post a status -await WeiboService.Instance.PostStatusAsync(StatusText.Text); - -// Post a status with a picture -await WeiboService.Instance.PostStatusAsync(StatusText.Text, stream); - -``` - -## Methods - -| Methods | Return Type | Description | -| -- | -- | -- | -| Initialize(string, string, string, IAuthenticationBroker, IPasswordManager, IStorageManager) | bool | Initialize underlying provider with relevant token information. | -| LoginAsync() | Task<bool> | Log user in to Weibo. | -| GetUserAsync(string) | Task<WeiboUser> | Retrieve user data. | -| GetUserTimeLineAsync(string, int) | Task<IEnumerable<WeiboStatus>> | Retrieve user timeline data. | -| PostStatusAsync(string) | Task<WeiboStatus> | Post a status. | -| PostStatusAsync(string, Stream) | Task<WeiboStatus> | Post a status with a picture. | - -## Sample Code - -[Weibo Service Sample Page Source](https://github.com/Microsoft/WindowsCommunityToolkit//tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Weibo%20Service). You can see this in action in [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9NBLGGH4TLCQ). - -## Requirements - -| Device family | Universal, 10.0.15063.0 or higher | -| --- | --- | -| Namespace | Microsoft.Toolkit.Uwp.Services | -| NuGet package | [Microsoft.Toolkit.Uwp.Services](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.Services/) | - -## API Source Code - -- [Weibo Service source code](https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Services/Services/Weibo) \ No newline at end of file diff --git a/docs/toc.md b/docs/toc.md deleted file mode 100644 index 22d65e6a5f2..00000000000 --- a/docs/toc.md +++ /dev/null @@ -1,163 +0,0 @@ -# [Windows Community Toolkit Documentation](index.md) - -# Setup -## [Getting Started with the Windows Community Toolkit](Getting-Started.md) -## [Windows Community Toolkit Nuget Packages](Nuget-Packages.md) -## [Adding the Windows Community Toolkit to your Visual Studio Toolbox](Toolbox-Support.md) - -# Controls -## Controls for WPF and Windows Forms -### [InkCanvas](controls/wpf-winforms/InkCanvas.md) -### [InkToolbar](controls/wpf-winforms/InkToolbar.md) -### [MediaPlayerElement](controls/wpf-winforms/MediaPlayerElement.md) -### [WebView](controls/wpf-winforms/WebView.md) -#### [WebView known issues](controls/wpf-winforms/WebView-known-issues.md) -### [WebViewCompatible](controls/wpf-winforms/WebViewCompatible.md) -### [WindowsXamlHost](controls/wpf-winforms/WindowsXamlHost.md) -## [AdaptiveGridView](controls/AdaptiveGridView.md) -## [BladeView](controls/BladeView.md) -## [CameraPreview](controls/CameraPreview.md) -## [Carousel](controls/Carousel.md) -## [DataGrid](controls/DataGrid.md) -### [How to: Add a DataGrid control to a page](controls/datagrid_guidance/datagrid_basics.md) -### [How to: Customize the DataGrid control using styling and formatting options](controls/datagrid_guidance/styling_formatting_options.md) -### [How to: Display and configure Row Details](controls/datagrid_guidance/rowdetails.md) -### [How to: Configure Auto-generated columns in the DataGrid control](controls/datagrid_guidance/customize_autogenerated_columns.md) -### [How to: Group, sort and filter data using LINQ and the DataGrid control](controls/datagrid_guidance/group_sort_filter.md) -### [How to: Edit and perform input validation in the DataGrid control](controls/datagrid_guidance/editing_inputvalidation.md) -### [Sizing options in the DataGrid control](controls/datagrid_guidance/sizing_options.md) -### [Default keyboard navigation and selection patterns](controls/datagrid_guidance/keyboard_navigation_selection.md) -## [DockPanel](controls/DockPanel.md) -## [DropShadowPanel Control](controls/DropShadowPanel.md) -## [Expander Control](controls/Expander.md) -## [GridSplitter](controls/GridSplitter.md) -## [HamburgerMenu](controls/HamburgerMenu.md) -## [HeaderedContentControl](controls/HeaderedContentControl.md) -## [HeaderedItemsControl](controls/HeaderedItemsControl.md) -## [HeaderedTextBlock](controls/HeaderedTextBlock.md) -## [ImageEx](controls/ImageEx.md) -## [InAppNotification](controls/InAppNotification.md) -## [InfiniteCanvas](controls/InfiniteCanvas.md) -## [LayoutTransformControl](controls/LayoutTransformControl.md) -## [Loading](controls/Loading.md) -## [MarkdownTextBlock](controls/MarkdownTextBlock.md) -## [MasterDetailsView](controls/MasterDetailsView.md) -## [Menu Control](controls/Menu.md) -## Microsoft Graph Controls -### [AadLogin](graph/AadLogin.md) -### [PeoplePicker](graph/PeoplePicker.md) -### [PlannerTaskList](graph/PlannerTaskList.md) -### [PowerBIEmbedded](graph/PowerBIEmbedded.md) -### [ProfileCard](graph/ProfileCard.md) -### [SharePointFileList](graph/SharePointFileList.md) -## [OrbitView](controls/OrbitView.md) -## [PullToRefreshListView](controls/PullToRefreshListview.md) -## [RadialGauge](controls/RadialGauge.md) -## [RadialProgressBar](controls/RadialProgressBar.md) -## [RangeSelector](controls/RangeSelector.md) -## [RotatorTile](controls/RotatorTile.md) -## [ScrollHeader](controls/ScrollHeader.md) -## [SlidableListItem](controls/SlidableListItem.md) -## [StaggeredPanel](controls/StaggeredPanel.md) -## [TextToolbar](controls/TextToolbar.md) -## [TileControl](controls/TileControl.md) -## [UniformGrid](controls/UniformGrid.md) -## [WrapPanel](controls/WrapPanel.md) - -# Animations -## [AnimationSet](animations/AnimationSet.md) -## [Blur](animations/Blur.md) -## [Composition Animations](animations/CompositionAnimations.md) -## [Connected Animations](animations/ConnectedAnimations.md) -## [ExpressionBuilder](animations/Expressions.md) -## [Fade](animations/Fade.md) -## [FadeHeader](animations/FadeHeader.md) -## [Implicit Animations](animations/ImplicitAnimations.md) -## [Light](animations/Light.md) -## [Offset](animations/Offset.md) -## [ParallaxService](animations/ParallaxService.md) -## [ReorderGridAnimation](animations/ReorderGrid.md) -## [Rotate](animations/Rotate.md) -## [Saturation](animations/Saturation.md) -## [Scale](animations/Scale.md) - -# Brushes -## [BackdropBlurBrush](brushes/BackdropBlurBrush.md) -## [BackdropGammaTransferBrush](brushes/BackdropGammaTransferBrush.md) -## [BackdropInvertBrush](brushes/BackdropInvertBrush.md) -## [BackdropSaturationBrush](brushes/BackdropSaturationBrush.md) -## [BackdropSepiaBrush](brushes/BackdropSepiaBrush.md) -## [ImageBlendBrush](brushes/ImageBlendBrush.md) -## [RadialGradientBrush](brushes/RadialGradientBrush.md) - -# Extensions -## [ArrayExtensions](extensions/ArrayExtensions.md) -## [Composition Visual Layer Extensions](extensions/VisualExtensions.md) -## [FrameworkElementExtensions](extensions/FrameworkElementExtensions.md) -## [HyperlinkExtensions](extensions/HyperlinkExtensions.md) -## [ListViewExtensions](extensions/ListViewExtensions.md) -## [Logical Tree](extensions/LogicalTree.md) -## [Matrix Extensions](extensions/MatrixExtensions.md) -### [Extra Matrix Helpers](extensions/MatrixHelperEx.md) -### [Transform Extensions](extensions/TransformExtensions.md) -## [Mouse Cursor](extensions/MouseCursor.md) -## [NavigationView Styles](extensions/NavigationView.md) -## [NullableBoolMarkup](extensions/NullableBoolMarkup.md) -## [ScrollViewerExtensions](extensions/ScrollViewerExtensions.md) -## [StringExtensions](extensions/StringExtensions.md) -## [SurfaceDialTextboxHelper](extensions/SurfaceDialTextboxHelper.md) -## [TextBoxMask](extensions/TextBoxMask.md) -## [TextBoxRegex](extensions/TextBoxRegex.md) -## [ViewExtensions](extensions/ViewExtensions.md) -## [Visual Tree](extensions/VisualTree.md) -## [WebViewExtensions](extensions/WebViewExtensions.md) - -# Helpers -## [AdvancedCollectionView](helpers/AdvancedCollectionView.md) -## [BackgroundTaskHelper](helpers/BackgroundTaskHelper.md) -## [BindableValueHolder](helpers/BindableValueHolder.md) -## [BluetoothLEHelper](helpers/BluetoothLEHelper.md) -## [CameraHelper](helpers/CameraHelper.md) -## [Colors](helpers/Colors.md) -## [Converters](helpers/Converters.md) -## [DeepLinkParser](helpers/DeepLinkParsers.md) -## [DispatcherHelper](helpers/DispatcherHelper.md) -## [HttpHelper](helpers/HttpHelper.md) -## [HttpHelperRequest](helpers/HttpHelperRequest.md) -## [HttpHelperResponse](helpers/HttpHelperResponse.md) -## [ImageCache](helpers/ImageCache.md) -## [IncrementalLoadingCollection](helpers/IncrementalLoadingCollection.md) -## [NetworkHelper](helpers/NetworkHelper.md) -## [ObjectStorage](helpers/ObjectStorage.md) -## [PrintHelper](helpers/PrintHelper.md) -## [StorageFileHelper](helpers/StorageFiles.md) -## [Streams Helper](helpers/Streams.md) -## [SystemInformation](helpers/SystemInformation.md) -## [ThemeListener](helpers/ThemeListener.md) -## [WeakEventListener](helpers/WeakEventListener.md) - -# Services -## [Bing Service](services/Bing.md) -## [Facebook Service](services/Facebook.md) -## [LinkedIn Service](services/Linkedin.md) -## [Microsoft Graph Service](services/MicrosoftGraph.md) -### [GraphLogin (WinForms)](services/GraphLogin.md) -## [Microsoft Translator Service](services/MicrosoftTranslator.md) -## [OneDrive Service](services/OneDrive.md) -## [Twitter Service](services/Twitter.md) - -# Parsers -## [MarkdownParser](parsers/MarkdownParser.md) -## [RSSParser](parsers/RSSParser.md) - -# Developer tools -## [AlignmentGrid](developer-tools/AlignmentGrid.md) -## [FocusTracker](developer-tools/FocusTracker.md) - -# [GazeInteractionLibrary](gaze/GazeInteractionLibrary.md) - -# [Notifications](notifications/NotificationsOverview.md) - -# [Platform Specific Analyzer](platform-specific/PlatformSpecificAnalyzer.md) - -# [Known Issues](knownissues.md) diff --git a/readme.md b/readme.md index d2a6c7b33c6..d16a3858fbd 100644 --- a/readme.md +++ b/readme.md @@ -1,3 +1,11 @@ +--- +topic: sample +languages: +- csharp +products: +- windows +--- + # Windows Community Toolkit The Windows Community Toolkit is a collection of helper functions, custom controls, and app services. It simplifies and demonstrates common developer patterns when building experiences for Windows 10. @@ -98,6 +106,7 @@ Once you do a search, you should see a list similar to the one below (versions m * [RotatorTile](https://docs.microsoft.com/windows/uwpcommunitytoolkit/controls/RotatorTile/) * [ScrollHeader](https://docs.microsoft.com/windows/uwpcommunitytoolkit/controls/ScrollHeader/) * [StaggeredPanel](https://docs.microsoft.com/windows/uwpcommunitytoolkit/controls/StaggeredPanel/) +* [TabView](https://docs.microsoft.com/windows/uwpcommunitytoolkit/controls/TabView/) * [TextToolbar](https://docs.microsoft.com/windows/uwpcommunitytoolkit/controls/TextToolbar/) * [TileControl](https://docs.microsoft.com/windows/uwpcommunitytoolkit/controls/TileControl/) * [WrapPanel](https://docs.microsoft.com/windows/uwpcommunitytoolkit/controls/WrapPanel/) diff --git a/version.json b/version.json index a2ca111916c..70a6737316b 100644 --- a/version.json +++ b/version.json @@ -1,5 +1,5 @@ { - "version": "5.0.0-build.{height}", + "version": "5.1.0-build.{height}", "publicReleaseRefSpec": [ "^refs/heads/master$", // we release out of master "^refs/heads/dev$", // we release out of dev diff --git a/windows-community-toolkit.yml b/windows-community-toolkit.yml deleted file mode 100644 index 952246baf41..00000000000 --- a/windows-community-toolkit.yml +++ /dev/null @@ -1,11 +0,0 @@ -### YamlMime:Sample -sample: -- name: Windows Community Toolkit - description: A collection of helper functions, custom controls, and app services. It simplifies and demonstrates common developer patterns when building experiences for Windows 10. - generateZip: true - author: nmetulev - languages: - - csharp - technologies: - - windows - vssolution: "Windows Community Toolkit.sln" \ No newline at end of file