Silverlight PathListBox Selecteditem - c#

ı tryed all the ways ı know but its not work I want image Show pictures when ı click item of pathListBox in silverlight here is my website you can see what ı am trying Click to PhotoGalley than left lower corner Picture click on it than storyboard will Show pictures ı want click on images of PathListbox And bind it to image source than ı can see big Picture here tutorial of create carosel & PathListbox But When I do lıke they do sample data create in expression blend xap getting bigger ı didnt create sample data ı load images from images folder in client bin folder here my website Http://forum.websayfaci.net
thx for your hellp
<ec:PathListBox x:Name="pathListBox1" Height="57.388" Canvas.Left="79" Canvas.Top="34" Width="280.248" ItemTemplate="{StaticResource ItemTemplate}" ItemsSource="{Binding Collection}">
<ec:PathListBox.LayoutPaths>
<ec:LayoutPath SourceElement="{Binding ElementName=path}" Distribution="Even" FillBehavior="NoOverlap"/>
</ec:PathListBox.LayoutPaths>
</ec:PathListBox>
<!--image sources coming from sample collection and this collection created in expreeion blend 4 -->
<Grid DataContext="{Binding SelectedItem, ElementName=pathListBox1}" Height="409" Canvas.Left="79" Canvas.Top="184" Width="247" d:DataContext="{Binding Collection[0]}">
<Image Source="{Binding Property1}" Margin="0,0,0,8" Stretch="Fill">
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseLeftButtonDown">
<ei:HyperlinkAction TargetWindow="_tab" NavigateUri="http://websayfaci.net"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</Image>
</Grid>
this xaml code work well but make your xap bigger. now ı try not create collection directly load images from my pictures folder to PathListbox source till here ok but when ı click any Picture on pathlistbox its not work how to bind or how is work selected item things

Related

Windows Phone 8.1 - Building image gallery from pictures library images

I'm trying to make an image gallery from pictures library images. Everything is working fine when I have a reduced number of images, but if I have more than 80 images, the phone runs out of memory. I've tried using data virtualization by defining a class which implements the ISupportIncrementalLoading interface. Then I used that class to populate my GridView, but with absolutely no luck: it still is throwing an OutOfMemoryException.
The possibility I'm thinking about is to use random access virtualization, but I haven't found any code template about it.
So,
Could you please explain me how to apply random access virtualization to my list of images?
Or
Could you please explain me how to effectively make an image gallery which retrieves its elements from the Phone's photo gallery?
My XAML code is as follows:
<GridView x:Name="photosGrid" Height="392" Width="400" ItemsSource="{Binding}" Margin="0,0,-0.333,0" SelectionMode="Multiple" Background="Black">
<GridView.ItemTemplate>
<DataTemplate>
<Image Width="90" Height="90" Margin="5" Source="{Binding}" Stretch="UniformToFill"/>
</DataTemplate>
</GridView.ItemTemplate>
</GridView>

WPF Datagrid cell button image not showing

Using the following XAML i am trying to add a button with image on it in a datagrid cell. The button will delete the row upon click
<DataGridTemplateColumn Width="32">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Command="Delete">
<Image Source="../Images/cross.png"/>
</Button>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
The button is added and deleting the row if clicked. But the image is not shown. I have tried many ways but none is working. I also placed the image in the same directory in which the XAML file is placed but even then no success.
Anyone have any idea about how to resolve this issue?
Make sure that you set the image Build Action property to Resource.
Right-click the image and go to it's properties and change it's type to Content.

Image permission windows 8 apps

