View has a button and Image control.I have bound the button command to a delegateCommand on the ViewModel, which opens a file dialog for the user to choose an Image.The Context "object" for View contains a property "Icon" which is of type byte[].I have bound the Icon to the Image control.The question is how do i display the selected image file on the image control?.
Xaml:
<Button x:Name="dlgIconbtn" Command="{Binding OpenFileCommand}" Content="Choose Icon" MaxWidth="120" Grid.Row="3" Grid.Column="1" Margin="5"/>
<Image Grid.Row="3" Margin="5" Grid.Column="3" Source="{Binding AppItem.Icon,Converter={StaticResource imgConverter}}"
Width="25" Height="25"/>
I solved it using a property "ImgSource" in the viewModel which is bound to the source of the ImageControl.Whenever a user selects an image using the button command i set the image file contents to the "ImgSource" and it works.
I assume Your Converter is working fine.
Now when OpenFileCommand fires user selects image and you update App.Icon property with new Byte[].
Now please RaiseProperty changed event on Icon so Binding get refreshed.
I do not think you need any Code here.
if still not working then please update you Question with full code XAML + ViewModel
Related
I have a app.html file that has this code.
<Page xmlns="http://schemas.nativescript.org/tns.xsd" actionBarHidden="true">
<ActionBar title="Tooling U-SME" class="action-bar" height="50">
<StackLayout orientation="horizontal"
ios:horizontalAlignment="center"
android:horizontalAlignment="center">
<Image src="res://tulogo" stretch="none"></Image>
</StackLayout>
</ActionBar>
<page-router-outlet></page-router-outlet>
</Page>
The action bar appears ok on my root default page with the proper page-router-outlet, but when the outlet changes the action bar does not appear. Instead a kind of default action bar appears. How do I have an action bar common to all my page views?
Did you go through the basics in NativeScript Angular? There are few core differences in declaring your components in HTML vs XML (Core NativeScript)
You suppose to not declare Page element, page-router-outlet actually does that for you. Try to declare action bar in your components which you are going to load inside page-router-outlet.
After reading this post I figured it out:
https://dzone.com/articles/working-with-angular-modules-in-nativescript-apps
I hadn't imported NativeScriptCommonModule in my Feature Module.
I wants to create a form in a specified format where main window area will have some common links or buttons to all pages and the page area is where all the pages will be shown. Is this possible in wpf ?
Yes you can do that by using tab item and frames. You can have an idea using:
<TabItem Header="about" Name="aboutTab">
<TabControl>
<TabItem Header="REGISTRATION" Name="subTabRegistration">
<Grid>
<Frame NavigationUIVisibility="Hidden" VerticalAlignment="Top" HorizontalContentAlignment="Stretch" ClipToBounds="True" JournalOwnership="Automatic" Source="Pages/register-activate.xaml" x:Name="frameRegistration" />
</Grid>
</TabItem>
</TabControl>
</TabItem>
In windows app (WINRT)i want to change the image dynamically inside the listview,where the listview items are bind by datatemplate
The image is part of your listviewitem template? Could you add an image source path text property of your list items? If you're updating the value dynamically your list items will need to implement INotifyPropertyChanged and raise the PropertyChanged event when the value changes.
<DataTemplate>
<Image Source="{Binding imageSourcePath}" />
</DataTemplate>
I'm trying to set icon to <aui:button> like on this tutorial.
But solution described there doesn't work well in my case, because I have a table and on each row I have a button with different resourceUrl. Like this:
<portlet:resourceURL id="saveReport" var="saveReportURL">
<portlet:param name="reportId" value="${report.reportId}" />
</portlet:resourceURL>
<aui:button onclick="location.href = '${saveReportURL}'">
Is it possible to set icon in <aui:button> without using JavaScript as described in tutorial?
Thanks
You can write this below code for setting icon in liferay alloy button
<aui:button type="cancel" cssClass="btn-info" icon="icon-upload-alt" iconAlign="right" value="upload" />
you need to use the icon attribute for this setting "Icon glyphs"
you need to use cssClass for adding extra design button class for the designing
you need to set iconAlign attribute for left or right side of the button text value
You should be able to add an icon to a button without using JavaScript by adding one of these Icon CSS classes to your button. For example, if you wanted to create a button with a calendar icon, your code should look something like this:
<aui:button class="icon-calendar" ... />
WPF 3.5
I have a ListView for which the XAML looks like so
<ListView Name="ListView_FileAttachments">
<ListView.View>
<GridView>
<GridView.Columns>
<GridViewColumn Header="Type"></GridViewColumn>
<GridViewColumn Header="File Name"></GridViewColumn>
<GridViewColumn Header="Security">
<GridViewColumn.CellTemplate>
<DataTemplate>
<Button Content="Set Restrictions" Click="Restrictions_Clicked"></Button>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView.Columns>
</GridView>
</ListView.View>
</ListView>
When I Click on a button in an individual cell how do I tell which button was clicked ( to be clear though I am interested in the ListView Item that this button belongs to because what I really want to do is retrieve the value of another column in that row )
The DataContext of the button (i.e. the sender for the event) will be the dataitem from the listview's Items. If you want the container (i.e. the ListViewItem) then you can either walk up the visual tree (e.g. using VisualTreeHelper.GetParent) until you hit the ListViewItem or you can use the ListView_FileAttachments.ItemContainerGenerator.ContainerFromItem passing in the data item (which you get from the DataContext of the button).