如果你們參觀amazon.com並搜索「電影」,你會看到上面的過濾器。
在我的應用程序中,我有一個ListView
,其中有一些MovieItem
s。前幾天, 我已經用搜索框成功過濾了ListView
。然後昨天,我訪問了amazon.com並查看了上面的過濾器面板。我想知道我是否可以將它應用到我的應用程序中。所以創造了我的ListView
的項目一個簡單的過濾器面板:
不幸的是,因爲我是新來WPF和C#語言,我不知道這樣做:(
所以請能有人告訴我,我應該怎麼辦
僅供參考,MovieItem
類:
public class MovieItem
{
public string aRomajiTitle { get; set; }
public string bEnglishTitle { get; set; }
public string cType { get; set; }
public string dScore { get; set; }
public string eEpisodes { get; set; }
public string fJapaneseTitle { get; set; }
public string gGenres { get; set; }
public string hSynopsis { get; set; }
public string iDuration { get; set; }
public string jStatus { get; set; }
public string kMALID { get; set; }
public string lMyStatus { get; set; }
public string mDownloaded { get; set; }
public string nWatched { get; set; }
public string oMyScore { get; set; }
public string pKeywords { get; set; }
public string qPicURL { get; set; }
public string rLocalPic { get; set; }
public string sEpsAcc { get; set; }
public string tRewatched { get; set; }
public string uNotes { get; set; }
public string zImage_url_med { get; set; }
public string zImage_url_sml { get; set; }
public string zStart_date { get; set; }
public string zEnd_date { get; set; }
public string zHashtag { get; set; }
public string zSource { get; set; }
public string zSynonyms { get; set; }
public string zImageBanner { get; set; }
public string zYoutube_ID { get; set; }
public bool zAdult { get; set; }
public int? zPopularity { get; set; }
public string zRelation_type { get; set; }
public string zRole { get; set; }
public bool favourite { get; set; }
public int? season { get; set; }
public List<Subclass_SmallReviewModel> reviews { get; set; }
public List<CharacterWithActor_Model> characters { get; set; }
public List<Staff_Model_Small> staff { get; set; }
public List<OP_SMALL_Model> OPS { get; set; }
public List<ED_SMALL_Model> EDS { get; set; }
public List<Subclass_Studio_Model> studio { get; set; }
public List<Subclass_Ext_Links> external_links { get; set; }
public Subclass_Airing zAiring { get; set; }
}
ListView的XAML:
<ListView x:Name="DM_AllMovies_List" Panel.ZIndex="0" VirtualizingPanel.IsVirtualizing="True" VirtualizingPanel.VirtualizationMode="Recycling" HorizontalAlignment="Left" Height="671" VerticalAlignment="Top" Width="902" ScrollViewer.HorizontalScrollBarVisibility="Auto" Foreground="Black" ScrollViewer.CanContentScroll="True" BorderBrush="#FFC54B4B" BorderThickness="3" Background="White" MouseDown="DM_AllMovie_List_MouseDown" Margin="0,0,0,-3">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<mwc:VirtualizingWrapPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ListView.ItemsPanel>
</ListView>
的ListView
的ItemsSource
是MovieItem
小號List
。
public void LoadMyList()
{
DM_AllMovies_List.ItemsSource = null;
List<MovieItem> MovieDataSource_AllMovies = new List<MovieListViewItem_V2>();
string json = File.ReadAllText(System.AppDomain.CurrentDomain.BaseDirectory + @"Database\DMTitles.col");
List<MovieItem> js = JsonConvert.DeserializeObject<List<MovieListViewItem_V2>>(json);
DM_AllMoview_List.ItemsSource = js;
}
告訴我,如果你需要看到的ListView
的ItemTemplate
。
是的,你可以做到這一點,發佈您的代碼和@Sajeetharan我添加的代碼所綁定 – Sajeetharan
列表。 Thx的快速回復:) – Wahyu
你可以使用linq查詢和適用於他們,只要他們選擇複選框 – Sajeetharan