listbox

Delete selected item from listbox in windowsphone using c#

大憨熊 提交于 2019-12-12 02:49:54
问题 i want delete selected item from my listbox using context menu drop-down box here is my xaml <ListBox Margin="3,60,1,10" Grid.Row="1" Name="lstNews" Tap="lstNews_Tap" Width="476" d:LayoutOverrides="VerticalMargin"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Grid.Row="1" Orientation="Horizontal" Height="120" Width="478"> <StackPanel.Background> <ImageBrush ImageSource="Images/Text-ALU.png" Stretch="Fill" /> </StackPanel.Background> <toolkit:ContextMenuService.ContextMenu> <toolkit

WPF - How to read values from checkbox items that are inside listbox item and bindied with database?

无人久伴 提交于 2019-12-12 02:46:11
问题 I am building an app that will return data from database based on the items that are checked on check box. I have successfully displayed data from database by binding the data. Like this: XAML: <ListBox x:Name="listBox1" ItemsSource="{Binding}" HorizontalAlignment="Left" Height="52" Margin="141,264,0,0" VerticalAlignment="Top" Width="307" SelectionMode="Multiple"> <ListBox.ItemTemplate> <DataTemplate> <CheckBox x:Name="checkBox1" IsChecked="{Binding IsSelected}" Content="{Binding

Getting a character from a string is returning an unexpected number?

泪湿孤枕 提交于 2019-12-12 02:38:50
问题 I have a list box that contains the ID number and model of a number of cars, taken from an access table. I have some text boxes that will be filled with the data from that table when a car is selected from the list box. To get the id number of the selected car, I'm using this code: int idNum = listBox1.SelectedItem.ToString()[0]; Which should get the first character in the item string (it's ID number). When I select the first item in the list, what I am instead getting is 49. My first thought

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

Load a listbox with two textblock from a database with LINQ windows phone

时光毁灭记忆、已成空白 提交于 2019-12-12 02:33:56
问题 I am trying to load a listbox with two textblock from a database with LINQ in windows phone 7.1. My problem is that data does not appear in the textblock. Maybe the problem is in the xaml code, but I don´t know. This is the xaml code: <controls:Pivot Title="CEBADEROS"> <controls:PivotItem Header="Entradas"> <ListBox x:Name="EntradasList" Margin="0,0,-12,0"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Margin="0,0,0,17"> <TextBlock Text="{Binding Fecha_entrada}" TextWrapping="NoWrap"

Finding Listbox Index of ListBoxItem (ItemsTemplate to specify Visual COntent)

百般思念 提交于 2019-12-12 02:33:04
问题 How do you find the index of a ListBoxItem if it is set within a DataTemplate as a Textbox control? Here is the WPF: <ListBox Name="ScriptEditor" Margin="10" Height="291" ItemsSource="{Binding Path=Script}" SelectionChanged="ScriptEditor_SelectionChanged_1" > <ListBox.ItemTemplate> <DataTemplate> <TextBox Text="{Binding Path=Command}"PreviewMouseDoubleClick="Command_DoubleClick" GotFocus="ScriptEditor_GotFocus" /> </DataTemplate> </ListBox.ItemTemplate> </ListBox> When I gain focus of the

Whats your favorite HTML/CSS “<select>” replacement object?

好久不见. 提交于 2019-12-12 02:25:57
问题 Looking for a object (CSS/Javascript) like jQueryUI controls that can be used instead of the standard HTML version; <select rows="10"> <option value="1">Number One</option> <option value="2">Number Two</option> </select> Some people write their own I have seen, but there must be some standard open source projects out there that already as this, or maybe there are not...? 回答1: Sometime clients demand some graphically enhanced version of a <select> . I believe the "best" solution is to use an

ListBox with “load more” option

让人想犯罪 __ 提交于 2019-12-12 02:17:53
问题 I would like to know how to construct the ListBox in WP7 that only load 20 items at a single time, and have a footer that show "load more" if there is any. When user press the "load more", it will load another 20 in the list without loading the previous loaded data? I am using LINQ at the behind source. my code for XMAL as follow: <Grid> <ListBox name="newsIndexListBoxEN"> <ListBoxItem> <DataTemplate> <StackPanel Width="410" Orientation="Horizontal" VerticalAlignment="Top" Margin="0,5,0,5">

WPF ListBox data binding

旧城冷巷雨未停 提交于 2019-12-12 02:15:56
问题 New to WPF here. The application being built has a list of users being pulled from a database for display in a "Users" Window, navigable from a "Main" Window. The list seems to be transferred to the code behind, but the list of users isn't displaying in the "Users" Window ListBox. Does anyone see why this isn't displaying? Many thanks in advance! "Main" Window directing: UsersViewModel Usersvm = new UsersViewModel(); Usersvm.Users = new List<UserViewModel>(); DbEntities db = new DbEntities();

Change the ListBox Item Border Color

☆樱花仙子☆ 提交于 2019-12-12 02:09:55
问题 I have list box with style added to it. Here is my code: <!-- Style for list item selector --> <Style x:Key="ListItemSelectorStyle" TargetType="ListBoxItem"> <Setter Property="Background" Value="Transparent"/> <Setter Property="BorderThickness" Value="1" /> <Setter Property="Padding" Value="0" /> <Setter Property="HorizontalContentAlignment" Value="Center"/> <Setter Property="VerticalContentAlignment" Value="Center"/> <Setter Property ="Foreground" Value="Black" /> <Setter Property="Template"