Silverlight 数据表:“保存”和“编辑”按钮不显示

发布于 2024-09-26 21:48:29 字数 737 浏览 6 评论 0原文

我正在尝试在 Silverlight 4 中制作数据表单。也许我做错了什么。

类:

public class ExpenseInfoTest
{
    public int MyProperty { get; set; }
    public int Foo { get; set; }
    public int Bar { get; set; }
}

XAML:

    <local:ExpenseInfoTest x:Key="newExpense"/>

    <df:DataForm Height="218" 
                 HorizontalAlignment="Left" 
                 Margin="13,368,0,0" 
                 Name="expenseDataForm" 
                 VerticalAlignment="Top" 
                 Width="590" 
                 CurrentItem="{StaticResource newExpense}" />

显示内容: 只是没有保存和编辑按钮的字段

我想要“保存”按钮。我怎样才能让它出现?我的 XAML 或数据类有问题吗?

I'm trying to make a data form in Silverlight 4. Perhaps I'm doing something wrong.

The class:

public class ExpenseInfoTest
{
    public int MyProperty { get; set; }
    public int Foo { get; set; }
    public int Bar { get; set; }
}

XAML:

    <local:ExpenseInfoTest x:Key="newExpense"/>

    <df:DataForm Height="218" 
                 HorizontalAlignment="Left" 
                 Margin="13,368,0,0" 
                 Name="expenseDataForm" 
                 VerticalAlignment="Top" 
                 Width="590" 
                 CurrentItem="{StaticResource newExpense}" />

What is displayed:
Just the fields without the save and edit buttons

I'd like the "Save" button. How can I get it to appear? Is something wrong in my XAML or data class?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

南七夏 2024-10-03 21:48:29

在您的 xaml 中,添加

CommandButtonsVisibility="All" 

您的 DataForm 声明。

如果您愿意,您可以将 CommandButtonsVisibility 绑定到组合框

<ComboBox SelectedItem="{Binding CommandButtonsVisibility, ElementName=expenseDataForm, Mode=TwoWay}" SelectedIndex="0" >

,并能够根据 CB 选择来控制哪些命令按钮可用。

In your xaml, add

CommandButtonsVisibility="All" 

in your DataForm declaration.

If you wanted to, you could bind the CommandButtonsVisibility to lets say a combo box

<ComboBox SelectedItem="{Binding CommandButtonsVisibility, ElementName=expenseDataForm, Mode=TwoWay}" SelectedIndex="0" >

and be able to control which command buttons are available based on the CB selection.

只是在用心讲痛 2024-10-03 21:48:29

这行代码很有帮助:

expenseDataForm.CommandButtonsVisibility = DataFormCommandButtonsVisibility.All;

This line of code is helpful:

expenseDataForm.CommandButtonsVisibility = DataFormCommandButtonsVisibility.All;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文