我有以下StatusBar,现在我想在ViewModel中设置StatusBarItems的位置。
<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>
我希望我的徽标位于第三列,但这不起作用:/
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);
答案 0 :(得分:1)
使用Grid.SetColumn
方法将Grid.Column
的{{1}}附加属性设置为StatusBarItem
:
2