I have the following StatusBar and now i want to set the position of the StatusBarItems in my ViewModel .
<StatusBar ItemsSource="{Binding StatusBarItemsSource}" DockPanel.Dock="Bottom" >
<StatusBar.ItemsPanel>
<ItemsPanelTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="100" />
</Grid.ColumnDefinitions>
</Grid>
</ItemsPanelTemplate>
</StatusBar.ItemsPanel>
</StatusBar>
I want my logo in the third column but this won't work :/
StatusBarItem logo = new StatusBarItem
{
Content = new Image
{
Source = new BitmapImage(new Uri("Logo.ico", UriKind.Relative)),
Width = 16,
Height = 16
}
Grid.Column = 3
};
StatusBarItemsSource.Add(logo);
Use the Grid.SetColumn
method to set the Grid.Column
attached property of the StatusBarItem
to 2
:
StatusBarItem logo = new StatusBarItem
{
Content = new Image
{
Source = new BitmapImage(new Uri("logo.ico", UriKind.Relative)),
Width = 16,
Height = 16
}
};
Grid.SetColumn(logo, 2);
StatusBarItemsSource.Add(logo);