TGIMBA Windows Presentation Foundation (WPF) Client – Clickable Bucket List Item View

Git  Code

Welcome back to the The Globe In My BucketList Application (TGIMBA) Windows Presentation Foundation (WPF) client creation. Tonight will be about making the bucket list view clickable so we can launch the edit window.

To make the list I wanted, I looked around and found the ItemControl. Starting with the example in reference #3, I was able to create a version of the control that took a dynamically loaded list of buttons for each item. This is what the xaml looks like:

one

The next step was to dynamically load them. This was accomplished by using the same technique in reference #3 from the code behind. Additionally, I am storing the entire data object (a string[]) in the button’s CommandParameter. When the button is clicked, I will retrieve this to populate the edit window. Specifically:

two

NOTE: The breakpoint shows the button’s CommandParameter where I am storing the full bucket list item data.

If you look at the bucket click event I have attached to each item, I am able to pull the database right back out by casting the sender argument. Specifically:

five

To see it in action:

  • Use the steps in my previous blog posts to get the the bucket list view

three

  • Click on an item and the prompt will show you the item you selected

four

I will take this entry and in my next blog post, populate the Edit View and allow the user to updated it and save it to the database. If time allows, I will add this same code to the search results so any search will also allow the user to edit from that view as well in the same post. If not, I will include it and a delete function (on the same Edit View) in the post following that.

Stay tuned!

References

  1. https://stackoverflow.com/questions/3970522/wpf-add-a-border-to-a-textblock
  2. https://stackoverflow.com/questions/979876/set-background-color-of-wpf-textbox-in-c-sharp-code
  3. http://www.wpf-tutorial.com/list-controls/itemscontrol/

 

 

References

1) https://docs.microsoft.com/en-us/dotnet/framework/wpf/controls/how-to-make-a-textbox-control-read-only
2) https://stackoverflow.com/questions/31734227/wpf-checkbox-check-ischecked

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s