-
Notifications
You must be signed in to change notification settings - Fork 661
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
winrt::hresult_error crash when trying to use TeachingTip in ControlTemplate #8572
Comments
I just wrote another control using Syncfusion library and it throws same error. This is real issue, custom controls are to make life easy, without them its going to be hell. |
Probably dupe of #3657 |
|
If anyone is open with any workaround, I will accept them. |
The crashing issue is caused by your public static readonly DependencyProperty SymbolProperty =
DependencyProperty.Register(
nameof(Symbol),
typeof(IconSource),
typeof(ValidatingTextBox),
new PropertyMetadata(new SymbolIconSource() { Symbol = Microsoft.UI.Xaml.Controls.Symbol.Edit }));
public IconSource Symbol
{
get => (IconSource)GetValue(SymbolProperty);
set => SetValue(SymbolProperty, value);
} I don't think the teaching tip target binding is correct. I would give the text box a name and use it when binding the target: <Style TargetType="controls:ValidatingTextBox">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:ValidatingTextBox">
<StackPanel>
<TextBox x:Name="tb" Text="{TemplateBinding Text}" PlaceholderText="{TemplateBinding PlaceholderText}" Header="{TemplateBinding Header}" IsReadOnly="{TemplateBinding IsReadOnly}"/>
<TeachingTip PreferredPlacement="Right" Target="{Binding ElementName=tb}" ShouldConstrainToRootBounds="False" Title="{TemplateBinding Title}" Subtitle="{TemplateBinding Subtitle}" IconSource="{TemplateBinding Symbol}" IsOpen="{TemplateBinding IsOpen}" Background="OrangeRed"/>
</StackPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style> |
@DHancock You are absolutely right. Is there any way I could find out about it without external help?
|
I cannot tell from just the xaml. I think the correct thing to do would be to close this bug, then post a question in the discussions section, preferably including a min repro project. |
Describe the bug
When developing custom TextBox control with TeachingTIp I hit barrier with exception:
Removing TeachingTip solves the issue... but I wanted that.
I am attaching source codes
Steps to reproduce the bug
Generic.xaml
ValidatingTextBox.cs
Expected behavior
No crash, I want TeachingTip to display next to my TextBox element
Screenshots
No response
NuGet package version
WinUI 3 - Windows App SDK 1.3.2: 1.3.230602002
Windows version
Windows Insider Build (xxxxx)
Additional context
No response
The text was updated successfully, but these errors were encountered: