I erased the partition where Windows 10 was previously installed. How can I merge it with my OS X partition? So I started up Disk Utility and erased my BOOTCAMP partition and set the format to OS X Extended (Journaled).

This is how my partitions look like now:


As you can see, I have a BOOTCAMP partition (129 GB), my mac partition (362 GB) and I have 8 GB of unused space. How can I merge all of this with my mac partition? I heard that I should be able to click "-" when BOOTCAMP is selected and then expand my mac partition to use the unused space, but as you can see, I can not click the "-" button. My mac partition is "Journaled, Encrypted" by the way.

diskutil list output:


diskutil cs list output:
You can't simply merge a Bootcamp partition or empty space and a FileVault volume with Disk Utility (Boot Camp Assistant should handle this though). You first have to remove the Bootcamp partition and then expand the FileVault volume.

To remove the Bootcamp partition and resize the CoreStorage Volume Group (containing the FileVault volume) the Mac has to be booted to Internet Recovery Mode. Recovery Mode is not sufficient because the Recovery HD has to be moved. The actual boot volume or partition can't be moved.

Preparation:


Detach any external drive (especially your external Time Machine backup drive)
Restart to Internet Recovery Mode by pressing alt cmd R at startup.
The prerequisites are the latest firmware update installed, either ethernet or WLAN (WPA/WPA2) and a router with DHCP activated.
On a 50 Mbps-line it takes about 4 min (presenting a small animated globe) to boot into a recovery netboot image which usually is loaded from an apple/akamai server.

I recommend ethernet because it's more reliable. If you are restricted to WIFI and the boot process fails, just restart your Mac until you succeed booting.

Alternatively you may start from a bootable installer thumb drive (preferably Yosemite or El Capitan) or a thumb drive containing a full system (preferably Yosemite or El Capitan).


Remove bootcamp partition and expand CoreStorage Volume Group


Booted to Internet Recovery Mode open Utilities → Terminal in the menubar and enter:  diskutil list to get the disk identifiers and diskutil cs list to get a CoreStorage listing. Below I assume that your main disk has the disk identifier disk0 and the CoreStorage Logical Volume disk2.
First you have to remove the Bootcamp partition:

gpt -r show /dev/disk0 #to get an overview


To remove a partition with gpt the disk (and all related disks like the inherent CoreStorage volume) has to be unmounted

diskutil unmountDisk /dev/disk2 #if your FileVault volume is unlocked and mounted (check this in the output of `diskutil cs list`)
diskutil unmountDisk /dev/disk0
gpt remove -i 4 /dev/disk0 #remove the Bootcamp partition

Then you have to resize the Logical Volume Group:

diskutil mount /dev/disk0s2 #mount the physical volume of the CoreStorage Logical Volume Group
diskutil mount /dev/disk2 #mount the Logical Volume of the CoreStorage Logical Volume Group
diskutil cs unlockVolume LVUUID #if your FileVault volume is locked


in your case:

diskutil cs unlockVolume 27640FE7-1349-4C98-B101-CE17EF75673E


and enter your passphrase if asked.

Then resize the stack:

diskutil cs resizeStack LVUUID size


in your case:

diskutil cs resizeStack 27640FE7-1349-4C98-B101-CE17EF75673E 500g

Enter exit and quit Terminal
Open Disk Utility and check the main volume for errors
Reboot to your main volume