Home Forums WPF controls Xceed DataGrid for WPF Namespace prefix "local" is not defined

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #23929 |

    I am going through the validation examples online, but when I try and run them as-is, I get “Namespace prefix “local” is not defined”. Can someone let me know what I am doing incorrectly.

    XAML:
    <Window x:Class=”PhoneTest.Window1″
    xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation&#8221;
    xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml&#8221;
    Title=”PhoneTest” Height=”400″ Width=”582″
    >

    <Grid xmlns:xcdg=”http://schemas.xceed.com/wpf/xaml/datagrid”&gt;
    <Grid.Resources>
    <xcdg:DataGridCollectionViewSource x:Key=”cvs_phone”
    Source=”{Binding Source={x:Static Application.Current},
    Path=PhoneDatatable}”/>
    </Grid.Resources>
    <xcdg:DataGridControl x:Name=”PhoneGrid”
    ItemsSource=”{Binding Source={StaticResource cvs_phone}}”
    View=”TableView.Aero.NormalColor”
    EditTriggers=”CellIsCurrent”>

    <xcdg:DataGridControl.Columns>
    <xcdg:Column FieldName=”sequence”>
    <xcdg:Column.CellValidationRules>
    <local:ShippingCostValidationRule/>
    </xcdg:Column.CellValidationRules>
    </xcdg:Column>
    </xcdg:DataGridControl.Columns>

    </xcdg:DataGridControl>
    </Grid>
    </Window>

    c#:
    using System;
    using System.Collections.Generic;
    using System.Text;
    using Xceed.Wpf.DataGrid;
    using Xceed.Wpf.DataGrid.ValidationRules;
    using System.Windows.Controls;
    using System.Globalization;

    namespace PhoneTest
    {
    public class ValidationRule : CellValidationRule
    {
    public override ValidationResult Validate(object value, CultureInfo cultureInfo, CellValidationContext cellValidationContext)
    {
    if ((int)cellValidationContext.Cell.ParentRow.Cells[“sequence”].Content < 0)
    {
    return new ValidationResult(false, “Sequence must be a whole number greater than 1.”);
    }

    return new ValidationResult(true, null);
    }

    }
    }

    Imported from legacy forums. Posted by Adam (had 2909 views)

    User (Old forums)
    Member
    Post count: 23064

    Never mind. I didn’t copy the example as-is…I missed the local namespace declaration. My bad.

    Imported from legacy forums. Posted by Adam (had 2922 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.