Hi friends, Am newbie for windows Development .i have created Grid With tabcontrol using silvelight OOB(out of browser app) .Able to add tabitem at run time by following code
TabItem tabItem = new TabItem();
tabItem.Header = "tab";
tabControl.Items.Add(tabItem);
While adding more no of tabitems, tabitems are added to new line automatically ,instead of scroll enable like google chrome browser.Any property is there to add Scroll???
i have gone through msdn documents but couldn't find anything.Some of the stackoverflow answers say third parties control but am not interested to use those.i want to do my own .Possible give some guidance to get my solution.
If you want to have scrollable tabs in stead of having them appear on multiple lines, you will need to either create you own tabcontrol from scratch, or create a tab control style in which you override the control template.
If you are completely new to silverlight (and xaml), this might be too difficult for you to do. I do not believe there is a simple way to do this, as this functionality is just not part of the standard tab control.
Related
I currently have an application that uses a ToggleButton/Popup feature and it all works as expected, but I wanted to see if there's a way (either through control templates or custom controls) that allows the toggle button to be included as part of the popup window.
The effect I'm going for is similar to the standard TabControl/TabItem layout but instead the ToggleButton would replace the header of the TabItem and the Popup would serve as it's content.
In the end, I want to have the Popup window display to the immediate right side of the ToggleButton and have one continuous border that wraps around the outside edges of the ToggleButton and the outside edges of the Popup window with no border inbetween. The final appearance would show no separation between the two controls, and the user would perceive the ToggleButton and the Popup as a single control object.
I was thinking it might be possible to edit a template of a standard TabItem and have it's content property display as a popup, but haven't tried it yet.
Let me know if you think this is the way to go or if there's any other potential solutions. Thanks.
Almost everything in WPF can be done in multiple ways. The same is true with your goal.
If you plan on reusing this control in multiple places, I would suggest building it as a custom control. I build custom controls and UI libraries for a living, so I am a bit biased.
I would build a custom control that inherits from HeaderedContentControl. The Header property is the content of your ToggleButton, and the Content property would be the content of your Popup. Since you own the ControlTemplate and code, you can make it look and function exactly how you need it to with no compromises.
I have a xaml which contains a tab control (Name="MyTabControl"). I'm a beginner with wpf and in code and I want to dynamically add tab items that I then add a list box to each created tab item. Below is the code I have so far.
ListBox listbox = new ListBox()
TabItem tab = new TabItem()
tab.AddChild(listbox)
MyTabControl.Add(tab)
My issue is that I can't figure out how dynamically create new tabs that also would add a list box to each new tab and the new tabs then added to MyTabControl.
Then, I would want to be able to access each list box control, individually, in each tab to edit the list box content.
How is this done in code? How can i access the created list box controls to edit them?
WPF/UWP and XAML are designed with the MVVM pattern in mind. While you can use other approaches, doing so will miss about 90% of it's power and run into issues at every other corner.
In MVVM this would be simply a mater of Exposing a Collection and having a Tempalte targetting that type. ListBoxes might even have a custom Template system, but using ListBoxes might no longer be nessesary - any container can expose a Collection.
If you plan on learning MVVM, mid to longertem you should learn MVVM. I wrote a short intro a few years back, that should help you going. Help for people not following MVVM is parse on the Forum.
In general, it's a violation of the MVVM principles WPF is built around to build a UI in this way. Instead, consider a solution similar to the one proposed in the answers to this question. They do a good job of explaining both what to do, and why we do it this way.
I'm new to Xamarin Forms, and am trying to create a page that has 4 sections of read-only data, one of which is a list of clickable items. In addition, the top section needs to be stationary (always on top).
My initial attempt was to use various StackLayouts, with a ScrollView to control this. There was much advice against putting a ListView in a ScrollView. After some struggles I got it to work, but then ran into an odd app crash on the ListView binding the second time a page is loaded (simple labels with the same binding are fine).
So my question is, should a ListView be used when many other elements are also on the page? If so, should the header and footer of the ListView contain the other controls, effectively making the ListView the root control? Is there an alternative suggestion to get a bound, clickable list on a page with other controls? Or maybe I'm running into difficulty simply due to the ListView needing to be in a ScrollView?
I'm writing a data-entry software with lots of pages. For example one page for entering team data and another page for entering match data. I want to use the new fancy Microsoft ribbon control to organize different pages and categories.
The problem is I'm new to WPF and I don't know what should I use for:
a. The container of pages (should I create a usercontrol for each page?)
b. The container on the main page where ribbon is placed. (By clicking each ribbon button an specific page should be opened on the main window.)
What would you do?
You could use a DockPanel for the main layout, a TabControl docked to the top for the ribbon, and a ContentControl filling the rest of your application. When a button gets clicked in the TabControl, set the ContentTemplate of the ContentControl.
if you are using the actual RibbonControl from Microsoft there is a RibbonWindow that is used to host the ribbon.
http://blogs.msdn.com/b/jaimer/archive/2010/08/04/wpf-ribbon-has-been-released.aspx?wa=wsignin1.0
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