Hi
I'm trying to display an image in my app but I can't display any Image besides the images that were originally in the app like: logo.png, smallogo.png etc...
but when I choose another image it seems like it has no permission can anybody tel me why?
the following works:
<Image x:Name="imag1" Source="Assets/logo.png" Width="100" Height="300" Stretch="None" HorizontalAlignment="Left"/>
and the folowing doesn't:
<Image x:Name="imag1" Source="Assets/camel.png" Width="100" Height="300" Stretch="None" HorizontalAlignment="Left"/>
needless to say that camel.png is in Assets folder
Make sure you also have "Camel.png" added to your project. If you copy it in the Assets folder and is not added to your project, it will not work. To verify this, in the solution explorer, open the Assets folder from the folder tree view, and if it's not there, right click on the folder, Add Existing Item and add your image.
hello the problem is about the properties you should have set for camel.png.so properties should be set in properties windows to Content and Copyalways..hope it help you..

Why do my images show at designtime and not at runtime?

I have a WPF <Image> that I am trying to display on a <Button> inside of a <Toolbar> with the following code.
<ToolBarTray>
<ToolBar Height="26" Name="toolBar1" VerticalAlignment="Top" >
<Button Name="StampButton" Click="StampButton_Click">
<Image Source="/MyApp.Resources;component/Resources/MyImage.png"
Height="16" Width="16" Stretch="Fill"/>
</Button>
</ToolBar>
</ToolBarTray>
The image shows up just fine at design time. However, at runtime nothing is displayed. The resources are in another dll called MyApp.Resources. The button is actually created just fine and the click event works fine also.
Set your image build action to "Resource". Try to use full source path.
I was getting same problem - image displaying at design time, but not at runtime.
I had build action set to resource, tried different pack uris etc etc, but solution was simple
<Window.Resources>
<BitmapImage x:Key="your_image_key" UriSource="your_image.png" />
<Image Source="{StaticResource your_image_key}"/>
</Window.Resources>
This is what worked for me, from a site called wpf-tutorial.com:
<Image Source="/WpfTutorialSamples;component/Images/copy.png" />
Images is a subfolder of the project folder in my case, and I assume also in this sample.

Editing child objects of a combo box using c# and Wpf

Backgorund
I am currently writing a program that allows a user to select a manufacture from a combo box. The combo box is created in wpf using the following wpf code segment:
<ComboBox Height="23" Margin="40.422,128.423,229.908,0" Name="itemProductManufacture" ToolTip="Click to open drop down menu" VerticalAlignment="Top" Text="Select A Manufacture" SelectionChanged="itemProductManufacture_SelectionChanged" DropDownOpened="itemProductManufacture_DropDownOpened">
<ComboBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding ManufactureId}" Width="0"/>
<Image Name="itemManufactureImage" Source="{Binding ManufactureImage}" Height="15" Width="70" Stretch="Uniform"/>
<TextBlock Text="{Binding ManufactureName}"/>
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
The data is provided form a database and each entry has a Image, a name and an Id (intentionally not shown)
Problem
I am trying to code the behaviour of the combo box so when it is open the image height is 50 and when it is closed it is 15 this is so the image is larger when it is first displayed and then smaller once selected so it doesn't take up too much space on the form.
I have tried editing the image propities using code but am unable to accsess it using its name or any other children of the combo box.
Thanks
Jonathan
As you are using data template you won't be able to access the directly by its name.
Try something like this -
Image image = this.itemProductManufacture.ItemTemplate.FindName("itemManufactureImage", this) as Image;
One thing I am not clear is whether you want to change image size for all the items or the selected one? If you need to access the image for a particulat item in combobox you may have to use the ItemContainerGenerator.ContainerFromItem, as explained in following posts -
WPF - ItemsControl - How do I get find my "CheckBox" item that is in the ItemTemplate?
http://www.sitechno.com/Blog/HowToUseAttachedPropertiesAsAnExtensionMechanismForACheckedListbox.aspx
look at this, To know the various ways of finding controls - How can I find WPF controls by name or type?
You can edit image properties from code using binding. Or you can use triggers in Datatemplate. When comboboxitems checked properties change, you can change height property of corresponding image
Try this:
<Image Height = "{Binding Path=IsDropDownOpen,
RelativeSource={RelativeSource FindAncestor,
AncestorType={x:Type ComboBox}},
Converter={StaticResource myBoolToHeightConverter}}" />
An example for Converter here

Categories

Resources