Search Results

Search found 64 results on 3 pages for 'wrappanel'.

Page 1/3 | 1 2 3  | Next Page >

  • Silverlight ItemsControl vertical scrollbar, using a wrappanel as ControlTemplate

    - by Orestes C.A.
    I have a collection of elements, each one with a name and a subcollection of image blobs. I want to display an Accordion, with each item representing each of the MainElements. inside each element, I display the images in the subcollecion of said MainElement. The Accordion gets resized by the user, so I use a wrappanel for presenting the images. When the accordion is wide enough, the images reorder themselves fitting as many as posible in each row. the problem comes when the wrappanel only displays one image per row (because there's no space enough for more), the image list continues, but I can't see all the images, because they don't fit inside the control's height. I need a vertical scrollbar to be displayed inside the AccordionItem so I can scroll down the image list. So, here's my code: <layoutToolkit:Accordion Width="Auto" Height="Auto" ItemsSource="{Binding MainElementCollection}"> <layoutToolkit:Accordion.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding MainElementName}" /> </DataTemplate> </layoutToolkit:Accordion.ItemTemplate> <layoutToolkit:Accordion.ContentTemplate> <DataTemplate> <ItemsControl ItemsSource="{Binding SubElementCollection}" ScrollViewer.VerticalScrollBarVisibility="Auto" > <ItemsControl.Template> <ControlTemplate> <controlsToolkit:WrapPanel /> </ControlTemplate> </ItemsControl.Template> <ItemsControl.ItemTemplate> <DataTemplate> <Grid> <Image Margin="2" Width="150" Source="{Binding PreviewImage, Converter={StaticResource ImageConverter}}" /> </Grid> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> </DataTemplate> </layoutToolkit:Accordion.ContentTemplate> </layoutToolkit:Accordion> http://www.silverlightshow.net/tips/How-to-add-scrollbars-to-ItemsControl.aspx suggests that I should surround my wrappanel with a scrollviewer, like this <ItemsControl.Template> <ControlTemplate> <scrollviewer> <controlsToolkit:WrapPanel /> </scrollviewer> </ControlTemplate> </ItemsControl.Template> But then my wrappanel gets really small and I can only see a small vertical scrollbar Any ideas? Thanks a lot. Edit: I figured thatthe wrappanel loses its width when used in the controltemplate It should be used as follows: <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <controlsToolkit:WrapPanel ScrollViewer.VerticalScrollBarVisibility="Visible" /> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> Anyway, I tried adding the ScrollViewer.VerticalScrollBarVisibility="Visible" line but I'm stuck again.

    Read the article

  • WPF: When is a WrapPanel full.

    - by rathkopf
    I'm using a WrapPanel to display variable height items in columns. The wrappanel has a constrained size. Is there an way to determine when the WrapPanel is 'full'? I will then page to another panel with an animation. I've looked at the ArrangeOverride of the items that are the panels children, but they always seem to be getting all the space they want. I need a way to determine when they begin getting clipped.

    Read the article

  • Silverlight Chat WrapPanel Crash / Bug

    - by Matt
    I've been given the task to create a simple Silverlight chat box for two people. My control must adhere to the following requirements Scrollable Text must wrap if it's too long When a new item / message is added it must scroll that item into view Now I've successfully made a usercontrol to meet these requirements, but I've run into a possible bug / crash that I can't for the life of me fix. I'm looking for either a fix to the bug, or a different approach to creating a scrollable chat control. Here's the code I've been using. We'll start with my XAML for the chat window <ListBox x:Name="lbChatHistory" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" ScrollViewer.VerticalScrollBarVisibility="Visible" ScrollViewer.HorizontalScrollBarVisibility="Disabled" > <ListBox.ItemTemplate> <DataTemplate> <Grid Background="Beige"> <Grid.ColumnDefinitions> <ColumnDefinition Width="70"></ColumnDefinition> <ColumnDefinition Width="Auto"></ColumnDefinition> </Grid.ColumnDefinitions> <TextBlock x:Name="lblPlayer" Foreground="{Binding ForeColor}" Text="{Binding Player}" Grid.Column="0"></TextBlock> <ContentPresenter Grid.Column="1" Width="200" Content="{Binding Message}" /> </Grid> </DataTemplate> </ListBox.ItemTemplate> </ListBox> The idea is to add a new Item to the listbox. The Item (as layed out in the XAML) is a simple 2 column grid. One column for the username, and one column for the message. Now the "items" that I add to the ListBox is a custom class. It has three properties (Player, ForeColor, and Message) that I using binding on within my XAML Player is a string of the current user to display. ForeColor is just a foreground color preference. It helps distinguish the difference between messages. Message is a WrapPanel. I programmatically break the supplied string on the white space for each word. Then for each word, I add a new TextBlock element to the WrapPanel Here is the custom class. public class ChatMessage :DependencyObject, INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; public static DependencyProperty PlayerProperty = DependencyProperty.Register( "Player", typeof( string ), typeof( ChatMessage ), new PropertyMetadata( new PropertyChangedCallback( OnPlayerPropertyChanged ) ) ); public static DependencyProperty MessageProperty = DependencyProperty.Register( "Message", typeof( WrapPanel ), typeof( ChatMessage ), new PropertyMetadata( new PropertyChangedCallback( OnMessagePropertyChanged ) ) ); public static DependencyProperty ForeColorProperty = DependencyProperty.Register( "ForeColor", typeof( SolidColorBrush ), typeof( ChatMessage ), new PropertyMetadata( new PropertyChangedCallback( OnForeColorPropertyChanged ) ) ); private static void OnForeColorPropertyChanged( DependencyObject d, DependencyPropertyChangedEventArgs e ) { ChatMessage c = d as ChatMessage; c.ForeColor = ( SolidColorBrush ) e.NewValue; } public ChatMessage() { Message = new WrapPanel(); ForeColor = new SolidColorBrush( Colors.White ); } private static void OnMessagePropertyChanged( DependencyObject d, DependencyPropertyChangedEventArgs e ) { ChatMessage c = d as ChatMessage; c.Message = ( WrapPanel ) e.NewValue; } private static void OnPlayerPropertyChanged( DependencyObject d, DependencyPropertyChangedEventArgs e ) { ChatMessage c = d as ChatMessage; c.Player = e.NewValue.ToString(); } public SolidColorBrush ForeColor { get { return ( SolidColorBrush ) GetValue( ForeColorProperty ); } set { SetValue( ForeColorProperty, value ); if(PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs( "ForeColor" )); } } public string Player { get { return ( string ) GetValue( PlayerProperty ); } set { SetValue( PlayerProperty, value ); if ( PropertyChanged != null ) PropertyChanged( this, new PropertyChangedEventArgs( "Player" ) ); } } public WrapPanel Message { get { return ( WrapPanel ) GetValue( MessageProperty ); } set { SetValue( MessageProperty, value ); if ( PropertyChanged != null ) PropertyChanged( this, new PropertyChangedEventArgs( "Message" ) ); } } } Lastly I add my items to the ListBox. Here's the simple method. It takes the above ChatMessage class as a parameter public void AddChatItem( ChatMessage msg ) { lbChatHistory.Items.Add( msg ); lbChatHistory.ScrollIntoView( msg ); } Now I've tested this and it all works. The problem I'm getting is when I use the scroll bar. You can scroll down using the side scroll bar or arrow keys, but when you scroll up Silverlight crashes. FireBug returns a ManagedRuntimeError #4004 with a XamlParseException. I'm soo close to having this control work, I can taste it! Any thoughts on what I should do or change? Is there a better approach than the one I've taken? Thanks in advance. UPDATE I've found an alternative solution using a ScrollViewer and an ItemsControl instead of a ListBox control. For the most part it's stable.

    Read the article

  • Scrollable Wrappanel in Silverlight

    - by Matt
    How do I make a Wrappanel scrollable? Here's the XAML that I've been using but I get errors with it. <ItemsControl x:Name="lbMedia"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto"> <c:WrapPanel></c:WrapPanel> </ScrollViewer> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate> <DataTemplate> <im:MediaManagerItem></im:MediaManagerItem> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl>

    Read the article

  • WPF WrapPanel - all items should have the same width

    - by John
    I have a ListBox whose ItemsPanel I have replaces with a WrapPanel. The WrapPanel now hosts the databound ListboxItems. Each item has a variable sized text in it, giving each item a different width. However, I want the width to be constant so that all items have the same width as the item with the longest text. Is that possible?

    Read the article

  • Improve WPF Rendering Performance (WrapPanel in ItemsControl)

    - by Wonko the Sane
    Hello All, I have an ItemsSource that appears to have poor performance when adding even a fairly small ObservableCollection to it. The ItemsPanel is a WrapPanel, and the ItemTemplate is essentially a Border containing another Border painted with an ImageBrush. The ItemsControl is wrapped inside a ScrollViewer. After some investigation using WpfPerf, it would appear that most of the "what the heck is it doing?" time is spent on WrapPanel.Measure after creating the collection that is being bound. As I've mentioned, it's a fairly small collection - generally less than 100 items. If nothing else, I'd like to be able to put a "Please Wait" on the screen (during the collection creation portion as well), but I am not sure how to know when the rendering is complete. Any thoughts would be greatly appreciated! Thanks, wTs

    Read the article

  • Dynamic filling WrapPanel buttons from DB, setting the event handlers

    - by Anry
    I have a table: I'm using NHibernate. The class of entity: public class PurchasedItem { public virtual int Id { get; set; } public virtual Product Product { get; set; } public virtual int SortSale { get; set; } } I want to get all the records table PurchasedItems (my method returns an IList ). Records are sorted in descending order (column SortSale). How to fill WrapPanel buttons from the list IList ? For each button assign the event handler. By pressing the button display a message with the name of the product.

    Read the article

  • How can I line up WPF items in a Horizontal WrapPanel so they line up based on an arbitrary vertical

    - by Scott Whitlock
    I'm trying to create a View in WPF and having a hard time figuring out how to set it up. Here's what I'm trying to build: My ViewModel exposes an IEnumerable property called Items Each item is an event on a timeline, and each one implements ITimelineItem The ViewModel for each item has it's own DataTemplate to to display it I want to display all the items on the timeline connected by a line. I'm thinking a WrapPanel inside of a ListView would work well for this. However, the height of each item will vary depending on the information it displays. Some items will have graphic objects right on the line (like a circle or a diamond, or whatever), and some have annotations above or below the line. So it seems complicated to me. It seems that each item on the timeline has to render its own segment of the line. That's fine. But the distance between the top of the item to the line (and the bottom of the item to the line) could vary. If one item has the line 50 px down from the top and the next item has the line 100 px down from the top, then the first item needs 50 px of padding so that the line segments add up. I think I could solve that problem, however, we only need to add padding if these two items are on the same line in the WrapPanel! Let's say there are 5 items and only room on the screen for 3 across... the WrapPanel will put the other two on the next line. That's ok, but that means only the first 3 need to pad together, and the last 2 need to pad together. This is what's giving me a headache. Is there another approach I could look at?

    Read the article

  • WrapPanel doesn't wrap in WPF ListView

    - by Joan Venge
    I am using a ListView with an ItemTemplate like this: <Window.Resources> <DataTemplate x:Key="ItemTemplate"> <WrapPanel Orientation="Horizontal"> <Image Width="50" Height="50" Stretch="Fill" Source="{Binding Cover}"/> <Label Content="{Binding Title}" /> </WrapPanel> </DataTemplate> </Window.Resources> But the Covers do not fill the screen like windows explorer windows. How do I do this? They just get stacked vertically in my version.

    Read the article

  • Visibility of Class field-data of Mouse Clicked ImageButton located within WrapPanel

    - by Bill
    I am attempting to obtain the class-data behind an ImageButton that is mouse-clicked; which ImageButton is located within a WrapPanel filled with ImageButtons. The problem I am having is obtaining the visibility of the field data within the class behind the image-button. Although I can see the class, I can neither see nor access the field data. Can anyone please point me in the right direction? // Handles the ImageButton mouseClick event within the WrapPanel. private void SolarSystem_Click(Object sender, RoutedEventArgs e) { FrameworkElement fe = e.OriginalSource as FrameworkElement; SelectedPlanet PlanetSelected = new SelectedPlanet(fe); PlanetSelected.Owner = this; MessageBox.Show(PlanetSelected.PlanetName); } // Used to initiate instance of Class and some field data. public SelectedPlanet(FrameworkElement fe) { InitializeComponent(); string sPlanetName = ((PlanetClass)(fe)).PlanetName; return sPlanetName } // Class Data public class PlanetClass { string planetName; public PlanetClass(string planetName) { PlanetName = planetName; } public string PlanetName { set { planetName = value; } get { return planetName; } } }

    Read the article

  • How to set margin for inner controls of WrapPanel

    - by Andrey Tagaew
    Hi Guys! I'm new in WPF and have a question. Here is an example that I'm using: <Window x:Class="WpfApplication2.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <StackPanel> <WrapPanel Orientation="Horizontal" > <Button Content="test1" Margin="10,0" Padding="10,10" /> <Button Content="test2" Margin="10,0" Padding="10,10" /> <Button Content="test3" Margin="10,0" Padding="10,10" /> <Button Content="test4" Margin="10,0" Padding="10,10" /> <Button Content="test5" Margin="10,0" Padding="10,10" /> </WrapPanel> </StackPanel> As you can see, my wrap panel has several buttons. Each button has the same margin and padding. The question is, is there a way of setting margin and padding for wrap panel, so each element inside the wrap panel may use it values? This make the code shorter and let me specify Margin and Padding only one time instead of setting it for each control in the panel. Thank you!

    Read the article

  • WPF wrappanel item alignment problem when scrolling

    - by Jayho
    Someone help me out pls. I set a wrapPanel in a listbox itemPanelTemplate, Also, I already set the ScrollViewer.CanContentScroll="True". But why the listbox items are not scrolling up/down by ITEM one by one? The scroll style is still by PIXEL. Is anyone help me? <Grid> <ListBox x:Name="testListbox" ScrollViewer.CanContentScroll="True"> <ListBox.ItemsPanel> <ItemsPanelTemplate> <WrapPanel Width="200" ScrollViewer.CanContentScroll="True"/> </ItemsPanelTemplate> </ListBox.ItemsPanel> <ListBoxItem Background="LimeGreen" BorderBrush="Black" BorderThickness="3" ScrollViewer.CanContentScroll="True"> <Image Height="50" Width="80" ScrollViewer.CanContentScroll="True"/> </ListBoxItem> <ListBoxItem Background="LimeGreen" BorderBrush="Black" BorderThickness="3" ScrollViewer.CanContentScroll="True"> <Image Height="50" Width="80" ScrollViewer.CanContentScroll="True"/> </ListBoxItem> <ListBoxItem Background="LimeGreen" BorderBrush="Black" BorderThickness="3" ScrollViewer.CanContentScroll="True"> <Image Height="50" Width="80" ScrollViewer.CanContentScroll="True"/> </ListBoxItem> <ListBoxItem Background="LimeGreen" BorderBrush="Black" BorderThickness="3" ScrollViewer.CanContentScroll="True"> <Image Height="50" Width="80" ScrollViewer.CanContentScroll="True"/> </ListBoxItem> <ListBoxItem Background="LimeGreen" BorderBrush="Black" BorderThickness="3" ScrollViewer.CanContentScroll="True"> <Image Height="50" Width="80" ScrollViewer.CanContentScroll="True"/> </ListBoxItem> <ListBoxItem Background="LimeGreen" BorderBrush="Black" BorderThickness="3" ScrollViewer.CanContentScroll="True"> <Image Height="50" Width="80" ScrollViewer.CanContentScroll="True"/> </ListBoxItem> <ListBoxItem Background="LimeGreen" BorderBrush="Black" BorderThickness="3" ScrollViewer.CanContentScroll="True"> <Image Height="50" Width="80" ScrollViewer.CanContentScroll="True"/> </ListBoxItem> <ListBoxItem Background="LimeGreen" BorderBrush="Black" BorderThickness="3" ScrollViewer.CanContentScroll="True"> <Image Height="50" Width="80" ScrollViewer.CanContentScroll="True"/> </ListBoxItem> <ListBoxItem Background="LimeGreen" BorderBrush="Black" BorderThickness="3" ScrollViewer.CanContentScroll="True"> <Image Height="50" Width="80" ScrollViewer.CanContentScroll="True"/> </ListBoxItem> <ListBoxItem Background="LimeGreen" BorderBrush="Black" BorderThickness="3" ScrollViewer.CanContentScroll="True"> <Image Height="50" Width="80" ScrollViewer.CanContentScroll="True"/> </ListBoxItem> <ListBoxItem Background="LimeGreen" BorderBrush="Black" BorderThickness="3" ScrollViewer.CanContentScroll="True"> <Image Height="50" Width="80" ScrollViewer.CanContentScroll="True"/> </ListBoxItem> <ListBoxItem Background="LimeGreen" BorderBrush="Black" BorderThickness="3" ScrollViewer.CanContentScroll="True"> <Image Height="50" Width="80" ScrollViewer.CanContentScroll="True"/> </ListBoxItem> <ListBoxItem Background="LimeGreen" BorderBrush="Black" BorderThickness="3" ScrollViewer.CanContentScroll="True"> <Image Height="50" Width="80" ScrollViewer.CanContentScroll="True"/> </ListBoxItem> <ListBoxItem Background="LimeGreen" BorderBrush="Black" BorderThickness="3" ScrollViewer.CanContentScroll="True"> <Image Height="50" Width="80" ScrollViewer.CanContentScroll="True"/> </ListBoxItem> <ListBoxItem Background="LimeGreen" BorderBrush="Black" BorderThickness="3" ScrollViewer.CanContentScroll="True"> <Image Height="50" Width="80" ScrollViewer.CanContentScroll="True"/> </ListBoxItem> <ListBoxItem Background="LimeGreen" BorderBrush="Black" BorderThickness="3" ScrollViewer.CanContentScroll="True"> <Image Height="50" Width="80" ScrollViewer.CanContentScroll="True"/> </ListBoxItem> </ListBox> </Grid>

    Read the article

  • Borderless ImageButtons in WrapPanel

    - by Bill
    I am attempting to create a WrapPanel with seamless ImageButtons containing Artwork. I put together the following ContentTemplate in the hopes that it would provide the seamless look required; however a thin white-line remained around each of the buttons. Can anyone steer me in the right direction? <Button.ContentTemplate> <DataTemplate DataType="{x:Type local:ArtInfo}"> <Border Name="border" BorderThickness="0" BorderBrush="blue" Height="280" Width="250" Background="#262c40"> <StackPanel> <Grid> <Grid.Resources> <local:MyConverter x:Key="MyConverter"></local:MyConverter> <ObjectDataProvider x:Key="Properties.Settings" ObjectType="{x:Type lcl:Properties.Settings}" /> </Grid.Resources> <Image Name="ArtImage" Margin="10,15,0,0" Height="195" Width="195" VerticalAlignment="Top" > <Image.Source> <Binding Path="ArtImage"/> </Image.Source> </Image> </Grid> <TextBlock Text="{Binding Path=ArtClass}" Margin="10,-17,0,0" FontSize="11" Foreground="white" /> <TextBlock Text="{Binding Path=Student}" Margin="10,0,0,0" FontSize="11" Foreground="white" /> <TextBlock Text="1998" Margin="10,0,0,0" FontSize="11" Foreground="white" /> </StackPanel> </Border> </DataTemplate> </Button.ContentTemplate>

    Read the article

  • WPF WrapPanel with some items having a height of *

    - by Aphex
    How do I make a WrapPanel with some items having a Height of *? A deceptively simple question that I have been trying to solve. I want a control (or some XAML layout magickry) that behaves similar to a Grid that has some rows with a Height of *, but supports wrapping of columns. Hell; call it a WrapGrid. :) Here's a mockup to visualize this. Imagine a grid defined as such: <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="400"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="*"/> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="*"/> <RowDefinition Height="Auto"/> <RowDefinition Height="*"/> <RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/> </Grid.RowDefinitions> <Button Grid.Row="0" MinHeight="30">I'm auto-sized.</Button> <Button Grid.Row="1" MinHeight="90">I'm star-sized.</Button> <Button Grid.Row="2" MinHeight="30">I'm auto-sized.</Button> <Button Grid.Row="3" MinHeight="90">I'm star-sized, too!</Button> <Button Grid.Row="4" MinHeight="30">I'm auto-sized.</Button> <Button Grid.Row="5" MinHeight="30">I'm auto-sized.</Button> </Grid> </Window> What I want this panel to do is wrap an item into an additional column when the item can not get any smaller than its minHeight. Here is a horrible MSPaint of some mockups I made detailing this process. Recall from the XAML that the auto-sized buttons have minHeights of 30, and the star-sized buttons have minHeights of 90. This mockup is just two grids side by side and I manually moved buttons around in the designer. Conceivably, this could be done programmatically and serve as a sort of convoluted solution to this. How can this be done? I will accept any solution whether it's through xaml or has some code-behind (though I would prefer pure XAML if possible since xaml code behind is tougher to implement in IronPython). Updated with a bounty

    Read the article

  • Where is the Microsoft.Windows.Controls.dll in the Nov 2009 Silverlight Toolkit?

    - by Edward Tanguay
    I want to use WrapPanel in Silverlight 3. It is apparently in the Silverlight Toolkit. All the information I can find on it say to download the toolkit, unzip the download, look in the folder binaries and you will find Microsoft.Windows.Controls.dll. This works for December 2008 version of the Silverlight toolkit just fine, since it is a zip file. But I would like the newest version. However, the November 2009 version of the Silverlight toolkit is an .msi file which installs but doesn't tell me where Microsoft.Windows.Controls.dll is. Nor is it in the Add Service | .NET tab. How can I get the Microsoft.Windows.Controls.dll from the November 2009 Silverlight Toolkit install so I can use WrapPanel in Silverlight 3?

    Read the article

  • Is there a WPF "WrapGrid" control available or an easy way to create one?

    - by Jason Coyne
    Essentially I want a wrapPanel, but I would like items to snap to a grid rather than be pressed up to the left, so I can get a nice uniform looking grid, that automatically consumes available space. WrapPanel handles the resize part. WPF.Contrib.AutoGrid handles a nice automatic grid. Anyone got a control that combines them? My use case is I have a series of somewhat irregularly shaped controls. I would like them to appear in nice columns so the wrap panel should snap to the next "tabstop" when placing a control

    Read the article

  • Displaying a collection of controls in a specific way in WPF

    - by Alvaro
    I have a collection of controls "MyCollection" wich changes in the Runtime. And I have to follow some constraints for that, for example: If my parameter "MyCollection.Count = 4" the property "NumberOfcolumns" will have the value 2, in order to create new Lines, and show the controls Two per Two. This is how I'm displaying my collection : <ItemsControl ItemsSource="{Binding MyCollection}" BorderThickness="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" > <ItemsControl.ItemsPanel> <ItemsPanelTemplate > <UniformGrid Columns="{Binding NumberOfColumns}" VerticalAlignment="Center" HorizontalAlignment="Center" Background="Transparent"/> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> </ItemsControl> The problem is that my controls have different sizes, and as In UniformGrids, Cells are uniform... My design is not really pretty, because I have little controls shown in big Cells !! Can someone help me to solve this problem ? NB: Please give me a detailled solution if possible, not something like : "Use WrapPanel..."

    Read the article

  • How can I get Silverlight 4 Tools to work in Web Developer 2010 Express?

    - by Edward Tanguay
    I installed Windows 7. I then installed Web Developer 2010 Express from here with the Web Platform Installer. I then installed the the April 15 release of Silverlight Toolkit from here. I then added this reference: Then in my XAML, I reference it like this but it gives me no intellisense and tells me that I am missing an assembly reference: What do I have to do to use the Silverlight 4 Toolkit in Web Developer 2010 Express?

    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

  • WPF create a list of controls that can be scrolled via the mouse but still remain functional

    - by Mark
    I have a list of controls that I am displaying via a WrapPanel and it horizontally oriented. I have implemented a "Click and Drag" scrolling technique so that the user scrolls with the mouse via clicking and dragging. Like so: <Canvas x:Name="ParentCanvas" PreviewMouseDown="Canvas_MouseDown" MouseMove="Canvas_MouseMove"> <WrapPanel> <WrapPanel.RenderTransform> <TranslateTransform /> </WrapPanel.RenderTransform> <!-- controls are all in here ... --> </WrapPanel> </Canvas> Then in the code behind: private Point _mousePosition; private Point _lastMousePosition; private void Canvas_MouseDown(object sender, MouseButtonEventArgs e) { _lastMousePosition = e.GetPosition(ParentCanvas); e.Handled = true; } private void Canvas_MouseMove(object sender, MouseEventArgs e) { _mousePosition = e.GetPosition(ParentCanvas); var delta = _mousePosition - _lastMousePosition; if(e.LeftButton == MouseButtonState.Pressed && delta.X != 0) { var transform = ((TranslateTransform)_wrapPanel.RenderTransform).Clone(); transform.X += delta.X; _wrapPanel.RenderTransform = transform; _lastMousePosition = _mousePosition; } } This all works fine But what I want to do is make it so that when a users clicks to drag, the items within the WrapPanel dont respond (i.e. the user is only browsing), but when the user clicks (as in a full click) then they do respond to the click. Just like how the iphone works, when you press and drag directly on an app, it does not open the app, but rather scrolls the screen, but when you tap the app, it starts... I hope this makes sense. Cheers, Mark

    Read the article

  • When will the ValueConverter's Convert method be called in wpf

    - by sudarsanyes
    I have an ObservableCollection bound to a list box and a boolean property bound to a button. I then defined two converters, one that operates on the collection and the other operates on the boolean property. Whenever I modify the boolean property, the converter's Convert method is called, where as the same is not called if I modify the observable collection. What am I missing?? Snippets for your reference, xaml snipet, <Window.Resources> <local:WrapPanelWidthConverter x:Key="WrapPanelWidthConverter" /> <local:StateToColorConverter x:Key="StateToColorConverter" /> </Window.Resources> <StackPanel> <ListBox x:Name="NamesListBox" ItemsSource="{Binding Path=Names}"> <ListBox.ItemsPanel> <ItemsPanelTemplate> <WrapPanel x:Name="ItemWrapPanel" Width="500" Background="Gray"> <WrapPanel.RenderTransform> <TranslateTransform x:Name="WrapPanelTranslatation" X="0" /> </WrapPanel.RenderTransform> <WrapPanel.Triggers> <EventTrigger RoutedEvent="WrapPanel.Loaded"> <BeginStoryboard> <Storyboard> <DoubleAnimation Storyboard.TargetName="WrapPanelTranslatation" Storyboard.TargetProperty="X" To="{Binding Path=Names,Converter={StaticResource WrapPanelWidthConverter}}" From="525" Duration="0:0:2" RepeatBehavior="100" /> </Storyboard> </BeginStoryboard> </EventTrigger> </WrapPanel.Triggers> </WrapPanel> </ItemsPanelTemplate> </ListBox.ItemsPanel> <ListBox.ItemTemplate> <DataTemplate> <Grid> <Label Content="{Binding}" Width="50" Background="LightGray" /> </Grid> </DataTemplate> </ListBox.ItemTemplate> </ListBox> <Button Content="{Binding Path=State}" Background="{Binding Path=State, Converter={StaticResource StateToColorConverter}}" Width="100" Height="100" Click="Button_Click" /> </StackPanel> code behind snippet public class WrapPanelWidthConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { ObservableCollection<string> aNames = value as ObservableCollection<string>; return -(aNames.Count * 50); } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { throw new NotImplementedException(); } } public class StateToColorConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { bool aState = (bool)value; if (aState) return Brushes.Green; else return Brushes.Red; } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { throw new NotImplementedException(); } }

    Read the article

  • WPF DataBinding to standard CLR properties in code-behind

    - by nukefusion
    Hi everyone, Just learning WPF databinding and have a gap in my understanding. I've seen a few similar questions on StackOverflow, but I'm still struggling in determining what I have done wrong. I have a simple Person class with a Firstname and Surname property (standard CLR properties). I also have a standard CLR property on my Window class that exposes an instance of Person. I've then got some XAML, with two methods of binding. The first works, the second doesn't. Can anybody help me to understand why the second method fails? There's no binding error message in the Output log. <Window x:Class="WpfApplication1.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:WpfApplication1" Title="Window1" Height="300" Width="300" DataContext="{Binding RelativeSource={RelativeSource Self}, Path=MyPerson}"> <StackPanel> <Label>My Person</Label> <WrapPanel> <Label>First Name:</Label> <Label Content="{Binding RelativeSource={RelativeSource AncestorType=Window, Mode=FindAncestor}, Path=MyPerson.FirstName}"></Label> </WrapPanel> <WrapPanel> <Label>Last Name:</Label> <Label Content="{Binding MyPerson.Surname}"></Label> </WrapPanel> </StackPanel> Edit: Ok, thanks so far. I've changed the second expression to: <Label Content="{Binding Surname}"></Label> I still can't get it to work though!

    Read the article

  • ListBox and Listview problem

    - by Anu
    Hi, I have listbox in my applcation and corresponding coding.. XAML: <DataTemplate x:Key="menuItemTemplate"> <WrapPanel> <TextBlock Text="{Binding Path = Menu}" /> </WrapPanel> </DataTemplate> <ListBox x:Name="menubox" ItemsSource="{Binding}" ItemTemplate="{StaticResource menuItemTemplate}" Margin="0,5,0,0"> .CS : public void Add(string[] menu) { ItemList items = ItemList.Load(menu); DataContext = items; } It works fine.Later i add Listview for another purpose and i coded like the same way of listbox XAML: <DataTemplate x:Key="ListItemTemplate"> <WrapPanel> <TextBlock Text="{Binding Path = Title}" /> </WrapPanel> </DataTemplate> <ListView ItemsSource="{Binding}" ItemTemplate="{StaticResource ListItemTemplate}" Name="listView1" /> .cs coding: public void SetTree(string Title,int BoxNo ) { TreeList items1 = TreeList.Load(Title,BoxNo); DataContext = items1; } After adding Listview,what happended this ListView show data,but Listbox didnot show anything.When i click the listbox it perfectly executing the clicking event of listbox.Only problem it doesnot display the text.What can i do for that. Here i added corresponding list class pls see tht. namespace Tabcontrol { public class TreeList : Collection<TreeItems> { public int size; public TreeList() { size = 0; } public int Count { get { return size; } } public static TreeList Load(string pmenu,int Box) { TreeList result = new TreeList(); TreeItems item = TreeItems.Load(pmenu,Box); result.Add(item); return result; } } } The ItemList class also the same thing, only variable names are getting differred.

    Read the article

  • How to have ListView items with Label show up at the bottom of the item not to the right in WPF?

    - by Joan Venge
    I am using a WrapPanel with an Image and Label, but the Label shows up to the right of the item. How can I make it show up at the bottom of the Image/Item? <Window.Resources> <DataTemplate x:Key="ItemTemplate"> <WrapPanel Orientation="Horizontal"> <Image Width="50" Height="50" Stretch="Fill" Source="{Binding Cover}"/> <Label Content="{Binding Title}" /> </WrapPanel> </DataTemplate> </Window.Resources>

    Read the article

1 2 3  | Next Page >