estoy tratando de que despues de insertar un dato en la base de datos se borre el texto del textbox. Me lo hace todo correcto menos el borrado del textbox.
<TextBlock Text="Blog" Grid.Column="1" Grid.Row="1" Margin="0,0,10,0" ></TextBlock>
<TextBox Grid.Column="2" Grid.Row="1" Margin="0,0,0,20" Width="150" Height="30" VerticalContentAlignment="Center" Text="{Binding Blog.Nombre, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"></TextBox>
<Button Grid.Column="2" Grid.Row="2" Content="Button" HorizontalAlignment="Center" Width="auto" Command="{Binding CrearBlogCommand}"/>
public class CrearBlogViewModel : ViewModelBase
{
private RelayCommand crearBlogCommand;
public ICommand CrearBlogCommand
{
get
{
if(crearBlogCommand == null)
{
this.crearBlogCommand = new RelayCommand(param => CrearBlog(), param => true);
}
return crearBlogCommand;
}
}
private Blog blog;
public Blog Blog
{
get
{
if(this.blog == null)
{
this.blog = new Blog();
}
return blog;
}
set
{
base.OnPropertyChanged("Blog");
}
}
private void CrearBlog()
{
var nuevoBlog = new DABlog();
try
{
nuevoBlog.CrearBLog(new Blog() { Nombre = this.Blog.Nombre });
MessageBox.Show("Blog creado correctamente");
this.Blog.Nombre = string.Empty;
}
catch (Exception)
{
MessageBox.Show("Se a producido un error");
}
}
}