itemtemplate

How to change the item template of list box depending upon the Current Orientation in metro app?

不打扰是莪最后的温柔 提交于 2019-12-12 17:09:57
问题 Hi I am developing an metro app , my app works perfectly fine in landscape mode but now i want to make it compatible to Portrait mode also. This is how i have defined students listbox :- <ListBox x:Name="lstbxbStudents" Background="Transparent" Height="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto" SelectionChanged="lstbxbStudents_SelectionChanged_1" HorizontalAlignment="Left" Width="Auto" Margin="4,50,0,122" Style="{StaticResource ListBoxStyle1}"> <ListBox.ItemTemplate> <DataTemplate>

ComboBox ItemTemplate does not support values of type 'Image'

谁说我不能喝 提交于 2019-12-12 04:59:33
问题 I'm trying to bind a WPF combobox to an observable collection of images. Here is my collection: public class AvatarPhoto { public int AvatarId { get; set; } public BitmapImage AvatarImage { get; set; } } public ObservableCollection<AvatarPhoto> AvailableProfilePictures { get; private set; } Here is my xaml: Visual Studio gives me this compile time error: Property 'ItemTemplate' does not support values of type 'Image'. Why is this error seen? Thanks Update: thanks for the answer! It solved the

DataTemplate for Listbox containing lists as items doesn't get displayed

て烟熏妆下的殇ゞ 提交于 2019-12-12 02:58:39
问题 I have the following data template for a list box items: <DataTemplate x:Key="substanceListShower"> <ListBox ItemsSource="{Binding Items}"> <ItemsPanelTemplate> <StackPanel Orientation="Horizontal"/> </ItemsPanelTemplate> </ListBox> </DataTemplate> And then I apply the item template like this: ReactantInterfacesListBox.ItemTemplate = (DataTemplate)FindResource("substanceListShower"); But in the list for the items i get a ToString() return: System.Windows.Controls.ItemsPanelTemplate Any help

wpf listview gridview swaping item template

故事扮演 提交于 2019-12-12 02:17:28
问题 I have a list view that is displaying data using the gridview. This list is displaying data typical of grid views. Lots of data displayed in rows and columns. However, on some rows I do not have any data to display, in the columns. I would like to swap out the item template for that row and display another template for the entire row that would display something like "blank row" or "empty row" for the text and also style the whole row not the individual cells. I have been trying to use this

WPF binding to Visibility of an Itemtemplate of a Listview not working [duplicate]

╄→гoц情女王★ 提交于 2019-12-11 17:47:39
问题 This question already has an answer here : How to use binding in the ListBox’s Items to the ViewModel’s properties (1 answer) Closed last year . I am using WPF Prism.Mvvm. I have a navigation bar on the side containing a Listview bound to an Itemssource. Those Items contain an image and the content. Now my goal is to collapse the content of the item so that my navigation control only shows the icons. I have defined a Visibility binding, using this on some image outside of my Listview which

Change ListView.ItemTemplate on subelement change

自闭症网瘾萝莉.ら 提交于 2019-12-11 08:03:23
问题 let's say we have simple data class: public class Ex { public string Prop1 {...} // notify property public string Prop2 {...} // notify property } and an ObservableCollection of objects of this class. I want to have this collection displayed in a ListView with seperated DataTemplated which is distinguished by Ex.Prop2 (if it is null or empty then template01 is used, otherwise template02). This property can be changed in runtime so simple "trick" with ListView.ItemTemplateSelector does not

Loop through longlistselector to get checkbox in itemtemplate

元气小坏坏 提交于 2019-12-11 06:55:38
问题 I have This Long list selector : <phone:LongListSelector Background="Transparent" x:Name="DocSummaries" ItemTemplate="{StaticResource DataTemplate_Header}" ItemsSource="{Binding DocumentHeaders}" Margin="33,0,-5,0"/> and that list uses this itemtemplate : <Viewbox x:Name="viewboxHeader" Tag="0"> <StackPanel Orientation="Vertical" x:Name="listStackpanel" Height="330" Width="410" Margin="0,10,0,8"> <Grid x:Name="HeaderGrid" Margin="0,0,0,0" Height="325" Width="410" Background="#FF4A4A4A" >

Several item templates in one listbox in mvvmcross Android

坚强是说给别人听的谎言 提交于 2019-12-11 06:37:52
问题 I use MvvmCross framework. I want to use different item templates in one listview depending on ViewModel type. For example I have the list of AnimalViewModels. And I want KittenViewModel and PuppyViewModel look different. I found out how to do this in iOS and WP7. How to implement this in Android. Thank you 回答1: A few of the samples show how to use cell type selection. See: polymorphic lists in https://github.com/slodge/MvvmCross-Tutorials/tree/master/Working%20With%20Collections grouped

Windows Universal Listbox Items Acess Specific UI Element

旧时模样 提交于 2019-12-11 04:57:34
问题 Here is the xaml code of my ListBox : <ListBox x:Name="BoardList" > <ListBox.ItemTemplate> <DataTemplate> <Grid> <StackPanel Orientation="Horizontal" HorizontalAlignment="Right"> <TextBox IsReadOnly="True" ScrollViewer.VerticalScrollBarVisibility="Visible" Text="{Binding}" TextWrapping="Wrap" Foreground="DarkBlue"></TextBox> <AppBarButton Visibility="Collapsed" Icon="Globe" Click="OpenInBrowser" x:Name="Link"></AppBarButton> <AppBarButton Icon="Copy" Click="Copy"></AppBarButton> <AppBarButton

How do I embed the ItemTemplate for a wpf ListBox into the Window's resources?

一笑奈何 提交于 2019-12-11 02:23:44
问题 Sorry if this is a basic question, but how can I take an ItemTemplate that I have for a ListBox, and put it in the resources for the window so that more than one ListBox can use it. Here's some XAML: <Window x:Class="Example"> <Window.Resources> <DataTemplate x:Key="dtExample"> <ListBox.ItemTemplate> // styles go here... </ListBox.ItemTemplate> </DataTemplate> </Window.Resources> <ListBox ItemTemplate="{StaticResource dtExample}"> // items go here... </ListBox> </Window> This is throwing a