Silverlight Dataform: “Save” and “Edit” buttons not showing up
-
28-09-2019 - |
Question
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:
I'd like the "Save" button. How can I get it to appear? Is something wrong in my XAML or data class?
Solution
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.
OTHER TIPS
This line of code is helpful:
expenseDataForm.CommandButtonsVisibility = DataFormCommandButtonsVisibility.All;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow