Note that there are some explanatory texts on larger screens.

plurals
  1. PODataBinding doesn't work inside DataTemplate for DataGrid rowdetails
    primarykey
    data
    text
    <p>I have a WPF toolkit grid with rowdetails property turned on.</p> <p>My rowdetails template is as follows</p> <pre><code> &lt;DataTemplate x:Key="rowDetailsTemplate"&gt; &lt;Border BorderBrush="Black" BorderThickness="1" Background="#BFEFF2F5"&gt; &lt;StackPanel Orientation="Horizontal"&gt; &lt;StackPanel Orientation="Vertical"&gt; &lt;ListBox Margin="100, 0, 0, 0" ItemsSource ="{Binding Path=GridSubItems}"&gt; &lt;/ListBox&gt; &lt;/StackPanel&gt; &lt;/StackPanel&gt; &lt;/Border&gt; &lt;/DataTemplate&gt; </code></pre> <p>Where GridSubItems defined in code behind:</p> <pre><code> public class GridDataSource { private List&lt;GridItemData&gt; _GridItems = new List&lt;GridItemData&gt;(); private List&lt;GridItemData&gt; _GridSubItems = new List&lt;GridItemData&gt;(); public List&lt;GridItemData&gt; GridItems { get { return _GridItems; } set { _GridItems = value; } } public List&lt;GridItemData&gt; GridSubItems { get { return _GridSubItems; } set { _GridSubItems = value; } } } </code></pre> <p>and its data defined in XAML:</p> <pre><code>&lt;ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:myapp="clr-namespace:MyControlsDemo.DemoResources" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt; &lt;myapp:GridDataSource x:Key="dgs"&gt; &lt;myapp:GridDataSource.GridItems&gt; &lt;myapp:GridItemData Name="Item1" Type="Numeric" Unit="MHz" Key="i1" /&gt; &lt;myapp:GridItemData Name="Item2" Type="List" Unit="enum" Key="i2" /&gt; &lt;myapp:GridItemData Name="Item3" Type="Text" Unit="text" Key="i3" /&gt; &lt;/myapp:GridDataSource.GridItems&gt; &lt;myapp:GridDataSource.GridSubItems&gt; &lt;myapp:GridItemData Name="SubItem1" Type="Numeric" Unit="MHz" Key="si1" /&gt; &lt;myapp:GridItemData Name="SubItem2" Type="Numeric" Unit="MHz" Key="si2" /&gt; &lt;myapp:GridItemData Name="SubItem3" Type="Numeric" Unit="MHz" Key="si3" /&gt; &lt;/myapp:GridDataSource.GridSubItems&gt; &lt;/myapp:GridDataSource&gt; </code></pre> <p>And that is how this datatemplate is used:</p> <pre><code>&lt;ContentControl Grid.Column="2"&gt; &lt;centerpanel:GenericParametersGrid DataContext="{StaticResource dgs}" ItemsSource="{Binding Path=GridItems}" RowDetailsTemplate="{StaticResource ResourceKey=rowDetailsTemplate}" Style="{StaticResource ResourceKey=centerPanelHierParameterGridStyle}"/&gt; &lt;/ContentControl&gt; </code></pre> <p>However I cannot see subitems in my application, the listbox is shown empty. If I define subitems directly inside datatemplate, I can see them, so I guess the problem is in my data binding, but for the life of me I cannot see what is wrong. I should admit I have a very short experience with WPF.</p> <p>Thanks a lot for any advice. flot</p> <p></p>
    singulars
    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.
 

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