listboxitem

Styling a ListBoxItem depending on its index in the ListBox

跟風遠走 提交于 2020-01-04 15:15:21
问题 I want to change the margin of the first item in the ListBox if SomeProperty value is 10, without code-behind. This is what I have so far: <ListBox x:Class="Windows.CustomList" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Windows" mc:Ignorable="d" x:Name="MyList

Change style for all ListBoxItem in a ListBox (Windows phone 8)

烂漫一生 提交于 2020-01-03 03:35:20
问题 I have a Listbox with some Listboxitem and I would like to change the style of all items. I know, it's possible to create a style in resources and bind this style to each item but maybe is there a possibility to do it so easier (without binding)? With ListBox.ItemTemplate? <ListBox SelectionChanged="ListBox_SelectionChanged"> <ListBoxItem x:Name="ItemAdress"> .... </ListBoxItem> <ListBoxItem x:Name="ItemPhone"> .... </ListBoxItem> <ListBoxItem x:Name="ItemEmail"> .... </ListBoxItem> </Listbox

WPF Listbox separator is shown with different thickness

旧城冷巷雨未停 提交于 2020-01-02 07:30:12
问题 I have created a custom ListBox with each item separated by separator. But I am seeing weird issue. The thickness of separator is not constant across List items. It changes if I change the position of list box as shown in this List Box Image. Below is the source code of custom listbox. <Window x:Class="CustListBox.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:CustListBox" Title=

C# XAML Listbox collapse when clicked

百般思念 提交于 2019-12-29 08:15:29
问题 I'm new in XAML for Windows Phone 8.1 and have some troubles with making a Stackpanel clickable collapse Item, when clicked My work so far looks like that: And the Code to that (please correct me, if there are major flaws): <Border CornerRadius="15" Background="#FF595656" Margin="0" Grid.ColumnSpan="2" Height="80"> <StackPanel Orientation="Horizontal"> <StackPanel Width="20" HorizontalAlignment="Left" VerticalAlignment="Top" /> <StackPanel HorizontalAlignment="Left" Height="80" Margin="0,0,0

adding a ListBoxItem in a ListBox in C#?

。_饼干妹妹 提交于 2019-12-29 05:47:10
问题 I know that: String test = "test"; ListBox.Items.Add(test); or String test = "test"; int index = 1; ListBox.Items.Insert(index, String); adds the String in a ListBox, but I want to insert ListBoxItem, how to? previously I learn that var contentToString = (String)ListBoxItem.Content; simply converts ListBoxItem to String, but I couldn't do the opposite to convert String to ListBoxItem 回答1: Try this: ListBoxItem itm = new ListBoxItem(); itm.Content = "some text"; listbox.Items.Add(itm); listbox

Select ListBoxItem if TextBox in ItemTemplate gets focus

孤人 提交于 2019-12-28 03:06:15
问题 I have added a DataTemplate to a ListBox class to bind my collection to: <ListBox x:Name="lstEmails" Height="259" Margin="12,0,12,41" Width="276" SelectionChanged="lstEmails_SelectionChanged"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <Label Visibility="Hidden" Content="{Binding ID}"></Label> <TextBox Width="200" Text="{Binding EmailAddress}"></TextBox> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> This does exactly what I want it to do.

Casting Devexpress gridview column to CheckedListBoxItem c#

北城以北 提交于 2019-12-25 09:12:02
问题 I have a column int my gridview with CheckedListBoxItem type.I need the value of this in my submit button as you can see here : private void btnSave_ItemClick_1(object sender, ItemClickEventArgs e) { gridView.CloseEditor(); Convert.ToDateTime(gridView.GetRowCellValue(rowHandle, "ReturnDateTime")); CheckedListBoxItem confirms =(CheckedListBoxItem)(gridView.GetRowCellValue(rowHandle, "Confirm")); } , My confirms is not ,i think because of GetRowCellValue because it returns string .how can i use

How to change properties of a TlistBoxItem in a android app in runtime?

帅比萌擦擦* 提交于 2019-12-25 06:55:04
问题 In my program, i made a function which reads a xml of a blog and put the Titles in a TListBox . But i need to change some properties in TListBoxItem , like font, height and color, but it doesn't change. How to set it in runtime ? repeat Title := ANode.ChildNodes['title'].Text; Link := ANode.ChildNodes['link'].Text; Desc := ANode.ChildNodes['description'].Text; DataPub := ANode.ChildNodes['pubDate'].Text; SetLength(Vet_News, Pos + 1); Vet_Nesw[Pos] := '<h2>'+Title+'</h2>'+Desc; Itemx :=

How to add some buttons to selected ListBox item via style?

孤者浪人 提交于 2019-12-25 04:14:08
问题 Is there a way to add some buttons to the selected ListBoxItem by adding these buttons to a style which is being used for the selected item? I didn't yet find a suitable style FMX uses to display the selected item. My goal is to have some buttons on the selected item with context based functionality. While I can do this by reparenting a TButton created in code in the OnPaint event of the ListBox, this works for Android but not for Win32 as it is being overpainted by the selection. Other

Is there a way to iterate in a ListBox Items templates?

拈花ヽ惹草 提交于 2019-12-24 06:04:08
问题 I have a list box that contains items that are represented by a single textbox. When the user clicks a button, I want to iterate thru all these text boxes and check if their binding expressions are clean of errors; Should be something like: Dim errCount = 0 For Each item In MyListBox.ListBoxItems 'There is no such thing ListBoxItems which is actually what I am looking for. Dim tb As TextBox = item '.........Dig in item to extract the textbox from the visual tree. errCount += tb