Search Results

Search found 919 results on 37 pages for 'listbox'.

Page 8/37 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • MSForms.ListBox Type Mismatch in Access

    - by Jason
    I have an Access database where I use a Tab control (without tabs) to simulate a wizard. One of the tab pages has an MSForms.ListBox control called lstPorts, and a button named cmdAdd which adds the contents of a textbox to the List Box. I then try to keep the contents of the ListBox sorted. However, the call to the Sort method causes a type mismatch. Here is the cmdAdd_Click() code behind: Private Sub cmdAdd_Click() Dim test As MSForms.ListBox lstPorts2.AddItem (txtPortName) Call SortListBox(lstPorts2) End Sub Here is the SortListBox Sub: Public Sub SortListBox(ByRef oLb As MSForms.ListBox) Dim vaItems As Variant Dim i As Long, j As Long Dim vTemp As Variant 'Put the items in a variant array vaItems = oLb.List For i = LBound(vaItems, 1) To UBound(vaItems, 1) - 1 For j = i + 1 To UBound(vaItems, 1) If vaItems(i, 0) > vaItems(j, 0) Then vTemp = vaItems(i, 0) vaItems(i, 0) = vaItems(j, 0) vaItems(j, 0) = vTemp End If Next j Next i 'Clear the listbox oLb.Clear 'Add the sorted array back to the listbox For i = LBound(vaItems, 1) To UBound(vaItems, 1) oLb.AddItem vaItems(i, 0) Next i End Sub Any help out there? Since the Sort routine explicitly references the MSForms.ListBox, most of the results from Google aren't applicable. Jason

    Read the article

  • WPF: Binding to ListBoxItem.IsSelected doesn't work for off-screen items

    - by Qwertie
    In my program I have a set of view-model objects to represent items in a ListBox (multi-select is allowed). The viewmodel has an IsSelected property that I would like to bind to the ListBox so that selection state is managed in the viewmodel rather than in the listbox itself. However, apparently the ListBox doesn't maintain bindings for most of the off-screen items, so in general the IsSelected property is not synchronized correctly. Here is some code that demonstrates the problem. First XAML: <StackPanel> <StackPanel Orientation="Horizontal"> <TextBlock>Number of selected items: </TextBlock> <TextBlock Text="{Binding NumItemsSelected}"/> </StackPanel> <ListBox ItemsSource="{Binding Items}" Height="200" SelectionMode="Extended"> <ListBox.ItemContainerStyle> <Style TargetType="{x:Type ListBoxItem}"> <Setter Property="IsSelected" Value="{Binding IsSelected}"/> </Style> </ListBox.ItemContainerStyle> </ListBox> <Button Name="TestSelectAll" Click="TestSelectAll_Click">Select all</Button> </StackPanel> C# Select All handler: private void TestSelectAll_Click(object sender, RoutedEventArgs e) { foreach (var item in _dataContext.Items) item.IsSelected = true; } C# viewmodel: public class TestItem : NPCHelper { TestDataContext _c; string _text; public TestItem(TestDataContext c, string text) { _c = c; _text = text; } public override string ToString() { return _text; } bool _isSelected; public bool IsSelected { get { return _isSelected; } set { _isSelected = value; FirePropertyChanged("IsSelected"); _c.FirePropertyChanged("NumItemsSelected"); } } } public class TestDataContext : NPCHelper { public TestDataContext() { for (int i = 0; i < 200; i++) _items.Add(new TestItem(this, i.ToString())); } ObservableCollection<TestItem> _items = new ObservableCollection<TestItem>(); public ObservableCollection<TestItem> Items { get { return _items; } } public int NumItemsSelected { get { return _items.Where(it => it.IsSelected).Count(); } } } public class NPCHelper : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; public void FirePropertyChanged(string prop) { if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(prop)); } } Two separate problems can be observed. If you click the first item and then press Shift+End, all 200 items should be selected; however, the heading reports that only 21 items are selected. If you click "Select all" then all items are indeed selected. If you then click an item in the ListBox you would expect the other 199 items to be deselected, but this does not happen. Instead, only the items that are on the screen (and a few others) are deselected. All 199 items will not be deselected unless you first scroll through the list from beginning to end (and even then, oddly enough, it doesn't work if you perform scrolling with the little scroll box). My questions are: Can someone explain precisely why this occurs? Can I avoid or work around the problem?

    Read the article

  • Safari Mobile Multi-Line <Select> aka GWT Multi-Line ListBox

    - by McTrafik
    Hi guys. Working on a webapp here that must run on the iPad (so, Safari Mobile). I have this code that works fine in just about anything except iPad: <select class="gwt-ListBox" size="12" multiple="multiple"> <option value="Bleeding Eyelashes">Bleeding Eyelashes</option> <option value="Smelly Pupils">Smelly Pupils</option> <option value="Bushy Eyebrows">Bushy Eyebrows</option> <option value="Green Vessels">Green Vessels</option> <option value="Sucky Noses">Sucky Noses</option> </select> What it's supposed to look like is a box with 12 lines ans 5 of them filled up. It works fine in FF, IE, Chrome, Safari Win. But, when I open it on iPad, it's just a single line! Styling it with CSS doesn't work. It just makes the single line bigger if I set the height. Is there a way to make it behave the same way as in normal browsers, or do I nave to make a custom component? Thanks.

    Read the article

  • ListBoxItem.Parent returns nothing, unable to get it thru VisualTreeHelper.GetParent either

    - by Shimmy
    How do I extract the parent container of a ListBoxItem? In the following example I can go till the ListBoxItem, higher than that I get Nothing: <ListBox Name="lbAddress"> <ListBox.ItemTemplate> <DataTemplate> <Button Click="Button_Click"/> </DataTemplate> </ListBox.ItemTemplate> </ListBox> Private Sub Button_Click(sender As Button, e As RoutedEventArgs) Dim lbAddress = GetAncestor(Of ListBox) 'Result: Nothing End Sub Public Shared Function GetAncestor(Of T)(reference As DependencyObject) As T Dim parent = GetParent(reference) While parent IsNot Nothing AndAlso Not parent.GetType.Equals(GetType(T)) parent = GetAncestor(Of T)(parent) End While If parent IsNot Nothing Then _ Return If(parent.GetType Is GetType(T), parent, Nothing) Return Nothing End Sub Public Function GetParent(reference As DependencyObject) As DependencyObject Dim parent As DependencyObject = Nothing If TypeOf reference Is FrameworkElement Then parent = DirectCast(reference, FrameworkElement).Parent ElseIf TypeOf reference Is FrameworkContentElement Then parent = DirectCast(reference, FrameworkContentElement).Parent End If Return If(parent, VisualTreeHelper.GetParent(reference)) End Function Update This is what happens (note that the 'parent' variable remains null):

    Read the article

  • ListBoxItem IsSelected style

    - by plotnick
    I still didn't get it. Could you please show me exactly how to override ListBox's default behavior. Everytime when ListBoxItem is selected the Border's background should be changed. Not the background of the whole row but only background of the border which's specified. <ListBox ItemsSource="{Binding Source={StaticResource AssetsViewSource}}"> <ListBox.ItemTemplate> <DataTemplate> <Border BorderThickness="2" BorderBrush="Black"> <StackPanel> <TextBlock Text="Name: " /> <TextBlock Text="{Binding Name}" /> </StackPanel> </Border> </DataTemplate> </ListBox.ItemTemplate> </ListBox>

    Read the article

  • How do I edit a "ell in an MFC Listbox?

    - by Pedro
    I have CListBox control that has 2 columns and any number of rows. I want the user to be able to click(or maybe double-click) a "cell" and be able edit the text therein. link text (Can't post images yet, need +10). What I mean is that I want to be able to click and edit any of the places where it says "TEST" by clicking on the text to make it editable. How should I go about this? I suppose I should use a mouse click event but how would I make the cell editable?

    Read the article

  • what are the possibilities of displaying items in a listbox.

    - by Selase
    Ive been trying to figure out for a long time now how to create an interface that can allows users to input several rows of data and passed those entries into an sql server database all at one shot. i could not get any better ideas so i came up with this.(see picture below.) so what i envisioned is that the user enters values in the textboxes and hits "add to list" button. the values are then populated in the list box below with the heading "exhibits lists" and when add exhibit button is pressed, all values from the list box are passed into the database. Well am left wondering again if it would be possible to tie this values from the texboxes to the list box and if id be able to pass them into the database. if it were possible then id please love to know how to go about it otherwise id be glad if you can recommend a better way for me to handle the situation otherwise id have to resolve to data entry one at a time.:(... Counting on you sublime advise. thanks. I believe there is some useful information from this website that can help solve my problem but i just cant make head and tail out of the article...it seems like am almost there and it skids off...can everyone please read and help me adapt it to my situation..thanks..post below http://www.codeproject.com/KB/aspnet/ExtendedGridView.aspx

    Read the article

  • How can I prevent ListBox from selecting an item when I right-click it?

    - by chaiguy
    The tricky part is that each item has a ContextMenu that I still want to open when it is right-clicked (I just don't want it selecting it). In fact, if it makes things any easier, I don't want any automatic selection at all, so if there's some way I can disable it entirely that would be just fine. I'm thinking of just switching to an ItemsControl actually, so long as I can get virtualization and scrolling to work with it.

    Read the article

  • ScrollViewer in a ListBox not working. WPF.

    - by guest
    Hi, I have the following defined in my control: <local:TestListBox.ItemTemplate> <DataTemplate> <Border x:Name="eventBorder" Width="{Binding ElementName=eventsLbx, Path=ActualWidth,BorderBrush="{Binding Color}" BorderThickness="1" CornerRadius="4"> <Border.Background> <LinearGradientBrush StartPoint="0,0" EndPoint="0,1"> <GradientStop x:Name="StartGradient" Color="#FFFFFFFF" Offset="0"/> <GradientStop x:Name="EndGradient" Color="{Binding Color}" Offset="1"/> </LinearGradientBrush> </Border.Background> <Border.ToolTip> <ToolTip Content="{Binding Text}"/> </Border.ToolTip> <TextBlock TextTrimming="CharacterEllipsis" HorizontalAlignment="Center" FontSize="12" Text="{Binding Text}" /> </Border> <DataTemplate.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter TargetName="eventBorder" Property="Background" Value="#FFE4EBF5"/> </Trigger> </DataTemplate.Triggers> --> </DataTemplate> </local:TestListBox.ItemTemplate> </local:TestListBox> </ScrollViewer.Content> </ScrollViewer> </Grid> <ControlTemplate.Triggers> <Trigger SourceName="eventsLbx" Property="HasItems" Value="False"> <Setter TargetName="eventsLbx" Property="Visibility" Value="Hidden"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> Now if there are more items than are visible, then the scrollviewer appears properly but the user CANNOT drag the scrollviewer middle button for scrolling. The user can click on the arrows at the end of the scrollviewer to scroll but he cannot click the bar that appears on the scrollbar and drag it to actually scroll the contents. I cannot figure out why this is happening...

    Read the article

  • How to get texts in ListBox using AutoIt

    - by Carlos_Liu
    I am using Autoit to create an auto-install app. There is an dialog which contains a ListBox control, and in the listbox there are some choices for user (the detailed choices depends on user's machine, for some users there maybe only one choice, for some users there may be 3 choices etc), so I want to get the texts in the listbox to make the decision. I have tried the following code but it did not work ; 2223 is the ID of listbox $txt = ControlGetText("Select Web Site", "", "[ID:2223]") Msgbox(0, "", $txt) after execution the $txt is null So what should I do to get the texts in Listbox?

    Read the article

  • How add a ItemsPanel dynamically to listbox.

    - by Subhen
    Hi, I have a list Box which contains few Images in the itemsTemplate , like below: <ListBox.ItemTemplate> <DataTemplate> <StackPanel x:Name="stackPanelItems" Orientation="Horizontal"> <Image Source="{Binding strAlbumcoverImage}" Height="40" Width="40"/> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> Now onClick of a button I want to change the view and for that I want to add the wrap panel to the ListBox ItemsPanelas following: <ListBox.ItemsPanel> <ItemsPanelTemplate> <controlsToolkit:WrapPanel></controlsToolkit:WrapPanel> </ItemsPanelTemplate> </ListBox.ItemsPanel> Do I need to define the ItemsPanel Style in App.XAML and then assign it. Not quite sure about it. Thanks, Subhen

    Read the article

  • Capturing WPF Listbox checkbox selection

    - by wonea
    Been trying to figure out, how do I capture the events from a listbox. In the template, I've added the parameter IsChecked="" which starts my method. However, the problem is trying to capture what has been checked in the method. SelectedItem only returns what is currently selected, not the checkbox. object selected = thelistbox.SelectedItem; DataRow row = ((DataRowView)selected).Row; string teststring = row.ItemArray[0].ToString(); // Doesn't return the checkbox! <ListBox IsSynchronizedWithCurrentItem="True" Name="thelistbox" ItemsSource="{Binding mybinding}"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel> <CheckBox Content="{Binding personname}" Checked="CheckBox_Checked" Name="thecheckbox"/> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox>

    Read the article

  • Silverlight - Disabling Item Selection from ListBox

    - by Villager
    Hello, I have a ListBox defined in Silverlight. Each item in this ListBox has a CheckBox. Based on some rules when the ListBox is populated, some of the items in the ListBox get selected. This is used just for the sake of highlighting certain rows. When a user clicks an item in the ListBox, I want to check or uncheck the CheckBox in the item. However, I want to leave the item as appeared as selected because of the highlighting. Is there a way to do this? If not, is there a repeater control where I can highlight certain rows but not others when items are loaded? Thank you,

    Read the article

  • How do I get a ComboBox SelectionChanged event to fire from a nested ListBoxItem?

    - by Stephen McCusker
    This is a rather complex problem that has me really confused right now. Any help would be greatly appreciated. The Setup: ListBox of Type A UserControls -ListBoxItem of Type A UserControl --ListBox of Type B UserControls ---ListBoxItem of Type B UserControl ----ListBox of Type C UserControls -----ListBoxItem of Type C UserControl (contains the ComboBox) In other words, the Type A control has a ListBox of Type B controls that has a ListBox of Type C controls. All of the controls are hierarchical in nature. Type A contains the data that's needed to load the Type B controls and the Type B contains the data that's needed to load the Type C controls. The Type C control has a standard ComboBox in it for changing the values of the present items. In addition to the above structure, I have drag and dropping tied to the PreviewMouseLeftButtonDown event on both the Type A and Type B UserControl levels to handle reordering/deleting/etc commands in the GUI. All of this is working as intended. The Problem: When I attempt to change the value in the ComboBox, the SelectionChanged event never fires on the Type C "level" unless I'm careful enough to click on the borders/spacing in between any Type A or B controls. This happens when my ComboBox popout menu overlaps on either a Type A or B control located below itself. The selection events for Type A or B are firing instead of the Type C events, so the ComboBox is never changing its value reliably. In the debugger, the code for handling the drag and drop is triggering on the next ListBoxItem that's located underneath the ComboBox. Thoughts: Is there a way I can make my ComboBox popup take prevalence over the items behind it while double-nested in a ListBox (ie, ignore anything behind it while it's open)? Is there some way to reroute the incorrectly firing SelectionChanged events down to the ComboBox that's supposed to be triggering them?

    Read the article

  • Scrolling list items in wpf

    - by sudarsanyes
    I guess the following picture depicts the problem better than texts... That is what I need. <ListBox x:Name="NamesListBox" ItemsSource="{Binding}"> <ListBox.ItemsPanel> <ItemsPanelTemplate> <WrapPanel x:Name="ItemWrapPanel"> <WrapPanel.RenderTransform> <TranslateTransform x:Name="ItemWrapPanelTransformation" X="0" /> </WrapPanel.RenderTransform> <WrapPanel.Triggers> <EventTrigger RoutedEvent="WrapPanel.Loaded"> <BeginStoryboard> <Storyboard> <DoubleAnimation Storyboard.TargetName="ItemWrapPanelTransformation" Storyboard.TargetProperty="X" To="-1000" From="{Binding ElementName=ScrollingListItemsWindow, Path=Width}" Duration="0:0:9" RepeatBehavior="100" /> </Storyboard> </BeginStoryboard> </EventTrigger> </WrapPanel.Triggers> </WrapPanel> </ItemsPanelTemplate> </ListBox.ItemsPanel> <ListBox.ItemTemplate> <DataTemplate> <Grid> <Label Content="{Binding}" /> </Grid> </DataTemplate> </ListBox.ItemTemplate> </ListBox> is what I did. But here I don't wanna hard code -1000 for the X value, rather I want to determine this based on the length of the wrap panel/number of items. Can somebody help me with this ?? Reason why I choose list box is that the number of items can increase and decrease at any time and suits the problem better. If you have got any other idea, please suggest it too. Thanks.

    Read the article

  • How to remove the small of padding around the ListBoxItem?

    - by Darf Zon
    I'm styling a listBox. i'm trying to clear the margins, so I realized which it, I set the padding of the style to 0 (left padding). But I can still seeing some margin in it, and I need to have no margin in it? Does you know which would be the problem? <ListBox ItemsSource="{Binding Partitions}"> <ListBox.ItemsPanel> <ItemsPanelTemplate> <Canvas /> </ItemsPanelTemplate> </ListBox.ItemsPanel> <ListBox.ItemContainerStyle> <Style TargetType="ListBoxItem"> <Setter Property="Padding" Value="0"/> <Setter Property="Canvas.Top"> ... </Setter> </Style> </ListBox.ItemContainerStyle> I mean, I can see an extra space around the item and I can't handle it to modify to 0.

    Read the article

  • Silverlight Question: How can I find the DataTemplate corresponding to an item in a ListBox

    - by morpheus
    I have two classes A & B, and a listbox. I assign listBox.ItemsSource equal to a collection of objects of type A. The listbox items are visualized using silverlight data templating, see http://msdn.microsoft.com/en-us/library/system.windows.datatemplate.aspx and http://www.codeproject.com/KB/WPF/UserControlAsDataTemplate.aspx for example. The listbox.ItemTemplate is a DataTemplate that uses class B to visualize the listbox items. Now, in my code-behind, inside any method of class B, if I do this.DataContext, it points to an object of type A. Thus, given an object of type B, I can find the corresponding object of type A. So far so good. My question is, given an object of type A, how can I navigate to the corresponding object of type B? Is this even possible in SL?

    Read the article

  • WPF binding not updating until after another action

    - by Matthew Stanford
    I have an observable collection bound to a listbox in WPF. One of the options in the window is to use an OpenFileDialog to add an item to the listbox with certain properties. When I use the OpenFileDialog it immeditaely sets two of the properties of the new item in the observable collection. I am using INotifyPropertyChanged to update the listbox. These two new properties are set correctly and now the listbox should display the title contained in the new title property and the title textbox which is bound to the listbox should display the new title as well. However, neither displays the new title upon the closing of the OpenFileDialog and when I click on another item in the listbox and come back to the item I have just changed it updates the title textbox but the title displayed in the list box is not changed until i move the item in the list box that I want to change. Here is the Binding code. ItemsSource="{Binding Path=MyData, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" And here is the implementation of the browse button that is not working (L1 being the listbox) private void browse_Click(object sender, RoutedEventArgs e) { OpenFileDialog opf = new OpenFileDialog(); opf.ShowDialog(); MyData[L1.SelectedIndex].Title = System.IO.Path.GetFileNameWithoutExtension(opf.FileName); MyData[L1.SelectedIndex].Command = opf.FileName; } When I simply type in the text boxes and click out of them it updates the list box immediately with the new information I have put in. I also have a create new button and upon clicking it, it immediately adds a new item to the list box and updates its' properties. The only one that is not updating correctly is this peice of code I have given you. Thanks for your help. EDIT: Here is my implementation of INotifyPropertyChanged private OCLB _MyData; public OCLB MyData { get { return _MyData; } set { _MyData= value; FirePropertyNotifyChanged("MyData"); } } OCLB is the obserable collection. Here is the function FirePropertyNotifyChanged public event PropertyChangedEventHandler PropertyChanged; private void FirePropertyNotifyChanged(string propertyName) { if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } } Each of these are in the partial class MainWindow for the wpf form. I also have a class for the MyData files (with 4 get/set functions) that are stored in the OCLB(observable collection). There is also a class with functions for the OCLB.

    Read the article

  • Can you set a gradient brush for a listboxitem background in silverlight?

    - by Michael
    I am looking for a way to set a gradientbrush as the background for a listbox item. I have a DataTemplate defined and have specified a gradient brush but it always appears as the listbox background (i.e. it never shows as a gradient brush). I have been able to set the background of the listbox itself, and I can set the listboxitem's background to a standard color using the "setter" object....but none of these are what I am after. I really want the background on each list item to be a gradient brush. Below is the datatemplate that I have constructed. <ListBox Name="MyListBox" Margin="12,67,12,169"> <ListBox.ItemTemplate> <DataTemplate> <Grid Height="51" VerticalAlignment="Bottom"> <Grid.Background> <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> <GradientStop Color="#FFC9F4D0"/> <GradientStop Color="#FF2AC12A" Offset="0.333"/> <GradientStop Color="#FF35DE35" Offset="1"/> </LinearGradientBrush> </Grid.Background> <Canvas > <dataInput:Label Width="227" Foreground="Yellow" Canvas.Left="158" Canvas.Top="8" Content="{Binding Place}"/> <dataInput:Label Width="146" Foreground="Yellow" Canvas.Left="8" Canvas.Top="8" Content="{Binding Date}"/> <dataInput:Label Content="{Binding People}" Width="346" FontSize="9.333" Foreground="Black" Canvas.Left="166" Canvas.Top="28"/> <!-- <dataInput:Label Width="45" Content="Accept" Foreground="White" Canvas.Left="8" Canvas.Top="28"/> <dataInput:Label Width="45" Content="Decline" Foreground="White" Canvas.Left="57" Canvas.Top="28"/> --> <dataInput:Label Content="SomeText" Width="101" FontSize="9.333" Foreground="White" Canvas.Left="389" Canvas.Top="10"/> <Image Height="21" Width="21" Canvas.Left="500" Canvas.Top="8" Source="Green Button.png"/> </Canvas> </Grid> </DataTemplate> </ListBox.ItemTemplate> </ListBox> Any Thoughts?

    Read the article

  • How to invalidate layout of listbox from custom children

    - by Stephen Price
    I have a custom panel for a listbox <ItemsPanelTemplate x:Key="FloatPanelTemplate"> <Controls:FloatPanel x:Name="CardPanel" /> </ItemsPanelTemplate> The panel lays out its children using its X and Y dependency properties. This all works nicely when the FloatPanel is used by itself - I'm using FrameworkPropertyMetadataOptions.AffectsArrange | FrameworkPropertyMetadataOptions.AffectsMeasure on the dependency properties of the child items to tell the FloatPanel to redraw its layout. When I use it in a Listbox (code above) then it draws fine the first time, but when I drag the children (which modifies the item's X and Y) it is not notifying the Listbox that it needs to redraw the FloatPanel's children. I think the issue is related to the fact that each item in the bound collection is wrapped with a ListBoxItem. Hopefully I've described what i'm doing well enough that someone can tell me how to make the panel (or its children) tell it needs to do the Layout routines again. As I said it works once (initial draw) but then dragging items doesn't work (Listbox isnt aware that its children have changed and needs to relayout.) If I drag an item and then resize the window, the listbox does a layout and the items are drawn in their new locations. How do I notify the ListBox (or more importantly the FloatPanel in the ItemsPanelTemplate) that it needs to do a Layout pass?

    Read the article

  • ASP.Net ListBox selections not working in Panel?

    - by larryq
    Hi everyone, I'm having trouble processing a listbox after selecting some items from it. In my markup, the listbox is contained within an asp:panel and is populated during page load in the codebehind. That part works fine. It's when I select various items and submit that I have trouble. My handler loops through the listbox items but doesn't see any as being selected. I'm not sure why. Here's the markup: <asp:Panel ID="panEdit" runat="server" Height="180px" Width="400px" CssClass="ModalWindow"> <table width="100%"> <asp:label runat = "server">Choose your items</asp:label> <tr> <td> <asp:ListBox ID="lstFundList" runat="server" SelectionMode="Multiple" OnLoad="lstFundList_LoadData"> </asp:ListBox> </td> </tr> </table> <asp:Button ID="btnUpdate" runat="server" Text="Update" OnClick="btnUpdate_OnClick"/> <asp:Button ID="btnCancel" runat="server" Text="Cancel" OnClientClick="$find('ModalPopupExtender1').hide(); return false;" /> </asp:Panel> In my btnUpdate_OnClick handler I can't see any listbox items that are marked as selected. I assume something strange is going on with respect to postback and the panel?

    Read the article

  • Binding between Usercontrol with listbox and parent control (MVVM)

    - by walkor
    I have a UserControl which contains a listbox and few buttons. <UserControl x:Class="ItemControls.ListBoxControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"> <Grid> <ListBox:ExtendedListBox SelectionMode="Single" ItemsSource="{Binding LBItems}" Height="184"> <ListBox.ItemTemplate> <DataTemplate> <CheckBox Content="{Binding}"/> </DataTemplate> </ListBox.ItemTemplate> </ListBox> <Button Command="RemoveCommand"/> </Grid> </UserControl> And the code behind: public static readonly DependencyProperty RemoveCommandProperty = DependencyProperty.Register("RemoveCommand", typeof(ICommand), typeof(ListBoxControl), null); public ICommand RemoveCommand { get { return (ICommand)GetValue(RemoveCommandProperty); } set { SetValue(RemoveCommandProperty, value); } } public static readonly DependencyProperty LBItemsProperty = DependencyProperty.Register("LBItems", typeof(IEnumerable), typeof(ListBoxControl), null); public IEnumerable LBItems { get { return (IEnumerable)GetValue(LBItemsProperty); } set { SetValue(LBItemsProperty, value); } } I'm using this control in the view like this: <ItemControls:ListBoxControl Height="240" Width="350" LBItems="{Binding Items, Converter={StaticResource ItemsConverter}, Mode=TwoWay}" RemoveCommand="{Binding RemoveCommand}"/> The command works fine, though the listbox binding doesn't. My question is - WHY?

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >