Search Results

Search found 918 results on 37 pages for 'usercontrol'.

Page 11/37 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • Should I inherit from a stackpanel instead of a stack panel, grid or other UI element or UserControl

    - by Joel Barsotti
    So I'm building a peice of UI that might me in a dialog window or might be in embedded in part of a bigger page. I don't have alot of experience with WPF, but in ASP.NET you always used UserControls, because their wasn't anyt really generic UI inherit to inherit from (and in a way UserControl was just a div). My coworker has written alot of controls that inherit directly from stackpanel. That seems like a decent way of doing things. But when I went to create a control for the code I was going to write I was presented with a dialog that only included the UserControl, which I wasn't that familiar with in the context of WPF. So can someone explain to me the difference from building a control that inherits from user control vs inheriting directly from a stackPanel?

    Read the article

  • How do I apply a ViewModel to the UserControl inside of a Page?

    - by Mike
    Doing something like this: <DataTemplate DataType="{x:Type vm:AllCustomersViewModel}"> <vw:AllCustomersView /> </DataTemplate> works in a ResourceDictionary for when I want to apply a ViewModel to a UserControl as root, but how do I the same thing when I have a UserControl inside of a Page? Would I create a ResourceDictionary for all my Pages then at the top of each Page do something like: <Page.Resources> <ResourceDictionary Source="../MainWindowResources.xaml"/> </Page.Resources> Any help is greatly appreciated, thanks!

    Read the article

  • How can I get my UserControl to look like a ComboBox?

    - by NoLuke
    I have a user control containing a TextBox, ToggleButton and Popup, just like the real ComboBox. Now my problem is to style it so that it looks just like the normal ComboBox. In Blend, I can "Edit Template/Edit a Copy..." of a real ComboBox to get the bits and pieces I need to get it to look right. For one Windows theme (Aero). If the application is run on another theme (e.g Luna), the control does not change its look, it still has the Aero look. Do I have to supply a style/template for each Windows theme, or can I somehow get hold of (at run-time) the default ComboBox style and apply it to my UserControl? Instead of making a UserControl, I have tried modifying a real ComboBox to my needs, but I just couldn't get it to work. How can I replace ALL the logic of a ComboBox with my own?

    Read the article

  • Why are all objects in this extension of usercontrol null at runtime?

    - by csciguy
    All, I have a simple class. public class Container : UserControl { public bool IsClickable { get; set; } } I have a class that extends this class. public class ScrollingContainer : Container { public void Draw() { } public void Update() { } } I have a custom class, that then extends ScrollingContainer. public partial class MaskContainer : ScrollingContainer { public MaskContainer() { InitializeComponent(); } } XAML <local:ScrollingContainer x:Class="Test.Types.MaskContainer" 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:local="clr-namespace:GameObjects;assembly=GameObjects" mc:Ignorable="d" > </local:ScrollingContainer> In my mainpage.xaml, I have the following. <types:MaskContainer x:Name="maskContainer" Canvas.ZIndex="1" Width="Auto" Height="Auto"> <Canvas x:Name="maskCanvas"> <Button x:Name="button1" Content="test button"/> </Canvas> </types:MaskContainer> Why, at runtime, are both maskCanvas and button1 null? maskContainer is not null. The inheritance should be straightforward here. Container inherits usercontrol. Scrollable container inherits container. Mask Container inherits scrollable container. Why am I losing the fucntionality of the original base class at this level? Is it incorrect to add the element (button1) to the maskcontainer inside of the main.xaml? My end goal is to create a container that is reusable, but inherits all properties/methods that I've specified throughout the chain. Any help is appreciated.

    Read the article

  • Can a storyboard access the UserControl that it resides in?

    - by Jeremy
    I have a usercontrol, and I want a storyboard inside the user control to fade the user control out. Using Expression Blend, I can create the storyboard and cause it to fade the user control out, but when I run the silverlight application I get an error on FindControl stating that it can't find the control. I'm guessing the find control only searches the children of the parent, but does not look at the parent itself. Is there any way around this?

    Read the article

  • ActiveX Control with included Form

    - by cru3l
    I'm try develop an ActiveX Control in VB6. It have one UserControl and one form. And the problem that i can't call usercontrol function's (even public) from this form. I can't type something like UserControl.DoSomething 'not working It work's only if create copy of usercontrol (UserControl1, for example). But in resulting i need one ocx file (component). So i can't create another form with copy of usercontrol in project

    Read the article

  • WPF - How can I place a usercontrol over an AdornedElementPlaceholder?

    - by Kevin
    I'm trying to get the validation to not show through my custom modal dialog. I've tried setting the zindex of the dialog and and of the elements in this template. Any ideas? This is coming from a validation template: <ControlTemplate x:Key="ValidationTemplate"> <DockPanel> <TextBlock Foreground="Red" FontSize="20" Panel.ZIndex="-10">!</TextBlock> <Border Name="validationBorder" BorderBrush="Red" BorderThickness="2" Padding="1" CornerRadius="3" Panel.ZIndex="-10"> <Border.Resources> <Storyboard x:Key="_blink"> <ColorAnimationUsingKeyFrames AutoReverse="True" BeginTime="00:00:00" Storyboard.TargetName="validationBorder" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" RepeatBehavior="Forever"> <SplineColorKeyFrame KeyTime="00:00:1" Value="#00FF0000"/> </ColorAnimationUsingKeyFrames> </Storyboard> </Border.Resources> <Border.Triggers> <EventTrigger RoutedEvent="FrameworkElement.Loaded"> <BeginStoryboard Storyboard="{StaticResource _blink}" /> </EventTrigger> </Border.Triggers> <AdornedElementPlaceholder/> </Border> </DockPanel> </ControlTemplate> The dialog: <UserControl 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" x:Class="GunMiser.Controls.PendingChangesConfirmationDialog" Height="768" Width="1024" mc:Ignorable="d"> <Grid Background="White"> <Rectangle x:Name="MainRectangle" Margin="0,0,0,0" Style="{DynamicResource UserControlOverlayRectangleStyle}" Opacity="0.85"/> <Border Margin="288,250,278,288" Background="#FF868686" BorderBrush="Black" BorderThickness="1"> <Border.Effect> <DropShadowEffect Color="#FFB6B2B2"/> </Border.Effect> <TextBlock x:Name="textBlockMessage" Margin="7,29,7,97" TextWrapping="Wrap" d:LayoutOverrides="VerticalAlignment" TextAlignment="Center"/> </Border> <Button x:Name="OkButton" Click="OkButton_Click" Margin="313,0,0,328" VerticalAlignment="Bottom" Height="24" Content="Save Changes" Style="{DynamicResource GunMiserButtonStyle}" HorizontalAlignment="Left" Width="103"/> <Button Click="CancelButton_Click" Margin="453.294,0,456,328" VerticalAlignment="Bottom" Height="24" Content="Cancel Changes" Style="{DynamicResource GunMiserButtonStyle}"/> <Button Click="CancelActionButton_Click" Margin="0,0,304,328" VerticalAlignment="Bottom" Height="24" Content="Go Back" Style="{DynamicResource GunMiserButtonStyle}" HorizontalAlignment="Right" Width="114.706"/> </Grid> </UserControl> And the overall window is: <Window x:Class="GunMiser.Views.Shell" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:cal="http://www.codeplex.com/CompositeWPF" xmlns:controls="clr-namespace:GunMiser.Controls;assembly=GunMiser.Controls" Title="Gun Miser" Height="768" Width="1024"> <Canvas> <controls:PendingChangesConfirmationDialog x:Name="PendingChangesConfirmationDialog" HorizontalAlignment="Stretch" Margin="0,0,0,0" VerticalAlignment="Stretch" Width="1008" Height="730" Visibility="Collapsed" Panel.ZIndex="100" /> <ContentControl x:Name="FilterRegion" cal:RegionManager.RegionName="FilterRegion" Width="326" Height="656" Canvas.Top="32" VerticalAlignment="Top" HorizontalAlignment="Left" /> <ContentControl Name="WorkspaceRegion" cal:RegionManager.RegionName="WorkspaceRegion" Width="678" Height="726" Canvas.Left="330" VerticalAlignment="Top" HorizontalAlignment="Left"/> <Button Click="GunsButton_Click" Width="75" Height="25" Content="Guns" Canvas.Top="3" Style="{DynamicResource GunMiserButtonStyle}"/> <Button Click="OpticsButton_Click" Width="75" Height="25" Content="Optics" Canvas.Left="81" Canvas.Top="3" Style="{DynamicResource GunMiserButtonStyle}"/> <Button Click="SettingsButton_Click" Width="56" Height="28" Content="Settings" Canvas.Left="944" Style="{DynamicResource GunMiserButtonStyle}" HorizontalAlignment="Left" VerticalAlignment="Top"/> <Button Click="AccessoriesButton_Click" Width="75" Height="25" Content="Accessories" Canvas.Left="239" Canvas.Top="3" Style="{DynamicResource GunMiserButtonStyle}"/> <Button Click="AmmunitionButton_Click" Width="75" Height="25" Content="Ammunition" Canvas.Left="160" Canvas.Top="3" Style="{DynamicResource GunMiserButtonStyle}"/> </Canvas> </Window>

    Read the article

  • How to make a UserControl with a custom DefaultBackColor?

    - by Blorgbeard
    When I right-click on my custom UserControl's BackColor property in the property-grid, then click Reset, I would like the BackColor property to change to (for example) Color.LightGreen, and the property value to appear un-bolded, to indicate that it is the default value. Currently, I know I can do this: public override void ResetBackColor() { BackColor = Color.LightGreen; } Which works as far as setting it to LightGreen on reset. But it still appears bolded in the property-grid, indicating that the current value is not the default. I notice that the Control class has a static read-only property, DefaultBackColor. Unfortunately, since it's static, I cannot override it. Is there some way to get all the functionality I want?

    Read the article

  • Caching Web UserControl by Propety is not working (Grr!)

    - by PapillonUK
    Here's my code behind: <PartialCaching(60, Nothing, "UsrCtl_WebUserControl.CacheString", Nothing, True)> _ Partial Class UsrCtl_WebUserControl Inherits System.Web.UI.UserControl Private _CacheString As String Public Property CacheString() As String Get Return _CacheString End Get Set(ByVal value As String) _CacheString = value End Set End Property End Class Here's the user control embedded in a page: <uc:wuc ID="wuc" runat="server" CacheString="A" /> And in another page: <uc:wuc ID="wuc" runat="server" CacheString="B" /> According to the docs this control should maintain a different, 60 second cached version for each value of the CacheString property. It doesn't work - it caches for 60 seconds, but only one cached copy is created regardless of what I put in the CacheString property. Anyone any ideas what i'm doing wrong? - After 4 hours of this I have no hair or nails left - please save my monitor from the brick.

    Read the article

  • Is it good to create a usercontrol for Recursive code in xaml?

    - by user281947
    <Border BorderBrush="#C4C8CC" BorderThickness="0,0,0,1"> <TextBlock x:Name="SectionTitle" FontFamily="Trebuchet MS" FontSize="14" FontWeight="Bold" Foreground="#3D3D3D" /> </Border> I have to use the same above format at many places in a single xaml page, so for this i created a usercontrol and defined the above code inside it. So my question is, What i am doing is it right approach? Will it make the page to load slower then the above code used as it is without defining it in a new user control?

    Read the article

  • Is it good to create a usercontrol for Recurrsive code in xaml?

    - by user281947
    <Border BorderBrush="#C4C8CC" BorderThickness="0,0,0,1"> <TextBlock x:Name="SectionTitle" FontFamily="Trebuchet MS" FontSize="14" FontWeight="Bold" Foreground="#3D3D3D" /> </Border> I have to use the same above format at many places in a single xaml page, so for this i created a usercontrol and defined the above code inside it. So my question is, what i am doing is it right approach ? Will it make the page to load slower then the above code used as it is without defining it in a new user control?

    Read the article

  • How best to embed multiple Flash Player instances using swfobject via a usercontrol?

    - by panamack
    I have a ListView on a Page within a MasterPage and some very ugly ugly autogenerated IDs. Such as..."ctl00_workbenchPlaceHolder_ListView1_ctrl1_LibItem2One" Using swfobject.embedSWF(...) requires me to hand over the id of a div on my page that can be replaced with object/embed markup depending on the browser context. My aim is to show the user a collection of video's they have uploaded to their website so they can review them and change some related data if desired. Hence the ListView which is populated via a SQLDataSource which currently provides a number of URLs pointing to .flv files. But it ain't gonna work if I put a <div id="replaceme"></div>' in my user control because I may then have more than one id="replaceme" and poor swfobject won't like it. So my evil solution is to put an <asp:Literal> in my usercontrol and build the script, function name and div tag id as a string. ApplyVideoConfiguration is called if the library object retreived from the database is a video and switches to the relevant View of a MultiView control. protected void ApplyVideoConfiguration() { MultiViewLibItem.ActiveViewIndex = 3; string functionName = "MakeFlashFor_" + this.ClientID; string divId = "fp" + this.ClientID; VideoScriptLiteral.Text = "<script type=\"text/javascript\">" + "Sys.Application.add_load(" + functionName + ");" + "function " + functionName + "(){" + "swfobject.embedSWF('PanamaVideoThumbnail.swf', '" + divId + "', '140', '127', '10');" + "};" + "</script>" + "<div id=\"" + divId + "\" ></div>" ; } I was wondering, just how bad a solution is this, I'm really completely inexperienced when it comes to best practices but my instincts are telling me this is bad, although it does succeed in the aim of embedding some Flash Player instances. Can anyone help me make it beautiful?

    Read the article

  • Error when using StaticResource

    - by James Hay
    Hi, I'm getting this error Attribute {StaticResource StoryboardIntroAnimation} value is out of range when I try and use a staic resource as the Storyboard property of a BeginStoryboard object. The markup looks a little like this: <UserControl ...> <UserControl.Resources> <Storyboard x:Key="StoryboardIntroAnimation"> ... </Storyboard> </UserControl.Resources> <UserControl.Triggers> <EventTrigger> <EventTrigger.Actions> <BeginStoryboard Storyboard="{StaticResource StoryboardIntroAnimation}" /> </EventTrigger.Actions> </EventTrigger> </UserControl.Triggers> ... </UserControl> Does anyone know why this is happening?

    Read the article

  • WPF: Change padding depending of container ?

    - by Alex Ilyin
    I have UserControl named MyUserControl, and another UserControl named MyContainer. I want MyUserControl to have padding 10 if it is placed inside MyContainer and 15 otherwise. Shortly, I want <MyContainer> <MyUserControl> Hello </MyUserControl> </MyContainer> to look like <MyContainer> <UserControl Padding="10"> Hello </UserControl> <MyContainer> and <MyUserControl> Hello </MyUserControl> to look like <UserControl Padding="15"> Hello </UserControl>

    Read the article

  • Access functions from user control without events?

    - by BornToCode
    I have an application made with usercontrols and a function on main form that removes the previous user controls and shows the desired usercontrol centered and tweaked: public void DisplayControl(UserControl uControl) I find it much easier to make this function static or access this function by reference from the user control, like this: MainForm mainform_functions = (MainForm)Parent; mainform_functions.DisplayControl(uc_a); You probably think it's a sin to access a function in mainform, from the usercontrol, however, raising an event seems much more complex in such case - I'll give a simple example - let's say I raise an event from usercontrol_A to show usercontrol_B on mainform, so I write this: uc_a.show_uc_b+= (s,e) => { usercontrol_B uc_b = new usercontrol_B(); DisplayControl(uc_b); }; Now what if I want usercontrol_B to also have an event to show usercontrol_C? now it would look like this: uc_a.show_uc_b+= (s,e) => { usercontrol_B uc_b = new usercontrol_B(); DisplayControl(uc_b); uc_b.show_uc_c += (s2,e2) => {usercontrol_C uc_c = new usercontrol_C(); DisplayControl(uc_c);} }; THIS LOOKS AWFUL! The code is much simpler and readable when you actually access the function from the usercontrol itself, therefore I came to the conclusion that in such case it's not so terrible if I break the rules and not use events for such general function, I also think that a readable usercontrol that you need to make small adjustments for another app is preferable than a 100% 'generic' one which makes my code look like a pile of mud. What is your opinion? Am I mistaken?

    Read the article

  • C#.NET: How to update multiple .NET pages when a particular event occurs in one .Net page? In another words how to use Observer pattern(Publish and subscribe to events)

    Problem: Suppose you have a scenario in which you have to update multiple pages when an event occurs in main page. For example imagine you have a main page where you are dispalying a tab control. This tab control has 3 tab pages where you are loading 3 different user controls. On click of an update button in main page imagine if you have do something in all the 3 tab panels. In other words an event in main page has to be handled in many other pages. An event in main page which contains the tab control has to be handled in all the tab panels(user controls) Answer: Use Observer pattern Define a base page for the page that contains the tab control. Main page which contains the tab: Baseline_Baseline Basepage for the above main page: BaselineBasePage User control that has to be udpated for an event in main page: Baseline_PriorNonDeloitte Source Code: public class BaselineBasePage : System.Web.UI.Page { IList lstControls = new List(); public void Add(IObserver userControl) { lstControls.Add(userControl); } public void Remove(IObserver userControl) { lstControls.Remove(userControl); } public void RemoveAllUserControls() { lstControls.Clear(); } public void Update(SaveEventArgs e) { foreach (IObserver LobjControl in lstControls) { LobjControl.Save(e); } } } public interface IObserver { void Update(SaveEventArgs e); } public partial class Baseline_Baseline : BaselineBasePage { . . . this.Add(_ucPI); this.Add(_ucPI1); protected void abActionBar_saveClicked(object sender, EventArgs e) { SaveEventArgs se = new SaveEventArgs(); se.TabType = (BaselineTabType)tcBaseline.ActiveTabIndex; this.Update(se); } } Public class Baseline_PriorNonDeloitte : System.Web.UI.UserControl,IObserver { public void Update(SaveEventArgs e) { } } More info at: http://www.dofactory.com/Patterns/PatternObserver.aspx span.fullpost {display:none;}

    Read the article

  • Programatically loading user controls

    - by PhilSando
    Today's little problem is that I am trying to load user controls from my codebehind like so: Dim myControl As UserControl = Page.LoadControl("~\Modules\Content.ascx")              Controls.Add(myControl)  On running the page myControl is no where to be seen. I wonder why that is? Well after a bit of thought the following come to mind... Am I using the correct code to insert the usercontrol? Is there an alternative available? Does the fact that the usercontrol has a page_load method make a difference? Does the fact that the usercontrol is being called from the page_init method make a difference? Do I need to register the control in my aspx page at design time? I'll be looking to answer these questions as the day goes on!

    Read the article

  • Philosophy of scroll bars [closed]

    - by Parkhid
    Please suppose I want to design my own text editor . simply like notepad. Without using any richtextbox or other controls LIKE EDIT in C++. Main Handle is just a window in C++ or usercontrol in C#. The Question is here for scrolling option , how can I perform scrolling when user is typing. I mean vertical scrolling here . What is Philosophy of works of scroll bars in C++ windows or C# user controls ? Should I Clear the (Usercontrol or Window) When User reaches to end of (Usercontrol or Window) and then Put caret on start of (Usercontrol or Window) ? What about scrolling with thumb or hand scrolling ? How can I find the Text Position which scroll to ?

    Read the article

  • C#.NET: How to update multiple .NET pages when a particular event occurs in one .Net page? In another words how to use Observer pattern(Publish and subscribe to events)

    Problem: Suppose you have a scenario in which you have to update multiple pages when an event occurs in main page. For example imagine you have a main page where you are dispalying a tab control. This tab control has 3 tab pages where you are loading 3 different user controls. On click of an update button in main page imagine if you have do something in all the 3 tab panels. In other words an event in main page has to be handled in many other pages. An event in main page which contains the tab control has to be handled in all the tab panels(user controls) Answer: Use Observer pattern Define a base page for the page that contains the tab control. Main page which contains the tab: Baseline_Baseline Basepage for the above main page: BaselineBasePage User control that has to be udpated for an event in main page: Baseline_PriorNonDeloitte Source Code: public class BaselineBasePage : System.Web.UI.Page { IList lstControls = new List(); public void Add(IObserver userControl) { lstControls.Add(userControl); } public void Remove(IObserver userControl) { lstControls.Remove(userControl); } public void RemoveAllUserControls() { lstControls.Clear(); } public void Update(SaveEventArgs e) { foreach (IObserver LobjControl in lstControls) { LobjControl.Save(e); } } } public interface IObserver { void Update(SaveEventArgs e); } public partial class Baseline_Baseline : BaselineBasePage { . . . this.Add(_ucPI); this.Add(_ucPI1); protected void abActionBar_saveClicked(object sender, EventArgs e) { SaveEventArgs se = new SaveEventArgs(); se.TabType = (BaselineTabType)tcBaseline.ActiveTabIndex; this.Update(se); } } Public class Baseline_PriorNonDeloitte : System.Web.UI.UserControl,IObserver { public void Update(SaveEventArgs e) { } } More info at: http://www.dofactory.com/Patterns/PatternObserver.aspx span.fullpost {display:none;}

    Read the article

  • Databinding between UserControls?

    - by Dave
    I've got a situation where one of my UserControls would like to display a list of strings in a droplist, and the ItemsSource is set to another UserControl's ObservableCollection. The consumer of this data has its droplist defined in XAML like this: <ComboBox Grid.Column="1" SelectedItem="{Binding MyItem, Mode=TwoWay}" ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.MyItems}" Margin="3"></ComboBox> MyItems is defined as an ObservableCollection<string> in the producer UserControl. Now everything works fine when the controls are loaded. As long as MyItems is populated first, and then the consumer UserControl is displayed, all of the items are there. I obviously don't get any errors in the Output Window or anything like that. The issue I have is that when the ObservableCollection is modified, those changes are not reflected in the consumer UserControl! I've never had this problem before, but all of my previous uses of ObservableCollection with updating the collection are within a single control, and databinding is not inter-UserControl. Is there something I did wrong? Is there a good way to actually debug this? Reed Copsey indicates here that inter-UserControl databinding is possible. Unfortunately, my favorite Bea Stollnitz article on WPF databinding debugging doesn't suggest anything that I could use for this particular problem.

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >