-
Notifications
You must be signed in to change notification settings - Fork 1
/
VisualCommentsHelper.cs
34 lines (30 loc) · 1.02 KB
/
VisualCommentsHelper.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Windows.Threading;
using Discussions.DbModel;
using Microsoft.Surface.Presentation.Controls;
namespace Discussions
{
internal class VisualCommentsHelper
{
private ItemContainerGenerator _gen = null;
private Comment _placeholder = null;
public VisualCommentsHelper(Dispatcher disp, ItemContainerGenerator gen, Comment placeholder)
{
_gen = gen;
_placeholder = placeholder;
disp.BeginInvoke(new Action(DeferredFocusSet),
System.Windows.Threading.DispatcherPriority.Background, null);
}
private void DeferredFocusSet()
{
var newItem = _gen.ContainerFromItem(_placeholder);
var commentText = Utils.FindChild<SurfaceTextBox>(newItem);
if (commentText != null)
commentText.Focus();
}
}
}