Skip to content

Upgrading to 11.x - AddOwnerWithDataValidation and ItemContainerGenerator<T> #18138

Discussion options

You must be logged in to vote

Answering here.

AddOwnerWithDataValidation

Now is:

/// <summary>
/// Defines the <see cref="Text"/> property.
/// </summary>
public static readonly StyledProperty<string?> TextProperty =
    TextBlock.TextProperty.AddOwner<TokenizingTextBox>(new(
        coerce: (sender, text) => text,
        defaultBindingMode: BindingMode.TwoWay,
        enableDataValidation: true));

You can customize coerce callback if you want.

CreateItemContainerGenerator

Doesn't exist anymore. Replace the former method with the overrides below:

protected override Control CreateContainerForItemOverride(object? item, int index, object? recycleKey)
{
    return new TokenizingTextBoxItem();
}

protected override bool N…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by alexandrehtrb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants