I am wondering if anyone knows of a WPF control that can serve the following functions.
Is a treeview that contains treenodes
Can display different numbers of treeviews depending on how wide the parent window is expanded
Can be bound with an ItemSource
You can try the DevExpress TreeList control:
http://www.devexpress.com/Products/NET/Controls/WPF/Tree_List/
Or
Telerik's TreeView control:
http://www.telerik.com/products/wpf/treeview.aspx
Check out their demos and you can even download and try them.
Related
I use a Contentcontrol to show the user controls of the program, Now there is a problem for me to close the user controls After searching, I found an example that The user controls is loaded on a DockPanel
Now my questions:
What is the difference between these two controls? (Dockpanel vs ContentControl)
Is it okay to use this control(dockpanel) Instead of Contentcontrol to display application user controls?
Is there a similar code for Contentcontrol?
ucChild ChildWindow = new ucChild();
ChildWindow.ParentControl = this.UIPanel;
UIPanel.Children.Clear();
UIPanel.Children.Add(ChildWindow);
Standard disclaimer for people coding WPF like it is WinForms: First off; direct UI manipulation like this is a bad idea. You should
be modifying a view model and allowing the binding system to update
the UI. Use the MVVM pattern; WPF will work for you instead of
against you
To your actual questions:
Everything. I mean; they both inherit from FrameworkElement but that's about it in terms of commonality.
A DockPanel is as the name suggests, a Panel. That is; it controls the layout and sizing of one or more child elements. Specifically, DockPanel is good at situations like the following: you want an element to use up a full column of width, then another span the top (except for the previous element) and have the last element fill the remaining space.
A ContentControl is basically a placeholder, its purpose is to expose a settable (and most importantly, bindable) Content property that you can stuff another control into. Even better; you can put an actual object there and use a DataTemplate to control the display (this approach would conform to MVVM).
You can't really replace one with the other, see above
No. ContentControl is not a Panel and so does not have the Children property.
Is there an equivalent to ItemsControl for hierarchical data (arbitrary depth)?
I want to avoid TreeView or such controls that offer expand/collapse/select functionality. I also don't want to fight against the default control implementations and re-template them writing pages of XAML.
PS: What I want can be done in code but I'd rather use the nice templates in XAML and type less.
I am currently looking for a control that allows me to show only few informations when the control is fold. And when we click on the control, the control is unfold and all the information of the control are showed. I have checked if I could use ListView but I did not see a match and the TreeView does not fit my will because it's not a child node but the same node showed in a different way.
Can you help me find a control that could fit my needs ?
Thanks in advance.
You could look into the Expander control. You can modify the control template to customize how it looks and behaves.
I have a grid view which has multiple items.
Each Item is a Webview. Now My issue is that I have a ComboBox above the GridView. When I select Combobox the drop down hides behind the GridView item (i.e Webview). Now I cannot use a WebViewBrush since I have multiple WebView items inside the grid view. Any suggestions?
XAML UI is always behind a WebView window - this is a typical airspace issue. You have to use WebViewBrush for any WebViews that might obscure your XAML controls. Some alternatives include modifying your UI layout - e.g. going to a separate page to display your selector control or moving ui elements about so they don't collide or implementing all of it in HTML.
I am new to C# .NET.
Can some one help me out with the below problem:
I have a TabControl in my WindowsForm application, where the tab pages are generated dynamically. The content to be displayed on each tab would be fetched from my database. I need some kind of control (which can display the fetched data) that I can add on each tab page (which would be same for all tabs) such that I can associate some kind of event, say click, on that added control.
Can anyone tell me how to do this programmatically & write the click event for all the controls added?
Please refer the below link! You will get more detail in this regard.
Creating a tab control with a dynamic number of tabs in Visual Studio C#
I'm not sure I completely understand your problem but my initial thoughts are that you could dynamically create a datagrid or something similar for each tab that you are dynmically creating. You could then bind the datasource for the grid and then add the grid as a control to your tabpage.
Something like...
DataGridView gv = new DataGridView();
gv.DataSource = //whatever your source is
this.tabPage1.Controls.Add(gv);
You would then have all the events associated with the grid to work with.
I'm thinking data binding is going to be your best bet for displaying this information. You can create a list of objects and use a DataTemplate to format the data. You can apply the DataTemplate to a quite a few objects. I generally use the ItemsControl and ListBox
http://msdn.microsoft.com/en-us/library/ms750612.aspx
good luck