I'm pretty new to c# and I'm trying to create a WPF window with menus and text-blocks but none of my data-binding work. I saw several pages and forums on the internet and I saw that people are always talking about setting a DataContext but I don't know why my MainWindow is not considered as DataContext. Do I do something very wrong? Here is my xaml:
<Window x:Class="holdingseditor.MainWindow"
<Grid>
<TextBlock Height="30" Margin="0,24,0,0" Width="675" Text="{Binding DbRibbonText}" Background="{Binding DbRibbonColor}"/>
<TextBlock Height="30" Margin="675,24,0,0" Width="472" Background="{Binding WfRibbonColor}" Text="{Binding WfRibbonText}"/>
<Menu HorizontalAlignment="Left" Height="24" Margin="0,0,0,0" VerticalAlignment="Top" Width="1155">
<MenuItem Header="_View">
<MenuItem Header="Show _Archived Files History" Height="22" FontSize="12" Margin="0" Click="M_ShowArchivedFiles" IsEnabled="{Binding Path=DiesenameLoaded}"/>
</MenuItem>
<MenuItem Header="_Workflow">
<MenuItem Header="O_utside Mode" Height="22" FontSize="12" Margin="0" IsCheckable="true" IsChecked="{Binding IsWfOutside}"/>
</MenuItem>
</Menu>
</Grid>
</Window>
And my properties look like that:
namespace holdingseditor
{
public partial class MainWindow : Window
{
public bool DiesenameLoaded
{get { return false; }}
public bool IsWfOutside
{get { return true; }}
public string DbRibbonText
{get {return "my text";}}
public Color DbRibbonColor
{get {return Color.FromArgb(255, 0, 0, 255);}}
}
}