Search Results

Search found 169 results on 7 pages for 'itemscontrol'.

Page 2/7 | < Previous Page | 1 2 3 4 5 6 7  | Next Page >

  • Prism's ItemsControl seems to have a xaml parse error. Why?

    - by user158103
    I am at a loss as to why my Shell.xaml's ItemsControl is causing a parse error. I know the syntax is correct because I copied the Silvelright project files from a working project. Right now my only guess is that ItemsControl is dependent on something else. Here is the relevant xaml line for ItemsControl. <ItemsControl x:Name="Region" VerticalAlignment="Center" HorizontalAlignment="Center" Regions:RegionManager.RegionName="Region"/>

    Read the article

  • Irregular layout ItemsControl

    - by firoso
    I have a strange layout for an ItemsControl. I have a 4x6 grid with the following pattern: 1 2 3 4 13 14 15 16 5 6 7 8 17 18 19 20 9 10 11 12 21 22 23 24 Is there an easy way to do this? should I be using 6 Items Controls and take "sections" of my list? is there a good way to do this? What about notification? It's important to note that I may, or may not, have all 24 entries present, but the layout needs to be maintained (think of it like filled slots on a bingo card or something)

    Read the article

  • Data binding of itemscontrol in Silverlight 3.0

    - by jmkarthik
    I am trying to define an itemscontrol and data bind it to a List and the code is as below. XAML Item Class public class Item { public string val; } XAML.cs public MainPage() { InitializeComponent(); List<Item> items = new List<Item>(); Item item1 = new Item(); item1.val = "iasl;fdj1"; items.Add(item1); Item item2 = new Item(); item2.val = "iasfdkasdkljf2"; items.Add(item2); ic.ItemsSource = items; } The items are displayed when I run this. Am I missing something?

    Read the article

  • ItemsControl ItemsTemplate vs ContentTemplate

    - by Allen Ho
    Hi, Is there any difference between setting the ContentTemplate of a ListBoxItem, compared to setting the ItemsTemplate on the ListBox? Or is it just a preference? Just say you set the ItemsTemplate of the ListBox can you still get the Data Template you assigned to the ListBox ItemsTemplate via the ListBoxItems ContentTemplate? ie. Like below ListBoxItem myListBoxItem = ...; ContentPresenter myContentPresenter = FindVisualChild(myListBoxItem); DataTemplate myDataTemplate = myContentPresenter.ContentTemplate;

    Read the article

  • How Do I Bind a "selected Item" in a Listbox to a ItemsControl in WPF?

    - by Scott
    LowDown: I am trying to create a Document Viewer in WPF. It will allow the user to preview selected documents and if they want, compare the documents in WPF. So they can view them side by side. The layout is this: Left side is a full list box. On the right side is a Collection or an Items control. Inside the items control will be a collection of the "selected documents" in the list box. So A user can select multiple items in the list box and for each new item they select, they can add the item to the collection on the right. I want the collection to look like a image gallery that shows up in Google/Bing Image searches. Make sense? The problem I am having is I can't get the WPFPreviewer to bind correctly to the selected item in the list box under the itemscontrol. Side Note: The WPFPreviewer is something Micorosft puts out that allows us to preview documents. Other previewers can be built for all types of documents, but im going basic here until I get this working right. I have been successful in binding to the list box WITHOUT the items control here: <Window.Resources> <DataTemplate x:Key="listBoxTemplate"> <StackPanel Margin="3" > <DockPanel > <Image Source="{Binding IconURL}" Height="30"></Image> <TextBlock Text=" " /> <TextBlock x:Name="Title" Text="{Binding Title}" FontWeight="Bold" /> <TextBlock x:Name="URL" Visibility="Collapsed" Text="{Binding Url}"/> </DockPanel> </StackPanel> </DataTemplate> </Window.Resources> <Grid Background="Cyan"> <ListBox HorizontalAlignment="Left" ItemTemplate="{StaticResource listBoxTemplate}" Width="200" AllowDrop="True" x:Name="lbDocuments" ItemsSource="{Binding Path=DocumentElements,ElementName=winDocument}" DragEnter="documentListBox_DragEnter" /> <l:WPFPreviewHandler Content="{Binding ElementName=lbDocuments, Path=SelectedItem.Url}"/> </Grid> Though, once I add in the ItemsControl, I can't get it to work anymore: <Window.Resources> <DataTemplate x:Key="listBoxTemplate"> <StackPanel Margin="3" > <DockPanel > <Image Source="{Binding IconURL}" Height="30"></Image> <TextBlock Text=" " /> <TextBlock x:Name="Title" Text="{Binding Title}" FontWeight="Bold" /> <TextBlock x:Name="URL" Visibility="Collapsed" Text="{Binding Url}"/> </DockPanel> </StackPanel> </DataTemplate> </Window.Resources> <Grid> <ListBox HorizontalAlignment="Left" ItemTemplate="{StaticResource listBoxTemplate}" Width="200" AllowDrop="True" x:Name="lbDocuments" ItemsSource="{Binding Path=DocumentElements,ElementName=winDocument}" DragEnter="documentListBox_DragEnter" /> <ItemsControl x:Name="DocumentViewer" ItemsSource="{Binding ElementName=lbDocuments, Path=SelectedItem.Url}" > <ItemsControl.ItemTemplate> <DataTemplate> <Grid Background="Cyan"> <l:WPFPreviewHandler Content="{Binding Url}"/> </Grid> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> </Grid> Can someone please help me out with trying to bind to the ItemsControl if I select one or even multiple items in the listbox.

    Read the article

  • How to Bind a selected Item in a Listbox to a ItemsControl and ItemTemplate in WPF and C#

    - by Scott
    All, LowDown: I am trying to create a Document Viewer in WPF. The layout is this: Left side is a full list box. On the right side is a Collection or an Items control. Inside the items control will be a collection of the "selected documents" in the list box. So A user can select multiple items in the list box and for each new item they select, they can add the item to the collection on the right. I want the collection to look like a image gallery that shows up in Google/Bing Image searches. Make sense? The problem I am having is I can't get the WPFPreviewer to bind correctly to the selected item in the list box under the itemscontrol. Side Note: The WPFPreviewer is something Micorosft puts out that allows us to preview documents. Other previewers can be built for all types of documents, but im going basic here until I get this working right. I have been successful in binding to the list box WITHOUT the items control here: <Window.Resources> <DataTemplate x:Key="listBoxTemplate"> <StackPanel Margin="3" > <DockPanel > <Image Source="{Binding IconURL}" Height="30"></Image> <TextBlock Text=" " /> <TextBlock x:Name="Title" Text="{Binding Title}" FontWeight="Bold" /> <TextBlock x:Name="URL" Visibility="Collapsed" Text="{Binding Url}"/> </DockPanel> </StackPanel> </DataTemplate> </Window.Resources><Grid Background="Cyan"> <ListBox HorizontalAlignment="Left" ItemTemplate="{StaticResource listBoxTemplate}" Width="200" AllowDrop="True" x:Name="lbDocuments" ItemsSource="{Binding Path=DocumentElements,ElementName=winDocument}" DragEnter="documentListBox_DragEnter" /> <l:WPFPreviewHandler Content="{Binding ElementName=lbDocuments, Path=SelectedItem.Url}"/> </Grid> Though, once I add in the ItemsControl, I can't get it to work anymore: <Window.Resources> <DataTemplate x:Key="listBoxTemplate"> <StackPanel Margin="3" > <DockPanel > <Image Source="{Binding IconURL}" Height="30"></Image> <TextBlock Text=" " /> <TextBlock x:Name="Title" Text="{Binding Title}" FontWeight="Bold" /> <TextBlock x:Name="URL" Visibility="Collapsed" Text="{Binding Url}"/> </DockPanel> </StackPanel> </DataTemplate> </Window.Resources> <Grid> <ListBox HorizontalAlignment="Left" ItemTemplate="{StaticResource listBoxTemplate}" Width="200" AllowDrop="True" x:Name="lbDocuments" ItemsSource="{Binding Path=DocumentElements,ElementName=winDocument}" DragEnter="documentListBox_DragEnter" /> <ItemsControl x:Name="DocumentViewer" ItemsSource="{Binding ElementName=lbDocuments, Path=SelectedItem.Url}" > <ItemsControl.ItemTemplate> <DataTemplate> <Grid Background="Cyan"> <l:WPFPreviewHandler Content="{Binding Url}"/> </Grid> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> </Grid> Can someone please help me out with trying to bind to the ItemsControl if I select one or even multiple items in the listbox.

    Read the article

  • What am I doing wrong with my ItemsControl & databinding?

    - by Joel
    I'm reworking my simple hex editor to practice using what I've recently learned about data binding in WPF. I'm not sure what I'm doing wrong here. As I understand it, for each byte in the collection "backend" (inherits from ObservableCollection), my ItemsControl should apply the DataTemplate under resources. This template is just a textbox with a binding to a value converter. So I'm expecting to see a row of textboxes, each containing a string representation of one byte. When I use this XAML, all I get is a single line of uneditable text, which as far as I can tell doesn't use a textbox. What am I doing wrong? I've pasted my XAML in below, with the irrelevant parts (Menu declaration, schema, etc) removed. <Window ...> <Window.Resources> <local:Backend x:Key="backend" /> <local:ByteConverter x:Key="byteConverter" /> <DataTemplate DataType="byte"> <TextBox Text="{Binding Converter={StaticResource byteConverter}}" /> </DataTemplate> </Window.Resources> <StackPanel> <ItemsControl ItemsSource="{Binding Source={StaticResource backend}}"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <WrapPanel /> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> </ItemsControl> </StackPanel> </Window>

    Read the article

  • XAML itemscontrol visibility

    - by Sam
    Hello, I have a ItemsControl in my XAML code. When some trigger occur i want to collapse the full itemsControl, so all the elements. <ItemsControl Name="VideoViewControl" ItemsSource="{Binding Videos}"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <WrapPanel ItemHeight="120" ItemWidth="160" Name="wrapPanel1"/> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate> <DataTemplate> <views:VideoInMenuView /> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> The trigger: <DataTrigger Value="videos" Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}, AncestorLevel=1}, Path=DataContext.VideosEnable}"> <Setter Property="ScrollViewer.Visibility" Value="Visible" TargetName="test1" /> <Setter Property="ScrollViewer.Visibility" Value="Collapsed" TargetName="test2" /> <Setter Property="WrapPanel.Visibility" Value="Collapsed" TargetName="wrapPanel1" /> </DataTrigger> When I add the last setter the program crashes. Without this last setter it works fine but no visibility change.... What is wrong with this code? What is the write method to collapse all the elements of a ItemsControl with a trigger?

    Read the article

  • Silverlight + ItemsControl + Get Control Property Value

    - by Villager
    Hello, I have an ItemsControl with a DataTemplate that has been defined. My ItemsControl definition looks like the following: <ItemsControl x:Name="myItemsControl" ItemsSource="{Binding}"> <ItemsControl.ItemTemplate> <DataTemplate> <Grid> <CheckBox x:Name="myCheckBox" Content="{Binding Name}" /> </Grid> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> This is a simplified version of my DataTemplate. Regardless, when a user clicks a button on the page, I want to loop through the items in myItemsControl and determine if the CheckBox element associated with the item is checked. How do I determine if a CheckBox is checked for a specific item within an ItemsControl? Thank you!

    Read the article

  • How to add children of an ItemsControl where the children should decide their own position in Wpf?

    - by code-zoop
    Hey all I am using a wpf slider to display the time line in a video player. I need to add an ItemControl of some sort on top of this so that I can add buttons on the time line on certain positions in the time line (the buttons will hold their own position relative to the parent ItemsControl). What ItemsControl container should I use where I can add child elements that know their own position (based on their timecode)? I have looked at the different ItemsControls in Wpf, and it looks like all of them have a certain way to stack their children (Horizontal or vertical one after another)! And to add some more complexity, How can the positioning of the children be relative to the width of the parent ItemsControl? This way scaling up and down the ItemsContol will reposition the children! Thanks

    Read the article

  • WPF ItemsControl - how to know when the items finished loading, so that I can focus the first one?

    - by Tomáš Kafka
    Hi everyone, I have an ItemsControl in my View, that is bound to an ObservableCollection from ViewModel. The collection is filled, and afterwards an event from VM to view is raised (think search results and SearchFinished event). I would like to move keyboard focus to the first item in an ItemsControl, but when I do it in View's code-behind when handling SearchFinished, the items are not yet rendered (the collection is filled already, but wpf's rendering is asynchronous and didn't happen yet), so there is nothing to focus (Focus() needs to have the items' visual tree already constructed). I wanted to do (myItemsControl.ItemContainerGenerator.ContainerFromIndex(0) as UIElement).Focus();, but as the 0th item is not yet loaded, ContainerFromIndex(0) returns null. I tried delaying it with Dispatcher.BeginInvoke... with low priority, but that is dependent on exact timing and usually doesn't work. How can I wait until the first item in ItemsControl is Loaded?

    Read the article

  • WPF Empty Row in ItemsControl Binding with ObservableCollection

    - by YoMo
    I have ItemsControl Binding with ObservableCollection, every think is oky excipt when ObservableCollection was empty the ItemsControl showing one empty row !! <ItemsControl Visibility="Visible" ItemsSource="{Binding ocItemsinInvoice,Mode=TwoWay}" x:Name="test" Margin="10,-32,0,207" Width="412" HorizontalAlignment="Left"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <UniformGrid Columns="1" VerticalAlignment="Top" /> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate> <DataTemplate> <Button x:Name="btnOpenInvoice" Style="{StaticResource OpenInvoicesButton}" FontSize="12" Width="300" Height="60" Foreground="#ff252526"> <StackPanel Orientation="Vertical"> <TextBlock Text="{Binding Item.ItemName}" HorizontalAlignment="Center" VerticalAlignment="Center" /> </StackPanel> </Button> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> How can I remove it?

    Read the article

  • WPF : Multiple views, one DataContext

    - by zapho
    Hi, I'm working on a WPF application which must handle multiple screens (two at this this time). One view can be opened on several screens and user actions must be reflected consistently on all screens. To achieve this, for a given type of view, a single DataContext is instantiated. Then, when a view is displayed on a screen, the unique DataContext is attached to it. So, one DataContext, several views (same type of view/xaml). So far so good. It works quite well in most cases. I do have a problem with a specific view which relies on ItemsControl. These ItemsControl are used to display UIElements dynamically build in the ViewModel/DataContext (C# code). These UIElements are mostly Path objects. Example : <ItemsControl ItemsSource="{Binding WindVectors}"> <ItemsControl.Template> <ControlTemplate TargetType="{x:Type ItemsControl}"> <Canvas IsItemsHost="True" /> </ControlTemplate> </ItemsControl.Template> </ItemsControl> Here, WindVectors is a ObservableCollection<UIElement>. When the view is opened the first time, everything is fine. The problem is that when the view is opened one another screen, all ItemsControl are removed from the first screen and displayed one the second screen. Other WPF components (TextBlock for instance) on this view react normally and are displayed on both screens. Any help would be greatly appreciated. Thanks. Fabrice

    Read the article

  • WPF Datatemplate + ItemsControl each item uses > 1 MB Memory?

    - by Matt H.
    Does that sound right to anyone???? I have an ItemsControl that displays data from a custom object that implements iNotifyPropertyChanged. The DataTemplate consists of: Border 3 buttons 5 textboxes An ellipse A Bindable RichTextBox (custom class that inherits from RichTextBox... so I could make Document a dependency property (to support binding)) Several grids and stackpanels for layout It uses: Styles (stored in a resource dictionary higher up the tree) Styles affect: colors, thicknesses, and text properties: which are data-bound to a "settings" class that implements iNotifyPropertyChanged, so the user can change display settings That's it! So what gives? I've also noticed that when I empty and remove the ItemsControl, memory isn't freed. over 5000 instances of "CommandBindingCollection" and "WeakReference" are CREATED (using ANTS profiler). And huge number of EffectiveValueEntry objects are created too. So really, what gives!!! :-) Thanks for your insight! Management needs this project soon but in its current state, it's unreleasable.

    Read the article

  • Possible to implement an IsViewPortVisible dependencyproperty for an item in an ItemsControl?

    - by Matt H.
    I need to enable/disable spell checking in a richtextbox in an ItemsControl, based on whether the RichTextBox is visible in the ItemsControl's Scrollviewer. I think the route is to implement an IsViewPortVisible dependency property and wire an event handler for a changed event... I found this article that describes the lengthy process for determining if an item is in the viewport: http://social.msdn.microsoft.com/Forums/en/wpf/thread/e6ccfec3-3dc0-4702-9d0d-1cfa55ecfc90 Any ideas on where to start? I'm familiar with implementing my own dependency property for the sake of simple bindings (integers, strings, etc...). I have no idea how to undergo something like this though) This is the end result I'm hoping for: <DataTemplate> <Grid> ...Stuff in the Grid <local:CustomRichTextBox SpellCheck.IsEnabled={Binding RelativeSource={RelativeSource Self}, Path=IsViewPortVisible}/> </Grid> </DataTemplate> Help will be EXTREMELY appreciated... you'll be saving me about 500MB in memory consumption while the program is running!!!! :)

    Read the article

  • Silverlight - Get the ItemsControl of a DataTemplate

    - by user208662
    Hello, I have a Silverlight application that is using a DataGrid. Inside of that DataGrid I have a DataTemplate that is defined like the following: <Grid x:Name="myGrid" Tag="{Binding}" Loaded="myGrid_Loaded"> <ItemsControl ItemsSource="{Binding MyItems}" Tag="{Binding}"> <ItemsControl.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal" Width="138"> <TextBlock Text="{Binding Type}" /> <TextBox x:Name="myTextBox" TextChanged="myTextBox_TextChanged" /> </StackPanel> </StackPanel> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> </Grid> When a user enters text into the TextBox, I have an event (myTextBox_TextChanged) that must be fired at this point. When that event gets fired, I would like to get the ItemsControl element that is the container for this TextBox. How do I get that ItemsControl from my event handler? Please note: Because the ItemsControl is in the DataTemplate of DataGrid, I don't believe I can just add an x:Name and reference it from my code-behind. Or is there a way to do that? Thank you!

    Read the article

  • Row Prefix - ItemsControl with UniformGrid

    - by tenfour
    I am using an ItemsControl to display a List<byte> in hex. The ItemsPanelTemplate is a UniformGrid with a fixed number of columns: <ItemsControl HorizontalAlignment="Left" VerticalAlignment="Top" ItemsSource="{Binding}"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <UniformGrid Columns="16"/> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding StringFormat='\{0:X2\}'}" Margin="5,5,5,0"/> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> I'd like to prefix each row with an 'Address' column, just like you'd see with the Notepad++ 'HEX-Editor' plugin. That is, since I have 16 columns, each row should be prefixed something like this: 0000 [00 01 02 .... 0F] 0010 [10 11 12 .... 1F] 0020 [20 21 22 .... 2F] ... Any suggestions?

    Read the article

  • MVVM Binding in Silverlight3 ItemsControl to get the parent controls DataContext

    - by BigTundra
    I have the following ItemsControl in Silverlight 3. <ItemsControl ItemsSource="{Binding ValueCollectionList}"> <ItemsControl.ItemTemplate> <DataTemplate> <Button x:Name="MyBtn" Height="40" Content="{Binding Name}" Tag="{Binding Value}" cmd:ButtonBaseExtensions.Command="{Binding ElementName=LayoutRoot, Path=ButtonCommand}" cmd:ButtonBaseExtensions.CommandParameter="{Binding ElementName=MyBtn, Path=Tag}"/> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> The Problem is that I have the ItemsControl bound to the Collection in my ViewModel, but I need the button to trigger a command on the ViewModel which is of course not Available in the DataContext of the button since it only contains the collection. I can make the command fire by setting my ViewModel as a Resource and then binding to it as a StaticResource, but I want to know why the element to element binding won't work in this scenario. I would prefer not to use the StaticResource binding because that requires the default constructor on the ViewModel and so I can't inject my data easily.

    Read the article

  • RelayCommand sender from ItemsControl item

    - by Padu Merloti
    I've been using MVVM's RelayCommand with success to bind actions to XAML, but I'm having a small problem with my ItemsControl. <ItemsControl ItemsSource="{Binding Devices}" > <ItemsControl.ItemTemplate> <DataTemplate> <Grid Width="100" Margin="4" > <Button Command="{Binding Path=SelectDeviceCommand}" > <Grid> <Image Source="img_small.png"></Image> <Image Source="{Binding Path=Logo}" /> </Grid> </Button> </Grid> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> In my view model: public RelayCommand SelectDeviceCommand { get; set; } private ObservableCollection<Device> Devices; Devices = CreateListOfDevices(); private void InitializeCommands() { SelectDeviceCommand = new RelayCommand((s) => MessageBox.Show(s.ToString())); } How do I define my SelectDeviceCommand in my view model in order to receive object that is bound to that item? My SelectDeviceCommand is not even being called... (but that I guess is because I need to make my Device a mini-viewmodel and implement the SelectDeviceCommand in it, is that correct?)

    Read the article

  • WPF items not visible when grouping is applied

    - by Tri Q
    Hi, I'm having this strange issue with my ItemsControl grouping. I have the following setup: <ItemsControl Margin="3" ItemsSource="{Binding Communications.View}" > <ItemsControl.GroupStyle> <GroupStyle> <GroupStyle.ContainerStyle> <Style TargetType="{x:Type GroupItem}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type GroupItem}"> <Expander> <Expander.Header> <Grid> <Grid.ColumnDefinitions > <ColumnDefinition Width="*" /> <ColumnDefinition Width="Auto" /> </Grid.ColumnDefinitions> <TextBlock Text="{Binding ItemCount, StringFormat='{}[{0}] '}" FontWeight="Bold" /> <TextBlock Grid.Column="1" Text="{Binding Name, Converter={StaticResource GroupingFormatter}, StringFormat='{}Subject: {0}'}" FontWeight="Bold" /> </Grid> </Expander.Header> <ItemsPresenter /> </Expander> </ControlTemplate> </Setter.Value> </Setter> </Style> </GroupStyle.ContainerStyle> </GroupStyle> </ItemsControl.GroupStyle> <ItemsControl.ItemTemplate> <DataTemplate> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="*" /> <ColumnDefinition Width="Auto" /> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition /> <RowDefinition /> </Grid.RowDefinitions> <TextBlock FontWeight="Bold" Text="{Binding Inspector, Converter={StaticResource NameFormatter}, StringFormat='{}From {0}:'}" Margin="3" /> <TextBlock Text="{Binding SentDate, StringFormat='{}{0:dd/MM/yy}'}" Grid.Row="1" Margin="3"/> <TextBlock Text="{Binding Message }" Grid.Column="1" Grid.RowSpan="2" Margin="3"/> <Button Command="vm:CommunicationViewModel.DeleteMessageCommand" CommandParameter="{Binding}" HorizontalAlignment="Right" Grid.Column="2">Delete</Button> </Grid> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> In my ViewModel, I expose a CollectionViewSource named 'Communications'. I proceed to adding a grouping patter like so: Communications.GroupDescriptions.Add(new PropertyGroupDescription("Subject")); Now, the problem i'm experience is the grouping work fine, but I can't see any items inside the groups. What am I doing wrong? Any pointers would be much appreciated.

    Read the article

  • ControlTemplate for ItemsControl with remove button near each item

    - by Broken Pipe
    I'm trying to figure out hot to create ItemsControl which contains Button near each Item, clicking on it removes this item from ItemsControl. I'm new to Silverlight|WPF is it possible to create this using just ControlTemplate? I tried to create inherited ListBox with ControlTemplate that renders button near each item and then i was supposed to hook to click event get item and remove it, but I neither found a way to render button near each item, neither how to subscribe to events from ControlTemplate ;-)

    Read the article

  • Get a button in itemscontrol and add eventhandler to its click event

    - by rockdale
    I have a custom control shows a customer info with an itemscontrol shows this customer's invoices. within the itemscontrol, I have button, in my code behind I want to wire the button's click event to my host window, but do now know how. //public event RoutedEventHandler ViewDetailClick; public static readonly RoutedEvent ButtonViewClickEvent = EventManager.RegisterRoutedEvent( "ButtonViewClick", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(custitem)); public event RoutedEventHandler ButtonViewClick { add { AddHandler(ButtonViewClickEvent, value); } remove {RemoveHandler(ButtonViewClickEvent, value);} } public override void OnApplyTemplate() { base.OnApplyTemplate(); this.lstInv = GetTemplateChild("lstInv") as ItemsControl; lstInv.ItemContainerGenerator.StatusChanged += new EventHandler(ItemContainerGenerator_StatusChanged); } private void ItemContainerGenerator_StatusChanged(object sender, EventArgs e) { if (lstInv.ItemContainerGenerator.Status == System.Windows.Controls.Primitives.GeneratorStatus.ContainersGenerated) { lstInv.ItemContainerGenerator.StatusChanged -= ItemContainerGenerator_StatusChanged; for (int i = 0; i < this.lstInv.Items.Count; i++) { ContentPresenter c = lstInv.ItemContainerGenerator.ContainerFromItem(lstInv.Items[i]) as ContentPresenter; DataTemplate dt = c.ContentTemplate; Grid grd = dt.LoadContent() as Grid; Button btnView = grd.FindName("btnView") as Button; if (btnView != null) { btnView.Click += new RoutedEventHandler(ButtonView_Click); //btnView.Click+= delegate(object senderObj, RoutedEventArgs eArg) //{ // if (this.ViewDetailClick != null) // { // this.ViewDetailClick(this, eArg); // } //}; } } private void ButtonView_Click(object sender, RoutedEventArgs e) { MessageBox.Show("clicked"); //e.RoutedEvent = ButtonViewClickEvent; //e.Source = sender; //RaiseEvent(e); } I succeed getting the btnView, then attach the click event, but the click event never get fired. Thanks in advance -rockdale

    Read the article

  • Binding to the selected item in an ItemsControl

    - by Jensen
    I created a custom ComboBox as follows: (note, code is not correct but you should get the general idea.) The ComboBox contains 2 dependency properties which matter: TitleText and DescriptionText. <Grid> <TextBlock x:Name="Title"/> <Grid x:Name="CBG"> <ToggleButton/> <ContentPresenter/> <Popup/> </Grid> </Grid> I want to use this ComboBox to display a wide range of options. I created a class called Setting which inherits from DependencyObject to create usable items, I created a DataTemplate to bind the contents of this Settings object to my ComboBox and created a UserControl which contains an ItemControl which has as a template my previously mentioned DataTemplate. I can fill it with Setting objects. <DataTemplate x:Key="myDataTemplate"> <ComboBox TitleText="{Binding Title}" DescriptionText="{Binding DescriptionText}"/> </DataTemplate> <UserControl> <Grid> <StackPanel Grid.Column="0"> <ItemsControl Template="{StaticResource myDataTemplate}"> <Item> <Setting Title="Foo" Description="Bar"> <Option>Yes</Option><Option>No</Option> </Setting> </Item> </ItemsControl> </StackPanel> <StackPanel Grid.Column="1"> <TextBlock x:Name="Description"/> </StackPanel> </Grid> </UserControl> I would like to have the DescriptionText of the selected ComboBox (selected by either the IsFocus of the ComboBox control or the IsOpen property of the popup) to be placed in the Description TextBlock in my UserControl. One way I managed to achieve this was replacing my ItemsControl by a ListBox but this caused several issues: it always showed a scrollbar even though I disabled it, it wouldn't catch focus when my popup was open but only when I explicitly selected the item in my ListBox, when I enabled the OverridesDefaultStyle property the contents of the ListBox wouldn't show up at all, I had to re-theme the ListBox control to match my UserControl layout... What's the best and easiest way to get my DescriptionText to show up without using a ListBox or creating a custom Selector control (as that had the same effect as a ListBox)? The goal at the end is to loop through all the items (maybe get them into an ObservableCollection or some sort and to save them into my settings file.

    Read the article

  • WPF Custom Control - ItemsControl template not being applied.

    - by Patrick White
    I'm building a custom WPF control that derives from TabControl. In the ControlTemplate, I'm using a ItemsControl to display a list that is being bound from the template (an observable collection of type FileMenuItem). During program execution, I'm getting the following error in the output window: ItemTemplate and ItemTemplateSelector are ignored for items already of the ItemsControl's container type; Type='FileMenuItem' The type FileMenuItem is derived from MenuItem. I googled the error and couldn't find anything about it, has anyone run into this while developing custom controls? I can post more code if it would help. Thanks!

    Read the article

  • ItemsPanel vs Grid vs GridSplitter

    - by bitbonk
    I am currently trying to build a ControlTemplate for an ItemsControl that uses the Grid as its ItemsPanel where each item is stacked horizontally and delimited with a GridSplitter. The basic goal is to have a dynamic bindable ItemsControl where all items stack up in a row and where each item can be resized with a splitter. There are two things I can't wrap my head around: How is the GridSplitter supposed to end up automatically between each item? How do I set Grid.Column for each item.

    Read the article

< Previous Page | 1 2 3 4 5 6 7  | Next Page >