19 Kasım 2008, ÇARŞAMBA
WPF Kullanıcı Denetimi Üst
Ben zamanında bir kullanıcı bir ana pencere içine benim yük var kontrol edin. Yapamam kullanıcının bulunduğu pencere üzerinde kontrolü ele almak.
Bunu denedim.Üst, ama her zaman boş. Herkes bir kullanıcı içeren pencere WPF kontrolü ele almak için nasıl biliyor mu?
Denetimi nasıl yüklenir:
private void XMLLogViewer_MenuItem_Click(object sender, RoutedEventArgs e)
{
MenuItem application = sender as MenuItem;
string parameter = application.CommandParameter as string;
string controlName = parameter;
if (uxPanel.Children.Count == 0)
{
System.Runtime.Remoting.ObjectHandle instance = Activator.CreateInstance(Assembly.GetExecutingAssembly().FullName, controlName);
UserControl control = instance.Unwrap() as UserControl;
this.LoadControl(control);
}
}
private void LoadControl(UserControl control)
{
if (uxPanel.Children.Count > 0)
{
foreach (UIElement ctrl in uxPanel.Children)
{
if (ctrl.GetType() != control.GetType())
{
this.SetControl(control);
}
}
}
else
{
this.SetControl(control);
}
}
private void SetControl(UserControl control)
{
control.Width = uxPanel.Width;
control.Height = uxPanel.Height;
uxPanel.Children.Add(control);
}
CEVAP
20 Kasım 2008, PERŞEMBE
Aşağıdaki kullanmayı deneyin
Window parentWindow = Window.GetWindow(userControlRefernce);
GetWindow yöntemi sizin için VisualTree yürüyüş ve denetimi barındıran bir pencere bulur.
Bunu PaylaÅŸ:

Kullanıcı Denetimi, bir Kütüphane ve b...
WPF Kullanıcı Denetimi Üst...
Nasıl WPF kullanıcı denetimi ithal ve ...
FormsAuthentication.() SignOut kullanı...
Nasıl MySQL kullanıcı adı ve parola ko...