Skip to content
Permalink
Browse files

Focussing is working

  • Loading branch information...
mbrenn committed May 24, 2019
1 parent d960e5b commit b29562e57a6f05c5ee74387598c19f77f964ace6
@@ -3,7 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<UserControl.CommandBindings>
<CommandBinding Command="Copy" Executed="CommandBinding_OnExecuted" />
@@ -6,6 +6,7 @@
using System.Windows.Input;
using System.Windows.Media;
using Autofac;
using BurnSystems.Logging;
using DatenMeister.Core.EMOF.Implementation;
using DatenMeister.Core.EMOF.Interface.Common;
using DatenMeister.Core.EMOF.Interface.Reflection;
@@ -30,6 +31,14 @@ namespace DatenMeister.WPF.Forms.Base
/// </summary>
public partial class DetailFormControl : UserControl, INavigationGuest, IHasSelectedItems, IHasTitle
{
/// <summary>
/// Stores the logger
/// </summary>
private static readonly ClassLogger logger = new ClassLogger(typeof(DetailFormControl));

/// <summary>
/// Stores the number of fields
/// </summary>
private int _fieldCount;

/// <summary>
@@ -64,7 +73,10 @@ public DetailFormControl()
/// Gets or sets a value indicating whether new properties may be added by the user to the element
/// </summary>
public bool AllowNewProperties { get; set; }


/// <summary>
/// Gets the attached element which is allocated in the navigation host
/// </summary>
public IElement AttachedElement => NavigationHost.AttachedElement;

/// <summary>
@@ -74,9 +86,15 @@ public DetailFormControl()
EffectiveForm?.getOrDefault<double>(_FormAndFields._Form.defaultWidth) ?? 0.0,
EffectiveForm?.getOrDefault<double>(_FormAndFields._Form.defaultHeight) ?? 0.0
);


/// <summary>
/// Gets the list of the item fields being used to store the information into the item
/// </summary>
public List<IDetailField> ItemFields { get; } = new List<IDetailField>();

/// <summary>
/// Gets the list of field information being allocated to the form but not to the detail form
/// </summary>
public List<IDetailField> AttachedItemFields { get; } = new List<IDetailField>();

public IObject GetSelectedItem()
@@ -417,7 +435,7 @@ private void CreateRows(IReflectiveCollection fields)
}

// Checks whether the control element shall be stored in
// the detail element iself or within the attached fields
// the detail element itself or within the attached fields
if (field.getOrNull<bool>(_FormAndFields._FieldData.isAttached) == true)
{
AttachedItemFields.Add(detailElement);
@@ -430,7 +448,15 @@ private void CreateRows(IReflectiveCollection fields)
// Check, if element shall be focused
if (!anyFocused && flags.CanBeFocused)
{
contentBlock.Focus();
// For what ever, we have to set the focus via the invoking and not directly
Dispatcher.BeginInvoke((Action)(() =>
{
if (!contentBlock.Focus())
{
logger.Debug("No keyboard focus set");
}
}));

anyFocused = true;
}
}
@@ -149,7 +149,7 @@ public void SetFocus()
}
else
{
MainContent?.Focus();
MainContent.Focus();
}
}

@@ -200,8 +200,6 @@ public void SetMainContent(UIElement element)
{
Title = title.Title;
}

Focus();
}

/// <summary>
@@ -330,7 +328,10 @@ private void CreateDetailForm()
}
}
}


/// <summary>
/// Sets the effective form by using the viewdefinition
/// </summary>
private void UpdateActualViewDefinition()
{
var viewFinder = GiveMe.Scope.Resolve<ViewFinderImpl>();

0 comments on commit b29562e

Please sign in to comment.
You can’t perform that action at this time.