Validation is only displayed on the first WizardPage

Abierto
#1,764 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
csharp
Área
desktop

Línea de trabajo

Reproduce the issue with the provided XAML and MainWindow code-behind, navigating between WizardPage instances and returning to the first page. Start by inspecting the Wizard and WizardPage navigation and validation lifecycle. Done means validation messages appear on every page and are re-triggered when revisiting a page.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Validation is done correctly on the first page of a wizard the first time it is displayed. If you then go to the next page no validation is displayed on any of the following pages, also if you go back to the first page, it does not re-do the validation.

XAML

<Window x:Class="XceedWizardValidation.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:XceedWizardValidation" xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800" x:Name="window" DataContext="{Binding ElementName=window}">
    <xctk:Wizard Name="Wizard">

        <xctk:WizardPage x:Name="Page1" Title="Page1">
            <StackPanel>
                <TextBlock>This field is always wrong</TextBlock>
                <TextBox Text="{Binding Path=MyTest, ValidatesOnDataErrors=True, NotifyOnValidationError=True}"/>

                <TextBlock FontSize="15" Margin="0,50,0,0">Go to the next wizardpage, then come back to this one.</TextBlock>
                <TextBlock FontSize="15">Bug: Validation is only performed on the first page of the wizard the first time it is seen.</TextBlock>
            </StackPanel>
        </xctk:WizardPage>

        <xctk:WizardPage x:Name="Page2" Title="Page2">
            <StackPanel>
                <TextBlock>This field also has an error, but its never displayed.</TextBlock>
                <TextBox Text="{Binding Path=MyOtherTest, ValidatesOnDataErrors=True, NotifyOnValidationError=True}"/>
            </StackPanel>
        </xctk:WizardPage>

    </xctk:Wizard>

</Window>

Code behind

public partial class MainWindow : Window, IDataErrorInfo, INotifyPropertyChanged
{
    private string _myTest = "Some Value";
    private string _myOtherTest = "Some Value";

    public MainWindow()
    {
        InitializeComponent();
    }

    public string MyTest
    {
        get { return _myTest; }
        set
        {
            _myTest = value;
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(MyTest)));
        }
    }


    public string MyOtherTest
    {
        get { return _myOtherTest; }
        set
        {
            _myOtherTest = value;
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(MyOtherTest)));
        }
    }

    #region IDataErrorInfo Implementation
    public string Error { get { return ""; } }

    public string this[string columnName]
    {
        get
        {
            if (columnName == nameof(MyTest))
                return "Its all wrong, try harder.";
            if (columnName == nameof(MyOtherTest))
                return "Its all wrong, try harder.";
            return "";
        }
    }
    #endregion

    public event PropertyChangedEventHandler? PropertyChanged;
}

image

After re-visiting the page

image

Lenguaje dominante
C#
Estrellas
4.2k
Forks
912
Métricas de merge de PR
Sin PR fusionados en 30 d

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de xceedsoftware/wpftoolkit

Todos los issues de xceedsoftware/wpftoolkit

Issues similares

Más issues de C#

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.