i´ve got a problem with a Button that i want to place within the ColumnHeader of my DataGrid. I want to place an Image in that Button but that image isn´t visible. Any guess how to fix this?
Here´s the xaml code:
<DataGridTextColumn x:Name="bemiNr" Visibility="Visible" FontSize="18" IsReadOnly="True" Binding="{Binding Path=bemiNr}">
<DataGridTextColumn.Header>
<Grid Margin="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="30"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="Bemi Nr" />
<Button Grid.Column="1" x:Name="btnFilterView" Margin="0,0,0,0" Foreground="White" Background="{x:Null}" HorizontalAlignment="Right">
<Image Height="30" Width="30" Source="/TestDB;component/Assets/filter-outline_black.png" />
</Button>
</Grid>
</DataGridTextColumn.Header>
</DataGridTextColumn>
CodePudding user response:
As you stated in the comments that you've set the build action to "Resource", try replacing /TestDB;component/Assets/filter-outline_black.png
with pack://application:,,,/TestDB;component/Assets/filter-outline_black.png
.