Add LayoutAnchorable programmatically on AvalonDock - c#

I'm trying to add a new Control to AvalonDock from code.
Here`s the code:
var test = new LayoutAnchorable();
test.Title = "teste";
test.IsActive = true;
test.IsSelected = true;
test.ContentId = "search12";
test.Content = new TextBox();
test.AddToLayout(dockingManager, AnchorableShowStrategy.Right);
The new panel shows up, but the Content doesn't (just gray panel).
Why?

Related

c# Help creating a new tab with new rdp session in side of it

Any advice greatly appreciated.
I'm trying to dynamically create a tab, and inside of that tab, create a new rdp control.
I've got the tab creation fine. The RDP session seems like it's running through the code, but it never renders anything on the screen and never errors out.
I have the tab presented, but with no content.
Thanks.
TabPage myTabPage = new TabPage(tabtitle);
tabControl1.TabPages.Add(myTabPage);
AxMsTscAxNotSafeForScripting rdp4 = new AxMSTSCLib.AxMsTscAxNotSafeForScripting();
((System.ComponentModel.ISupportInitialize)(rdp4)).BeginInit();
rdp4.CreateControl();
myTabPage.Controls.Add(rdp4);
rdp4.Dock = System.Windows.Forms.DockStyle.Fill;
rdp4.Enabled = true;
rdp4.Location = new System.Drawing.Point(3, 3);
rdp4.Name= targetdevice;
rdp4.OcxState = ((System.Windows.Forms.AxHost.State)(new ComponentResourceManager(typeof(Form1)).GetObject("rdp4.OcxState")));
rdp4.Size = new System.Drawing.Size(574, 529);
rdp4.TabIndex = 0;
var settings = (MSTSCLib.IMsRdpClientAdvancedSettings8)rdp4.AdvancedSettings;
settings.allowBackgroundInput = 1;
settings.ClientProtocolSpec = MSTSCLib.ClientSpec.FullMode;
settings.ConnectToServerConsole = true;
settings.EnableCredSspSupport = true;
settings.EncryptionEnabled = 1;
settings.SmartSizing = true;
rdp4.DesktopHeight = 768;
rdp4.DesktopWidth = 1366;
rdp4.Server = targetdevice;
rdp4.UserName = txt_user.Text;
IMsTscNonScriptable secured = (IMsTscNonScriptable)rdp4.GetOcx();
secured.ClearTextPassword = txt_password.Text;
rdp4.Connect();
tabControl1.SelectedTab = myTabPage;

ASPxTabControl created dynamically does not receive input events

I have a ASP page with a ASPxTabControl created dynamically (in C#/code behind). The first tab is selected.
But for some reason if I click the 2nd tab, it does not get selected. Any idea's why this could be the case?
Here is my C# code:
Label question1 = new Label();
question1.Text = "Vraag 1";
question1.Font.Bold = true;
placeHolderVrResults.Controls.Add(question1);
ASPxTabControl tabQuestion1 = new ASPxTabControl();
tabQuestion1.TabStyle.BackColor = Color.White;
tabQuestion1.Paddings.PaddingLeft = 0;
tabQuestion1.Paddings.PaddingRight = 0;
tabQuestion1.Enabled = true;
tabQuestion1.EnableClientSideAPI = true;
Tab tab1 = new Tab();
tab1.Text = "1";
tab1.ActiveTabStyle.BackColor = Color.FromArgb(0, 26, 171, 178);
Tab tab2 = new Tab();
tab2.Text = "2";
tab2.ActiveTabStyle.BackColor = Color.FromArgb(0, 26, 171, 178);
tabQuestion1.Tabs.Add(tab1);
tabQuestion1.Tabs.Add(tab2);
placeHolderVrResults.Controls.Add(tabQuestion1);
If I use ASPxTabControl in the .aspx page, then it just works.
So I must be missing some property of ASPxTabControl which needs to be set such that it can receive input/mouse events?
BR, Rene
Your code looks fine, and this works perfectly for me DevExpress Version=16.1.6.0
ASPxTabControl tab = new ASPxTabControl();
tab.Tabs.Add(new Tab("hi"));
tab.Tabs.Add(new Tab("2"));
this.PanelContent3.Controls.Add(tab);
But each project is different, so always you can open a ticket in DX support, they are very nice and will help you for sure.

How to customize a tooltip for each individual datapoint in a wpf toolkit lineseries chart?

I have seen several questions about doing a custom tooltip for a single line series.
I need a custom tool-tip for each data-point. I would like to add more to the tool-tip than just the dependent value path and the independent value path.
Example I have 2 data points on the same line one with a value(Y-axis)
of 2, date(x-axis) of 4/28/2016, and configuration of A. The other has
a value of 3, date of 4/29/2016, and configuration of B.
How would I also show the configurations? This is all done in code behind because I have a dynamic number of lineseries. So I can't just assign a style to each lineseries in the xaml.
var MyLineSeries = new LineSeries();
lMyLineSeries.DependentValuePath = "Y";
lMyLineSeries.IndependentValuePath = "X";
lMyLineSeries.DataPointStyle = lToolTipDataPointStyle;
This is my code for creating the tool tip style.
var lToolTipDataPointStyle = new Style(typeof(LineDataPoint));
var lTemplate = new ControlTemplate(typeof(LineDataPoint));
var lGridElement = new FrameworkElementFactory(typeof(Border));
//Tooltip
var lStackPanel = new StackPanel();
var lValueContentControl = new ContentControl();
lValueContentControl.SetBinding(ContentControl.ContentProperty, new Binding(myLineSeries.DependentValuePath));
lValueContentControl.ContentStringFormat = "Value: {0}";
var lConfigurationContentControl = new ContentControl();
lConfigurationContentControl.SetBinding(ContentControl.ContentProperty, new Binding())//This is what Idk what to bind to???
lConfigurationContentControl.ContentStringFormat = "Configuration: {0}";
lStackPanel.Children.Add(lValueContentControl);
lStackPanel.Children.Add(lConfigurationContentControl);
lGridElement.SetValue(ToolTipService.ToolTipProperty, lStackPanel);
var lEllipseElement = new FrameworkElementFactory(typeof(Ellipse));
lEllipseElement.SetValue(Ellipse.StrokeThicknessProperty, new TemplateBindingExtension(Border.BorderThicknessProperty));
lEllipseElement.SetValue(Ellipse.StrokeProperty, new TemplateBindingExtension(Border.BorderBrushProperty));
lEllipseElement.SetValue(Ellipse.FillProperty, new TemplateBindingExtension(Grid.BackgroundProperty));
lGridElement.AppendChild(lEllipseElement);
lTemplate.VisualTree = lGridElement;
var lTemplateSetter = new Setter();
lTemplateSetter.Property = LineDataPoint.TemplateProperty;
lTemplateSetter.Value = lTemplate;
lToolTipDataPointStyle.Setters.Add(lTemplateSetter);
return lToolTipDataPointStyle;
I figured it out by using the Tag on the Line series.
myLineSeries.Tag = "Configuration";
var lConfigurationContentControl = new ContentControl();
lConfigurationContentControl.SetBinding(ContentControl.ContentProperty, new Binding(myLineSeries.Tag.ToString()))
lConfigurationContentControl.ContentStringFormat = "Configuration: {0}";

RadDock's SplitContainer does not fill the Windows

I have the following code to create RadDock programmatically:
public void CreateDock(Control parent)
{
RadDock dock = new RadDock();
DocumentContainer docContainerLeft = new DocumentContainer();
docContainerLeft.SizeInfo.SizeMode = Telerik.WinControls.UI.Docking.SplitPanelSizeMode.Fill;
DocumentTabStrip leftDocStrip = new DocumentTabStrip();
DocumentWindow leftDoc = new DocumentWindow("Left");
leftDocStrip.Controls.Add(leftDoc);
docContainerLeft.Controls.Add(leftDocStrip);
DocumentContainer docContainerRight = new DocumentContainer();
docContainerRight.SizeInfo.SizeMode = Telerik.WinControls.UI.Docking.SplitPanelSizeMode.Fill;
DocumentTabStrip rightDocStrip = new DocumentTabStrip();
DocumentWindow rightDoc = new DocumentWindow("Right");
rightDocStrip.Controls.Add(rightDoc);
docContainerRight.Controls.Add(rightDocStrip);
RadSplitContainer middleSplitter = new RadSplitContainer(Orientation.Vertical);
middleSplitter.Dock = DockStyle.Fill;
middleSplitter.SizeInfo.SizeMode = SplitPanelSizeMode.Fill;
middleSplitter.Controls.Add(docContainerLeft);
middleSplitter.Controls.Add(docContainerRight);
dock.Controls.Add(middleSplitter);
ToolWindow transferWindow = new ToolWindow();
transferWindow.Text = "Transfer Queue";
transferWindow.DockState = DockState.Docked;
dock.DockWindow(transferWindow, DockPosition.Bottom);
dock.Dock = DockStyle.Fill;
parent.Controls.Add(dock);
}
I'm trying to make the middleSplitter to fit the window. However there is always an unwanted area at the bottom. I have a picture of it here but SO does not allow me to post an image.
My question is: How to avoid the unwanted area and make the Splitter fill the window?
The DockWindow method of RadDock might be of help in this case. Here is how you can achieve the desired look:
DocumentWindow middleDoc = new DocumentWindow("Middle");
dock.AddDocument(middleDoc);
DocumentWindow leftDoc = new DocumentWindow("Left");
dock.DockWindow(leftDoc, middleDoc, DockPosition.Top);
DocumentWindow rightDoc = new DocumentWindow("Right");
dock.DockWindow(rightDoc, leftDoc, DockPosition.Right);
ToolWindow transferWindow = new ToolWindow();
transferWindow.Text = "Transfer Queue";
transferWindow.DockState = DockState.Docked;
dock.DockWindow(transferWindow, DockPosition.Bottom);
More information and examples are available in the Telerik UI for WinForms documentation

New TabItem at run time

Hi I am using TabControl to make Conference System, the private chats would be in a new TabItem. I am using this code to present a new member chatting in private:
TabItem ti = new TabItem();
ti.Header="Name";
MyTabControl.Items.Add(ti);
but the problem with this code is that I am adding a list box in the TabItem but the TabItem doesn't have a function to add an item in it. how can I add items into TabItem?
Second try: I used this code to present a new member chatting in private
ItemsControl it = new ItemsControl();
ListBox lst = new ListBox();
lst.Width = 571;
lst.Height = 301;
it.Items.Add(lst);
tabControlChat.Items.Add(it);
with this code I can add all items I need in the new tab. but the main problem is that I can't name the tab there is no property like (ti.Header) to name the tab. so what is the solution please? and thank you
For short:
ListBox lb = new ListBox();
lb.Items.Add("chat member");
TabItem ti = new TabItem();
ti.Header = "Private Chats";
ti.Content = lb;
TabControl tc = new TabControl();
tc.Items.Add(ti);
Use this:
TabItem ti = new TabItem();
ti.Header = "Name";
tabControl1.Items.Add(ti);
ListBox lst = new ListBox();
lst.Width = 571;
lst.Height = 301;
ti.Content = lst;

Categories

Resources