I have a working ProgressBar displayed in a single column. But need it instead to span over the whole row. How can that be achieved?
This works, ProgressBar in single column :
<UserControl.Resources>
<SolidColorBrush x:Key="DgGridLineBrush" Color="LightGray" />
<Style x:Key="ProgressBarStyle" TargetType="ProgressBar">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ProgressBar">
<Grid x:Name="PART_Track" >
<Rectangle x:Name="PART_Indicator" Fill="{Binding [3]}" HorizontalAlignment="Left" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<DataGrid x:Name="MbpDg" HeadersVisibility="Column" AutoGenerateColumns="False" IsReadOnly="True" CanUserAddRows="False" HorizontalAlignment="Right" ColumnHeaderHeight="20" Height="221" Margin="0,1,0,0" VerticalAlignment="Top" Width="164"
GridLinesVisibility="None" >
<DataGrid.Columns>
<DataGridTemplateColumn Header="Size" Width="55">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Grid>
<ProgressBar Value="{Binding [2], Mode=OneWay}" Style="{StaticResource ProgressBarStyle}" Minimum="0" Maximum="100"/>
<TextBlock Text="{Binding [2], Mode=OneWay}" HorizontalAlignment="Right"/>
</Grid>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Binding="{Binding [0]}" Header="Price" Width="50"/>
<DataGridTextColumn Binding="{Binding [1]}" Header="Qty" Width="30*"/>
</DataGrid.Columns>
I did see this question, but attempting to incorporate it gives binding exceptions.. I don't really know what I'm doing here to be honest..
<Setter Property="DataGrid.Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridRow}">
<Grid>
<ProgressBar Value="{Binding [2], Mode=OneWay}" Style="{StaticResource ProgressBarStyle}" Minimum="0" Maximum="100"/>
</Grid>
</ControlTemplate>
</Setter.Value>
EDIT: Answer worked great, but left with this "error" displayed three times:
System.Windows.Data Error: 1 : Cannot create default converter to perform 'one-way' conversions between types 'System.Boolean' and 'System.Windows.Controls.SelectiveScrollingOrientation'. Consider using Converter property of Binding. BindingExpression:Path=AreRowDetailsFrozen; DataItem='DataGrid' (Name='MyDg'); target element is 'DataGridDetailsPresenter' (Name=''); target property is 'SelectiveScrollingOrientation' (type 'SelectiveScrollingOrientation')
System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; Value='False' BindingExpression:Path=AreRowDetailsFrozen; DataItem='DataGrid' (Name='MyDg'); target element is 'DataGridDetailsPresenter' (Name=''); target property is 'SelectiveScrollingOrientation' (type 'SelectiveScrollingOrientation')