I'm trying to get the entire width for a current cell so I can draw a rectangle with a width of a certain percentage of that cell. I wasn't able to bind to set the Width property more than once, as suggested here. So my next attempt was to pass the grid with and UtilPct to the converter, subtract 150 (for the first column) and return my width. However, the grid doesn't have a width, it just say NaN in Snoop and the actual width is 0?
What is the best way to get the actual calculated width of my cell so I can adjust the rectangle's width? If anyone has any other approaches, I appreciated any help!
XAML:
<ItemsControl x:Name="icBrokerCreditList" Grid.Row="1" Grid.Column="1" ItemsSource="{Binding Path=BrokerCreditList}" HorizontalAlignment="Stretch">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid HorizontalAlignment="Stretch" x:Name="brokerGrid">
<Grid.RowDefinitions>
<RowDefinition Height="20"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="150"></ColumnDefinition>
<ColumnDefinition x:Name="utilCol" Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Background="White" Foreground="Black" FontSize="12" Text="{Binding Path=BrokerName}"></TextBlock>
<Rectangle Fill="Green" Height="20" Grid.Row="0" Grid.Column="1">
<Rectangle.Width>
<MultiBinding Converter="{StaticResource PercentageConverter}">
<Binding Path="ActualWidth" ElementName="utilCol" />
<Binding Path="UtilPct" />
</MultiBinding>
</Rectangle.Width>
</Rectangle>
</TextBlock>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>