This is a migrated thread and some comments may be shown as answers.

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

4 Answers 79 Views
DataBoundListBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
bc3tech
Top achievements
Rank 2
bc3tech asked on 04 Nov 2011, 06:08 PM
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.

4 Answers, 1 is accepted

Sort by
0
bc3tech
Top achievements
Rank 2
answered on 04 Nov 2011, 06:27 PM
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?
0
Deyan
Telerik team
answered on 07 Nov 2011, 08:29 AM
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 >>

0
bc3tech
Top achievements
Rank 2
answered on 07 Nov 2011, 03:11 PM
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
0
Deyan
Telerik team
answered on 08 Nov 2011, 09:26 AM
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 >>

Tags
DataBoundListBox
Asked by
bc3tech
Top achievements
Rank 2
Answers by
bc3tech
Top achievements
Rank 2
Deyan
Telerik team
Share this question
or