Установите фоновое изображение для каждой панели элементов ListBox в WP7.1

Привет, я новичок в разработке Windows Mobile.

Мне нужно установить фоновое изображение для каждой ListBox ItemsPanel.

<Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
            <TextBlock x:Name="ApplicationTitle" Text="Issues" Style="{StaticResource PhoneTextNormalStyle}"/>
        </StackPanel>

        <!--ContentPanel - place additional content here-->
        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
            <rlb:PullDownToRefreshPanel
            x:Name="refreshPanel"
            RefreshRequested="refreshPanel_RefreshRequested"
            Grid.Row="2" />

            <rlb:ReorderListBox FlowDirection="LeftToRight" 
            x:Name="allIssuesItemsListBox" 
            ItemsSource="{Binding All_xp_issue}" 
            Margin="12, 0, 12, 0"  
            ItemTemplate="{StaticResource IssuesItemTemplate}" 
            SelectionChanged="allIssuesItemsListBox_SelectionChanged"
            IsReorderEnabled="{Binding IsChecked, ElementName=enableReorderCheckbox}"
             >
                <ListBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <toolkit:WrapPanel HorizontalAlignment="Center">
                        </toolkit:WrapPanel>
                    </ItemsPanelTemplate>
                </ListBox.ItemsPanel>
            </rlb:ReorderListBox>
        </Grid>
    </Grid>

До сих пор я разработал страницу, в которой элементы деформируются с помощью инструментария:WrapPanel.

Теперь для каждой панели я хочу установить фоновое изображение. Означает, что если на одной панели есть два элемента, то для обоих элементов я хочу установить одно фоновое изображение.

Заранее спасибо.

1 ответ

Вы можете установить фон инструментария:WrapPanel с помощью кисти изображений

создать изображение кисти в ресурсах.

<ImageBrush ImageSource="/images/YourImage.jpg" x:Key="BackgroundBrush" />

Используйте image brush в качестве инструментария: фон WrapPanel

<toolkit:WrapPanel  Background="{DynamicResource BackgroundBrush}"></toolkit:WrapPanel>
Другие вопросы по тегам