Adding on click event on image
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I want to add a clickable event where it goes to specific query action
Example: I have this 3 list Image
how to add an action when I click one of that list and it goes to id that i selected and doing something
Mydb Example Database
Query
select * from library where id_movie = (the one that i clicked)
Xaml
<ItemsControl ItemsSource="{Binding Path=Library}" Margin="0,0,2,0">
<ItemsControl.ItemTemplate>
<DataTemplate DataType="viewModels:Card">
<UniformGrid Rows="1" Columns="1">
<StackPanel Orientation="Horizontal" Width="100" Height="150" Margin="10,25,0,0" >
<Image Width="100" Source="{Binding Path=cover}"/>
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="10,0,0,0">
<Label Content="{Binding Path=title}"/>
</StackPanel>
</UniformGrid>
</DataTemplate>
</ItemsControl.ItemTemplate>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
MyClass
public class VModel
{
public VModel()
{
DataTable dt = new DataTable();
DataSet ds = new DataSet();
using (MySqlConnection connection = new MySqlConnection("SERVER=localhost;" + "DATABASE=library;" + "UID=root;" + "PASSWORD=;"))
{
MySqlDataAdapter adapter = new MySqlDataAdapter();
adapter.SelectCommand = new MySqlCommand("Select * from movie_list", connection);
adapter.Fill(dt);
}
Library = dt.DefaultView;
}
public DataView Library { get; private set; }
}
c# mysql wpf visual-studio xaml
|
show 5 more comments
I want to add a clickable event where it goes to specific query action
Example: I have this 3 list Image
how to add an action when I click one of that list and it goes to id that i selected and doing something
Mydb Example Database
Query
select * from library where id_movie = (the one that i clicked)
Xaml
<ItemsControl ItemsSource="{Binding Path=Library}" Margin="0,0,2,0">
<ItemsControl.ItemTemplate>
<DataTemplate DataType="viewModels:Card">
<UniformGrid Rows="1" Columns="1">
<StackPanel Orientation="Horizontal" Width="100" Height="150" Margin="10,25,0,0" >
<Image Width="100" Source="{Binding Path=cover}"/>
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="10,0,0,0">
<Label Content="{Binding Path=title}"/>
</StackPanel>
</UniformGrid>
</DataTemplate>
</ItemsControl.ItemTemplate>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
MyClass
public class VModel
{
public VModel()
{
DataTable dt = new DataTable();
DataSet ds = new DataSet();
using (MySqlConnection connection = new MySqlConnection("SERVER=localhost;" + "DATABASE=library;" + "UID=root;" + "PASSWORD=;"))
{
MySqlDataAdapter adapter = new MySqlDataAdapter();
adapter.SelectCommand = new MySqlCommand("Select * from movie_list", connection);
adapter.Fill(dt);
}
Library = dt.DefaultView;
}
public DataView Library { get; private set; }
}
c# mysql wpf visual-studio xaml
1
Instead of Image use button with image as background, and use command parameter to pass id. Let me know if you need a full answer.
– Kaspar
Nov 22 '18 at 8:42
<Button><Image/><Button>You should get a WPF book
– Clemens
Nov 22 '18 at 8:46
Besides that, you probably want to replace the ItemsControl by a ListBox and execute the query when the SelectedItem changes.
– Clemens
Nov 22 '18 at 8:47
@Clemens yes thankyou, but i need an example for using command paramater to pass id like kaspar said
– Hans
Nov 22 '18 at 8:48
2
Possible duplicate of How to Add OnClick event on Image in WPF Programmatically
– Peregrine
Nov 22 '18 at 9:45
|
show 5 more comments
I want to add a clickable event where it goes to specific query action
Example: I have this 3 list Image
how to add an action when I click one of that list and it goes to id that i selected and doing something
Mydb Example Database
Query
select * from library where id_movie = (the one that i clicked)
Xaml
<ItemsControl ItemsSource="{Binding Path=Library}" Margin="0,0,2,0">
<ItemsControl.ItemTemplate>
<DataTemplate DataType="viewModels:Card">
<UniformGrid Rows="1" Columns="1">
<StackPanel Orientation="Horizontal" Width="100" Height="150" Margin="10,25,0,0" >
<Image Width="100" Source="{Binding Path=cover}"/>
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="10,0,0,0">
<Label Content="{Binding Path=title}"/>
</StackPanel>
</UniformGrid>
</DataTemplate>
</ItemsControl.ItemTemplate>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
MyClass
public class VModel
{
public VModel()
{
DataTable dt = new DataTable();
DataSet ds = new DataSet();
using (MySqlConnection connection = new MySqlConnection("SERVER=localhost;" + "DATABASE=library;" + "UID=root;" + "PASSWORD=;"))
{
MySqlDataAdapter adapter = new MySqlDataAdapter();
adapter.SelectCommand = new MySqlCommand("Select * from movie_list", connection);
adapter.Fill(dt);
}
Library = dt.DefaultView;
}
public DataView Library { get; private set; }
}
c# mysql wpf visual-studio xaml
I want to add a clickable event where it goes to specific query action
Example: I have this 3 list Image
how to add an action when I click one of that list and it goes to id that i selected and doing something
Mydb Example Database
Query
select * from library where id_movie = (the one that i clicked)
Xaml
<ItemsControl ItemsSource="{Binding Path=Library}" Margin="0,0,2,0">
<ItemsControl.ItemTemplate>
<DataTemplate DataType="viewModels:Card">
<UniformGrid Rows="1" Columns="1">
<StackPanel Orientation="Horizontal" Width="100" Height="150" Margin="10,25,0,0" >
<Image Width="100" Source="{Binding Path=cover}"/>
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="10,0,0,0">
<Label Content="{Binding Path=title}"/>
</StackPanel>
</UniformGrid>
</DataTemplate>
</ItemsControl.ItemTemplate>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
MyClass
public class VModel
{
public VModel()
{
DataTable dt = new DataTable();
DataSet ds = new DataSet();
using (MySqlConnection connection = new MySqlConnection("SERVER=localhost;" + "DATABASE=library;" + "UID=root;" + "PASSWORD=;"))
{
MySqlDataAdapter adapter = new MySqlDataAdapter();
adapter.SelectCommand = new MySqlCommand("Select * from movie_list", connection);
adapter.Fill(dt);
}
Library = dt.DefaultView;
}
public DataView Library { get; private set; }
}
c# mysql wpf visual-studio xaml
c# mysql wpf visual-studio xaml
edited Nov 22 '18 at 8:41
Hans
asked Nov 22 '18 at 8:32
HansHans
207
207
1
Instead of Image use button with image as background, and use command parameter to pass id. Let me know if you need a full answer.
– Kaspar
Nov 22 '18 at 8:42
<Button><Image/><Button>You should get a WPF book
– Clemens
Nov 22 '18 at 8:46
Besides that, you probably want to replace the ItemsControl by a ListBox and execute the query when the SelectedItem changes.
– Clemens
Nov 22 '18 at 8:47
@Clemens yes thankyou, but i need an example for using command paramater to pass id like kaspar said
– Hans
Nov 22 '18 at 8:48
2
Possible duplicate of How to Add OnClick event on Image in WPF Programmatically
– Peregrine
Nov 22 '18 at 9:45
|
show 5 more comments
1
Instead of Image use button with image as background, and use command parameter to pass id. Let me know if you need a full answer.
– Kaspar
Nov 22 '18 at 8:42
<Button><Image/><Button>You should get a WPF book
– Clemens
Nov 22 '18 at 8:46
Besides that, you probably want to replace the ItemsControl by a ListBox and execute the query when the SelectedItem changes.
– Clemens
Nov 22 '18 at 8:47
@Clemens yes thankyou, but i need an example for using command paramater to pass id like kaspar said
– Hans
Nov 22 '18 at 8:48
2
Possible duplicate of How to Add OnClick event on Image in WPF Programmatically
– Peregrine
Nov 22 '18 at 9:45
1
1
Instead of Image use button with image as background, and use command parameter to pass id. Let me know if you need a full answer.
– Kaspar
Nov 22 '18 at 8:42
Instead of Image use button with image as background, and use command parameter to pass id. Let me know if you need a full answer.
– Kaspar
Nov 22 '18 at 8:42
<Button><Image/><Button> You should get a WPF book– Clemens
Nov 22 '18 at 8:46
<Button><Image/><Button> You should get a WPF book– Clemens
Nov 22 '18 at 8:46
Besides that, you probably want to replace the ItemsControl by a ListBox and execute the query when the SelectedItem changes.
– Clemens
Nov 22 '18 at 8:47
Besides that, you probably want to replace the ItemsControl by a ListBox and execute the query when the SelectedItem changes.
– Clemens
Nov 22 '18 at 8:47
@Clemens yes thankyou, but i need an example for using command paramater to pass id like kaspar said
– Hans
Nov 22 '18 at 8:48
@Clemens yes thankyou, but i need an example for using command paramater to pass id like kaspar said
– Hans
Nov 22 '18 at 8:48
2
2
Possible duplicate of How to Add OnClick event on Image in WPF Programmatically
– Peregrine
Nov 22 '18 at 9:45
Possible duplicate of How to Add OnClick event on Image in WPF Programmatically
– Peregrine
Nov 22 '18 at 9:45
|
show 5 more comments
2 Answers
2
active
oldest
votes
Change Image control to following code, it will be button with the Image.
See that Command is bind to global DataContext, because in viewmodel I will declare command. I use the command parameter and pass there Id.
<Button Command="{Binding Path=DataContext.DoSomething, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}" CommandParameter="{Binding id}">
<StackPanel>
<Image Width="100" Source="{Binding Path=cover}"/>
</StackPanel>
</Button>
You then need to declare the Command in the ViewModel
public ICommand DoSomething {get;set;}
And initialize it in constructor
DoSomething = new DoSomethingCommand(this);
Add another class to for definition fo command
internal class DoSomethingCommand: ICommand
{
private VModel vm;
public PlotPlane(VModel mainViewModel)
{
this.vm = mainViewModel;
}
public event EventHandler CanExecuteChanged;
public bool CanExecute(object parameter)
{
return true;
}
public void Execute(object parameter)
{
var id = (id)parameter;
//do something, use vm to access your viewmodel
}
}
it says method must have a return type on PlotPlane and I still not understand about "class DoSomethingCommand : ICommand" work. Can you elaborate?
– Hans
Nov 22 '18 at 9:59
EDIT : it works
– Hans
Nov 22 '18 at 10:08
Good to hear, there is also possibility to use, SelectedItem as @Clemens suggest.
– Kaspar
Nov 22 '18 at 10:11
add a comment |
I think this is what you're looking for. Each item is a button, which contains an image and a label. Clicking the button calls a command (on the DataContext of the window) with a parameter.
<ItemsControl.ItemTemplate>
<DataTemplate DataType="viewModels:Card">
<Button Command="{Binding DataContext.QueryCommand, RelativeSource={RelativeSource FindAncestor, AncestorType=Window}}"
CommandParameter="{Binding Path=id}">
<StackPanel>
<Image Width="100" Source="{Binding Path=cover}"/>
<Label Content="{Binding Path=title}" HorizontalContentAlignment="Center"/>
<StackPanel>
</Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53426745%2fadding-on-click-event-on-image%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Change Image control to following code, it will be button with the Image.
See that Command is bind to global DataContext, because in viewmodel I will declare command. I use the command parameter and pass there Id.
<Button Command="{Binding Path=DataContext.DoSomething, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}" CommandParameter="{Binding id}">
<StackPanel>
<Image Width="100" Source="{Binding Path=cover}"/>
</StackPanel>
</Button>
You then need to declare the Command in the ViewModel
public ICommand DoSomething {get;set;}
And initialize it in constructor
DoSomething = new DoSomethingCommand(this);
Add another class to for definition fo command
internal class DoSomethingCommand: ICommand
{
private VModel vm;
public PlotPlane(VModel mainViewModel)
{
this.vm = mainViewModel;
}
public event EventHandler CanExecuteChanged;
public bool CanExecute(object parameter)
{
return true;
}
public void Execute(object parameter)
{
var id = (id)parameter;
//do something, use vm to access your viewmodel
}
}
it says method must have a return type on PlotPlane and I still not understand about "class DoSomethingCommand : ICommand" work. Can you elaborate?
– Hans
Nov 22 '18 at 9:59
EDIT : it works
– Hans
Nov 22 '18 at 10:08
Good to hear, there is also possibility to use, SelectedItem as @Clemens suggest.
– Kaspar
Nov 22 '18 at 10:11
add a comment |
Change Image control to following code, it will be button with the Image.
See that Command is bind to global DataContext, because in viewmodel I will declare command. I use the command parameter and pass there Id.
<Button Command="{Binding Path=DataContext.DoSomething, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}" CommandParameter="{Binding id}">
<StackPanel>
<Image Width="100" Source="{Binding Path=cover}"/>
</StackPanel>
</Button>
You then need to declare the Command in the ViewModel
public ICommand DoSomething {get;set;}
And initialize it in constructor
DoSomething = new DoSomethingCommand(this);
Add another class to for definition fo command
internal class DoSomethingCommand: ICommand
{
private VModel vm;
public PlotPlane(VModel mainViewModel)
{
this.vm = mainViewModel;
}
public event EventHandler CanExecuteChanged;
public bool CanExecute(object parameter)
{
return true;
}
public void Execute(object parameter)
{
var id = (id)parameter;
//do something, use vm to access your viewmodel
}
}
it says method must have a return type on PlotPlane and I still not understand about "class DoSomethingCommand : ICommand" work. Can you elaborate?
– Hans
Nov 22 '18 at 9:59
EDIT : it works
– Hans
Nov 22 '18 at 10:08
Good to hear, there is also possibility to use, SelectedItem as @Clemens suggest.
– Kaspar
Nov 22 '18 at 10:11
add a comment |
Change Image control to following code, it will be button with the Image.
See that Command is bind to global DataContext, because in viewmodel I will declare command. I use the command parameter and pass there Id.
<Button Command="{Binding Path=DataContext.DoSomething, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}" CommandParameter="{Binding id}">
<StackPanel>
<Image Width="100" Source="{Binding Path=cover}"/>
</StackPanel>
</Button>
You then need to declare the Command in the ViewModel
public ICommand DoSomething {get;set;}
And initialize it in constructor
DoSomething = new DoSomethingCommand(this);
Add another class to for definition fo command
internal class DoSomethingCommand: ICommand
{
private VModel vm;
public PlotPlane(VModel mainViewModel)
{
this.vm = mainViewModel;
}
public event EventHandler CanExecuteChanged;
public bool CanExecute(object parameter)
{
return true;
}
public void Execute(object parameter)
{
var id = (id)parameter;
//do something, use vm to access your viewmodel
}
}
Change Image control to following code, it will be button with the Image.
See that Command is bind to global DataContext, because in viewmodel I will declare command. I use the command parameter and pass there Id.
<Button Command="{Binding Path=DataContext.DoSomething, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}" CommandParameter="{Binding id}">
<StackPanel>
<Image Width="100" Source="{Binding Path=cover}"/>
</StackPanel>
</Button>
You then need to declare the Command in the ViewModel
public ICommand DoSomething {get;set;}
And initialize it in constructor
DoSomething = new DoSomethingCommand(this);
Add another class to for definition fo command
internal class DoSomethingCommand: ICommand
{
private VModel vm;
public PlotPlane(VModel mainViewModel)
{
this.vm = mainViewModel;
}
public event EventHandler CanExecuteChanged;
public bool CanExecute(object parameter)
{
return true;
}
public void Execute(object parameter)
{
var id = (id)parameter;
//do something, use vm to access your viewmodel
}
}
edited Nov 22 '18 at 10:37
Clemens
90.2k894186
90.2k894186
answered Nov 22 '18 at 9:50
KasparKaspar
29328
29328
it says method must have a return type on PlotPlane and I still not understand about "class DoSomethingCommand : ICommand" work. Can you elaborate?
– Hans
Nov 22 '18 at 9:59
EDIT : it works
– Hans
Nov 22 '18 at 10:08
Good to hear, there is also possibility to use, SelectedItem as @Clemens suggest.
– Kaspar
Nov 22 '18 at 10:11
add a comment |
it says method must have a return type on PlotPlane and I still not understand about "class DoSomethingCommand : ICommand" work. Can you elaborate?
– Hans
Nov 22 '18 at 9:59
EDIT : it works
– Hans
Nov 22 '18 at 10:08
Good to hear, there is also possibility to use, SelectedItem as @Clemens suggest.
– Kaspar
Nov 22 '18 at 10:11
it says method must have a return type on PlotPlane and I still not understand about "class DoSomethingCommand : ICommand" work. Can you elaborate?
– Hans
Nov 22 '18 at 9:59
it says method must have a return type on PlotPlane and I still not understand about "class DoSomethingCommand : ICommand" work. Can you elaborate?
– Hans
Nov 22 '18 at 9:59
EDIT : it works
– Hans
Nov 22 '18 at 10:08
EDIT : it works
– Hans
Nov 22 '18 at 10:08
Good to hear, there is also possibility to use, SelectedItem as @Clemens suggest.
– Kaspar
Nov 22 '18 at 10:11
Good to hear, there is also possibility to use, SelectedItem as @Clemens suggest.
– Kaspar
Nov 22 '18 at 10:11
add a comment |
I think this is what you're looking for. Each item is a button, which contains an image and a label. Clicking the button calls a command (on the DataContext of the window) with a parameter.
<ItemsControl.ItemTemplate>
<DataTemplate DataType="viewModels:Card">
<Button Command="{Binding DataContext.QueryCommand, RelativeSource={RelativeSource FindAncestor, AncestorType=Window}}"
CommandParameter="{Binding Path=id}">
<StackPanel>
<Image Width="100" Source="{Binding Path=cover}"/>
<Label Content="{Binding Path=title}" HorizontalContentAlignment="Center"/>
<StackPanel>
</Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
add a comment |
I think this is what you're looking for. Each item is a button, which contains an image and a label. Clicking the button calls a command (on the DataContext of the window) with a parameter.
<ItemsControl.ItemTemplate>
<DataTemplate DataType="viewModels:Card">
<Button Command="{Binding DataContext.QueryCommand, RelativeSource={RelativeSource FindAncestor, AncestorType=Window}}"
CommandParameter="{Binding Path=id}">
<StackPanel>
<Image Width="100" Source="{Binding Path=cover}"/>
<Label Content="{Binding Path=title}" HorizontalContentAlignment="Center"/>
<StackPanel>
</Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
add a comment |
I think this is what you're looking for. Each item is a button, which contains an image and a label. Clicking the button calls a command (on the DataContext of the window) with a parameter.
<ItemsControl.ItemTemplate>
<DataTemplate DataType="viewModels:Card">
<Button Command="{Binding DataContext.QueryCommand, RelativeSource={RelativeSource FindAncestor, AncestorType=Window}}"
CommandParameter="{Binding Path=id}">
<StackPanel>
<Image Width="100" Source="{Binding Path=cover}"/>
<Label Content="{Binding Path=title}" HorizontalContentAlignment="Center"/>
<StackPanel>
</Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
I think this is what you're looking for. Each item is a button, which contains an image and a label. Clicking the button calls a command (on the DataContext of the window) with a parameter.
<ItemsControl.ItemTemplate>
<DataTemplate DataType="viewModels:Card">
<Button Command="{Binding DataContext.QueryCommand, RelativeSource={RelativeSource FindAncestor, AncestorType=Window}}"
CommandParameter="{Binding Path=id}">
<StackPanel>
<Image Width="100" Source="{Binding Path=cover}"/>
<Label Content="{Binding Path=title}" HorizontalContentAlignment="Center"/>
<StackPanel>
</Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
answered Nov 22 '18 at 9:43
Robin BennettRobin Bennett
1,880413
1,880413
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53426745%2fadding-on-click-event-on-image%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Instead of Image use button with image as background, and use command parameter to pass id. Let me know if you need a full answer.
– Kaspar
Nov 22 '18 at 8:42
<Button><Image/><Button>You should get a WPF book– Clemens
Nov 22 '18 at 8:46
Besides that, you probably want to replace the ItemsControl by a ListBox and execute the query when the SelectedItem changes.
– Clemens
Nov 22 '18 at 8:47
@Clemens yes thankyou, but i need an example for using command paramater to pass id like kaspar said
– Hans
Nov 22 '18 at 8:48
2
Possible duplicate of How to Add OnClick event on Image in WPF Programmatically
– Peregrine
Nov 22 '18 at 9:45