Search Results

Search found 136 results on 6 pages for 'bindable'.

Page 1/6 | 1 2 3 4 5 6  | Next Page >

  • Bindable richTextBox still hanging in memory {WPF, Caliburn.Micro}

    - by Paul
    Hi, I use in WFP Caliburn.Micro Framework. I need bindable richTextbox for Document property. I found many ways how do it bindable richTextBox. But I have one problem. From parent window I open child window. Child window consist bindable richTextBox user control. After I close child window and use memory profiler view class with bindabelrichTextBox control and view model class is still hanging in memory. - this cause memory leaks. If I use richTextBox from .NET Framework or richTextBox from Extended WPF Toolkit it doesn’t cause this memory leak problem. I can’t identified problem in bindable richTextBox class. Here is ist class for bindable richTextBox: Base class can be from .NET or Extended toolkit. /// <summary> /// Represents a bindable rich editing control which operates on System.Windows.Documents.FlowDocument /// objects. /// </summary> public class BindableRichTextBox : RichTextBox { /// <summary> /// Identifies the <see cref="Document"/> dependency property. /// </summary> public static readonly DependencyProperty DocumentProperty = DependencyProperty.Register("Document", typeof(FlowDocument), typeof(BindableRichTextBox)); /// <summary> /// Initializes a new instance of the <see cref="BindableRichTextBox"/> class. /// </summary> public BindableRichTextBox() : base() { } /// <summary> /// Initializes a new instance of the <see cref="BindableRichTextBox"/> class. /// </summary> /// <param title="document">A <see cref="T:System.Windows.Documents.FlowDocument"></see> to be added as the initial contents of the new <see cref="T:System.Windows.Controls.BindableRichTextBox"></see>.</param> public BindableRichTextBox(FlowDocument document) : base(document) { } /// <summary> /// Raises the <see cref="E:System.Windows.FrameworkElement.Initialized"></see> event. This method is invoked whenever <see cref="P:System.Windows.FrameworkElement.IsInitialized"></see> is set to true internally. /// </summary> /// <param title="e">The <see cref="T:System.Windows.RoutedEventArgs"></see> that contains the event data.</param> protected override void OnInitialized(EventArgs e) { // Hook up to get notified when DocumentProperty changes. DependencyPropertyDescriptor descriptor = DependencyPropertyDescriptor.FromProperty(DocumentProperty, typeof(BindableRichTextBox)); descriptor.AddValueChanged(this, delegate { // If the underlying value of the dependency property changes, // update the underlying document, also. base.Document = (FlowDocument)GetValue(DocumentProperty); }); // By default, we support updates to the source when focus is lost (or, if the LostFocus // trigger is specified explicity. We don't support the PropertyChanged trigger right now. this.LostFocus += new RoutedEventHandler(BindableRichTextBox_LostFocus); base.OnInitialized(e); } /// <summary> /// Handles the LostFocus event of the BindableRichTextBox control. /// </summary> /// <param title="sender">The source of the event.</param> /// <param title="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param> void BindableRichTextBox_LostFocus(object sender, RoutedEventArgs e) { // If we have a binding that is set for LostFocus or Default (which we are specifying as default) // then update the source. Binding binding = BindingOperations.GetBinding(this, DocumentProperty); if (binding.UpdateSourceTrigger == UpdateSourceTrigger.Default || binding.UpdateSourceTrigger == UpdateSourceTrigger.LostFocus) { BindingOperations.GetBindingExpression(this, DocumentProperty).UpdateSource(); } } /// <summary> /// Gets or sets the <see cref="T:System.Windows.Documents.FlowDocument"></see> that represents the contents of the <see cref="T:System.Windows.Controls.BindableRichTextBox"></see>. /// </summary> /// <value></value> /// <returns>A <see cref="T:System.Windows.Documents.FlowDocument"></see> object that represents the contents of the <see cref="T:System.Windows.Controls.BindableRichTextBox"></see>.By default, this property is set to an empty <see cref="T:System.Windows.Documents.FlowDocument"></see>. Specifically, the empty <see cref="T:System.Windows.Documents.FlowDocument"></see> contains a single <see cref="T:System.Windows.Documents.Paragraph"></see>, which contains a single <see cref="T:System.Windows.Documents.Run"></see> which contains no text.</returns> /// <exception cref="T:System.ArgumentException">Raised if an attempt is made to set this property to a <see cref="T:System.Windows.Documents.FlowDocument"></see> that represents the contents of another <see cref="T:System.Windows.Controls.RichTextBox"></see>.</exception> /// <exception cref="T:System.ArgumentNullException">Raised if an attempt is made to set this property to null.</exception> /// <exception cref="T:System.InvalidOperationException">Raised if this property is set while a change block has been activated.</exception> public new FlowDocument Document { get { return (FlowDocument)GetValue(DocumentProperty); } set { SetValue(DocumentProperty, value); } } } Thank fro help and advice. Qucik example: Child window with .NET richTextBox <Window x:Class="WpfApplication2.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> <RichTextBox Background="Green" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" FontSize="13" Margin="4,4,4,4" Grid.Row="0"/> </Grid> </Window> This window I open from parent window: var w = new Window1(); w.Show(); Then close this window, check with memory profiler and it memory doesn’t exist any object of window1 - richTextBox. It’s Ok. But then I try bindable richTextBox: Child window 2: <Window x:Class="WpfApplication2.Window2" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Controls="clr-namespace:WpfApplication2.Controls" Title="Window2" Height="300" Width="300"> <Grid> <Controls:BindableRichTextBox Background="Red" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" FontSize="13" Margin="4,4,4,4" Grid.Row="0" /> </Grid> </Window> Open child window 2, close this child window and in memory are still alive object of this child window also bindable richTextBox object.

    Read the article

  • Combine Hibernate class with @Bindable for SwingBuilder without Griffon?

    - by Misha Koshelev
    Dear All: I have implemented a back-end for my application in Groovy/Gradle, and am now trying to implement a GUI. I am using Hibernate for my data storage (with HSQLDB) per http://groovy.codehaus.org/Using+Hibernate+with+Groovy (with Jasypt for encryption) and it is working quite well. I was wondering if there are any good tips for using @Bindable with, e.g., an @Entity class such as @Entity class Book { @Id @GeneratedValue(strategy = GenerationType.AUTO) public Long id @OneToMany(cascade=CascadeType.ALL) public Set<Author> authors public String title String toString() { "$title by ${authors.name.join(', ')}" } } or if I am: (i) asking for Griffon (ii) completely on the wrong track? Thank you! Misha

    Read the article

  • RadGrid OnNeedDataSource when the returned datasource is empty, I get a "Cannot find any bindable pr

    - by Matt
    RadGrid OnNeedDataSource when the returned datasource is empty (not null), I get a "Cannot find any bindable properties in an item from the datasource" This is how I have my RadGrid defined in the ASP markup <telerik:RadGrid runat="server" ID="RadGridSearchResults" AllowFilteringByColumn="false" ShowStatusBar="true" AllowPaging="True" AllowSorting="true" VirtualItemCount="10000" AllowCustomPaging="True" OnNeedDataSource="RadGridSearchResults_NeedDataSource" Skin="Default" GridLines="None" ShowGroupPanel="false" GroupLoadMode="Client"> <MasterTableView Width="100%" > <NoRecordsTemplate> <asp:Label ID="LabelNoRecords" runat="server" Text="No Results Found for your Query"/> </NoRecordsTemplate> </MasterTableView> <PagerStyle Mode="NextPrevAndNumeric" /> <FilterMenu EnableTheming="True"> <CollapseAnimation Duration="200" Type="OutQuint" /> </FilterMenu> </telerik:RadGrid> Here is my OnNeedDataSource protected void RadGridSearchResults_NeedDataSource(object source, GridNeedDataSourceEventArgs e) { RadGridSearchResults.DataSource = GetSearchResults(); } And here is my GetSearchResults() private DataTable GetSearchResults() { DataTable dataTableResults = new DataTable(); // Get my data results -- When I get no results, I have a datable with 0 rows return dataTableResults; } This works great when I have results in my DataSet and other tables of mine setup similarly work with the NoRecordsTemplate tag when results are empty. Any clue?

    Read the article

  • Ninject WithConstructorArgument : No matching bindings are available, and the type is not self-bindable

    - by Jean-François Beauchamp
    My understanding of WithConstructorArgument is probably erroneous, because the following is not working: I have a service, lets call it MyService, whose constructor is taking multiple objects, and a string parameter called testEmail. For this string parameter, I added the following Ninject binding: string testEmail = "[email protected]"; kernel.Bind<IMyService>().To<MyService>().WithConstructorArgument("testEmail", testEmail); However, when executing the following line of code, I get an exception: var myService = kernel.Get<MyService>(); Here is the exception I get: Error activating string No matching bindings are available, and the type is not self-bindable. Activation path: 2) Injection of dependency string into parameter testEmail of constructor of type MyService 1) Request for MyService Suggestions: 1) Ensure that you have defined a binding for string. 2) If the binding was defined in a module, ensure that the module has been loaded into the kernel. 3) Ensure you have not accidentally created more than one kernel. 4) If you are using constructor arguments, ensure that the parameter name matches the constructors parameter name. 5) If you are using automatic module loading, ensure the search path and filters are correct. What am I doing wrong here? UPDATE: Here is the MyService constructor: [Ninject.Inject] public MyService(IMyRepository myRepository, IMyEventService myEventService, IUnitOfWork unitOfWork, ILoggingService log, IEmailService emailService, IConfigurationManager config, HttpContextBase httpContext, string testEmail) { this.myRepository = myRepository; this.myEventService = myEventService; this.unitOfWork = unitOfWork; this.log = log; this.emailService = emailService; this.config = config; this.httpContext = httpContext; this.testEmail = testEmail; } I have standard bindings for all the constructor parameter types. Only 'string' has no binding, and HttpContextBase has a binding that is a bit different: kernel.Bind<HttpContextBase>().ToMethod(context => new HttpContextWrapper(new HttpContext(new MyHttpRequest("", "", "", null, new StringWriter())))); and MyHttpRequest is defined as follows: public class MyHttpRequest : SimpleWorkerRequest { public string UserHostAddress; public string RawUrl; public MyHttpRequest(string appVirtualDir, string appPhysicalDir, string page, string query, TextWriter output) : base(appVirtualDir, appPhysicalDir, page, query, output) { this.UserHostAddress = "127.0.0.1"; this.RawUrl = null; } }

    Read the article

  • binding to arraycollection does not work

    - by ron
    Hi, I am using flex SDK 3.5. I have model.as and in it i have an ArrayCollection (name it arr_mod) which is Bindable. From my mxml i link to this arr_mod in two ways: 1) in DataGrid i set dataprovider={arr_mode} ... 2) in Button i add new item to the arr_mod this way: 3) in textBox i want to add mx:TextBox text="{mySpecialCounterFunc(arr_mod)}" note that in the Script of mxml arr_mod is Bindable as well as in the class definition in model.as The problem is, that when clicking on button, mySpecialCounterFunc is not called! it should be called, since i use {} and this should listen to changes in arr_mod (a change that was made in the button should cause a new item to be added.. and than the listener to respond). While The DataGrid is updated correctly! Why??

    Read the article

  • SelectedItem of listbox - BindableCollection is binded on listbox

    - by user572844
    Hi, I bind BindableCollection from caliburn micro on listbox. Also I bind selected listbox item on property in view model. After I select some item on listbox, property SelectedFriedn which is bind on SelectedItem of listbox is still null. Code from view model: private BindableCollection<UserInfo> _friends; //bind on listbox public BindableCollection<UserInfo> Friends { get { return _friends; } set { _friends = value; NotifyOfPropertyChange(() => Friends); } } private UserInfo _selectedFriend = new UserInfo(); //bind on SelectedItem property of listbox public UserInfo SelectedFriend { get { return _selectedFriend; } set { _selectedFriend = value; NotifyOfPropertyChange(() => SelectedFriend); } } In view I have this: <ListBox Name="Friends" SelectedIndex="{Binding Path=SelectedFriendsIndex,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" SelectedItem="{Binding Path=SelectedFriend, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" Style="{DynamicResource friendsListStyle}" IsTextSearchEnabled="True" TextSearch.TextPath="Nick" Grid.Row="2" Margin="4,4,4,4" PreviewMouseRightButtonUp="ListBox_PreviewMouseRightButtonUp" PreviewMouseRightButtonDown="ListBox_PreviewMouseRightButtonDown" MouseRightButtonDown="ListBox_MouseRightButtonDown" Micro:Message.Attach="[MouseDoubleClick]=[Action OpenChatScreen()]" > Where can be problem?

    Read the article

  • BindableAttribute, Combobox, Selectedvalue property - WinForms

    - by user63891
    I am deriving from combobox (WinForms) and am providing a new implementation for the Selectedvalue property. It works fine as is, but any change to the selectedvalue property is not updating other controls bound to the same "binding context" to change their values accordingly. I did try adding the BindableAttribute(true) to the property, but still it does nottrigger the change in value to the other linked controls. The control's DataBindings.add(...) is all set up. And other controls are also bound to the same data filed on the same datasource. Any ideas what i am doing wrong.

    Read the article

  • Is it okay if my ViewModel 'creates' bindable user controls for my View?

    - by j0rd4n
    I have an entry-point View with a tab control. Each tab is going to have a user control embedded within it. Each embedded view inherits from the same base class and will need to be updated as a key field on the entry-point view is updated. I'm thinking the easiest way to design this page is to have the entry-point ViewModel create and expose a collection of the tabbed views so the entry-point View can just bind to the user control elements using a DataTemplate on the tab control. Is it okay for a ViewModel to instantiate and provide UI elements for its View?

    Read the article

  • Rendering MXML component only after actionscript is finished

    - by basicblock
    In my mxml file, I'm doing some calculations in the script tag, and binding them to a custom component. <fx:Script> <![CDATA[ [Bindable] public var calc1:Number; [Bindable] public var calc2:Number; private function init():void { calc1 = //calculation; calc2 = //calculation; } ]]> </fx:Script> <mycomp:Ball compfield1="{calc1}" compfield2="{calc2}"/> The problem is that the mxml component is being created before the actionscript is run. So when the component is created, it actually doesn't get calc1 and calc2 and it fails from that point. I know that binding happens after that, but the component and its functions have already started and have run with the null or 0 initial values. My solution was to create the component also in actionscript right after calc1 and calc2 have been created. This way I get to control precisely when it's created <fx:Script> <![CDATA[ [Bindable] public var calc1:Number; [Bindable] public var calc2:Number; private function init():void { calc1 = //calculation; calc2 = //calculation; var Ball:Ball = new Ball(calc1, calc2); } ]]> </fx:Script> but this is creating all kinds of other problems due to the way I've set up the component. Is there a way I can still use mxml to create the component, yet control that it the <myComp:Ball> gets created only after init() is run and calc1 calc2 evaluated?

    Read the article

  • Flex ChangeWatcher bind to a negative condition

    - by bedwyr
    I have a bindable getter in a component which informs me when a [hidden] timer is running. I also have a context menu which, if this timer is running, should disable one of the menu items. Is it possible to create a ChangeWatcher which watches for the negative condition of a bindable property/getter and changes the enabled property of the menu item? Here are the basic methods I'm trying to bind together: Class A: [Bindable] public function get isPlaying():Boolean { return (_timer != null) ? _timer.running : false; } Class B: private var _playingWatcher:ChangeWatcher; public function createContextMenu():void { //...blah blah, creating context menu var newItem:ContextMenuItem = new ContextMenuItem(); _playingWatcher = BindingUtils.bindProperty(newItem, "enabled", _classA, "isPlaying"); } In the code above, I have the inverse case: when isPlaying() is true, the menu item is enabled; I want it to only be enabled when the condition is false. I could create a second getter (there are other bindings which rely on the current getter) to return the inverse condition, but that sounds ugly to me: [Bindable] public function get isNotPlaying():Boolean { return !isPlaying; } Is this possible, or is there another approach I'm completely missing?

    Read the article

  • Having trouble with binding

    - by Tam
    I'm not sure if I'm misunderstanding the binding in Flex. I'm using Cairngorm framework. I have the following component with code like: [Bindable] var _model:LalModelLocator = LalModelLocator.getInstance(); .... <s:DataGroup dataProvider="{_model.friendsSearchResults}" includeIn="find" itemRenderer="com.lal.renderers.SingleFriendDisplayRenderer"> <s:layout> <s:TileLayout orientation="columns" requestedColumnCount="2" /> </s:layout> </s:DataGroup> in the model locator: [Bindable] public var friendsSearchResults:ArrayCollection = new ArrayCollection(); Inside the item renderer there is a button that calls a command and inside the command results there is a line like this: model.friendsSearchResults = friendsSearchResults; Putting break points and stepping through the code I confirmed that this like gets called and the friendsSearchResults gets updated. To my understanding if I update a bindable variable it should automatically re-render the s:DataGroup which has a dataProvider of that variable.

    Read the article

  • Silverlight Cream for March 05, 2011 -- #1053

    - by Dave Campbell
    In this all-sumbittal (while I was at MVP11) Issue: Michael Washington(-2-), goldytech, JFo, Andrea Boschin, Jonathan Marbutt, Gregor Biswanger, Michael Wolf, and Peter Kuhn. Above the Fold: Silverlight: "A Simple Bindable CheckboxList Control" Jonathan Marbutt WP7: "Struggles with the Panorama Control" JFo Lightswitch: "HTML (including HTML 5) and LightSwitch at the same time?" Michael Washington From SilverlightCream.com: LightSwitch vs HTML 5 ? In his first post-MVP11 post, Michael Washington takes on HTML5 with a Lightswitch discussion. Good discussion follows in the comments also. HTML (including HTML 5) and LightSwitch at the same time? Michael Washington's 2nd post is a great tutorial on creating a re-usable business layer with Lightswitch... all good stuff, and look for more from Michael as Lightswitch matures. How to add Computed Properties in WCF Ria Services on client goldytech has a new post up about providing real-time solutions to client-side calculations with WCF RIA services. Struggles with the Panorama Control JFo details a problem he had with the Panorama control on WP7... detailing 4 problems she had and her solutions... well thought-out explanations too.. a definite good read... and another blogger to add to my list! Windows Phone 7 - Part #7: Understanding Push Notifications Andrea Boschin has part 7 of his WP7 series up at SilverlightShow, concentrating on Push Notifications this time out... great explanation of push notifications in this tutorial from the service and phone side with a working sample to boot. A Simple Bindable CheckboxList Control Jonathan Marbutt took a completely different direction than most and created his own Bindable CheckboxList by starting with ContentControl rather than a Listbox as most do... pretty cool and all the source. Own routed events in Silverlight I met Gregor Biswanger at the MVP Summit and asked him to send me his blog run through Microsoft Translator ... here's a great post on routed events he did back in November... and a discussion of his CallMethodAction Behavior... which looks like another good post subject! Creating a Silverlight Out-of-Browser Splash Screen Michael Wolf has a post up discussing OOB splash screens... I like his "White screen of Awesome" definition ... I'm very familiar with that :) ... check out his solution for getting around that white screen, and lots of external links too. XNA for Silverlight developers: Part 5 - Input (touch + gestures) Peter Kuhn has Part 5 in his tutorial series on XNA for Silverlight devs up at SilverlightShow... this time covering touch and gestures ... how to enable and read gestures, and the difference between Silverlight and XNA in the touch department. Stay in the 'Light! Twitter SilverlightNews | Twitter WynApse | WynApse.com | Tagged Posts | SilverlightCream Join me @ SilverlightCream | Phoenix Silverlight User Group Technorati Tags: Silverlight    Silverlight 3    Silverlight 4    Windows Phone MIX10

    Read the article

  • customizing into a reusable component in flex

    - by Fresher4Flex
    need to make a reusable custom component from the existing code here. So that I can use this code to make this effect(view stack) to work in any direction. In the code it has user specified height and works from downside. I need to make this component customizable, something like user is able do it in any direction.I need it urgently. I appreciate your help. 1)main Application: <?xml version="1.0" encoding="utf-8"?> <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:sh="windowShade.*"> <sh:Shade id="i1" height="15" headerHeight="14" thisHeight="215" alwaysOnTop="false" y="{this.height - 14}"/> </mx:WindowedApplication> 2)Custom Comp: Shade.mxml <?xml version="1.0" encoding="utf-8"?> <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="300" creationComplete="init()" verticalScrollPolicy="off" verticalGap="0" > <mx:Script> <![CDATA[ import mx.core.Container; import mx.core.Application; import mx.controls.Alert; import mx.effects.easing.*; import mx.binding.utils.BindingUtils; /** * Need host to adjust this object to Top */ public var alwaysOnTop:Boolean = false; /** * User can custom the height of this component */ public var thisHeight:int = 0; /** * User can custom the header height of this component */ [Bindable] public var headerHeight:int = 14; /** * The bindable value of this height */ [Bindable] public var tHeight:int = 0; /** * The bindable value of parent height */ [Bindable] public var pHeight:int = 0; /** * Initialize method */ private function init():void { if (this.thisHeight > 0 ) this.height = this.thisHeight; BindingUtils.bindProperty(this, "tHeight",this,"height" ); BindingUtils.bindProperty(this, "pHeight",this.parent,"height" ); } /** * Toggle button */ private function toggleBtn(e:MouseEvent):void { if (this.alwaysOnTop) { var container:Container = Application.application as Container; container.setChildIndex(this.parent, container.numChildren - 1 ); } if ( vs.selectedIndex == 0 ) panelOut.play(); else panelIn.play(); } ]]> </mx:Script> <mx:Move id="panelOut" target="{this}" yTo="{ pHeight - this.tHeight }" effectEnd="vs.selectedIndex = 1" duration="600" easingFunction="Back.easeOut"/> <mx:Move id="panelIn" target="{this}" yTo="{ this.pHeight - headerHeight }" effectEnd="vs.selectedIndex = 0" duration="600" easingFunction="Back.easeIn"/> <mx:VBox horizontalAlign="center" width="100%"> <mx:ViewStack id="vs" width="100%"> <mx:VBox horizontalAlign="center" > <mx:Label text="VBox 1"/> <mx:Image source="@Embed('/windowShade/add.png')" click="toggleBtn(event)"/> </mx:VBox> <mx:VBox horizontalAlign="center"> <mx:Label text="2nd VBox"/> <mx:Image source="@Embed('/windowShade/back.png')" click="toggleBtn(event)"/> </mx:VBox> </mx:ViewStack> </mx:VBox> <mx:VBox id="drawer" height="100%" width="100%" backgroundColor="#000000"> </mx:VBox> </mx:VBox>

    Read the article

  • WPF MVVM UserControl Binding "Container", dispose to avoid memory leak.

    - by user178657
    For simplicity. I have a window, with a bindable usercontrol <UserControl Content="{Binding Path = BindingControl, UpdateSourceTrigger=PropertyChanged}"> I have two user controls, ControlA, and ControlB, Both UserControls have their own Datacontext ViewModel, ControlAViewModel and ControlBViewModel. Both ControlAViewModel and ControlBViewModel inh. from a "ViewModelBase" public abstract class ViewModelBase : DependencyObject, INotifyPropertyChanged, IDisposable........ Main window was added to IoC... To set the property of the Bindable UC, i do ComponentRepository.Resolve<MainViewWindow>().Bindingcontrol= new ControlA; ControlA, in its Datacontext, creates a DispatcherTimer, to do "somestuff".. Later on., I need to navigate elsewhere, so the other usercontrol is loaded into the container ComponentRepository.Resolve<MainViewWindow>().Bindingcontrol= new ControlB If i put a break point in the "someStuff" that was in ControlA's datacontext. The DispatcherTimer is still running... i.e. loading a new usercontrol into the bindable Usercontrol on mainwindow does not dispose/close/GC the DispatcherTimer that was created in the DataContext View Model... Ive looked around, and as stated by others, dispose doesnt get called because its not supposed to... :) Not all my usercontrols have DispatcherTimer, just a few that need to do some sort of "read and refresh" updates./. Should i track these DispatcherTimer objects in the ViewModelBase that all Usercontrols inh. and manually stop/dispose them everytime a new usercontrol is loaded? Is there a better way?

    Read the article

  • Reading component parameters and setting defaults

    - by donut
    I'm pulling my hair on this because it should be simple, but can't get it to do the right thing. What's the best practice way of doing the following I've created a custom component that extends <s:Label> so now the Label has additional properties color2 color3 value which can be called like this and are used in the skin. <s:CustomLabel text="Some text" color2="0x939202" color3="0x999999" value="4.5" /> If I don't supply these parameters, I'd like some defaults to be set. So far I've had some success, but it doesn't work 100% of the time, which leads me to think that I'm not following best practices when setting those defaults. I do it now like this: [Bindable] private var myColor2:uint = 0x000000; [Bindable] private var myColor3:uint = 0x000000; [Bindable] private var myValue:Number = 10.0; then in the init function, I do a variation of this to set the default myValue = hostComponent.value; myValue = (hostComponent.value) ? hostComponent.value : 4.5; Sometimes it works, sometimes it doesn't, depending on the type of variable I'm trying to set. I eventually decided to read them as Strings then convert them to the desired type, but it seems that this also works half the time.

    Read the article

  • Flex List ItemRenderer with image looses BitmapData when scrolling

    - by Dominik
    Hi i have a mx:List with a DataProvider. This data Provider is a ArrayCollection if FotoItems public class FotoItem extends EventDispatcher { [Bindable] public var data:Bitmap; [Bindable] public var id:int; [Bindable] public var duration:Number; public function FotoItem(data:Bitmap, id:int, duration:Number, target:IEventDispatcher=null) { super(target); this.data = data; this.id = id; this.duration = duration; } } my itemRenderer looks like this: <?xml version="1.0" encoding="utf-8"?> <mx:VBox xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" > <fx:Script> <![CDATA[ import mx.collections.ArrayCollection; ]]> </fx:Script> <s:Label text="index"/> <mx:Image source="{data.data}" maxHeight="100" maxWidth="100"/> <s:Label text="Duration: {data.duration}ms"/> <s:Label text="ID: {data.id}"/> </mx:VBox> Now when i am scrolling then all images that leave the screen disappear :( When i take a look at the arrayCollection every item's BitmapData is null. Why is this the case?

    Read the article

  • Flex 4, chart, Error 1009

    - by Stephane
    Hello, I am new to flex development and I am stuck with this error TypeError: Error #1009: Cannot access a property or method of a null object reference. at mx.charts.series::LineSeries/findDataPoints()[E:\dev\4.0.0\frameworks\projects\datavisualization\src\mx\charts\series\LineSeries.as:1460] at mx.charts.chartClasses::ChartBase/findDataPoints()[E:\dev\4.0.0\frameworks\projects\datavisualization\src\mx\charts\chartClasses\ChartBase.as:2202] at mx.charts.chartClasses::ChartBase/mouseMoveHandler()[E:\dev\4.0.0\frameworks\projects\datavisualization\src\mx\charts\chartClasses\ChartBase.as:4882] I try to create a chart where I can move the points with the mouse I notice that the error doesn't occur if I move the point very slowly I have try to use the debugger and pint some debug every where without success All the behaviours were ok until I had the modifyData Please let me know if you have some experience with this kind of error I will appreciate any help. Is it also possible to remove the error throwing because after that the error occur if I click the dismiss all error button then the component work great there is the simple code of the chart <fx:Declarations> </fx:Declarations> <fx:Script> <![CDATA[ import mx.charts.HitData; import mx.charts.events.ChartEvent; import mx.charts.events.ChartItemEvent; import mx.collections.ArrayCollection; [Bindable] private var selectItem:Object; [Bindable] private var chartMouseY:int; [Bindable] private var hitData:Boolean=false; [Bindable] private var profitPeriods:ArrayCollection = new ArrayCollection( [ { period: "Qtr1 2006", profit: 32 }, { period: "Qtr2 2006", profit: 47 }, { period: "Qtr3 2006", profit: 62 }, { period: "Qtr4 2006", profit: 35 }, { period: "Qtr1 2007", profit: 25 }, { period: "Qtr2 2007", profit: 55 } ]); public function chartMouseUp(e:MouseEvent):void{ if(hitData){ hitData = false; } } private function chartMouseMove(e:MouseEvent):void { if(hitData){ var p:Point = new Point(linechart.mouseX,linechart.mouseY); var d:Array = linechart.localToData(p); chartMouseY=d[1]; modifyData(); } } public function modifyData():void { var idx:int = profitPeriods.getItemIndex(selectItem); var item:Object = profitPeriods.getItemAt(idx); item.profit = chartMouseY; profitPeriods.setItemAt(item,idx); } public function chartMouseDown(e:MouseEvent):void{ if(!hitData){ var hda:Array = linechart.findDataPoints(e.currentTarget.mouseX, e.currentTarget.mouseY); if (hda[0]) { selectItem = hda[0].item; hitData = true; } } } ]]> </fx:Script> <s:layout> <s:HorizontalLayout horizontalAlign="center" verticalAlign="middle" /> </s:layout> <s:Panel title="LineChart Control" > <s:VGroup > <s:HGroup> <mx:LineChart id="linechart" color="0x323232" height="500" width="377" mouseDown="chartMouseDown(event)" mouseMove="chartMouseMove(event)" mouseUp="chartMouseUp(event)" showDataTips="true" dataProvider="{profitPeriods}" > <mx:horizontalAxis> <mx:CategoryAxis categoryField="period"/> </mx:horizontalAxis> <mx:series> <mx:LineSeries yField="profit" form="segment" displayName="Profit"/> </mx:series> </mx:LineChart> <mx:Legend dataProvider="{linechart}" color="0x323232"/> </s:HGroup> <mx:Form> <mx:TextArea id="DEBUG" height="200" width="300"/> </mx:Form> </s:VGroup> </s:Panel> UPDATE 30/2010 : the null object is _renderData.filteredCache from the chartline the code call before error is the default mouseMoveHandler of chartBase to chartline. Is it possible to remove it ? or provide a filteredCache

    Read the article

  • Flex chart not displaying right values along x axis.

    - by Shah Al
    I don't know of any better way to ask this question. If the below code is run (i know the cData sections are not visible in the preview, something causes it to be ignored). The result does not represent the data correctly. 1. Flex ignores missing date 24 aug for DECKER. 2. It wrongly associates 42.77 to 23-Aug instead of 24-AUG. Is there a way in flex, where the x-axis is a union of all available points ? The below code is entirely from : Adobe website link I have only commented 2 data points. //{date:"23-Aug-05", close:45.74}, and //{date:"24-Aug-05", close:150.71}, <?xml version="1.0"?> [Bindable] public var SMITH:ArrayCollection = new ArrayCollection([ {date:"22-Aug-05", close:41.87}, //{date:"23-Aug-05", close:45.74}, {date:"24-Aug-05", close:42.77}, {date:"25-Aug-05", close:48.06}, ]); [Bindable] public var DECKER:ArrayCollection = new ArrayCollection([ {date:"22-Aug-05", close:157.59}, {date:"23-Aug-05", close:160.3}, //{date:"24-Aug-05", close:150.71}, {date:"25-Aug-05", close:156.88}, ]); [Bindable] public var deckerColor:Number = 0x224488; [Bindable] public var smithColor:Number = 0x884422; ]] <mx:horizontalAxisRenderers> <mx:AxisRenderer placement="bottom" axis="{h1}"/> </mx:horizontalAxisRenderers> <mx:verticalAxisRenderers> <mx:AxisRenderer placement="left" axis="{v1}"> <mx:axisStroke>{h1Stroke}</mx:axisStroke> </mx:AxisRenderer> <mx:AxisRenderer placement="left" axis="{v2}"> <mx:axisStroke>{h2Stroke}</mx:axisStroke> </mx:AxisRenderer> </mx:verticalAxisRenderers> <mx:series> <mx:ColumnSeries id="cs1" horizontalAxis="{h1}" dataProvider="{SMITH}" yField="close" displayName="SMITH" > <mx:fill> <mx:SolidColor color="{smithColor}"/> </mx:fill> <mx:verticalAxis> <mx:LinearAxis id="v1" minimum="40" maximum="50"/> </mx:verticalAxis> </mx:ColumnSeries> <mx:LineSeries id="cs2" horizontalAxis="{h1}" dataProvider="{DECKER}" yField="close" displayName="DECKER" > <mx:verticalAxis> <mx:LinearAxis id="v2" minimum="150" maximum="170"/> </mx:verticalAxis> <mx:lineStroke> <mx:Stroke color="{deckerColor}" weight="4" alpha="1" /> </mx:lineStroke> </mx:LineSeries> </mx:series> </mx:ColumnChart> <mx:Legend dataProvider="{myChart}"/>

    Read the article

  • The Enterprise Side of JavaFX: Part Two

    - by Janice J. Heiss
    A new article, part of a three-part series, now up on the front page of otn/java, by Java Champion Adam Bien, titled “The Enterprise Side of JavaFX,” shows developers how to implement the LightView UI dashboard with JavaFX 2. Bien explains that “the RESTful back end of the LightView application comes with a rudimentary HTML page that is used to start/stop the monitoring service, set the snapshot interval, and activate/deactivate the GlassFish monitoring capabilities.”He explains that “the configuration view implemented in the org.lightview.view.Browser component is needed only to start or stop the monitoring process or set the monitoring interval.”Bien concludes his article with a general summary of the principles applied:“JavaFX encourages encapsulation without forcing you to build models for each visual component. With the availability of bindable properties, the boundary between the view and the model can be reduced to an expressive set of bindable properties. Wrapping JavaFX components with ordinary Java classes further reduces the complexity. Instead of dealing with low-level JavaFX mechanics all the time, you can build simple components and break down the complexity of the presentation logic into understandable pieces. CSS skinning further helps with the separation of the code that is needed for the implementation of the presentation logic and the visual appearance of the application on the screen. You can adjust significant portions of an application's look and feel directly in CSS files without touching the actual source code.”Check out the article here.

    Read the article

  • how to change a button into a imagebutton in asp.net c#

    - by sweetsecret
    How to change the button into image button... the button in the beginning has "Pick a date" when clicked a calender pops out and the when a date is selected a label at the bottom reading the date comes in and the text on the button changes to disabled... i want to palce a imagebutton having a image icon of the calender and rest of the function will be the same.... the code as follows: using System; using System.Collections.Generic; using System.ComponentModel; using System.Text; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; [assembly: TagPrefix("DatePicker", "EWS")] namespace EclipseWebSolutions.DatePicker { [DefaultProperty("Text")] [ToolboxData("<{0}:DatePicker runat=server")] [DefaultEvent("SelectionChanged")] [ValidationProperty("TextValue")] public class DatePicker : WebControl, INamingContainer { #region Properties public TextBox txtDate = new TextBox(); public Calendar calDate = new Calendar(); public Button btnDate = new Button(); public Panel pnlCalendar = new Panel(); private enum ViewStateConstants { ValidationGroup, RegularExpression, ErrorMessage, RegExText, CalendarPosition, FormatString, ExpandLabel, CollapseLabel, ApplyDefaultStyle, CausesValidation, } /// <summary> /// Defines the available display modes of this calendar. /// </summary> public enum CalendarDisplay { DisplayRight, DisplayBelow } /// <summary> /// Where to display the popup calendar. /// </summary> [Category("Behaviour")] [Localizable(true)] public CalendarDisplay CalendarPosition { get { if (ViewState[ViewStateConstants.CalendarPosition.ToString()] == null) { ViewState[ViewStateConstants.CalendarPosition.ToString()] = CalendarDisplay.DisplayRight; } return (CalendarDisplay)ViewState[ViewStateConstants.CalendarPosition.ToString()]; } set { ViewState[ViewStateConstants.CalendarPosition.ToString()] = value; } } /// <summary> /// Text version of the control's value, for use by ASP.NET validators. /// </summary> public string TextValue { get { return txtDate.Text; } } /// <summary> /// Holds the current date value of this control. /// </summary> [Category("Behaviour")] [Localizable(true)] [Bindable(true, BindingDirection.TwoWay)] public DateTime DateValue { get { try { if (txtDate.Text == "") return DateTime.MinValue; DateTime val = DateTime.Parse(txtDate.Text); return val; } catch (ArgumentNullException) { return DateTime.MinValue; } catch (FormatException) { return DateTime.MinValue; } } set { if (value == DateTime.MinValue) { txtDate.Text = ""; } else { txtDate.Text = value.ToShortDateString(); } } } [Category("Behavior"), Themeable(false), DefaultValue("")] public virtual string ValidationGroup { get { if (ViewState[ViewStateConstants.ValidationGroup.ToString()] == null) { return string.Empty; } else { return (string)ViewState[ViewStateConstants.ValidationGroup.ToString()]; } } set { ViewState[ViewStateConstants.ValidationGroup.ToString()] = value; } } /// <summary> /// The label of the exand button. Shown when the calendar is hidden. /// </summary> [Bindable(true)] [Category("Appearance")] [DefaultValue("PickDate")] [Localizable(true)] public string ExpandButtonLabel { get { String s = (String)ViewState[ViewStateConstants.ExpandLabel.ToString()]; return ((s == null) ? "PickDate" : s); } set { ViewState[ViewStateConstants.ExpandLabel.ToString()] = value; } } /// <summary> /// The label of the collapse button. Shown when the calendar is visible. /// </summary> [Bindable(true)] [Category("Appearance")] [DefaultValue("Disabled")] [Localizable(true)] public string CollapseButtonLabel { get { String s = (String)ViewState[ViewStateConstants.CollapseLabel.ToString()]; return ((s == null) ? "Disabled" : s); } set { ViewState[ViewStateConstants.CollapseLabel.ToString()] = value; } } /// <summary> /// Whether to apply the default style. Disable this if you want to apply a custom style, or to use themes and skins /// to style the control. /// </summary> [Category("Appearance")] [DefaultValue(true)] [Localizable(true)] public bool ApplyDefaultStyle { get { if (ViewState[ViewStateConstants.ApplyDefaultStyle.ToString()] == null) { ViewState[ViewStateConstants.ApplyDefaultStyle.ToString()] = true; } return (bool)ViewState[ViewStateConstants.ApplyDefaultStyle.ToString()]; } set { ViewState[ViewStateConstants.ApplyDefaultStyle.ToString()] = value; } } /// <summary> /// Causes Validation /// </summary> [Category("Appearance")] [DefaultValue(false)] [Localizable(false)] public bool CausesValidation { get { if (ViewState[ViewStateConstants.CausesValidation.ToString()] == null) { ViewState[ViewStateConstants.CausesValidation.ToString()] = false; } return (bool)ViewState[ViewStateConstants.CausesValidation.ToString()]; } set { ViewState[ViewStateConstants.CausesValidation.ToString()] = value; btnDate.CausesValidation = value; } } #endregion #region Events /// <summary> /// A day was selected from the calendar control. /// </summary> public event EventHandler SelectionChanged; protected virtual void OnSelectionChanged() { if (SelectionChanged != null) // only raise the event if someone is listening. { SelectionChanged(this, EventArgs.Empty); } } #endregion #region Event Handlers /// <summary> /// The +/- button was clicked. /// </summary> protected void btnDate_Click(object sender, System.EventArgs e) { if (!calDate.Visible) { // expand the calendar calDate.Visible = true; txtDate.Enabled = false; btnDate.Text = CollapseButtonLabel; if (DateValue != DateTime.MinValue) { calDate.SelectedDate = DateValue; calDate.VisibleDate = DateValue; } } else { // collapse the calendar calDate.Visible = false; txtDate.Enabled = true; btnDate.Text = ExpandButtonLabel; } } /// <summary> /// A date was selected from the calendar. /// </summary> protected void calDate_SelectionChanged(object sender, System.EventArgs e) { calDate.Visible = false; txtDate.Visible = true; btnDate.Text = ExpandButtonLabel; txtDate.Enabled = true; txtDate.Text = calDate.SelectedDate.ToShortDateString(); OnSelectionChanged(); } #endregion /// <summary> /// Builds the contents of this control. /// </summary> protected override void CreateChildControls() { btnDate.Text = ExpandButtonLabel; btnDate.CausesValidation = CausesValidation; txtDate.ID = "txtDate"; calDate.Visible = false; if (ApplyDefaultStyle) { calDate.BackColor = System.Drawing.Color.White; calDate.BorderColor = System.Drawing.Color.FromArgb(10066329); calDate.CellPadding = 2; calDate.DayNameFormat = DayNameFormat.Shortest; calDate.Font.Name = "Verdana"; calDate.Font.Size = FontUnit.Parse("8pt"); calDate.ForeColor = System.Drawing.Color.Black; calDate.Height = new Unit(150, UnitType.Pixel); calDate.Width = new Unit(180, UnitType.Pixel); calDate.DayHeaderStyle.BackColor = System.Drawing.Color.FromArgb(228, 228, 228); calDate.DayHeaderStyle.Font.Size = FontUnit.Parse("7pt"); calDate.TitleStyle.Font.Bold = true; calDate.WeekendDayStyle.BackColor = System.Drawing.Color.FromArgb(255, 255, 204); } ConnectEventHandlers(); pnlCalendar.Controls.Add(calDate); pnlCalendar.Style["position"] = "absolute"; pnlCalendar.Style["filter"] = "alpha(opacity=95)"; pnlCalendar.Style["-moz-opacity"] = ".95"; pnlCalendar.Style["opacity"] = ".95"; pnlCalendar.Style["z-index"] = "2"; pnlCalendar.Style["background-color"] = "White"; if (CalendarPosition == CalendarDisplay.DisplayBelow) { pnlCalendar.Style["margin-top"] = "27px"; } else { pnlCalendar.Style["display"] = "inline"; } Controls.Add(txtDate); Controls.Add(pnlCalendar); Controls.Add(btnDate); base.CreateChildControls(); } /// <summary> /// Render the contents of this control. /// </summary> /// <param name="output">The HtmlTextWriter to use.</param> protected override void RenderContents(HtmlTextWriter output) { switch (CalendarPosition) { case CalendarDisplay.DisplayRight: { txtDate.RenderControl(output); btnDate.RenderControl(output); pnlCalendar.RenderControl(output); break; } case CalendarDisplay.DisplayBelow: { pnlCalendar.RenderControl(output); txtDate.RenderControl(output); btnDate.RenderControl(output); break; } } } /// <summary> /// Connect event handlers to events. /// </summary> private void ConnectEventHandlers() { btnDate.Click += new System.EventHandler(btnDate_Click); calDate.SelectionChanged += new System.EventHandler(calDate_SelectionChanged); } } } using System; using System.Collections.Generic; using System.ComponentModel; using System.Text; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; [assembly: TagPrefix("DatePicker", "EWS")] namespace EclipseWebSolutions.DatePicker { [DefaultProperty("Text")] [ToolboxData("<{0}:DatePicker runat=server")] [DefaultEvent("SelectionChanged")] [ValidationProperty("TextValue")] public class DatePicker : WebControl, INamingContainer { #region Properties public TextBox txtDate = new TextBox(); public Calendar calDate = new Calendar(); public Button btnDate = new Button(); public Panel pnlCalendar = new Panel(); private enum ViewStateConstants { ValidationGroup, RegularExpression, ErrorMessage, RegExText, CalendarPosition, FormatString, ExpandLabel, CollapseLabel, ApplyDefaultStyle, CausesValidation, } /// <summary> /// Defines the available display modes of this calendar. /// </summary> public enum CalendarDisplay { DisplayRight, DisplayBelow } /// <summary> /// Where to display the popup calendar. /// </summary> [Category("Behaviour")] [Localizable(true)] public CalendarDisplay CalendarPosition { get { if (ViewState[ViewStateConstants.CalendarPosition.ToString()] == null) { ViewState[ViewStateConstants.CalendarPosition.ToString()] = CalendarDisplay.DisplayRight; } return (CalendarDisplay)ViewState[ViewStateConstants.CalendarPosition.ToString()]; } set { ViewState[ViewStateConstants.CalendarPosition.ToString()] = value; } } /// <summary> /// Text version of the control's value, for use by ASP.NET validators. /// </summary> public string TextValue { get { return txtDate.Text; } } /// <summary> /// Holds the current date value of this control. /// </summary> [Category("Behaviour")] [Localizable(true)] [Bindable(true, BindingDirection.TwoWay)] public DateTime DateValue { get { try { if (txtDate.Text == "") return DateTime.MinValue; DateTime val = DateTime.Parse(txtDate.Text); return val; } catch (ArgumentNullException) { return DateTime.MinValue; } catch (FormatException) { return DateTime.MinValue; } } set { if (value == DateTime.MinValue) { txtDate.Text = ""; } else { txtDate.Text = value.ToShortDateString(); } } } [Category("Behavior"), Themeable(false), DefaultValue("")] public virtual string ValidationGroup { get { if (ViewState[ViewStateConstants.ValidationGroup.ToString()] == null) { return string.Empty; } else { return (string)ViewState[ViewStateConstants.ValidationGroup.ToString()]; } } set { ViewState[ViewStateConstants.ValidationGroup.ToString()] = value; } } /// <summary> /// The label of the exand button. Shown when the calendar is hidden. /// </summary> [Bindable(true)] [Category("Appearance")] [DefaultValue("PickDate")] [Localizable(true)] public string ExpandButtonLabel { get { String s = (String)ViewState[ViewStateConstants.ExpandLabel.ToString()]; return ((s == null) ? "PickDate" : s); } set { ViewState[ViewStateConstants.ExpandLabel.ToString()] = value; } } /// <summary> /// The label of the collapse button. Shown when the calendar is visible. /// </summary> [Bindable(true)] [Category("Appearance")] [DefaultValue("Disabled")] [Localizable(true)] public string CollapseButtonLabel { get { String s = (String)ViewState[ViewStateConstants.CollapseLabel.ToString()]; return ((s == null) ? "Disabled" : s); } set { ViewState[ViewStateConstants.CollapseLabel.ToString()] = value; } } /// <summary> /// Whether to apply the default style. Disable this if you want to apply a custom style, or to use themes and skins /// to style the control. /// </summary> [Category("Appearance")] [DefaultValue(true)] [Localizable(true)] public bool ApplyDefaultStyle { get { if (ViewState[ViewStateConstants.ApplyDefaultStyle.ToString()] == null) { ViewState[ViewStateConstants.ApplyDefaultStyle.ToString()] = true; } return (bool)ViewState[ViewStateConstants.ApplyDefaultStyle.ToString()]; } set { ViewState[ViewStateConstants.ApplyDefaultStyle.ToString()] = value; } } /// <summary> /// Causes Validation /// </summary> [Category("Appearance")] [DefaultValue(false)] [Localizable(false)] public bool CausesValidation { get { if (ViewState[ViewStateConstants.CausesValidation.ToString()] == null) { ViewState[ViewStateConstants.CausesValidation.ToString()] = false; } return (bool)ViewState[ViewStateConstants.CausesValidation.ToString()]; } set { ViewState[ViewStateConstants.CausesValidation.ToString()] = value; btnDate.CausesValidation = value; } } #endregion #region Events /// <summary> /// A day was selected from the calendar control. /// </summary> public event EventHandler SelectionChanged; protected virtual void OnSelectionChanged() { if (SelectionChanged != null) // only raise the event if someone is listening. { SelectionChanged(this, EventArgs.Empty); } } #endregion #region Event Handlers /// <summary> /// The +/- button was clicked. /// </summary> protected void btnDate_Click(object sender, System.EventArgs e) { if (!calDate.Visible) { // expand the calendar calDate.Visible = true; txtDate.Enabled = false; btnDate.Text = CollapseButtonLabel; if (DateValue != DateTime.MinValue) { calDate.SelectedDate = DateValue; calDate.VisibleDate = DateValue; } } else { // collapse the calendar calDate.Visible = false; txtDate.Enabled = true; btnDate.Text = ExpandButtonLabel; } } /// <summary> /// A date was selected from the calendar. /// </summary> protected void calDate_SelectionChanged(object sender, System.EventArgs e) { calDate.Visible = false; txtDate.Visible = true; btnDate.Text = ExpandButtonLabel; txtDate.Enabled = true; txtDate.Text = calDate.SelectedDate.ToShortDateString(); OnSelectionChanged(); } #endregion /// <summary> /// Builds the contents of this control. /// </summary> protected override void CreateChildControls() { btnDate.Text = ExpandButtonLabel; btnDate.CausesValidation = CausesValidation; txtDate.ID = "txtDate"; calDate.Visible = false; if (ApplyDefaultStyle) { calDate.BackColor = System.Drawing.Color.White; calDate.BorderColor = System.Drawing.Color.FromArgb(10066329); calDate.CellPadding = 2; calDate.DayNameFormat = DayNameFormat.Shortest; calDate.Font.Name = "Verdana"; calDate.Font.Size = FontUnit.Parse("8pt"); calDate.ForeColor = System.Drawing.Color.Black; calDate.Height = new Unit(150, UnitType.Pixel); calDate.Width = new Unit(180, UnitType.Pixel); calDate.DayHeaderStyle.BackColor = System.Drawing.Color.FromArgb(228, 228, 228); calDate.DayHeaderStyle.Font.Size = FontUnit.Parse("7pt"); calDate.TitleStyle.Font.Bold = true; calDate.WeekendDayStyle.BackColor = System.Drawing.Color.FromArgb(255, 255, 204); } ConnectEventHandlers(); pnlCalendar.Controls.Add(calDate); pnlCalendar.Style["position"] = "absolute"; pnlCalendar.Style["filter"] = "alpha(opacity=95)"; pnlCalendar.Style["-moz-opacity"] = ".95"; pnlCalendar.Style["opacity"] = ".95"; pnlCalendar.Style["z-index"] = "2"; pnlCalendar.Style["background-color"] = "White"; if (CalendarPosition == CalendarDisplay.DisplayBelow) { pnlCalendar.Style["margin-top"] = "27px"; } else { pnlCalendar.Style["display"] = "inline"; } Controls.Add(txtDate); Controls.Add(pnlCalendar); Controls.Add(btnDate); base.CreateChildControls(); } /// <summary> /// Render the contents of this control. /// </summary> /// <param name="output">The HtmlTextWriter to use.</param> protected override void RenderContents(HtmlTextWriter output) { switch (CalendarPosition) { case CalendarDisplay.DisplayRight: { txtDate.RenderControl(output); btnDate.RenderControl(output); pnlCalendar.RenderControl(output); break; } case CalendarDisplay.DisplayBelow: { pnlCalendar.RenderControl(output); txtDate.RenderControl(output); btnDate.RenderControl(output); break; } } } /// <summary> /// Connect event handlers to events. /// </summary> private void ConnectEventHandlers() { btnDate.Click += new System.EventHandler(btnDate_Click); calDate.SelectionChanged += new System.EventHandler(calDate_SelectionChanged); } } } <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" % <%@ Register Assembly="EclipseWebSolutions.DatePicker" Namespace="EclipseWebSolutions.DatePicker" TagPrefix="ews" % Untitled Page       using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void DatePicker1_SelectionChanged(object sender, EventArgs e) { Label1.Text = DatePicker1.DateValue.ToShortDateString(); pnlLabel.Update(); } }

    Read the article

  • flex datagrid re-assign dataprovider

    - by gauravgr8
    Hi, I am working on a datagrid with custom itemRenderer & [Bindable]xmllist as dataprovider. Now the changes done in xmllist are not reflected on datagrid UI until unless I re-assign the dataprovider as the same xmllist. As the dataprovider is Bindable so re-assigning is not required. But it was not working so I re-assigned the xmllist to the dataprovider of datagrid. It worked. Now my problem is when I re-assign the dataprovider my datagrid flicker(refreshes). It should not happen. 1) Is there any way out to avoid re-assigning of dataprovider? 2) Is there any way to stop flickering of datagrid on re-assigning the dataprovider? Thanks in advance.

    Read the article

  • How can we retrieve value on main.mxml from other .mxml?

    - by Roshan
    main.mxml [Bindable] private var _dp:ArrayCollection = new ArrayCollection([ {day:"Monday", dailyTill:7792.43}, {day:"Tuesday", dailyTill:8544.875}, {day:"Wednesday", dailyTill:6891.432}, {day:"Thursday", dailyTill:10438.1}, {day:"Friday", dailyTill:8395.222}, {day:"Saturday", dailyTill:5467.00}, {day:"Sunday", dailyTill:10001.5} ]); public var hx:String ; public function init():void { //parameters is passed to it from flashVars //values are either amount or order hx = Application.application.parameters.tab; } ]]> </mx:Script> <mx:LineChart id="myLC" dataProvider="{_dp}" showDataTips="true" dataTipRenderer="com.Amount" > <mx:horizontalAxis> <mx:CategoryAxis categoryField="day" /> </mx:horizontalAxis> <mx:series> <mx:LineSeries xField="day" yField="dailyTill"> </mx:LineSeries> </mx:series> </mx:LineChart> com/Amount.mxml [Bindable] private var _dayText:String; [Bindable] private var _dollarText:String; override public function set data(value:Object):void{ //Alert.show(Application.application.parameters.tab); //we know to expect a HitData object from a chart, so let's cast it as such //so that there aren't any nasty runtime surprises var hd:HitData = value as HitData; //Any HitData object carries a reference to the ChartItem that created it. //This is where we need to know exactly what kind of Chartitem we're dealing with. //Why? Because a pie chart isn't going to have an xValue and a yValue, but things //like bar charts, column charts and, in our case, line charts will. var item:LineSeriesItem = hd.chartItem as LineSeriesItem; //the xValue and yValue are returned as Objects. Let's cast them as strings, so //that we can display them in the Label fields. _dayText = String(item.xValue); var hx : String = String(item.yValue) _dollarText = hx.replace("$"," "); }//end set data ]]> </mx:Script> QUES : Amount.mxml is used as dataTipRenderer for line chart. Now, I need to obtain the value assigned to variable "hx" in main.mxml from "com/Amount.mxml".Any help would be greatly appreciated?

    Read the article

  • Image surrounded by text in WPF

    - by niao
    Greetings, I have some control which display bunch of textblocks and image. I would like the image to be surrounded by text. I have already implemented some functionality by using FlowDocument and custom bindable run control. (These controls are included inside user control). When I generate lots of these controls in treeview, application goes into infinite loop. I asked on forums before about this problem and the answer was that it can be WPF issue. Howver when I removed bindable run from my user control, problem dissappeared. Now I am trying to implement other solution where image will be surrounded by text. Can someone please help me? EDIT: Generally i would like to achieve something like this

    Read the article

  • Order of calls to set functions when invoking a flex component

    - by Jason
    I have a component called a TableDataViewer that contains the following pieces of data and their associated set functions: [Bindable] private var _dataSetLoader:DataSetLoader; public function get dataSetLoader():DataSetLoader {return _dataSetLoader;} public function set dataSetLoader(dataSetLoader:DataSetLoader):void { trace("setting dSL"); _dataSetLoader = dataSetLoader; } [Bindable] private var _table:Table = null; public function set table(table:Table):void { trace("setting table"); _table = table; _dataSetLoader.load(_table.definition.id, "viewData", _table.definition.id); } This component is nested in another component as follows: <ve:TableDataViewer width="100%" height="100%" paddingTop="10" dataSetLoader="{_openTable.dataSetLoader}" table="{_openTable.table}"/> Looking at the trace in the logs, the call to set table is coming before the call to set dataSetLoader. Which is a real shame because set table() needs dataSetLoader to already be set in order to call its load() function. So my question is, is there a way to enforce an order on the calls to the set functions when declaring a component?

    Read the article

1 2 3 4 5 6  | Next Page >