Hello,
It happened gradually over time. In 1867 Canada did officially become a country but under the British Crown it still had colonial status. Different Prime Ministers did small things here and there to further Canada's independence, for example when Sir Wilfrid Laurier created his own Navy for Canada instead of sharing Great Britain's. The two biggest strides though were probably first of all when Borden insisted that Canada have it's own seat for the signing of the Treaty of Versailles, which means for the first time that Canada's international affairs were separated from Great Britain's, and of course when Trudeau brought the constitution home in 1982 which officially allowed Canada to makes amendments to its own constitution instead of having to ask Great Britain to amend it for US, and was the last step in becoming a completely independent nation.
Hope this helps you!!