listboxitem

WPF XAML: How to trigger style change in ListBoxItem ancestor to user class?

I have an ObservableCollection of items of my class "PlaylistItem" that implements INotifyPropertyChanged. The collection is databound to a ListBox and everything else is working. I want to know what markup to use to trigger a style change of the wrapping ListBoxItem based on a property (e.g. "Playing", bool) of the PlaylistItem. How ...

Custom ListBox Highlight Colours

Hi there. I'm trying to override the default ListBox colour properties when an item is highlighted. However, this XAML code simply causes the text of the highlighted item to disappear completely (or become transparent). <SolidColorBrush Color="{Binding Path=Foreground, ElementName=UserControl}" x:Key="{x:Static SystemColors.ControlText...

How do I change the visual style of a listitem based on its bound value?

I have a listbox (here's the xaml): <ListBox MinWidth="300" ItemsSource="{Binding Relationships, Mode=OneWay}" SelectedItem="{Binding SelectedRelationship, Mode=TwoWay}" SelectionMode="Single" HorizontalAlignment="Left" > <ListBox.ItemTemplate> <DataTemplate> ...

How to use IsKeyboardFocusWithin and IsSelected together?

I have a style defined for my ListBoxItems with a trigger to set a background color when IsSelected is True: <Style x:Key="StepItemStyle" TargetType="{x:Type ListBoxItem}"> <Setter Property="SnapsToDevicePixels" Value="true"/> <Setter Property="OverridesDefaultStyle" Value="true"/> <Setter Property="Template"...

how to select a value from a listbox?

Hi I am having a list box like this ,the list box is populated from the database <td bgcolor="#FFFFCC"> <select name="listbox" id="FriendmailId" size="3" > <option value="0">Select User From List</option> <? foreach($searchfriend as $row) {?> <option value=""><?=$row['dEmailID'];?></option> <? } ?> </select> </td> The values are li...

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

I want to create a list of logically related RadioButtons. The RadioButtons are bound for MVVM use. There's ToolTips on each RadioButtons. ...

DataTrigger inside ControlTemplate doesn't update

I have a ListBox that is bound to a list of CustomerViewModel-objects, that each has two dependency properties: - Name (string) - Description (string) - IsVisible (bool) (the IsVisible property is True by default and is reversed via the ToggleVisibility Command on the CustomerViewModel) I would like to display the Name and Descriptio...

How can you make the content of a ListBoxItem copyable?

How can you make the content of a ListBoxItem copyable? not editable. ...

Access button in ListBoxItem in Silverlight

Hey everyone. I'm new to Silverlight and would like to access a button control that is part of a ListBoxItem. However, I'm not quite sure how to do this. My XAML is: <DataTemplate x:Key="ItemTemplate2"> <Grid Height="51"> <TextBlock x:Name="tbName" Text="{Binding Property1}" Margin="0,0,98,0" d:LayoutOverride...

select all items in the listbox in asp.net

if checkbox is clicked i need to select all items in the listbox in asp.net... how to show the items all selected in listbox once the 'selectall' checkbox is clicked ...

WPF: Dynamically change ListBox's ItemTemplate based on ListBox Items Size

I need to change the DataTemplate of my ListBox, based on the ListBox items count. I have come up with the following XAML: <Window.Resources> <DataTemplate x:Key="DefaultTemplate"> <StackPanel Orientation="Horizontal"> <TextBlock Text="{Binding Path=Text}"/> <TextBlock Text="default template" /> </StackPanel> </DataTem...

WPF ListBoxItem how to wrap Text in it?

WPF ListBoxItem how to wrap text in it? My Item container style looks like this: <Style x:Key="GroupListBoxItemStyle" TargetType="ListBoxItem"> <Setter Property="OverridesDefaultStyle" Value="True" /> <Setter Property="FocusVisualStyle" Value="{x:Null}" /> <Sette...

WPF ListBoxItem with value ?

Hi ! I would like you to ask if it is somehow possible to provide in the ListBoxItem the string that will appear and the value to be stored in DB. This is indeed possible: ItemSource={Binding MyEnumColleciton} or ItemSource={DynamicResource MyCollection} etc.. but if you image that I have about 100 ListBoxes .. I don't want to hav...

C# Help displaying listbox item from instantiated object

Hey guys, I have a listbox which the user inputs data into. I then can display the output with a line like this: dest.Text = (string)listBox.Items[0]; Basically, it outputs the the listBox item at location 0 to a textbox called dest. Problem is that I want to be able to do this from a different class so I instantiate an object like so...

Handling double click events on ListBox items in C#

I am trying to do something when double clicking an item in a ListBox. I have found this code for doing that void listBox1_MouseDoubleClick(object sender, MouseEventArgs e) { int index = this.listBox1.IndexFromPoint(e.Location); if (index != System.Windows.Forms.ListBox.NoMatches) { MessageBox.Sh...

WPF- ListBoxItem border is sometimes hidden behind the ListBox's scrollbar.

Most of the time the ListBox appears like this: But every once in a while it looks like this: Any idea of what is going wrong? --Edit-- I removed the control templates from the question, because when I removed them from my program the problem still existed. Is this a WPF bug? ...

Impossible to select multiple items from the listbox in a windows phone 7 application.

How can I select multiple items from the listbox in a windows phone 7 application? e.g listboxName.SelectedIndex = 0; listboxName.SelectedIndex = 1; listboxName.SelectedIndex = 2; The above code selects 2 while I need to select all three of those. The values I need to preselect are given to me in a array like {true,true,true,false,fa...

WinForm: Represent a single ListBox item in a foreach statement

How do I repesent a single item in a list box in a foreach statement? I have tried ListBoxItem but System.Windows.Controls is not considered a valid namespace in my .Net framework (version 4). foreach(ListBoxItem item in listBoxObject.Items) { ... } ...

Not all ListBoxItem are created equal.

Hello Everyone, In the example below, the DataTemplate only gets applied to the first and second list item, the third and fourth are completely ignored. <ListBox> <ListBox.ItemTemplate> <DataTemplate> <Button Content="{Binding}"></Button> </DataTemplate> </ListBox.ItemTemplate> <sys:String>One</s...

Silverlight - Binding Listbox ActualWidth to ListboxItem Width

Hi, I'm working on a photo gallery for Windows Phone 7 and I'm trying to get each image to take the full screen and slide horizontally. What I am doing so far is to use a listbox that I have modified to scroll horizontally but the problem is that I can't seem to find a way to bind the width and the height of the ListboxItem with the A...