Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

There are some very important controls in Catel which help with visualizing the validation results.

...

InfoBarMessageControl  is automaticly automatically added to the DataWindow, if you want to use a different style for this InfoBarMessageControl, you must override the default style, add your own InfoBarMessageControl and disable the deafault default InfoBarMessageControl  from the DataWindow.

  1. Create a custom style based on the default style.
  2. Change the x:Key from  x:Key="{x:Type local:InfoBarMessageControl}" to  x:Key="yourCustomStyleKey"
  3. Set the InfoBarMessageControlGenerationMode to None

    Code Block
    languagec#
            /// <summary>
            /// Initializes a new instance of the <see cref="DataWindow"/> class.
            /// </summary>
            /// <param name="viewModel">The view model to inject.</param>
            /// <remarks>
            /// This constructor can be used to use view-model injection.
            /// </remarks>
            public DataWindow(DataWindowViewModel viewModel)
                : base(viewModel, DataWindowMode.Custom, null, DataWindowDefaultButton.None, true, InfoBarMessageControlGenerationMode.None)
            {
                InitializeComponent();
            }
  4. Add a new InfoBarMessageControl  as root control to your DataWindow and set the style.

    Code Block
    <catel:InfoBarMessageControl  Style="{DynamicResource yourCustomStyleKey}">
            <Grid>
                <catel:WarningAndErrorValidator Source="{Binding}" />
    			//Your content 
            </Grid>
    </catel:InfoBarMessageControl>

...