itemtemplate

WPF. Binding inside listbox itemtemplate to ObservableCollection source. Source PropertyChanged is ignored

℡╲_俬逩灬. 提交于 2021-02-11 14:29:34
问题 I'm trying to create a ListBox that displays formatted text. I want to be able to change formatting from code. For displaying formatted text I chose TextBlock and intend to use the TextBlock.Inlines collection for formatting. TextBlock.Inlines is not bindable so I created new class BindableTextBlock derived from TextBlock. This class has one dependency property InlineList that I'm trying to bind to InlinesColl ObservableCollection in Model. The problem is that changes in InlinesColl don't

How to set all the item template data into a single view in Xamarin Carousel

≡放荡痞女 提交于 2021-02-10 06:47:09
问题 I have tried to make all the items in the itemtemplate into a single view as like in the below image, how to achieve this by using Xamarin CarouselView, i am using like this carousel = new CarouselView(); carousel.BindingContext = this; carousel.ItemTemplate = itemTemplate; carousel.SetBinding(CarouselView.ItemsSourceProperty, new Binding(nameof(this.Items), mode: BindingMode.OneWay)); LinearItemsLayout linearItemsLayout = new LinearItemsLayout(ItemsLayoutOrientation.Horizontal);

How to set all the item template data into a single view in Xamarin Carousel

痴心易碎 提交于 2021-02-10 06:46:11
问题 I have tried to make all the items in the itemtemplate into a single view as like in the below image, how to achieve this by using Xamarin CarouselView, i am using like this carousel = new CarouselView(); carousel.BindingContext = this; carousel.ItemTemplate = itemTemplate; carousel.SetBinding(CarouselView.ItemsSourceProperty, new Binding(nameof(this.Items), mode: BindingMode.OneWay)); LinearItemsLayout linearItemsLayout = new LinearItemsLayout(ItemsLayoutOrientation.Horizontal);

How to set all the item template data into a single view in Xamarin Carousel

梦想的初衷 提交于 2021-02-10 06:46:05
问题 I have tried to make all the items in the itemtemplate into a single view as like in the below image, how to achieve this by using Xamarin CarouselView, i am using like this carousel = new CarouselView(); carousel.BindingContext = this; carousel.ItemTemplate = itemTemplate; carousel.SetBinding(CarouselView.ItemsSourceProperty, new Binding(nameof(this.Items), mode: BindingMode.OneWay)); LinearItemsLayout linearItemsLayout = new LinearItemsLayout(ItemsLayoutOrientation.Horizontal);

Use Page.LoadTemplate and Pass Parameters

≯℡__Kan透↙ 提交于 2020-03-05 03:13:51
问题 I need to load a template to an ASP.NET ListView depending on the type of an object. However, I need to pass parameters to that ItemTemplate before loading it in. The item template that gets loaded into the list view is a .ascx user control. ITemplate template = Page.LoadTemplate("~/Controls/Questions/TrueFalse.ascx"); listView.ItemTemplate = template; I've tried casting template as UserControl or as TrueFalse (the type of the user control that loads), but both cast to a null. I need to pass

Getting Listbox Item Index from Button Click

橙三吉。 提交于 2020-02-04 07:20:17
问题 So I'm using a button in the DataTemplate of my Listbox ItemTemplate . Any ideas how I would grab the index of the item of the Listbox from the button click? I can't see to grab the button's parent. <ListBox.ItemTemplate> <DataTemplate DataType="{x:Type local:Img}"> <Button Click="lstButton_Click">... 回答1: private void lstButton_Click(object sender, RoutedEventArgs e) { Button button = sender as Button; int index = _myListBoxName.Items.IndexOf(button.DataContext); //or try this index =

Getting Listbox Item Index from Button Click

杀马特。学长 韩版系。学妹 提交于 2020-02-04 07:08:09
问题 So I'm using a button in the DataTemplate of my Listbox ItemTemplate . Any ideas how I would grab the index of the item of the Listbox from the button click? I can't see to grab the button's parent. <ListBox.ItemTemplate> <DataTemplate DataType="{x:Type local:Img}"> <Button Click="lstButton_Click">... 回答1: private void lstButton_Click(object sender, RoutedEventArgs e) { Button button = sender as Button; int index = _myListBoxName.Items.IndexOf(button.DataContext); //or try this index =

Metro app: ListView ItemTemplate DataTemplate for selected item

别来无恙 提交于 2020-01-06 07:45:10
问题 I created a SplitPage view from canned templates that has the following ListView definition: <!-- Vertical scrolling item list --> <ListView x:Name="itemListView" AutomationProperties.AutomationId="ItemsListView" AutomationProperties.Name="Items" TabIndex="1" Grid.Row="1" Margin="-10,-10,0,0" Padding="120,0,0,60" ItemsSource="{Binding Source={StaticResource itemsViewSource}}" IsSwipeEnabled="False" SelectionChanged="ItemListView_SelectionChanged" ItemTemplate="{StaticResource

Custom control's content can't bind to parent of the control

纵然是瞬间 提交于 2020-01-04 05:16:09
问题 I have following XAML (simplified, no ending tags): <Window Name="myWindow" DataContext="{Binding ElementName=myWindow}" > <DockPanel> <tb:ToolBar Name="toolbar" DockPanel.Dock="Top"> <tb:ToolBar.Items> <tb:ToolBarControl Priority="-3"> <tb:ToolBarControl.Content> <StackPanel Orientation="Horizontal"> <TextBlock>Maps:</TextBlock> <ComboBox ItemsSource="{Binding Generator.Maps, ElementName=myWindow}"> But the ComboBox 's binding will fail with Cannot find source for binding with reference

DataTemplate for a DataType - how to override this DataTemplate in a particular ListBox?

荒凉一梦 提交于 2020-01-02 06:58:31
问题 I have created several DataTemplates for some of the DataTypes in my pet project. These data templates are really cool as they work like magic, magically transforming the look of the instances of the data types whenever and wherever they show up in the UI. Now I want to be able to change the DataTemplate for these DataTypes in one particular ListBox. Does this mean I have to stop relying on WPF automatically applying the data template to the data types and assign a x:Key to the DataTemplates