Как мне создать ResourceDictionary для моего ItemContainerStyle?

Просто добавьте что-то примечательное здесь.


myQueue.hpp:

template <class T> 
class QueueA {
    int size;
    ...
public:
    template <class T> T dequeue() {
       // implementation here
    }

    bool isEmpty();

    ...
}    

myQueue можно определить методы шаблонного класса, которые просто прекрасны в файле реализации. cpp:

// implementation of regular methods goes like this:
template <class T> bool QueueA<T>::isEmpty() {
    return this->size == 0;
}


main()
{
    QueueA<char> Q;

    ...
}
0
задан dhilmathy 3 March 2019 в 18:43
поделиться

1 ответ

Словарь ресурсов

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <ItemsPanelTemplate x:Key="lstViewItemsPanelTemplate">
        <UniformGrid Columns="3"/>
    </ItemsPanelTemplate>
    <Style TargetType="ListViewItem" x:Key="lstViewItemContainerStyle">
        <Setter Property="HorizontalContentAlignment" 
                Value="Stretch"/>
    </Style>
    <DataTemplate x:Key="lstViewItemTemplate">
        <Grid Width="100"
              Height="100"
              Background="{Binding Color}">
            <StackPanel Margin="10">
                <TextBlock Text="{Binding Title}"/>
                <TextBlock Text="{Binding Description}"/>
            </StackPanel>
        </Grid>
    </DataTemplate>
</ResourceDictionary>

Список представлений

<ListView ItemsPanel="{StaticResource lstViewItemsPanelTemplate}"
          ItemContainerStyle="{StaticResource lstViewItemContainerStyle}"
          ItemTemplate="{StaticResource lstViewItemTemplate}"/>

или

Вы также можете определить глобальный Style в ResourceDictionary.xaml, например,

<Style TargetType="ListView">
    <Setter Property="ItemsPanel" Value="{StaticResource lstViewItemsPanelTemplate}"/>
    <Setter Property="ItemContainerStyle" Value="{StaticResource lstViewItemContainerStyle}"/>
    <Setter Property="ItemTemplate" Value="{StaticResource lstViewItemTemplate}"/>
</Style>
0
ответ дан dhilmathy 3 March 2019 в 18:43
поделиться
Другие вопросы по тегам:

Похожие вопросы: