private void InitCustomPickerDialog() { // Initialize viewmodel this.viewModel = new DialogViewModel(); this.currentColorItem = viewModel.Items[0]; // Assing it to the page's DataContext this.DataContext = currentColorItem; this.customDialog = new PickerBoxDialog(); this.customDialog.Title = "ACCENTS"; // Assign our style to the dialog this.customDialog.Style = this.Resources["Custom"] as Style; this.customDialog.ItemSource = viewModel.Items; this.customDialog.Closed += new EventHandler(customDialog_Closed); }
void customDialog_Closed(object sender, EventArgs e) { this.currentColorItem = (ColorItem)this.customDialog.SelectedItem; this.DataContext = currentColorItem; }