Search Results

Search found 160 results on 7 pages for 'tabcontrol'.

Page 4/7 | < Previous Page | 1 2 3 4 5 6 7  | Next Page >

  • Problem with the way the Ajax Control Toolkit tab control sets the default submit button

    - by Colin
    We have a tab control containing some textboxes for doing a search. When you keypress inside one of the textboxes, the tab control sets the default button to be the button immediately following the tab control. This is fine because that's the search button. The problem occurs after the button is clicked and results returned. Now there is no default button, and keypress does nothing. Any suggestions?

    Read the article

  • Adding the same Panel to multiple TabPages

    - by BDotA
    In my previous question I could add a design time panel to a tab page at run time and my code looks like this and it works Ok. tabControl1.SuspendLayout(); tabControl1.TabPages[0].Controls.Add(panel1); tabControl1.ResumeLayout(); but now I need to do something like this: tabControl1.SuspendLayout(); tabControl1.TabPages[0].Controls.Add(panel1); tabControl1.TabPages[1].Controls.Add(panel1); tabControl1.TabPages[2].Controls.Add(panel1); tabControl1.ResumeLayout(); which just at run-time I can know how many of these Tabpages I will need. but now for testing I am assuming I will have three tabPages the Problem is that the panel only gets added to the Last tabPage, How can I fix this? I want it get added to all of the tab pages Thanks.

    Read the article

  • how to get TabHeader on trigger

    - by CurlyFro
    i have a tabcontrol. i'm trying to pass the tabcontrol as a parameter to figure out the selected tab item so i can get the tab header name. Binding this doesn't seem to work. ideas? <TabControl Background="#FFF9F9F9" Height="650"> <i:Interaction.Triggers> <i:EventTrigger EventName="SelectionChanged"> <n:ExecuteCommandAction Command="{Binding UpdateTabCommand}" Parameter="{Binding this}"/> </i:EventTrigger> </i:Interaction.Triggers> in my viewmodel constructor i have: _updateTabCommand = new ActionCommand< TabControl>(UpdateTab); private method: public void UpdateTab(TabControl tabControl) { var tabItem = (TabItem)tabControl.SelectedItem;

    Read the article

  • Adding & Removing Dynamic Controls in C# WinForms.

    - by gsvirdi
    I have three Tabs in my WinForm; depending on the selected RaioButton in the TabPages[0] I added few dynamic controls on the relevant TabPage. On Button_Click event the controls are added, but the prob is the I'm not able to remove the Dynamically added controls from the other (irrelevant) TabPage. Here's my code: Label label235 = new Label(); TextBox tbMax = new TextBox(); label235.Name = "label235"; tbMax.Name = "txtBoxNoiseMax"; label235.Text = "Noise"; tbMax.ReadOnly = true; label235.ForeColor = System.Drawing.Color.Blue; tbMax.BackColor = System.Drawing.Color.White; label235.Size = new Size(74, 13); tbMax.Size = new Size(85, 20); if (radioButton1.Checked) { label235.Location = new Point(8, 476); tbMax.Location = new Point(138, 473); tabControl.TabPages[1].Controls.Add(label235); tabControl.TabPages[1].Controls.Add(tbMax); tabControl.TabPages[2].Controls.RemoveByKey("label235"); tabControl.TabPages[2].Controls.RemoveByKey("tbMax"); } else { label235.Location = new Point(8, 538); tbMax.Location = new Point(138, 535); tabControl.TabPages[1].Controls.RemoveByKey("label235"); tabControl.TabPages[1].Controls.RemoveByKey("tbMax"); tabControl.TabPages[2].Controls.Add(label235); tabControl.TabPages[2].Controls.Add(tbMax); } Where am I making that mistake?????

    Read the article

  • How do I detect a change of tab page in TabControl prior to SelectedIndexChanged event?

    - by JYelton
    I currently determine what page of a tabcontrol was clicked on via the SelectedIndexChanged event. I would like to detect before the selected index actually changes, for validation purposes. For example, a user clicks a tab page other than the one they are viewing. A dialog is presented if form data is unsaved and asks if it's ok to proceed. If the user clicks no, I'd like to remain on the current tab. Currently I have to remember the previous tab page and switch back to it after an answer of 'no.' I considered MouseDown (and the assorted calculation logic), but I doubt that's the best way. (This is in .NET C# 3.5)

    Read the article

  • Using data binding on value which is a FrameworkElement

    - by JaredPar
    One of my data sources produces a collection of values which are typed to the following interface public interface IData { string Name { get; } FrameworkElement VisualElement { get; } } I'd like to use data binding in WPF to display a collection of IData instances in a TabControl where the Name value becomes the header of the tab and the VisualElement value is displayed as the content of the corresponding tab. Binding the header is straight forward. I'm stuck though on how to define a template which allows me to display the VisualElement value. I've tried a number of solutions with little success. My best attempt is as follows. <TabControl ItemsSource="{Binding}"> <TabControl.ItemTemplate> <DataTemplate> <Label Content="{Binding Name}"/> </DataTemplate> </TabControl.ItemTemplate> <TabControl.ContentTemplate> <DataTemplate> How do I display VisualElement here? </DataTemplate> </TabControl.ContentTemplate> </TabControl> I'm still very new to WPF so I could be missing the obvious here.

    Read the article

  • WPF Debugging AvalonEdit binding to Document property.

    - by kubal5003
    Hello, all day long I am sitting and trying to find out why binding to AvalonEdits Document property isn't working. AvalonEdit is an advanced WPF text editor - part of the SharpDevelop project.(it's going to be used in SharpDevelop v4 Mirador). So when I set up a simple project - one TextEditor (that's the AvalonEdits real name in the library) and made a simple class that has one property - Document and it returns a dummy object with some static text the binding is working perfectly. However in real life solution I'm binding a collection of SomeEditor objects to TabControl. TabControl has DataTemplate for SomeEditor and there's the TextEditor object. <TabControl Grid.Column="1" x:Name="tabControlFiles" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" > <TabControl.Resources> <DataTemplate DataType="{x:Type m:SomeEditor}"> <a:TextEditor Document="{Binding Path=Document, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource NoopConverter}, IsAsync=True}" x:Name="avalonEdit"></a:TextEditor> </DataTemplate> </TabControl.Resources> <TabControl.ItemContainerStyle> <Style BasedOn="{StaticResource TabItemStyle}" TargetType="{x:Type TabItem}"> <Setter Property="IsSelected" Value="{Binding IsSelected}"></Setter> </Style> </TabControl.ItemContainerStyle> </TabControl> This doesn't work. What I've investigated so far: DataContext of TextEditor is set to the proper instance of SomeEditor TextEditors Document property is set to some other instance than SomeEditor.Document property when I set breakpoint to no-op converter that is attached to that binding it shows me the correct value for Document (the converter is used!) I also dug through the VisualTree to obtain reference to TextEditor and called GetBindingExpression(TextEditor.DocumentProperty) and this did return nothing WPF produces the following information: System.Windows.Data Information: 10 : Cannot retrieve value using the binding and no valid fallback value exists; using default instead. BindingExpression:Path=Document; DataItem='SomeEditor' (HashCode=26280264); target element is 'TextEditor' (Name='avalonEdit'); target property is 'Document' (type 'TextDocument') SomeEditor instance that is bound to already has a created and cached copy of Document before the binding occurs. The getter is never called. Anyone can tell me what might be wrong? Why BindingExpression isn't set ? Why property getter is never called?

    Read the article

  • WPF How to add and perform events on those controls generated during Runtime

    - by 103318677739703278524
    For example, I have an empty tabControl in my Windows during the compile time, and I have an undetermined amount of images need to be added onto the tabControl, so I used loop + tabControl.Children.Add("image1 to x") to add those images... but after that during runtime, I want to perform events on those image controls, such as dragging the image from the tabControl to another Panel. Is it possible to do so? If it's possible, how?

    Read the article

  • How to add custom-control-derived TabItem to TabControl in WPF?

    - by orloffm
    I want to have my own base TabItem class and use other classes that derive from it. I define base class in MyNs namespace like this: public class MyCustomTab : TabItem { static MyCustomTab() { DefaultStyleKeyProperty.OverrideMetadata(typeof(MyCustomTab), new FrameworkPropertyMetadata(typeof(TabItem))); } } And this is what I do for the class that inherits from it: code-behind in MyNs namespace: public partial class ActualTab : MyCustomTab { public ActualTab() { InitializeComponent(); } } XAML: <MyCustomTab x:Class="MyNs.ActualTab" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <Grid> </Grid> </MyCustomTab> The error I get is "The tag 'MyCustomTab' does not exist in XML namespace 'http://schemas.microsoft.com/winfx/2006/xaml/presentation'". If I use TabItem tag in XAML the error says that it's not possible to define to different base classes. How to fix this?

    Read the article

  • WPF TabBarControl Setting Focus to element when tab changes

    - by Aran Mulholland
    I have a TabControl that is bound to a view model <TabControl ItemsSource="{Binding Path=ViewModelCollection}" > <TabControl.ItemContainerStyle> <Style TargetType="TabItem" BasedOn="{StaticResource {x:Type TabItem}}"> <Setter Property="Header" Value="{Binding Title}" /> <Setter Property="Content" Value="{Binding}" /> </Style> </TabControl.ItemContainerStyle> </TabControl> Each Tab simply contains a View Model Item. I use a data template to display this. <!-- View Model Template --> <DataTemplate DataType="{x:Type local:ViewModelItem}"> <DockPanel> <TextBox Text="I want this to have the focus"/> </DockPanel> </DataTemplate> When the current tab is changed i want the focus to be on the textbox (this is a simple example, in my production code i have a datagrid) in the data template. how do i accomplish this?

    Read the article

  • Binding DataTemplates (or another aproach)

    - by Bataglião
    Hi all, I'm having some troubles trying to dynamically generate content in WPF and after it bind data. I have the following scenario: TabControl - Dynamically generated TabItems through DataTemplate - inside TabItems, I have dynamic content generated by DataTemplate that I wish to bind (ListBox). The code follows: ::TabControl <TabControl Height="252" HorizontalAlignment="Left" Name="tabControl1" VerticalAlignment="Top" Width="458" Margin="12,12,12,12" ContentTemplate="{StaticResource tabItemContent}"></TabControl> ::The Template for TabControl to generate TabItems <DataTemplate x:Key="tabItemContent"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="*" /> </Grid.RowDefinitions> <ListBox ItemTemplate="{StaticResource listBoxContent}" ItemsSource="{Binding}"> </ListBox> </Grid> </DataTemplate> ::The template for ListBox Inside each TabItem <DataTemplate x:Key="listBoxContent"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="22"/> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <Image Grid.Column="0" Source="{Binding Path=PluginIcon}" /> <TextBlock Grid.Column="1" Text="{Binding Path=Text}" /> </Grid> </DataTemplate> So, when I try to do this on code inside a loop to create the tabitems: TabItem tabitem = tabControl1.Items[catIndex] as TabItem; tabitem.DataContext = plugins.ToList(); where 'plugins' is an Enumerable The ListBox is not bounded. I tried also to find the ListBox inside the TabItem to set the ItemSource property but no success at all. Someone have an idea on how to do that? Thanks in advance.

    Read the article

  • WPF: Set style on immediate children only

    - by ollifant
    In my application I have a tab control which has several tab items. The problem is that I want to apply a style to these tab items, but to no other (nested) tab items. I have tried setting the following style on the tab control, but this also effects all children: <Style x:Key="tabControlStyle" TargetType="{x:Type TabControl}"> <Setter Property="TabItem.Template" Value="{StaticResource tabItemTemplate}" /> </Style> By using the code above I get the following error: 'TabItem' ControlTemplate TargetType does not match templated type 'TabControl', as TabItem and TabControl have the same DependencyProperty "Template", and the code tries to set the TabItemTemplate as TabControl- Template. Can anybody help me?

    Read the article

  • WPF Canvas Binding

    - by morsanu
    Hey guys, I'm rather new to WPF, so maybe this is a simple question. I have a class that derives from Canvas, let's call it MyCanvas. And I have a class, MyClass, that has a property of type MyCanvas. In XAML, I built a TabControl, so each TabItem binds to a MyClass object. Now, in the Content of every tab I want to display MyObject.MyCanvas. How should I do that? <TabControl.ContentTemplate> <DataTemplate> <Grid> <myCanvas:MyCanvas Focusable="true" Margin="10" > <Binding Path="Canvas"></Binding> </screenCanvas:ScreenCanvas> </Grid> </DataTemplate> </TabControl.ContentTemplate>

    Read the article

  • how to get the region name?

    - by shemesh
    using Silverlight & Prism. i create a new scoped region inside a TabControl like so: IRegionManager regionManager = tabControl.Add(viewRegions, UNIQUEID, true); then from the TabControl SelectionChanged event i want to get the name of that region. so i go: TabItem item = e.AddedItems[0] as TabItem; FrameworkElement view = item.Content as FrameworkElement; IRegionManager xxx = RegionManager.GetRegionManager(view); so now i have the scoped region manager at hand = xxx! but how do i get its name? (the "UNIQUEID" param i have assigned to it ). HOW?

    Read the article

  • WPF: disable inheritance of properties

    - by Maximilian Csuk
    Hi! I would like to use a TabControl as the main navigation in the application I am working on. So I would like to make the font in the headers of the TabItems bigger and also give it another background-color. However, I do not want this to be inherited. For example, if I use this code: <TabControl FontSize="18pt"> <TabItem Header="Tab 1"> <Button>Button 1</Button> </TabItem> </TabControl> The font in the button is also 18pt big. I know that this is normal dependency property behaviour because the property is inherited, but that's not what I want in this case. I would like to change the TabItems without changing anything in the children. Isn't that possible? Because re-setting all children to default values is a PITA. Thanks for your time.

    Read the article

  • WPF: How to bind and update display with DataContext

    - by Am
    I'm trying to do the following thing: I have a TabControl with several tabs. Each TabControlItem.Content points to PersonDetails which is a UserControl Each BookDetails has a dependency property called IsEditMode I want a control outside of the TabControl , named ToggleEditButton, to be updated whenever the selected tab changes. I thought I could do this by changing the ToggleEditButton data context, by it doesn't seem to work (but I'm new to WPF so I might way off) The code changing the data context: private void tabControl1_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (e.Source is TabControl) { if (e.Source.Equals(tabControl1)) { if (tabControl1.SelectedItem is CloseableTabItem) { var tabItem = tabControl1.SelectedItem as CloseableTabItem; RibbonBook.DataContext = tabItem.Content as BookDetails; ribbonBar.SelectedTabItem = RibbonBook; } } } } The DependencyProperty under BookDetails: public static readonly DependencyProperty IsEditModeProperty = DependencyProperty.Register("IsEditMode", typeof (bool), typeof (BookDetails), new PropertyMetadata(true)); public bool IsEditMode { get { return (bool)GetValue(IsEditModeProperty); } set { SetValue(IsEditModeProperty, value); SetValue(IsViewModeProperty, !value); } } And the relevant XAML: <odc:RibbonTabItem Title="Book" Name="RibbonBook"> <odc:RibbonGroup Title="Details" Image="img/books2.png" IsDialogLauncherVisible="False"> <odc:RibbonToggleButton Content="Edit" Name="ToggleEditButton" odc:RibbonBar.MinSize="Medium" SmallImage="img/edit_16x16.png" LargeImage="img/edit_32x32.png" Click="Book_EditDetails" IsChecked="{Binding Path=IsEditMode, Mode=TwoWay}"/> ... There are two things I want to accomplish, Having the button reflect the IsEditMode for the visible tab, and have the button change the property value with no code behind (if posible) Any help would be greatly appriciated.

    Read the article

  • Text orientation

    - by Psytronic
    Hi Guys I know you can do this to get vertical text in a tab header: <Window x:Class="Abodemploy.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300" <Grid <TabControl Margin="0" Name="tabControl1" FlowDirection="LeftToRight" TabStripPlacement="Left" <TabItem <TabItem.Header <StackPanel Orientation="Horizontal" <TextBlockHomes</TextBlock </StackPanel </TabItem.Header <TabItem.LayoutTransform <TransformGroup <RotateTransform Angle="90" / </TransformGroup </TabItem.LayoutTransform <Grid / </TabItem </TabControl </Grid </Window However the text letters are sideways. What I'd like (if possible) is for the letter orientation to be correct (ie upwards), but the text flow downwards, is this possible, or am I just dreaming the impossible dream? Thanks Psy

    Read the article

  • Clean way to display/hide a bunch of buttons based on a ComboBox selection

    - by John at CashCommons
    I'm writing a standalone application in VB.NET using Visual Studio 2005. I want to display/hide a bunch of Buttons based on the selected value of a ComboBox. Each selection would have a different set of Buttons to display, and I'd like to have them arranged in a nice grid. Driving a TabControl with the ComboBox value would be the kind of behavior I want, but I don't want it to look like a TabControl to the user because it might be confusing. Is there a way to do this? Basically, I'd like Selection1 of the ComboBox to show Buttons 1-4, Selection2 to show Buttons 5-11, Selection3 to show (maybe) Buttons 1, 3, 5, 6, and 8, etc., have them arranged nicely, and have the GUI show only the ComboBox and the buttons. Thanks in advance as always!

    Read the article

  • Improving WPF memory usage

    - by Krishna
    Hello developers Is there any way you can store the UI state to disk when a WPF form has been minimised. I have a complex GUI with few Tab Controls and it consumes quite a bit of memory which is kept allocated when the application is not active. I was hoping one of you may have got this working along the lines (or similar) Application Active User does work, plays with UI - enters some information in the text boxes and moves around the tabs User minimises the form to work with other applications On Minimise, Save the current state to the disk and dispose the root tabcontrol On Activiate, build the root tabcontrol from the disk and add to the controls collection Before I divein to do this, I thought it will help me if I ask this question here. Please let me know your thoughts

    Read the article

  • Frustrated With Wpf DataGrid

    - by user197373
    Hello Experts, I have a tabcontrol and I place datagrid inside a tabcontrol... But I could not focus that Datagrid at the load event ... Focus means I couldn't navigate through keyboard into it... I'm getting this problem only inside of the tab control otherwise it works fine...my sample project link as follows.. http://cid-0255f3152326d2b1.skydrive.live.com/browse.aspx/WPF%20Datagrid%20Problem?uc=1&nl=1 (1) Please remember note that focus means I couldn't navigate a datagrid through keyboard (2) It should be in load event......Because it works fine in other events... (3) Datagrid should be placed inside a tab control... Because it works fine outside a tab control..... I hope u wil help me... please help me out Thanks in Advance

    Read the article

  • Adding Volcanos and Options - Earthquake Locator, part 2

    - by Bobby Diaz
    Since volcanos are often associated with earthquakes, and vice versa, I decided to show recent volcanic activity on the Earthquake Locator map.  I am pulling the data from a website created for a joint project between the Smithsonian's Global Volcanism Program and the US Geological Survey's Volcano Hazards Program, found here.  They provide a Weekly Volcanic Activity Report as an RSS feed.   I started implementing this new functionality by creating a new Volcano entity in the domain model and adding the following to the EarthquakeService class (I also factored out the common reading/parsing helper methods to a separate FeedReader class that can be used by multiple domain service classes):           private static readonly string VolcanoFeedUrl =             ConfigurationManager.AppSettings["VolcanoFeedUrl"];           /// <summary>         /// Gets the volcano data for the previous week.         /// </summary>         /// <returns>A queryable collection of <see cref="Volcano"/> objects.</returns>         public IQueryable<Volcano> GetVolcanos()         {             var feed = FeedReader.Load(VolcanoFeedUrl);             var list = new List<Volcano>();               if ( feed != null )             {                 foreach ( var item in feed.Items )                 {                     var quake = CreateVolcano(item);                     if ( quake != null )                     {                         list.Add(quake);                     }                 }             }               return list.AsQueryable();         }           /// <summary>         /// Creates a <see cref="Volcano"/> object for each item in the RSS feed.         /// </summary>         /// <param name="item">The RSS item.</param>         /// <returns></returns>         private Volcano CreateVolcano(SyndicationItem item)         {             Volcano volcano = null;             string title = item.Title.Text;             string desc = item.Summary.Text;             double? latitude = null;             double? longitude = null;               FeedReader.GetGeoRssPoint(item, out latitude, out longitude);               if ( !String.IsNullOrEmpty(title) )             {                 title = title.Substring(0, title.IndexOf('-'));             }             if ( !String.IsNullOrEmpty(desc) )             {                 desc = String.Join("\n\n", desc                         .Replace("<p>", "")                         .Split(                             new string[] { "</p>" },                             StringSplitOptions.RemoveEmptyEntries)                         .Select(s => s.Trim())                         .ToArray())                         .Trim();             }               if ( latitude != null && longitude != null )             {                 volcano = new Volcano()                 {                     Id = item.Id,                     Title = title,                     Description = desc,                     Url = item.Links.Select(l => l.Uri.OriginalString).FirstOrDefault(),                     Latitude = latitude.GetValueOrDefault(),                     Longitude = longitude.GetValueOrDefault()                 };             }               return volcano;         } I then added the corresponding LoadVolcanos() method and Volcanos collection to the EarthquakeViewModel class in much the same way I did with the Earthquakes in my previous article in this series. Now that I am starting to add more information to the map, I wanted to give the user some options as to what is displayed and allowing them to choose what gets turned off.  I have updated the MainPage.xaml to look like this:   <UserControl x:Class="EarthquakeLocator.MainPage"     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"     xmlns:basic="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"     xmlns:bing="clr-namespace:Microsoft.Maps.MapControl;assembly=Microsoft.Maps.MapControl"     xmlns:vm="clr-namespace:EarthquakeLocator.ViewModel"     mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480" >     <UserControl.Resources>         <DataTemplate x:Key="EarthquakeTemplate">             <Ellipse Fill="Red" Stroke="Black" StrokeThickness="1"                      Width="{Binding Size}" Height="{Binding Size}"                      bing:MapLayer.Position="{Binding Location}"                      bing:MapLayer.PositionOrigin="Center">                 <ToolTipService.ToolTip>                     <StackPanel>                         <TextBlock Text="{Binding Title}" FontSize="14" FontWeight="Bold" />                         <TextBlock Text="{Binding UtcTime}" />                         <TextBlock Text="{Binding LocalTime}" />                         <TextBlock Text="{Binding DepthDesc}" />                     </StackPanel>                 </ToolTipService.ToolTip>             </Ellipse>         </DataTemplate>           <DataTemplate x:Key="VolcanoTemplate">             <Polygon Fill="Gold" Stroke="Black" StrokeThickness="1" Points="0,10 5,0 10,10"                      bing:MapLayer.Position="{Binding Location}"                      bing:MapLayer.PositionOrigin="Center"                      MouseLeftButtonUp="Volcano_MouseLeftButtonUp">                 <ToolTipService.ToolTip>                     <StackPanel>                         <TextBlock Text="{Binding Title}" FontSize="14" FontWeight="Bold" />                         <TextBlock Text="Click icon for more information..." />                     </StackPanel>                 </ToolTipService.ToolTip>             </Polygon>         </DataTemplate>     </UserControl.Resources>       <UserControl.DataContext>         <vm:EarthquakeViewModel AutoLoadData="True" />     </UserControl.DataContext>       <Grid x:Name="LayoutRoot">           <bing:Map x:Name="map" CredentialsProvider="--Your-Bing-Maps-Key--"                   Center="{Binding MapCenter, Mode=TwoWay}"                   ZoomLevel="{Binding ZoomLevel, Mode=TwoWay}">               <bing:MapItemsControl ItemsSource="{Binding Earthquakes}"                                   ItemTemplate="{StaticResource EarthquakeTemplate}" />               <bing:MapItemsControl ItemsSource="{Binding Volcanos}"                                   ItemTemplate="{StaticResource VolcanoTemplate}" />         </bing:Map>           <basic:TabControl x:Name="tabs" VerticalAlignment="Bottom" MaxHeight="25" Opacity="0.7">             <basic:TabItem Margin="90,0,-90,0" MouseLeftButtonUp="TabItem_MouseLeftButtonUp">                 <basic:TabItem.Header>                     <TextBlock x:Name="txtHeader" Text="Options"                                FontSize="13" FontWeight="Bold" />                 </basic:TabItem.Header>                   <StackPanel Orientation="Horizontal">                     <TextBlock Text="Earthquakes:" FontWeight="Bold" Margin="3" />                     <StackPanel Margin="3">                         <CheckBox Content=" &lt; 4.0"                                   IsChecked="{Binding ShowLt4, Mode=TwoWay}" />                         <CheckBox Content="4.0 - 4.9"                                   IsChecked="{Binding Show4s, Mode=TwoWay}" />                         <CheckBox Content="5.0 - 5.9"                                   IsChecked="{Binding Show5s, Mode=TwoWay}" />                     </StackPanel>                       <StackPanel Margin="10,3,3,3">                         <CheckBox Content="6.0 - 6.9"                                   IsChecked="{Binding Show6s, Mode=TwoWay}" />                         <CheckBox Content="7.0 - 7.9"                                   IsChecked="{Binding Show7s, Mode=TwoWay}" />                         <CheckBox Content="8.0 +"                                   IsChecked="{Binding ShowGe8, Mode=TwoWay}" />                     </StackPanel>                       <TextBlock Text="Other:" FontWeight="Bold" Margin="50,3,3,3" />                     <StackPanel Margin="3">                         <CheckBox Content="Volcanos"                                   IsChecked="{Binding ShowVolcanos, Mode=TwoWay}" />                     </StackPanel>                 </StackPanel>               </basic:TabItem>         </basic:TabControl>       </Grid> </UserControl> Notice that I added a VolcanoTemplate that uses a triangle-shaped Polygon to represent the Volcano locations, and I also added a second <bing:MapItemsControl /> tag to the map to bind to the Volcanos collection.  The TabControl found below the map houses the options panel that will present the user with several checkboxes so they can filter the different points based on type and other properties (i.e. Magnitude).  Initially, the TabItem is collapsed to reduce it's footprint, but the screen shot below shows the options panel expanded to reveal the available settings:     I have updated the Source Code and Live Demo to include these new features.   Happy Mapping!

    Read the article

  • Add PRISM Region Manager In Existing Navigation Window

    - by Nate Noonen
    We have a "legacy" WPF applicaton that is based on a NavigationWindow. The NavigationWindow has a fairly large ControlTemplate that houses a ContentPresenter as so: <ControlTemplate> ....snip... <ContentPresenter x:Name="PART_NavWinCP" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/> .....snip.... </ControlTemplate> What we want to do is use that ContentPresenter as the first tab and dynamically add other tabs at run time. Like this: <ControlTemplate> ....snip... <TabControl Background="Transparent" cal:RegionManager.RegionName="MainRegion" Grid.ColumnSpan="2" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"> <TabItem Header="Nav Window Content"> <ContentPresenter x:Name="PART_NavWinCP" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/> </TabItem> </TabControl> .....snip.... </ControlTemplate> Then our Modules grab the RegionName and insert their content dynamically. The issue seems to be that the PRISM region manager doesn't like that our code is in a ContentTemplate and cannot resolve the region. I have tried updating the RegionManager, adding the Region dynamically, just having a root tab control without the ContentPresenter, but I cannot get this to work. Any ideas?

    Read the article

  • XAML | When used XamlReader.Parse, not able to refer the items using the LogicalTreeHelper/VisualTre

    - by Roopesh
    Hi, I am setting the dynamic xaml (I am reading the xaml from the DB) for the content of a tab using the below statement. Tab.Content = XamlReader.Parse(xaml, ctx) After setting the content, if I try getting the children using the VisualTreeHelper, but I am not able to get. How ever I dont have this issue when I construct the xaml statically. Here is the code to reading the xaml. Dim XmlDocument = New XmlDataDocument() Dim IID As String = Nothing Dim xaml As String = Nothing Dim Tab As New TabItem Dim TempPanel As XmlNode = Nothing 'Tab.Height = 0 Try XmlDocument.Load(Directory.GetCurrentDirectory & "\Xml\AppFile.xml") pXmlDoc = XmlDocument xaml = XmlDocument.SelectSingleNode("//Grid").OuterXml Dim AsmName As String = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name Dim ctx As ParserContext = New ParserContext() ' New ParserContext() ctx.XamlTypeMapper = New XamlTypeMapper(New String() {AsmName}) ctx.XamlTypeMapper.AddMappingProcessingInstruction("src", "WpfToolkitDataGridTester", AsmName) ctx.XmlnsDictionary.Add("", "http://schemas.microsoft.com/winfx/2006/xaml/presentation") ctx.XmlnsDictionary.Add("x", "http://schemas.microsoft.com/winfx/2006/xaml") ctx.XmlnsDictionary.Add("src", "clr-namespace:WpfToolkitDataGridTester;assembly=" + AsmName) Tab.Name = "Tab" & Grid1Tab.Items.Count + 1 Tab.Header = "AppFile-1" Tab.BorderThickness = New Thickness(0) Tab.IsSelected = True Tab.Content = XamlReader.Parse(xaml, ctx) Grid1Tab.Items.Add(Tab) Return True Catch ex As Exception Throw End Try Here is the code to access the item after constructing the XAML. For i As Integer = 0 To VisualTreeHelper.GetChildrenCount(myVisual) - 1 Dim childVisual As Visual = CType(VisualTreeHelper.GetChild(myVisual, i), Visual) Select Case childVisual.DependencyObjectType.Name Case "ComboBox" AddHandler CType(childVisual, ComboBox).SelectionChanged, AddressOf ComboBox_SelectChanged Case "CheckBox" AddHandler CType(childVisual, CheckBox).Checked, AddressOf CheckBoxClicked AddHandler CType(childVisual, CheckBox).Unchecked, AddressOf CheckBoxClicked Case "RadioButton" AddHandler CType(childVisual, RadioButton).Checked, AddressOf CheckBoxClicked Case "TabControl" For Each item As System.Windows.Controls.TabItem In CType(childVisual, TabControl).Items EnumVisual(item.Content) Next End Select EnumVisual(childVisual) Next i any help is highly appreciated. Thanks,

    Read the article

  • Binding WPF menu items to WPF Tab Control Items collection

    - by William
    I have a WPF Menu and a Tab control. I would like the list of menu items to be generated from the collection of TabItems on my tab control. I am binding my tab control to a collection to generate the TabItems. I have a TabItem style that uses a ContentPresenter to display the TabItem text in a TextBlock. When I bind the tab items to my menu the menu items are blank. I assume the menu items are looking for the Header property of the TabItems which I am not using. Is there a workaround for my scenario? Is it possible to bind to the Header property of the tab item, when I do not know the number of tabs in advance? Below is a copy of my xaml declarations. Tab Control and items: <DataTemplate x:Key="ClosableTabItemTemplate"> <DockPanel HorizontalAlignment="Stretch"> <Button Command="{Binding Path=CloseWorkSpaceCommand}" Content="X" Cursor="Hand" DockPanel.Dock="Right" Focusable="False" FontFamily="Courier" FontSize="9" FontWeight="Bold" Margin="10,1,0,0" Padding="0" VerticalContentAlignment="Bottom" Width="16" Height="16" Background="Red" /> <ContentPresenter HorizontalAlignment="Center" Content="{Binding Path=DisplayName}"> <ContentPresenter.Resources> <Style TargetType="{x:Type TextBlock}"/> </ContentPresenter.Resources> </ContentPresenter> </DockPanel> </DataTemplate> <DataTemplate x:Key="WorkspacesTemplate"> <TabControl IsSynchronizedWithCurrentItem="True" ItemsSource="{Binding}" ItemTemplate="{StaticResource ClosableTabItemTemplate}" Margin="10" Background="#4C4C4C"/> </DataTemplate> My Menu <Menu Background="Transparent"> <MenuItem Style="{StaticResource TabMenuButtonStyle}" ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type TabControl}}, Path=Items}" ItemContainerStyle="{StaticResource TabMenuItem}"> </MenuItem> </Menu>

    Read the article

< Previous Page | 1 2 3 4 5 6 7  | Next Page >