datatemplate

Xamarin.Forms show a different datatemplate for a specific item in listview

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 05:24:23
问题 I'm currently developing a dynamic app using Xamarin.Forms with .Net Standard. I am using MVVM as code pattern. No code behind the view. The content of the view/page is a listview bound to a list of TemplateItem objects. Every listview item, TemplateItem , should look the same (as an article). But when the property BlockType of the TemplateItem is slideshow , the listview must look different by using another data template. How can I use another data template for a listview item when a

Using pushpins in a DataTemplateSelector

本秂侑毒 提交于 2019-12-11 05:19:54
问题 I have built a DataTemplateSelector which I use for showing a different pushpin on the map. I now have the following DataTemplate wich works in the way I want, except that it are not pushpins but textblocks which are shown on the map. <DataTemplate x:Key="pushpinSelector"> <my:Pushpin Location="{Binding Location}" Tap="Pushpin_Tap"> <my:Pushpin.Template> <ControlTemplate> <local:PushpinTemplateSelector Content="{Binding}"> <local:PushpinTemplateSelector.ClusterTemplate> <DataTemplate>

Different DataTemplates in one TreeView?

淺唱寂寞╮ 提交于 2019-12-11 05:08:23
问题 is it possible to use two different DataTemplates in one WPF TreeView? Maybe the first and second flat with yellow Background and the thirt flat with red Background. Where is the right place for the distinction - in Code or in XAML? Thanks for your ideas. 回答1: Different templates are possible in more than one ways... Templates at various hierarchy levels. Templates using selector. One template with multiple data triggers setting various backgrounds. 回答2: Sure, if you use

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

Set Grid Column Width to Bound Perctange

假如想象 提交于 2019-12-11 04:48:15
问题 I want to display a Rectangle with a dynamic Width based on a bound data source. I originally looked into using a Converter , but wasn't able to bind to the converter parameter to get a read dynamic width. My most recent attempt was binding the parent column to the UtilPct property, which is a decimal in my BrokerCredit object. I think this is using the decimal value as an absolute instead of a percentage display. How would I go about doing this? I'd like my Rectangle or the parent column to

Programmatically access a control from a DataTemplate

匆匆过客 提交于 2019-12-11 04:28:32
问题 What's a good way to get at the controls in a DataTemplate? I've used the technique of handing the Loaded event on the control of interest as well as using VisualTreeHelper to walk the visual tree and neither of those is very elegant. What's a good way to access DataTemplate controls? In one example, I need to add a binding whos ConverterParameter isn't know at design time, and since binding to ConverterParameters isn't supported I need to create the binding in code. Ideally I'd like to be

How to get the root element inside an applied DataTemplate when it does not have a resource key?

断了今生、忘了曾经 提交于 2019-12-11 04:10:18
问题 I wish to get the root element inside an applied DataTemplate . I tried this but it does not work for me, because for the ContentPresenter returned by MyItemsControl.ItemContainerGenerator.ContainerFromItem(vm) where vm is a ViewModel, ContentPresenter.ContentTemplate is null , although ContentPresenter.Content is the corresponding data (the same ViewModel). I would access DataTemplate s as resources like here but I cannot give the DataTemplate s resource keys because I want them to be

listbox isSelected databinding in DataTemplate

孤街浪徒 提交于 2019-12-11 03:47:08
问题 I try to simply databind IsSelected property with IsSelected field in my class. But after I change the value in code, it doesn't change the property, neither does clicking on ListBoxItem change the field value. XAML: <FlipView ItemsSource="{Binding Source={StaticResource itemsViewSource}}" ... > <FlipView.ItemTemplate> <DataTemplate> <UserControl Loaded="StartLayoutUpdates" Unloaded="StopLayoutUpdates"> <!-- other controls --> <ListBox Grid.Row="1" Grid.ColumnSpan="3" SelectionMode="Multiple"

jquery xml based template engine

拥有回忆 提交于 2019-12-11 03:39:52
问题 Judging from the lack of info around, I'm guessing the following question maybe a little "off piste" as they say.. I am trying to find an XML based javascript (pref. JQuery based) templating engine.. A little like say how Ext.JS (Sencha) do things, or SPRY datasets. Something lite.. Obviously there are lots of JSON based ones, and for good reason I know, although I have a requirement that has to use XML. I have been using John Resig's micro-templating engine for JSON data, and really want

ValueConverter not invoked in DataTemplate binding

孤街醉人 提交于 2019-12-11 01:27:07
问题 I have a ComboBox that uses a DataTemplate . The DataTemplate contains a binding which uses an IValueConverter to convert an enumerated value into a string. The problem is that the value converter is never invoked. If I put a breakpoint in StatusToTextConverter.Convert() , it never is hit. This is my XAML: <ComboBox ItemsSource="{Binding Path=StatusChoices, Mode=OneWay}"> <ComboBox.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding Converter={StaticResource StatusToTextConverter}}"/> <