Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 编辑嵌套对象时,“数据表单确定/保存”按钮保持禁用状态_C#_Wpf_Silverlight_Xaml_Dataform - Fatal编程技术网

C# 编辑嵌套对象时,“数据表单确定/保存”按钮保持禁用状态

C# 编辑嵌套对象时,“数据表单确定/保存”按钮保持禁用状态,c#,wpf,silverlight,xaml,dataform,C#,Wpf,Silverlight,Xaml,Dataform,我一直在使用工具箱中的数据表单,现在我意识到我显然在IEditableObject接口方面有问题。绑定到具有2个子对象的对象的数据表单。父对象和2个子对象的所有字段位于同一窗体上。当我从父对象修改数据字段时,“确定”按钮变为启用状态,但当我从子对象播放3个字段中的2个时,“确定”按钮保持禁用状态。我曾试图调查不同领域之间的差异,但它们似乎都是一样的。有人面临同样的问题吗 在下面的示例中,字段NumberRapper和LabelWrapper属于父对象,然后Stc1Wrapper是父对象的一部分。

我一直在使用工具箱中的数据表单,现在我意识到我显然在IEditableObject接口方面有问题。绑定到具有2个子对象的对象的数据表单。父对象和2个子对象的所有字段位于同一窗体上。当我从父对象修改数据字段时,“确定”按钮变为启用状态,但当我从子对象播放3个字段中的2个时,“确定”按钮保持禁用状态。我曾试图调查不同领域之间的差异,但它们似乎都是一样的。有人面临同样的问题吗

在下面的示例中,字段NumberRapper和LabelWrapper属于父对象,然后Stc1Wrapper是父对象的一部分。字段标签会触发ok按钮,但电话号码和传输代码字段不会。Stc1Wrapper的3个字段的底层实现似乎完全相同。我被困在这里,我找不到关于这个dataform控件的正确MSDN文档,因为它来自工具包,这很不幸

<toolkit:DataForm Grid.Column="1" 
                          Margin="0,94,0,0" 
                          Width="350"
                          Name="EsnDataForm" 
                          Header="Esn Item"
                          AutoGenerateFields="False" 
                          CurrentItem="{Binding ElementName=MyGrid, Path=SelectedItem,Mode=TwoWay}" 
                          AutoEdit="False" 
                          AutoCommit="False"
                          CommandButtonsVisibility="Cancel,Edit,Commit"
                          CommitButtonContent="Save"
                          CancelButtonContent="Cancel">
            <toolkit:DataForm.NewItemTemplate>
                <DataTemplate>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="32" />
                            <RowDefinition Height="32" />
                            <RowDefinition Height="32" />
                            <RowDefinition Height="32" />
                        </Grid.RowDefinitions>
                        <toolkit:DataField Label="Number" IsReadOnly="True" >
                            <TextBox Text="{Binding NumberWrapper,Mode=TwoWay}" MaxLength="9" Width="120" IsReadOnly="True" />
                        </toolkit:DataField>
                        <toolkit:DataField Label="Label" Grid.Row="1" >
                            <TextBox Name="NameBox" Text="{Binding LabelWrapper,Mode=TwoWay}" MaxLength="32" Width="120" />
                        </toolkit:DataField>
                        <toolkit:DataField Label="Sub Label" Grid.Row="2" >
                            <TextBox Name="SubLabelBox" Text="{Binding PrimaryPsapLabelWrapper,Mode=TwoWay}" MaxLength="32" Width="120" />
                        </toolkit:DataField><toolkit:DataField Label="Label" Margin="-50,1,1,1" >
                            <TextBox Name="Stc1LabelBox" Text="{Binding Stc1Wrapper.LabelWrapper, Mode=TwoWay}" MaxLength="32" Width="120" />
                        </toolkit:DataField>
                        <toolkit:DataField Label="Telephone Number" Margin="-50,1,1,1" >
                            <TextBox Name="Stc1TelephoneBox" Text="{Binding Stc1Wrapper.TnWrapper, Mode=TwoWay}" MaxLength="10" Width="120" />
                        </toolkit:DataField>
                        <toolkit:DataField Label="Transfer Code" Margin="-50,1,1,1" >
                            <TextBox Name="Stc1TransferCodeBox" Text="{Binding Stc1Wrapper.TransferCodeWrapper, Mode=TwoWay}" Width="120" />
                        </toolkit:DataField>
                    [...]

    /// <remarks/>
    [System.Xml.Serialization.XmlIgnore]
    public string TransferCodeWrapper
    {
        get
        {
            return this.TransferCode;
        }
        set
        {
            ValidateRequired("TransferCodeWrapper", value, "Transfer Code is mandatory");
            ValidateRegularExpression("TransferCodeWrapper", value, @"^[\*]\d{1,3}$", "The format should be * followed by 1 to 3 digits");
            this.TransferCode = value;
            this.RaisePropertyChanged("TransferCodeWrapper");
        }
    }

    /// <remarks/>
    [System.Xml.Serialization.XmlIgnore]
    public string TnWrapper
    {
        get
        {
            return this.Tn;
        }
        set
        {
            ValidateRequired("TnWrapper", value, "Telephone number is mandatory when Type is Telephone Number");
            ValidateRegularExpression("TnWrapper", value, @"^\d{10}$", "The telephone number should be 10 digits");
            this.Tn = value;
            this.RaisePropertyChanged("TnWrapper");
        }
    }

    /// <remarks/>
    [System.Xml.Serialization.XmlIgnore]
    public string LabelWrapper
    {
        get
        {
            return this.Label;
        }
        set
        {
            ValidateRequired("LabelWrapper", value, "Label is required");
            ValidateRegularExpression("LabelWrapper", value, @"^[\w-_ ]$+", "Characters allowed (a-z,A-Z,0-9,-,_, )");
            this.Label = value;
            this.RaisePropertyChanged("LabelWrapper");
        }
    }

[...]
/// 
[System.Xml.Serialization.XmlIgnore]
公共字符串TransferCodeWrapper
{
得到
{
返回此.TransferCode;
}
设置
{
ValidateRequired(“TransferCodeWrapper”,值,“传输代码是必需的”);
ValidateRegularExpression(“TransferCodeWrapper”,value,@“^[\*]\d{1,3}$”,“格式应*后跟1到3位”);
this.TransferCode=值;
此.RaisePropertyChanged(“TransferCodeWrapper”);
}
}
/// 
[System.Xml.Serialization.XmlIgnore]
公共字符串包装器
{
得到
{
返回此.Tn;
}
设置
{
ValidateRequired(“TnWrapper”,值,“当类型为电话号码时,电话号码是必需的”);
ValidateRegularExpression(“TnWrapper”,value,@“^\d{10}$”,“电话号码应为10位”);
该值为.Tn=数值;
此.RaisePropertyChanged(“TnWrapper”);
}
}
/// 
[System.Xml.Serialization.XmlIgnore]
公共字符串标签包装器
{
得到
{
退回这个。标签;
}
设置
{
ValidateRequired(“LabelWrapper”,值,“需要标签”);
ValidateRegularExpression(“LabelWrapper”,value,@“^[\w-]$+”,“允许的字符(a-z,a-z,0-9,,,,)”;
这个标签=值;
此.RaisePropertyChanged(“LabelWrapper”);
}
}