Open AndySteelApd opened 2 years ago
@AndySteelApd I took a look. There are 2 questions.
Hello @lsoft, how did you manage that the frame is displayed like this?
@mkornreder are you interested for the code? if so, PTAL:
...
if (options.ShowTaskBarThumbnails || options.ShowTaskBarOverlay)
{
ShowInTaskBar(brush, options);
}
if (options.ShowTestExplorer) // <-- added an option
{
ShowInTestExplorer(brush); // <-- show that border
}
...
private static void ShowInTestExplorer(SolidColorBrush color)
{
foreach (System.Windows.Window w in Application.Current.Windows)
{
if (!w.GetType().Name.Contains("FloatingWindow")) //at the moment we support only floating window
{
continue;
}
FrameworkElement fe = w.FindChildByItsType("TestWindowToolWindowControl");
if (fe == null)
{
continue;
}
if(fe is Control c)
{
c.BorderBrush = color;
c.BorderThickness = new Thickness(General.Instance.Width);
break;
}
}
}
and
public static class WpfExtensions
{
public static FrameworkElement FindChildByItsType(
this DependencyObject root,
string type
)
{
if (root == null)
{
throw new ArgumentNullException(nameof(root));
}
if (type == null)
{
throw new ArgumentNullException(nameof(type));
}
int childrenCount = VisualTreeHelper.GetChildrenCount(root);
for (int cc = 0; cc < childrenCount; cc++)
{
DependencyObject control = VisualTreeHelper.GetChild(
root,
cc
);
if (control is FrameworkElement fe)
{
if (fe.GetType().Name == type)
{
return fe;
}
}
var result = control.FindChildByItsType(type);
if (result != null)
{
return result;
}
}
return null;
}
...
Thank you very much.Message ID: @.***>
+1 seems any separate code window also loses the colour.
Thanks for this great extension :)
I always have the Text Explorer window pulled out onto separate monitors. Can this colourisation also be implemented at the bottom of this window as well so it's easier to identify which solution the window applies to.
thanks