如何在WPF中向左浮动到ListView ItemTemplate

时间:2019-06-23 07:37:20

标签: c# wpf

如何在ListView中设置向左浮动?

这是现在的样子:

enter image description here

这就是我想要的:

enter image description here

这是我的隐藏代码:

public function insert_record($book_id, $user_id) {
    $book = $this->db->select('book_id, book_title, pickup, return')
                        ->from('books')
                        ->where('book_id', $book_id)
                        ->get()
                        ->result_array();
    if(!empty($book)) {
        $data = array(
                'book_id' => $book[0]['book_id'],
                'user_id' => $user_id,
                'title' => $book[0]['book_title'],
                'pickup' => $book[0]['pickup'],
                'return_time' => $book[0]['return'],
            );
        $this->db->insert('orders', $data);
    }

}

1 个答案:

答案 0 :(得分:0)

如果只需要包装行为,则可以将此xaml代码添加到ListView

<ListView.ItemsPanel>
      <ItemsPanelTemplate>
           <WrapPanel/>
      </ItemsPanelTemplate>
</ListView.ItemsPanel>