I have a WPF listview with 3 columns. Name, cost, and sell. Cost and Sell are editable textboxes formatted as currency.
2 issues: - I might have specific items listed where the cost and sell need to be formatted as a percentage instead of currency. So if Name="x" then cost and sell should have percentage stringformt.
- Some items only require a sell option. so if Name="y", do not display textbox in Cost column.
How would I implement this in WPF? I was looking into DataTriggers but couldn't figure out how to implement correctly.
<ListView x:Name="Pricing_LV" HorizontalAlignment="Left" Height="335" Margin="10,41,0,0" VerticalAlignment="Top" Width="350" TabIndex="22">
<ListView.View>
<GridView>
<GridViewColumn Header="Surcharge" Width="185" DisplayMemberBinding="{Binding Path=Name}"/>
<GridViewColumn Header="Cost" Width="70">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBox Width="55" Text="{Binding Path=Cost, StringFormat='c'}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="Sell" Width="70">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBox Width="55" Text="{Binding Path=Sell, StringFormat='c'}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>