Search Results

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

Page 3/37 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • WPF Custom Buttons below ListBox Items

    - by Ryan
    WPF Experts - I am trying to add buttons below my custom listbox and also have the scroll bar go to the bottom of the control. Only the items should move and not the buttons. I was hoping for some guidance on the best way to achieve this. I was thinking the ItemsPanelTemplate needed to be modified but was not certain. Thanks My code is below <!-- List Item Selected --> <LinearGradientBrush x:Key="GotFocusStyle" EndPoint="0.5,1" StartPoint="0.5,0"> <LinearGradientBrush.GradientStops> <GradientStop Color="Black" Offset="0.501"/> <GradientStop Color="#FF091F34"/> <GradientStop Color="#FF002F5C" Offset="0.5"/> </LinearGradientBrush.GradientStops> </LinearGradientBrush> <!-- List Item Hover --> <LinearGradientBrush x:Key="MouseOverFocusStyle" StartPoint="0,0" EndPoint="0,1"> <LinearGradientBrush.GradientStops> <GradientStop Color="#FF013B73" Offset="0.501"/> <GradientStop Color="#FF091F34"/> <GradientStop Color="#FF014A8F" Offset="0.5"/> <GradientStop Color="#FF003363" Offset="1"/> </LinearGradientBrush.GradientStops> </LinearGradientBrush> <!-- List Item Selected --> <LinearGradientBrush x:Key="LostFocusStyle" EndPoint="0.5,1" StartPoint="0.5,0"> <LinearGradientBrush.RelativeTransform> <TransformGroup> <ScaleTransform CenterX="0.5" CenterY="0.5"/> <SkewTransform CenterX="0.5" CenterY="0.5"/> <RotateTransform CenterX="0.5" CenterY="0.5"/> <TranslateTransform/> </TransformGroup> </LinearGradientBrush.RelativeTransform> <GradientStop Color="#FF091F34" Offset="1"/> <GradientStop Color="#FF002F5C" Offset="0.4"/> </LinearGradientBrush> <!-- List Item Highlight --> <SolidColorBrush x:Key="ListItemHighlight" Color="#FFE38E27" /> <!-- List Item UnHighlight --> <SolidColorBrush x:Key="ListItemUnHighlight" Color="#FF6FB8FD" /> <Style TargetType="ListBoxItem"> <EventSetter Event="GotFocus" Handler="ListItem_GotFocus"></EventSetter> <EventSetter Event="LostFocus" Handler="ListItem_LostFocus"></EventSetter> </Style> <DataTemplate x:Key="CustomListData" DataType="{x:Type ListBoxItem}"> <Border BorderBrush="Black" BorderThickness="1" Margin="-2,0,0,-1"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListBoxItem}}, Path=ActualWidth}" /> </Grid.ColumnDefinitions> <Label VerticalContentAlignment="Center" BorderThickness="0" BorderBrush="Transparent" Foreground="{StaticResource ListItemUnHighlight}" FontSize="24" Tag="{Binding .}" Grid.Column="0" MinHeight="55" Cursor="Hand" FontFamily="Arial" FocusVisualStyle="{x:Null}" KeyboardNavigation.TabNavigation="None" Background="{StaticResource LostFocusStyle}" MouseMove="ListItem_MouseOver" > <Label.ContextMenu> <ContextMenu Name="editMenu"> <MenuItem Header="Edit"/> </ContextMenu> </Label.ContextMenu> <TextBlock Text="{Binding .}" Margin="15,0,40,0" TextWrapping="Wrap"></TextBlock> </Label> <Image Tag="{Binding .}" Source="{Binding}" Margin="260,0,0,0" Grid.Column="1" Stretch="None" Width="16" Height="22" HorizontalAlignment="Center" VerticalAlignment="Center" /> </Grid> </Border> </DataTemplate> </Window.Resources> <Window.DataContext> <ObjectDataProvider ObjectType="{x:Type local:ImageLoader}" MethodName="LoadImages" /> </Window.DataContext> <ListBox ItemsSource="{Binding}" Width="320" Background="#FF021422" BorderBrush="#FF1C4B79" > <ListBox.Resources> <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}">Transparent</SolidColorBrush> <Style TargetType="{x:Type ListBox}"> <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" /> <Setter Property="ItemTemplate" Value="{StaticResource CustomListData }" /> </Style> </ListBox.Resources> </ListBox>

    Read the article

  • GWT - ListBox - pre-selecting an item

    - by rgoytacaz
    Hey there Stackoverflow, I got a doubt regarding pre-selecting(setSelectedIndex(index)) an item in a ListBox, Im using Spring + GWT. I got a dialog that contains a painel, this panel has a flexpanel, in which I've put a couple ListBox, this are filled up with data from my database. But this painel is for updates of an entity in my database, thus I wanted it to pre-select the current properties for this items, alowing the user to change at will. I do the filling up in the update method of the widget. I tried setting the selectedItem in the update method, but it gives me an null error. I've searched a few places and it seems that the listbox are only filled at the exact moment of the display. Thus pre-selecting would be impossible. I thought about some event, that is fired when the page is displayed. onLoad() doesnt work.. Anyone have something to help me out in here? Thx in advance, Rodrigo Dellacqua

    Read the article

  • .NET 3.5 Listbox Selected Values (Winforms)

    - by Jimbo
    I am BATTLING to get the selected values (please note VALUES not TEXT) from a Winforms Listbox that has multi-select enabled and has been bound to a database table getting the Name (as DisplayMember) and ID (as ValueMember) - I need the ID of the selected items. The listbox control has properties for SelectedValue to get one of the selected items values, but not for all selected items values. The SelectedItems property returns a Listbox.SelectedObjectCollection from which I cannot seem to extract the VALUES of the items. Please help! Thanks.

    Read the article

  • How to disable listbox's click event

    - by StupidDeveloper
    I have a listbox which acts as a list of items. If you click on some item, it's contents are shown in the panel on the right (few textboxes etc.). I need to have a validation on these controls as all of them are required fields. And I do have it. The problem is that, even when the validators are not valid, user can click the listbox and change active index (that doesn't have impact on the panel on the right, as SelectedIndexChanged isn't fired). The validators are standard RequiredFieldValidator with their Display property set to "Dynamic". So, what I want is to disallow the user clicking on the listbox and changing the index untill all validators are Valid. What would be your solution for that? Is that even possible?

    Read the article

  • C# : changing listbox row colour?

    - by Meko
    HI. I am trying to changing backround colour of some rows on listbox.I have 2 list that one has all names and it shown on listbox.And second list has some same value with first list.I want to show that when clicking button it will search in listbox and in second list then will change colour where found value. I may search in list box like for (int i = 0; i < listBox1.Items.Count; i++) { for (int j = 0; j < students.Count; j++) if (listBox1.Items[i].ToString().Contains(students[j].ToString())) { } } But I dont know which method to change appearances of row.Any help?

    Read the article

  • Dynamically add rows to listbox

    - by Ivan S
    I have a list box that displays information off of a column of a dataset. I would like the number of rows displayed to be all the rows that are in the dataset (the number of datasets in the rows vary). I'm figuring it has something to do with ListBox.Rows = Dataset.Tables[0].Rows.Count; But it seems to just always default to 4 even when it is only 2. This is what I have in my aspx.cs file. pirateBox.DataTextField = Pirateship.Tables[0].Columns["displayName"].ToString(); pirateBox.DataValueField = pirateship.Tables[0].Columns["PKID"].ToString(); pirateBox.DataSource = pirateship.Tables[0]; pirateBox.DataBind(); pirateBox.Rows = pirateship.Tables[0].Rows.Count; I've been trying a few things and this is what I have so far in .aspx <asp:ListBox ID="pirateBox" runat="server" Rows="1"></asp:ListBox>

    Read the article

  • Windows Phone 7: Making ListBox items change dynamically

    - by Chad La Guardia
    I am working on creating a Windows Phone app that will play a series of sound clips selected from a list. I am using the MVVM (Model View View-Model) Design pattern and have designed a model for my data, along with a view model for my page. Here is what the XAML for the ListBox looks like: <ListBox x:Name="MediaListBox" Margin="0,0,-12,0" ItemsSource="{Binding Media}" SelectionChanged="MediaListBox_SelectionChanged" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"> <ListBox.ItemTemplate > <DataTemplate> <StackPanel Margin="0,0,0,17" Width="432" Orientation="Horizontal"> <Image Source="../Media/Images/play.png" /> <StackPanel > <TextBlock Text="{Binding Title}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}"/> <TextBlock Text="{Binding ShortDescription}" TextWrapping="Wrap" Margin="12,-6,12,0" Visibility="{Binding ShortDescriptionVisibility}" Style="{StaticResource PhoneTextSubtleStyle}"/> <TextBlock Text="{Binding LongDescription}" TextWrapping="Wrap" Visibility="{Binding LongDescriptionVisibility}" /> <StackPanel> <Slider HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" Visibility="{Binding LongDescriptionVisibility}" ValueChanged="Slider_ValueChanged" LargeChange="0.25" SmallChange="0.05" /> </StackPanel> </StackPanel> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> My question is this: I want to be able to expand and collapse part of the items in the ListBox. As you can see, I have a binding for the visibility. That binding is coming from the MediaModel. However, when I change this property in the ObservableCollection, the page is not updated to reflect this. The ViewModel for this page looks like this: public class ListenPageViewModel : INotifyPropertyChanged { public ListenPageViewModel() { this.Media = new ObservableCollection<MediaModel>; } /// <summary> /// A collection for MediaModel objects. /// </summary> public ObservableCollection<MediaModel> Media { get; private set; } public bool IsDataLoaded { get; private set; } /// <summary> /// Creates and adds the media to their respective collections. /// </summary> public void LoadData() { this.Media.Clear(); this.Media.Add(new MediaModel() { Title = "Media 1", ShortDescription = "Short here.", LongDescription = "Long here.", MediaSource = "/Media/test.mp3", LongDescriptionVisibility = Visibility.Collapsed, ShortDescriptionVisibility = Visibility.Visible }); this.Media.Add(new MediaModel() { Title = "Media 2", ShortDescription = "Short here.", LongDescription = "Long here.", MediaSource = "/Media/test2.mp3", LongDescriptionVisibility = Visibility.Collapsed, ShortDescriptionVisibility = Visibility.Visible }); this.IsDataLoaded = true; } public event PropertyChangedEventHandler PropertyChanged; private void NotifyPropertyChanged(String propertyName) { PropertyChangedEventHandler handler = PropertyChanged; if (null != handler) { handler(this, new PropertyChangedEventArgs(propertyName)); } } } The bindings work correctly and I am seeing the data displayed; however, when I change the properties, the list does not update. I believe that this may be because when I change things inside the observable collection, the property changed event is not firing. What can I do to remedy this? I have poked around for some info on this, but many of the tutorials don't cover this kind of behavior. Any help would be greatly appreciated! Thanks Edit: As requested, I have added the MediaModel code: public class MediaModel : INotifyPropertyChanged { public string Title { get; set; } public string ShortDescription { get; set; } public string LongDescription { get; set; } public string MediaSource { get; set; } public Visibility LongDescriptionVisibility { get; set; } public Visibility ShortDescriptionVisibility { get; set; } public MediaModel() { } public MediaModel(string Title, string ShortDescription, string LongDescription, string MediaSource, Visibility LongDescriptionVisibility, Visibility ShortDescriptionVisibility) { this.Title = Title; this.ShortDescription = ShortDescription; this.LongDescription = LongDescription; this.MediaSource = MediaSource; this.LongDescriptionVisibility = LongDescriptionVisibility; this.ShortDescriptionVisibility = ShortDescriptionVisibility; } public event PropertyChangedEventHandler PropertyChanged; private void NotifyPropertyChanged(String propertyName) { PropertyChangedEventHandler handler = PropertyChanged; if (null != handler) { handler(this, new PropertyChangedEventArgs(propertyName)); } } } Originally, I did not have this class implement the INotifyPropertyChanged. I did this to see if it would solve the problem. I was hoping this could just be a data object.

    Read the article

  • iTextSharp Set content of ListBox?

    - by Petoj
    Well im trying to set the content of a ListBox but even if it returns true nothing happens.. PdfStamper stamper = new PdfStamper(reader, context.Response.OutputStream); AcroFields fields = stamper.AcroFields; bool result = fields.SetListOption("listbox", data.ToArray(), data.ToArray()); So what am i doing wrong the data never gets to the pdf?

    Read the article

  • problem binding ListBox on ObservableCollection<T>

    - by Fabian
    Hello, I have a strange "problem". Could someone explain me why : If I have in an ObservableCollection, twice (or more time) an item with the same value, then the selections of those values in the ListBox won't work properly ? In fact, what the ListBox is doing when I click on an item(Even in single item selection) : It selects the first item from the ObservableCollection collection with a matching value. so in the case if multiple items with same value are in the collection, then only the first one will be selected !

    Read the article

  • Fill WPF listbox with string array

    - by Archie
    Instead of adding each item one by one to the ListBox destinationList from the string array m_List like this: foreach (object name in m_List) { destinationList.Items.Add((string)name); } Is there any better way I can do it? I don't want to bind the data to the destinationList since I want to delete some entries from the ListBox later on.

    Read the article

  • How to read the selected items in an Html.ListBox at postback time

    - by EasyTimer
    I have a search page on my MVC site that contains a list of strings that I think the user might wish to search for in my database. This list of strings is available in my model class, so I can populate an Html.ListBox with those strings thus: <%=Html.ListBox("SearchStrings", new SelectList(Model.SearchStrings)) % My problem is, how can I tell which strings the user selected in that list in my postback action? Any help would be most appreciated.

    Read the article

  • WPF Listbox display next element after SelectedItem

    - by Daniil Harik
    I have TextBox and ListBox with bunch of elements. TextBox has KeyDown event handler, the idea behind this is to allow user to press up and down keys to scroll inside ListBox while focus is on TextBox. When user presses "down key" several times, selected element becomes last visible element on screen. If user has reached bottom of visible list element on screen, I want him to see next element after selected element as well.

    Read the article

  • WPF Databound Listbox

    - by Jeff
    I have a listbox bound to a list of objects for a data entry screen. The item template includes textblocks, a checkbox and comboboxes. When the listbox is populated I would like to change the foreground color of the textblocks to red if object.value1 = true and object.value2 = 0. Any ideas?

    Read the article

  • Dynamically Populate Listbox - Exclude Empty cells

    - by Daniel
    I am creating a form in excel (not a userform) and I am populating the listbox using cells. However, these cells are sometimes A1:10 and sometimes they are A1:A4. Is there a way to dynamically change what is shown in the listbox? Right now, when I use A1:10 and there are only 4 cells populated, I get the list of 4 populated cells followed by 6 blank entries. I'd like to get rid of the 6 blanks when there are only 4.

    Read the article

  • Strange WPF ListBox Behavior

    - by uncle-harvey
    I’m trying to bind a List of items to a listbox in WPF. The items are grouped by one value and each group is to be housed in an expander. Everything works fine when I don’t use any custom styles. However, when I use custom styles (which work properly with non-grouped items and as independent controls) the binding doesn’t display any items. Below is the code I’m executing. Any ideas why the items won’t show up in the Expander? Test.xaml: <Window x:Class="Glossy.Test" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Test" Height="300" Width="300"> <Window.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="..\TestStyles.xaml"/> <ResourceDictionary> <Style x:Key="ContainerStyle" TargetType="{x:Type GroupItem}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate> <Expander Header="{Binding}" IsExpanded="True"> <ItemsPresenter /> </Expander> </ControlTemplate> </Setter.Value> </Setter> </Style> </ResourceDictionary> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Window.Resources> <Grid> <ListBox x:Name="TestList"> <ListBox.GroupStyle> <GroupStyle ContainerStyle="{StaticResource ContainerStyle}"/> </ListBox.GroupStyle> </ListBox> </Grid> Test.xaml.cs: public partial class Test : Window { private List<Contact> _ContactItems; public List<Contact> ContactItems { get { return _ContactItems; } set { _ContactItems = value; } } public Test() { InitializeComponent(); ContactItems = new List<Contact>(); ContactItems.Add(new Contact()); ContactItems.Last().CompanyName = "ABC"; ContactItems.Last().Name = "Contact 1"; ContactItems.Add(new Contact()); ContactItems.Last().CompanyName = "ABC"; ContactItems.Last().Name = "Contact 2"; ContactItems.Add(new Contact()); ContactItems.Last().CompanyName = "ABC"; ContactItems.Last().Name = "Contact 3"; ContactItems.Add(new Contact()); ContactItems.Last().CompanyName = "ABC"; ContactItems.Last().Name = "Contact 10"; ContactItems.Add(new Contact()); ContactItems.Last().CompanyName = "ABC"; ContactItems.Last().Name = "Contact 11"; ContactItems.Add(new Contact()); ContactItems.Last().CompanyName = "ABC"; ContactItems.Last().Name = "Contact 12"; ContactItems.Add(new Contact()); ContactItems.Last().CompanyName = "RST"; ContactItems.Last().Name = "Contact 7"; ContactItems.Add(new Contact()); ContactItems.Last().CompanyName = "RST"; ContactItems.Last().Name = "Contact 8"; ContactItems.Add(new Contact()); ContactItems.Last().CompanyName = "RST"; ContactItems.Last().Name = "Contact 9"; ContactItems.Add(new Contact()); ContactItems.Last().CompanyName = "XYZ"; ContactItems.Last().Name = "Contact 4"; ContactItems.Add(new Contact()); ContactItems.Last().CompanyName = "XYZ"; ContactItems.Last().Name = "Contact 5"; ContactItems.Add(new Contact()); ContactItems.Last().CompanyName = "XYZ"; ContactItems.Last().Name = "Contact 6"; ICollectionView view = CollectionViewSource.GetDefaultView(ContactItems); view.GroupDescriptions.Add(new PropertyGroupDescription("CompanyName")); view.SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Ascending)); TestList.ItemsSource = view; } } public class Contact { public string CompanyName { get; set; } public string Name { get; set; } public override string ToString() { return Name; } } TestStyles.xaml: <Style TargetType="{x:Type ListBox}"> <Setter Property="SnapsToDevicePixels" Value="true"/> <Setter Property="OverridesDefaultStyle" Value="true"/> <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/> <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/> <Setter Property="ScrollViewer.CanContentScroll" Value="true"/> <Setter Property="MinWidth" Value="120"/> <Setter Property="MinHeight" Value="95"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="ListBox"> <Grid Background="Black"> <Rectangle VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Fill="White"> <Rectangle.OpacityMask> <DrawingBrush> <DrawingBrush.Drawing> <GeometryDrawing Geometry="M65.5,33 L537.5,35 537.5,274.5 C536.5,81 119.5,177 66.5,92" Brush="#11444444"> <GeometryDrawing.Pen> <Pen Brush="Transparent"/> </GeometryDrawing.Pen> </GeometryDrawing> </DrawingBrush.Drawing> </DrawingBrush> </Rectangle.OpacityMask> </Rectangle> <Border Name="Border" Background="Transparent" BorderBrush="Gray" BorderThickness="1" CornerRadius="2"> <ScrollViewer Margin="0" Focusable="false"> <StackPanel Margin="2" IsItemsHost="True" /> </ScrollViewer> </Border> </Grid> <ControlTemplate.Triggers> <Trigger Property="IsEnabled" Value="false"> <Setter TargetName="Border" Property="Background" Value="Gray" /> <Setter TargetName="Border" Property="BorderBrush" Value="DimGray" /> </Trigger> <Trigger Property="IsGrouping" Value="true"> <Setter Property="ScrollViewer.CanContentScroll" Value="false"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style TargetType="{x:Type ListBoxItem}"> <Setter Property="SnapsToDevicePixels" Value="true"/> <Setter Property="OverridesDefaultStyle" Value="true"/> <Setter Property="Foreground" Value="Gray"/> <Setter Property="Background" Value="Transparent"/> <Setter Property="FontFamily" Value="Verdana"/> <Setter Property="HorizontalAlignment" Value="Stretch"/> <Setter Property="FontSize" Value="11"/> <Setter Property="Margin" Value="3,1,3,1"/> <Setter Property="Padding" Value="0"/> <Setter Property="FontWeight" Value="Normal"/> <Setter Property="VerticalAlignment" Value="Center"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="ListBoxItem"> <Border Name="Border" Padding="2" SnapsToDevicePixels="true"> <ContentPresenter /> </Border> <ControlTemplate.Triggers> <Trigger Property="IsSelected" Value="true"> <Setter TargetName="Border" Property="Background" Value="Gray"/> </Trigger> <Trigger Property="IsEnabled" Value="false"> <Setter Property="Foreground" Value="White"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> <ControlTemplate x:Key="ExpanderToggleButton" TargetType="ToggleButton"> <Border Name="Border" CornerRadius="2,0,0,0" Background="Transparent" BorderBrush="LightGray" BorderThickness="0,0,1,0"> <Path Name="Arrow" Fill="Blue" HorizontalAlignment="Center" VerticalAlignment="Center" Data="M 0 0 L 4 4 L 8 0 Z"/> </Border> <ControlTemplate.Triggers> <Trigger Property="ToggleButton.IsMouseOver" Value="True"> <Setter TargetName="Border" Property="Background" Value="Gray" /> </Trigger> <Trigger Property="IsPressed" Value="True"> <Setter TargetName="Border" Property="Background" Value="Black" /> </Trigger> <Trigger Property="IsChecked" Value="True"> <Setter TargetName="Arrow" Property="Data" Value="M 0 4 L 4 0 L 8 4 Z" /> </Trigger> <Trigger Property="IsEnabled" Value="False"> <Setter TargetName="Border" Property="Background" Value="DimGray" /> <Setter TargetName="Border" Property="BorderBrush" Value="DimGray" /> <Setter Property="Foreground" Value="LightGray"/> <Setter TargetName="Arrow" Property="Fill" Value="LightBlue" /> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> <Style TargetType="{x:Type Expander}"> <Setter Property="Foreground" Value="White"/> <Setter Property="FontFamily" Value="Verdana"/> <Setter Property="FontSize" Value="11"/> <Setter Property="FontWeight" Value="Normal"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="Expander"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Name="ContentRow" Height="0"/> </Grid.RowDefinitions> <Border Name="Border" Grid.Row="0" Background="Black" BorderBrush="DimGray" BorderThickness="1" Cursor="Hand" CornerRadius="2,2,0,0" > <Grid HorizontalAlignment="Left"> <Grid.RowDefinitions> <RowDefinition Height="23"/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="20" /> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <ToggleButton IsChecked="{Binding Path=IsExpanded,Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}}" Template="{StaticResource ExpanderToggleButton}" Background="Black" /> <Label Grid.Column="1" FontSize="14" FontWeight="Normal" Margin="0" VerticalAlignment="Top" Foreground="White" FontFamily="Verdana"> <ContentPresenter Grid.Column="1" Margin="4,3,0,0" HorizontalAlignment="Left" ContentSource="Header" RecognizesAccessKey="True" /> </Label> </Grid> </Border> <Border Name="Content" Background="Black" BorderBrush="DimGray" BorderThickness="1,0,1,1" Grid.Row="1" CornerRadius="0,0,2,2" > <Grid Background="Black"> <Rectangle VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Fill="White"> <Rectangle.OpacityMask> <DrawingBrush> <DrawingBrush.Drawing> <GeometryDrawing Geometry="M65.5,33 L537.5,35 537.5,274.5 C536.5,81 119.5,177 66.5,92" Brush="#11444444"> <GeometryDrawing.Pen> <Pen Brush="Transparent"/> </GeometryDrawing.Pen> </GeometryDrawing> </DrawingBrush.Drawing> </DrawingBrush> </Rectangle.OpacityMask> </Rectangle> <ContentPresenter Margin="4" /> </Grid> </Border> </Grid> <ControlTemplate.Triggers> <Trigger Property="IsExpanded" Value="True"> <Setter TargetName="ContentRow" Property="Height" Value="{Binding ElementName=Content,Path=DesiredHeight}" /> </Trigger> <Trigger Property="IsEnabled" Value="False"> <Setter TargetName="Border" Property="Background" Value="Gray" /> <Setter TargetName="Border" Property="BorderBrush" Value="DimGray" /> <Setter Property="Foreground" Value="White"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style>

    Read the article

  • How to remove all ListBox items?

    - by Nano HE
    Hi, I created two RadioButton (Weight and Height). I will do switch between the two categories. But the they share the same ListBox Controllers (listBox1 and listBox2). Is there any good method to clear all the ListBox items simpler? I didn't find the removeAll() for ListBox. I don't like my complex multi-lines style which I posted here. private void Weight_Click(object sender, RoutedEventArgs e) { // switch between the radioButton "Weith" and "Height" // Clear all the items first listBox1.Items.Remove("foot"); listBox1.Items.Remove("inch"); listBox1.Items.Remove("meter"); listBox2.Items.Remove("foot"); listBox2.Items.Remove("inch"); listBox2.Items.Remove("meter"); // Add source units items for listBox1 listBox1.Items.Add("kilogram"); listBox1.Items.Add("pound"); // Add target units items for listBox2 listBox2.Items.Add("kilogram"); listBox2.Items.Add("pound"); } private void Height_Click(object sender, RoutedEventArgs e) { // switch between the radioButton "Weith" and "Height" // Clear all the items first listBox1.Items.Remove("kilogram"); listBox1.Items.Remove("pound"); listBox2.Items.Remove("kilogram"); listBox2.Items.Remove("pound"); // Add source units items for listBox1 listBox1.Items.Add("foot"); listBox1.Items.Add("inch"); listBox1.Items.Add("meter"); // Add target units items for listBox2 listBox2.Items.Add("foot"); listBox2.Items.Add("inch"); listBox2.Items.Add("meter"); }

    Read the article

  • Stretch ListBox Items hit area to full width if the ListBox?

    - by Nicholas
    I've looked around for an answer on this, but the potential duplicates are more concerned with presentation than interaction. I have a basic list box, and each item's content is a simple string. The ListBox itself is stretched to fill it's grid container, but each ListBoxItem's hitarea does not mirror the ListBox width. It looks as if the hitarea (pointer contact area) for each item is only the width of the text content. How do I make this stretch all the way across, regardless of the text size. I've set HorizontalContentAlignment to Stretch, but this doesn't solve my problem. My only other guess is that the content is actually stretching, but the background is invisible and so not capturing the mouse pointer. <ListBox Grid.Row="1" x:Name="ProjectsListBox" DisplayMemberPath="Name" ItemsSource="{Binding Path=Projects}" SelectedItem="{Binding Path=SelectedProject}" HorizontalContentAlignment="Stretch"/> The XAML is pretty straight forward on this. If I mouse over the text in one of the items, then the entire width of the item becomes active. I guess I just need to know how to create an interactive background that is invisible.

    Read the article

  • Rendering ListBox takes too long on Windows Phone

    - by Bhawk1990
    I am working on a Windows Phone 7 Application using Local SQLite Database and I'm having an issue with the rendering time of pages that use DataBinding. Currently it takes 60-70ms to retrieve the data from the database. Then it takes about 3100ms to render the data retrieved using a ListBox with DataBinding. Here you can see the DataTemplate of the ListBox: <DataTemplate x:Key="ListBoxItemTemplate"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="68" /> <ColumnDefinition /> </Grid.ColumnDefinitions> <TextBlock x:Name="TimeColumn" Text="{Binding TimeSpan}" Grid.Column="0" Grid.Row="0" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center" /> <TextBlock Text="{Binding Stop.StopName}" Grid.Column="1" Grid.Row="0" Margin="15,0,0,0" TextWrapping="NoWrap" Foreground="Black" HorizontalAlignment="Left" VerticalAlignment="Center" /> </Grid> </DataTemplate> Comment: I have tried it using Canvas instead of Grid too, same result. Then, the database loads data into a CSList (using ViciCoolStorage) and that gets Binded to the ListBox: StationList.ItemsSource = App.RouteViewModel.RouteStops; Comment: I have tried to add the elements of the CSList to an ObservableCollection and bind that to the interface but didn't seem to change anything. Question: Am I doing something wrong that results in a huge load time - even if just loading 10 elements -, or this is normal? Do you have any recommendations to get a better performance with DataBinding? Thank you for your answers in advance!

    Read the article

  • C# Dictionary as a ListBox.DataSource

    - by Steve H.
    I am trying to bind a dictionary as a DataSource to a ListBox. The solution in How to bind a dicationary to a ListBox in winforms will not work for me because my dictionary is a class-level variable and not a method-level variable, so I can not use var. When you put a class-level variable into new BindingSource(...) with null as the second argument I get an ArgumentNull exception. How do I bind a class-level dictionary as a data source for a list box? I don't like the List< KeyValuePair< string, string work-around becuase Where(...) and First(...) are ugly, complicated, and confusing compared to TryGetValue(...) and other Dictionary functionality.

    Read the article

  • WPF: Apply ScrollBar Style to ListBox Template - Error object cannot be added to border

    - by TheMar
    Hi, I thought this may be straightforward question but did not find any definitive answer while searching net or SO. I have created scrollbar style (using standard scroll bard template - Blend 2) I am not sure how to apply this style "MyScrollStyle" to a ListBox Template . I saw on ListBox template they have Scroll Viewer -- which should contain the scrollbar Assuming it is something simple as ---Content Added--- After going through lot of xaml in template edit I kind of understood how to apply style. I am trying to add the scroll view style set in this example -http://blog.xamltemplates.net/wp-content/uploads/2008/12/scrollviewer.zip, to my list view template but it gives error -- System.Windows.Markup.XamlParseException was unhandled Message="'ScrollViewer' object cannot be added to 'Border'. Exception has been thrown by the target of an invocation. Error at object 'System.Windows.Controls.ScrollViewer' in markup file 'MenuModule, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null;component/resources/Resources.xaml' Line 19 Position 26." Source="PresentationFramework" LineNumber=19 LinePosition=26 NameContext="1_T" Any help is appreciated Thank you, The Mar

    Read the article

  • IPhone like scrolling on Silverlight ListBox

    - by Larsi
    Hi! I need a listbox with IPhone-like functionality for Silverlight. That is, animated scrolling, and click and drag to scroll. Scrolling will continue a bit after the mouse up event based on the "speed" of the dragging. I've search and found no control vendors providing this. So question is how should I build it? I need some hints to get started. There's two parts to this question: Part 1, How to get the animated scrolling of the listbox. Part 2, How to build a "draggable" scrolling, I guess I should put a canvas on top and track the mouseevent, and simulate some physics. Some hints here would have been great. Thanks Larsi.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >