Home Forums WPF controls Xceed DataGrid for WPF Bug with ItemsControl in ItemsControl?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #23933 |

    I have 2 problems.

    First, if you run the below code by uncommenting <xcdg:TableView />, you will get an exception indicating that TableView cannot be assigned by ItemsSource is in use.

    Second, if you keep that piece of the code uncommented but remove ItemsSource of DataGridControl instead, you won’t get any exception anymore. However, you will notice that only the first grid works correctly (i.e. showing column header) but not the others. It happens only you try to override FixedHeader template.

    All of these problems occur when DataGridControl lives inside other ItemsControl. Is it a bug? Is there a way to work around it?

    ———————

    <Window
    xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation&#8221;
    xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml&#8221;
    xmlns:xcdg=”http://schemas.xceed.com/wpf/xaml/datagrid&#8221;
    Title=”WindowsApplication4″ Height=”300″ Width=”300″
    >
    <Window.Resources>
    <XmlDataProvider x:Key=”InventoryData” XPath=”Inventory/Books”>
    <x:XData>
    <Inventory xmlns=””>
    <Books>
    <Book ISBN=”0-7356-0562-9″ Stock=”in” Number=”9″>
    <Title>XML in Action</Title>
    <Summary>XML Web Technology</Summary>
    </Book>
    <Book ISBN=”0-7356-1370-2″ Stock=”in” Number=”8″>
    <Title>Programming Microsoft Windows With C#</Title>
    <Summary>C# Programming using the .NET Framework</Summary>
    </Book>
    <Book ISBN=”0-7356-1288-9″ Stock=”out” Number=”7″>
    <Title>Inside C#</Title>
    <Summary>C# Language Programming</Summary>
    </Book>
    <Book ISBN=”0-7356-1377-X” Stock=”in” Number=”5″>
    <Title>Introducing Microsoft .NET</Title>
    <Summary>Overview of .NET Technology</Summary>
    </Book>
    <Book ISBN=”0-7356-1448-2″ Stock=”out” Number=”4″>
    <Title>Microsoft C# Language Specifications</Title>
    <Summary>The C# language definition</Summary>
    </Book>
    </Books>
    <CDs>
    <CD Stock=”in” Number=”3″>
    <Title>Classical Collection</Title>
    <Summary>Classical Music</Summary>
    </CD>
    <CD Stock=”out” Number=”9″>
    <Title>Jazz Collection</Title>
    <Summary>Jazz Music</Summary>
    </CD>
    </CDs>
    </Inventory>
    </x:XData>
    </XmlDataProvider>
    </Window.Resources>
    <Grid>
    <ListBox
    Width=”400″ Height=”300″ Background=”Honeydew”>
    <ListBox.ItemsSource>
    <Binding Source=”{StaticResource InventoryData}”
    XPath=”*[@Stock=’out’] | *[@Number>=8 or @Number=3]”/>
    </ListBox.ItemsSource>

    <ListBox.ItemTemplate>
    <DataTemplate>
    <StackPanel>
    <xcdg:DataGridControl AutoCreateColumns=”False”
    ItemsSource=”{Binding XPath=.}”>
    <xcdg:DataGridControl.Columns>
    <xcdg:Column Title=”Title”
    FieldName=”Title”
    Width=”200″
    DisplayMemberBinding=”{Binding XPath=Title}”/>

    <xcdg:Column Title=”Summary”
    FieldName=”Summary”
    Width=”200″
    DisplayMemberBinding=”{Binding XPath=Summary}”/>
    </xcdg:DataGridControl.Columns>

    <!–<xcdg:TableView Theme=”RoyaleNormalColorTheme”
    ShowRowSelectorPane=”False” ShowFixedColumnSplitter=”False”>
    <xcdg:TableView.FixedHeaders>
    <xcdg:ClearHeadersFooters/>
    <DataTemplate>
    <xcdg:ColumnManagerRow/>
    </DataTemplate>
    </xcdg:TableView.FixedHeaders>
    </xcdg:TableView>–>

    </xcdg:DataGridControl>
    </StackPanel>
    </DataTemplate>
    </ListBox.ItemTemplate>
    </ListBox>
    </Grid>
    </Window>

    Imported from legacy forums. Posted by nat (had 614 views)

    Xceed Support
    Member
    Post count: 5658

    The problem comes from the fact that the TableView was not assigned to the View property of the DataGridControl but instead to the Default Content property (Items)

    You should enclose you TableViewDeclaration in:

    <xcdg:DataGridControl.View>
    … put view declaration here
    </xcdg:DataGridControl.View>

    Imported from legacy forums. Posted by Marcus [Xceed] (had 2753 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.