Hello Chris!
Not completely sure of what control you mean with TextControlCFAdapter, but maybe you can make something out of this.
Here is a little example I put together.
I the screen there is three buttons.
Button 1 will toggle the visibility of the two other.
Button 2 is hidden at screen opened event.
Button 3 is visible from start.
By finding the buttons via their names we can control them.
Code: Select all
namespace Neo.ApplicationFramework.Generated
{
using System.Windows.Forms;
using System;
using System.Drawing;
using Neo.ApplicationFramework.Tools;
using Neo.ApplicationFramework.Common.Graphics.Logic;
using Neo.ApplicationFramework.Controls;
using Neo.ApplicationFramework.Interfaces;
using System.Collections;
using System.Windows;
public partial class Screen2
{
void Screen2_Opened(System.Object sender, System.EventArgs e)
{
Button2.Visible = false;
}
void Button1_Click(System.Object sender, System.EventArgs e)
{
ToggleButtonVisibility("Button2");
ToggleButtonVisibility("Button3");
}
public void ToggleButtonVisibility (string buttonName)
{
System.Collections.Generic.List<Neo.ApplicationFramework.Controls.Button> buttons = GetLogicalChildCollection<Neo.ApplicationFramework.Controls.Button>(this);
foreach (Neo.ApplicationFramework.Controls.Button button in buttons)
if(button.Name == "m_" + buttonName)
if(button.IsVisible)
button.Visibility = System.Windows.Visibility.Hidden;
else
button.Visibility = System.Windows.Visibility.Visible;
}
public static System.Collections.Generic.List<T> GetLogicalChildCollection<T>(object parent) where T : DependencyObject
{
System.Collections.Generic.List<T> logicalCollection = new System.Collections.Generic.List<T>();
GetLogicalChildCollection(parent as DependencyObject, logicalCollection);
return logicalCollection;
}
private static void GetLogicalChildCollection<T>(DependencyObject parent, System.Collections.Generic.List<T> logicalCollection) where T : DependencyObject
{
IEnumerable children = LogicalTreeHelper.GetChildren(parent);
foreach (object child in children)
{
if (child is DependencyObject)
{
DependencyObject depChild = child as DependencyObject;
if (child is T)
{
logicalCollection.Add(child as T);
}
GetLogicalChildCollection(depChild, logicalCollection);
}
}
}
}
}
Please note that iX adds "m_" to the name of each control (good practice when declaring member variables to a class).