Can't use <Button> or <Canvas> in ItemTemplate?

5 posts, 0 answers
  1. bc3tech
    bc3tech avatar
    14 posts
    Member since:
    Oct 2011

    Posted 04 Nov 2011 Link to this post

    I've found that if I do either of the following:
    <telerikPrimitives:RadDataBoundListBox x:Name="FileList">
        <telerikPrimitives:RadDataBoundListBox.ItemTemplate>
            <DataTemplate>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>
                    <TextBlock Grid.Column="0"
                               Text="{Binding DisplayName}"
                               Margin="0,0,0,12"
                               TextTrimming="WordEllipsis"
                               FontSize="{StaticResource PhoneFontSizeMediumLarge}" />
                    <Canvas Grid.Column="1">
                        <Image Source="/Icons/appbar.basecircle.rest.png">
                            <Image.RenderTransform>
                                <ScaleTransform ScaleX="0.75"
                                                ScaleY="0.75" />
                            </Image.RenderTransform>
                        </Image>
                        <Image Source="/Icons/appbar.transport.play.rest.png">
                            <Image.RenderTransform>
                                <ScaleTransform ScaleX="0.75"
                                                ScaleY="0.75" />
                            </Image.RenderTransform>
                        </Image>
                    </Canvas>
                </Grid>
            </DataTemplate>
        </telerikPrimitives:RadDataBoundListBox.ItemTemplate>
    </telerikPrimitives:RadDataBoundListBox>

    <telerikPrimitives:RadDataBoundListBox x:Name="FileList">
        <telerikPrimitives:RadDataBoundListBox.ItemTemplate>
            <DataTemplate>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>
                    <TextBlock Grid.Column="0"
                               Text="{Binding DisplayName}"
                               Margin="0,0,0,12"
                               TextTrimming="WordEllipsis"
                               FontSize="{StaticResource PhoneFontSizeMediumLarge}" />
                    <Button Grid.Column="1" Content="Test" />
                </Grid>
            </DataTemplate>
        </telerikPrimitives:RadDataBoundListBox.ItemTemplate>
    </telerikPrimitives:RadDataBoundListBox>

    my app crashes as soon as I populate ItemSource. Take out the <Canvas> or <Button> tags, and it works just fine. Is this a limitation of DataBoundListBox, or a bug?
    I'm using the latest tool set, just downloaded it last week.
  2. bc3tech
    bc3tech avatar
    14 posts
    Member since:
    Oct 2011

    Posted 04 Nov 2011 Link to this post

    Furthermore, I've found that if you even include <Image> element that specifies Tag or Tap attributes, it will crash as well. Remove both of those, and you're good.

    What is up with this?
  3. DevCraft banner
  4. Deyan
    Admin
    Deyan avatar
    2039 posts

    Posted 07 Nov 2011 Link to this post

    Hello Brandon,

    Thanks for writing.

    We are extensively using both Image and Button instances throughout our item temlpates in our examples and have not noticed any undesired behavior in RadDataBoundListBox. Since we cannot reproduce the issue you are reporting, we would like to kindly as you to prepare a sample project that reproduces it and send it to us so that we can directly take a look at it and provide you with further assistance.

    Please note that you will have to open a new support ticket in order to be able to attach your project.

    Thanks for your time.

    Best wishes,
    Deyan
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  5. bc3tech
    bc3tech avatar
    14 posts
    Member since:
    Oct 2011

    Posted 07 Nov 2011 Link to this post

    Thanks Deyan. For now I've gotten around this using Commanding, but when I get the time I'll certainly send this your way so you can investigate what the problem might be.For what it's worth, I am not entirely sure it's even on your end, as I went through and switched the whole RadDataBoundListBox to a wp7-native ListBox control and was STILL unable to attach to any 'Tap' event of an object inside it. The only thing I can think is that some other Rad control I have on the form is causing a conflict here, so the ball may still be in your court.

    At any rate, I will update when I can.
    Thanks
  6. Deyan
    Admin
    Deyan avatar
    2039 posts

    Posted 08 Nov 2011 Link to this post

    Hi Brandon,

    Good to hear that you found a workaround.

    Anyway, do not hesitate to drop a line in case you think there is something we should take a look at regarding our controls.

    Thanks for your time.

    All the best,
    Deyan
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top
DevCraft banner