private async static void OnOpenXamlCommand(object sender, RoutedEventArgs e) { var fileName = DialogUtil.ShowOpenFileDialog("XAML|*.xaml"); if (string.IsNullOrEmpty(fileName) || !File.Exists(fileName)) { return; } var ctrl = sender as LiveXaml; using (var fs = new FileStream(fileName, FileMode.Open, FileAccess.Read)) { using (var sr = new StreamReader(fs, Encoding.UTF8)) { ctrl.Text = await sr.ReadToEndAsync(); } } }