-
Notifications
You must be signed in to change notification settings - Fork 706
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Properly display text for selected item
- Loading branch information
1 parent
9253de6
commit 531dd2a
Showing
9 changed files
with
92 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
src/Uno.UI/UI/Xaml/Controls/Primitives/SelectorItem.partial.mux.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Microsoft.UI.Xaml.Automation; | ||
using static Uno.UI.FeatureConfiguration; | ||
|
||
namespace Microsoft.UI.Xaml.Controls.Primitives; | ||
|
||
partial class SelectorItem | ||
{ | ||
//--------------------------------------------------------------------------- | ||
// | ||
// Synopsis: | ||
// Returns a plain text string to provide a default AutomationProperties.Name | ||
// in the absence of an explicitly defined one | ||
// | ||
//--------------------------------------------------------------------------- | ||
internal override string GetPlainText() | ||
{ | ||
string strPlainText = null; | ||
|
||
var contentTemplateRoot = ContentTemplateRoot; | ||
|
||
if (contentTemplateRoot != null) | ||
{ | ||
// we have the first child of the content. Check whether it has an automation name | ||
|
||
strPlainText = AutomationProperties.GetName(contentTemplateRoot); | ||
|
||
// fallback: use getplain text on it | ||
if (string.IsNullOrEmpty(strPlainText)) | ||
{ | ||
var contentTemplateRootAsIFE = contentTemplateRoot as FrameworkElement; | ||
|
||
strPlainText = null; | ||
|
||
if (contentTemplateRootAsIFE is not null) | ||
{ | ||
strPlainText = contentTemplateRootAsIFE.GetPlainText(); | ||
} | ||
} | ||
|
||
// fallback, use GetPlainText on the contentpresenter, who has some special logic to account for old templates | ||
if (string.IsNullOrEmpty(strPlainText)) | ||
{ | ||
var contentTemplateRootAsIFE = contentTemplateRoot as FrameworkElement; | ||
|
||
strPlainText = null; | ||
|
||
if (contentTemplateRootAsIFE is not null) | ||
{ | ||
var pParent = contentTemplateRootAsIFE.Parent; | ||
if (pParent is ContentPresenter cp) | ||
{ | ||
strPlainText = cp.GetTextBlockText(); | ||
} | ||
} | ||
} | ||
} | ||
|
||
return strPlainText; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters