How can i set the grid position to my StatusBarItems programatically?
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.SetColumnmethod to set theGrid.Columnattached property of theStatusBarItemto2: