I have a data grid whose width is initialized to the width of the row that it is in in the parent grid. The columns don't fill all of the empty space in the grid, what I want is for each column to have an equal width. A coworker of mine set the ColumnWidth property of the datagrid to "*" which is supposed to work (it works in another application that he created but not when he opens my solution on his computer, nor does it work on my computer.) See the attached picture for what the columns look like.
I would imagine that the property should work for me as well, but it doesn't— the width of each column is only one letter wide. Does it have something to do with me binding to an Observable Collection of objects? Also, since I couldn't get the ColumnWidth property to work, I tried creating a multivalue converter that takes two parameters, the width of the data grid and the number of columns that I have. I can't get that converter to fire off when my view loads. I have used multibinding converters before with booleans, but again not with Observable Collections. Could that be the issue? Any help would be greatly appreciated.
<DataGrid x:Name="DataGrid" Grid.Row="7" Grid.Column="3" AutoGenerateColumns="False" FontSize="18" ItemsSource="{Binding ObservableCollectionInViewModel}">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Path=PartNumber}" Header="Part Number">
<DataGridTextColumn.Width>
<MultiBinding Converter="{StaticResource DataGridEvenColumnConverter}">
<Binding Path="DataGridWidth"/> <!--{Binding ElementName=DataGrid, Path=Width}-->
<Binding Path="ColumnCount"/>
</MultiBinding>
</DataGridTextColumn.Width>
</DataGridTextColumn>
<DataGridTextColumn Binding="{Binding Path=SerialNumber}" Header="Serial Number">
<DataGridTextColumn.Width>
<MultiBinding Converter="{StaticResource DataGridEvenColumnConverter}">
<Binding Path="DataGridWidth"/>
<Binding Path="ColumnCount"/>
</MultiBinding>
</DataGridTextColumn.Width>
</DataGridTextColumn>
<DataGridTextColumn Binding="{Binding Path=Weight}" Header="Weight">
<DataGridTextColumn.Width>
<MultiBinding Converter="{StaticResource DataGridEvenColumnConverter}">
<Binding Path="DataGridWidth"/>
<Binding Path="ColumnCount"/>
</MultiBinding>
</DataGridTextColumn.Width>
</DataGridTextColumn>
<DataGridTextColumn Binding="{Binding Path=Quantity}" Header="Quantity">
<DataGridTextColumn.Width>
<MultiBinding Converter="{StaticResource DataGridEvenColumnConverter}">
<Binding Path="DataGridWidth"/>
<Binding Path="ColumnCount"/>
</MultiBinding>
</DataGridTextColumn.Width>
</DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>