Note that there are some explanatory texts on larger screens.

plurals
  1. POWhether to include view specific information in model
    primarykey
    data
    text
    <p>I currently have a class containing the following properties</p> <pre><code>public class Chromosome { public int Length { get; set; } public int Number { get; set; } public Chromosome(int _length, int _number) { Length = _length; Number = _number; } } </code></pre> <p>I have a list box data binded to my view model. The items source is data binded to a <strong>Observable</strong> of Chromosome objects <strong>ChromosomeList</strong>. </p> <pre><code>&lt;Grid&gt; &lt;ListBox Style="{StaticResource ListBoxStyle}" ItemsSource="{Binding Path=ChromosomeList}" ItemTemplate="{StaticResource ChromosomeDataTemplate}"&gt; &lt;/ListBox&gt; &lt;/Grid&gt; </code></pre> <p>The ItemTemplate for the list box items is <strong>ChromosomeDataTemplate</strong> and is shown below.</p> <pre><code>&lt;DataTemplate x:Key="ChromosomeDataTemplate"&gt; &lt;Border&gt; &lt;Grid Height="10"&gt; &lt;TextBlock VerticalAlignment="Bottom" Text="{Binding Number}"&gt; &lt;/TextBlock&gt; &lt;/Grid&gt; &lt;/Border&gt; </code></pre> <p></p> <p>In this case, I want the <strong>Height</strong> property of the grid to be data binded to the <strong>Length</strong> property of the chromosome. However, as the <strong>Length</strong> is extremely large, I need it to be a small percentage of the actual value. I could do this by:</p> <ul> <li>Making a new property specific for the modified height</li> </ul> <p>However, I feel that this does not follow the MVVM Pattern. Is there any way to modify the <strong>Length</strong> value when data binding it?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload