Reputation: 4837
I have a Label defined in XAML as follows:
<Label Content="{Binding Name}"></Label>
The problem is that the label is invisible in the XAML editor and I'd like it to have a default value there so that the editor accurately reflects what will show up at runtime.
Is there a way to give it a value in XAML which will show up in the editor, but then use the binding at runtime?
Upvotes: 5
Views: 4311
Reputation: 13679
Here you go
FallbackValue
is the answer for the same
example
<Label Content="{Binding Name, FallbackValue=Default}"></Label>
Upvotes: 11
Reputation: 625
You also assign the default value to name of its viewmodel.cs file in its constructor
Upvotes: 1