I have an application where the user can select the company to be worked on. When he selects, I would like this information to be for the Title of the application ... Is this possible?
The Title attribute is in the parent window. Since this MouseDoubleClick event is in a child UserControl ... This is my doubt, how to pass from child to Father ..
For now I have this TextBlock to be able to add the information in the title:
<TextBlock Text="{Binding Titulo, RelativeSource={RelativeSource FindAncestor,AncestorType=Window}}" HorizontalAlignment="Center" VerticalAlignment="Top"/>
Title:
private string _titulo;
public string Titulo
{
get
{
return _titulo;
}
set
{
_titulo = value;
}
}
What can I do here when the user selects?
private void dataGridEmpresa_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
--- AQUI! ---
}
After the change:
<my:EscolherEmpresa TitleValue="{Binding Title,RelativeSource={RelativeSource FindAncestor,AncestorType=Window}, Mode=OneWayToSource}"/>
WhereIopentheUserControl:
privatevoidmain_KeyDown(objectsender,KeyEventArgse){if(e.Key==Key.F5){tbTitulo.Text="ESCOLHER EMPRESA PARA TRABALHAR";
MainMdiContainer.Children.Clear();
MainMdiContainer.Children.Add(new MdiChild()
{
Margin = new Thickness(-10, -28, 0, 0),
Width = this.Width - 20,
Height = this.Height - 113,
//WindowState = System.Windows.WindowState.Maximized,
Style = null,
Content = new Telas.EscolherEmpresa()
});
}
}