listboxitem

How to have a multi-coloured items of a ListBox in winforms?

妖精的绣舞 提交于 2019-12-13 16:07:54
问题 I am developing a software in winforms, I am stuck in a step where I have List<KeyValuePair<string, string>>. and some sample data: List <KeyValuePair<"S", "1200">> List <KeyValuePair<"S", "1300">> List <KeyValuePair<"L", "1400">> I want to diplay the value of the key pair inside a ListBox, where based in the key of the pair the Item on the ListBox has a diffrent colour, for example if the Key is S, then the Item should be red and if the Key is L the Item should be blue. Hope you could help

Drag Drop ListBoxItems from ListBox1 to ListBox2 with their images and avoiding duplication Delphi

烈酒焚心 提交于 2019-12-13 09:13:24
问题 My code is working and the drag and drop but what i want to add is to Drag and Drop items from ListBox1 to ListBox2 with their images. Also when i want to rearrange the items in ListBox2 it duplicates without deleting the previous one. Or if it's possible I would love to know how to move items from ListBox1 to ListBox2 with just a double Click no need to the drag and drop. I am using the 10.2 version Here is my code and i would appreciate if anyone can help me : type TListBoxItem = class(FMX

Remove an item from listbox in WP7

非 Y 不嫁゛ 提交于 2019-12-13 07:15:23
问题 I am both a freshman in WP7 and c# development .I confused with listbox removing operate. I want to remove a item through a click event(remove item data and refresh UI).I've searched in website,and knew first resource should extend ObservableCollection, but How to do next?Who can give me a more detail example. Here is my code MainPage.xaml.Example source download <phone:PhoneApplicationPage x:Class="WPListBoxImage.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

How to implement long press using manipulation events in windows phone 8?

≯℡__Kan透↙ 提交于 2019-12-13 05:15:08
问题 Since GestureListener is deprecated, we are now left with three events namely ManipulationStarted , ManipulationDelta , ManipulationCompleted . My custom listbox enables, swiping left and right on listbox items to do certain functions. How do I use the manipulation events to detect long press on a listboxitem? I want to implement the long press in such a way that the swipe left and right is not broken. Any clue/idea would be of great help! 回答1: Windows Phone 8 includes a Hold event. Can you

using different itemcontainerstyles based on objecttype

佐手、 提交于 2019-12-13 01:34:55
问题 I have a Listbox with an collection ObservableCollection<BaseObject> _baseObjects; public ObservableCollection<BattlegroundBaseObject> BaseObject { get { return _baseObjects?? (_baseObjects= new ObservableCollection<BaseObject>()); } } the collection has two different children from BaseObject. one is a path the other an image.. more are coming i need now two different ItemContainerStyles based on the childrens <ListBox.ItemContainerStyle> <Style BasedOn="ListBoxItem" TargetType="ListBoxItem"

pass listbox item to a textbox on another form c#

孤街浪徒 提交于 2019-12-12 06:33:49
问题 I am making this simple Windows forms app in Visual studio in c#. I have two forms. On form1 I have a textbox,listbox and two buttons (one to insert into listbox from textbox and another to open form2). On form2 I only have a textbox. I just simply want, when click on a button (for opening form2) on form1, form2 to open and textbox to contain (on formLoad) selected item from listbox from form1. But when I click on button it says "Object reference not set to an instance of an object". What am

Get items values of ListBox with SelectedIndex

依然范特西╮ 提交于 2019-12-12 03:52:52
问题 I've got for example ListBox with two TextBlock s like this: <ListBox Name="listboxNews" SelectionChanged="listboxNews_SelectionChanged"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Width="400" Height="70"> <TextBlock Text="{Binding Title}" name="title" /> <TextBlock Text="{Binding Description}" name="desc" /> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> And as you can see, I've got listboxNews_SelectionChanged method, in which i need to select Text of first

UWP: changing the (text) style of a ListBoxItem Element in c# code

守給你的承諾、 提交于 2019-12-12 02:37:28
问题 I have a listbox with many listboxitems inside. those items only contain text elements. What I want to do is change the text style (and maybe the background colour as well) for a single listboxitem in c# code (as I need to apply conditions). how would I go about that? XAML: <ListBox x:Name="todoList" Margin="5, 5, 5, 5" Grid.Row="1" SelectionChanged="todoList_SelectionChanged"/> I fill the listbox by parsing a file and then adding items to the listbox. Subclassing the ItemControlStyleSelector

How Can I Create a Bound List of RadioButtions with ToolTips in Xaml?

痴心易碎 提交于 2019-12-12 01:35:39
问题 I want to create a list of logically related RadioButtons. The RadioButtons are bound for MVVM use. There's ToolTips on each RadioButtons. 回答1: Here is a Style that creates a group of logically related RadioButtons by using a ListBox. MyClass contains two String properties: MyName and MyToolTip. The style will display the list of RadioButtons including properly functioning individual ToolTips. This is an all bound, all Xaml solution for MVVM use. Example usage: ListBox Style="{StaticResource

How to change ListboxItem Size with respect to Slider value

十年热恋 提交于 2019-12-11 21:09:06
问题 I have two Usercontrols say "Usercntrl1" and "Usercntrl2" , "Usercntrl1" contains Slider , "Usercntr2" has ListBox with Images , Now when i change the Slider value in "Usercntrl1" ,the ListboxItems size(i.e,) Width and Height has to change with Respect to Slider value. It can be easily done when both of them present in same usercontrol as follows <ListBox.ItemContainerStyle> <Style TargetType="{x:Type ListBoxItem}"> <Setter Property="HorizontalContentAlignment" Value="Stretch"/> <Setter