Search Results

Search found 11381 results on 456 pages for 'intellectual property'.

Page 3/456 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Binding property to Silverlight dependency property independent of DataContext

    - by Simon_Weaver
    I'm trying to make an Address control that has an IsReadOnly property, which will make every TextBox inside read only when set to true. <my:AddressControl Grid.Column="1" Margin="5" IsReadOnly="True"/> I've managed to do this just fine with a dependency property and it works. Here's a simple class with the dependency property declared : public partial class AddressControl : UserControl { public AddressControl() { InitializeComponent(); this.DataContext = this; } public static readonly DependencyProperty IsReadOnlyProperty = DependencyProperty.Register("IsReadOnly", typeof(bool), typeof(AddressControl), null); public bool IsReadOnly { get { return (bool)GetValue(IsReadOnlyProperty); } set { SetValue(IsReadOnlyProperty, value); } } } In the XAML for this codebehind file I have a Textbox for each address line: <TextBox IsReadOnly="{Binding IsReadOnly}" Text="{Binding City, Mode=TwoWay}"/> <TextBox IsReadOnly="{Binding IsReadOnly}" Text="{Binding State, Mode=TwoWay}"/> <TextBox IsReadOnly="{Binding IsReadOnly}" Text="{Binding Zip, Mode=TwoWay}"/> Like i said this works just fine. The problem is that the Address control itself is bound to its parent object (I have several addresses I am binding). <my:AddressControl DataContext="{Binding ShippingAddress, Mode=TwoWay}" IsReadOnly="True"> <my:AddressControl DataContext="{Binding BillingAddress, Mode=TwoWay}" IsReadOnly="True"> The problem is that as soon as I set DataContext to something other than 'this' then the binding for IsReadOnly breaks. Not surprising because its looking for IsReadOnly on the Address data entity and it doesn't exist or belong there. I've tried just about every combination of binding attributes to get IsReadOnly to bind to the AddressControl obejct but can't get it working. I've tried things like this, but I can't get IsReadOnly to bind independently to the AddressControl property instead of its DataContext. <TextBox IsReadOnly="{Binding RelativeSource={RelativeSource Self}, Path=IsReadOnlyProperty}" Text="{Binding City, Mode=TwoWay}" /> I think I'm pretty close. What am I doing wrong?

    Read the article

  • Why can't I Bind a viewmodel property to a dependency property of a custom control

    - by Robert
    I want to use a color picker in my wpf application and I saw a nice looking one on this codeproject page. The control works fine until I want to connect the control to a viewmodel. I created a small test program with this viewmodel: public class ColorViewModel : ViewModelBase { public ColorViewModel() { LineColor = Brushes.Yellow; } SolidColorBrush _brushColor; public SolidColorBrush LineColor { get { return _brushColor; } set { _brushColor = value; RaisePropertyChanged(() => LineColor); } } } The test program has a textbox and the colorpicker controls: <StackPanel Orientation="Horizontal"> <TextBlock Text="Please Select a Color" FontWeight="Bold" Margin="10" Foreground="{Binding Path=LineColor, UpdateSourceTrigger=PropertyChanged}"/> <vw:ColorPickerControlView x:Name="ForeColorPicker" Margin="10" CurrentColor="{Binding Path=LineColor, UpdateSourceTrigger=PropertyChanged }"/> </StackPanel> In the loaded event of the window I set the viewmodel to the datacontext like this: DataContext = new ColorViewModel(); The problem is that I can't seem to bind the LineColor property of the viewmodel to the CurrentColor property of the ColorPickerControlView. The CurrentControl property of the ColorPickerControlView seems to be fine. The constructor looks like this: public ColorPickerControlView() { this.DataContext = this; InitializeComponent(); CommandBindings.Add(new CommandBinding(SelectColorCommand, SelectColorCommandExecute)); } In the constructor of the UserControl there is the line this.DataContext = this; I read that is is necessary to bind the dependency properties. Do I override this line when I set my viewmodel to the datacontext and is that why I can't bind to the CurrentColor property? Is there any workaround? Or did I make another mistake?

    Read the article

  • WPF ContextMenu bind some property to another property of the same control

    - by bebicasoft
    I have a ContextMenu and a ColumnHeaderStyle defined in Window.Resource section witch i use-it to a DataGrid ColumnHeader. My code is something like this: <ContextMenu x:Key="cm_columnHeaderMenu"/> <Style x:Key="DefaultColumnHeaderStyle" TargetType="{x:Type DataGridColumnHeader}"> <Setter Property="ContextMenu" Value="{StaticResource cm_columnHeaderMenu}" /> </Style> <DataGrid Grid.Column="2" Grid.Row="1" x:Name="dgridFiles" IsReadOnly="True" ColumnHeaderStyle="{StaticResource DefaultColumnHeaderStyle}"> I want to know if I can (and if the answer it true, then HOW I could do it) bind the ContextMenu Visibility property to same control ContextMenu Items.Count>0 property. Initially based on some other treeView control selections made there shoud be no items in the context menu, but i wish to add dinamically items in ContextMenu based on selection in treeView. This part is done, the context has those items. On some selections there are no-items, but still on the grid it appears an empty ContextMenu. So I believe the easiest part it would be to bind the Visibility to Items.Count property of the same control. Sorry if my english is not good enought, I'll try to explain better if i didnt make clear 1st time.

    Read the article

  • Expose UserControl property to XAML

    - by Jared
    WPF controls have certain properties (UserControl.Resources, UserControl.CommandBindings) that can have items added to them from the XAML of a user control declaration. Example: <UserControl ... > <UserControl.CommandBindings> ... </UserControl.CommandBindings> <UserControl.Resources> ... </UserControl.Resources> </UserControl> I have a new list property defined in my user control: public partial class ArchetypeControl : UserControl { ... public List<Object> UICommands { get; set; } I want to add items to this list like I can with resources and CommandBindings, but when I do this: <c:ArchetypeControl.UICommands> </c:ArchetypeControl.UICommands> I get the error "Error 4 The attachable property 'UICommands' was not found in type 'ArchetypeControl'. " Suggestions? - Given the comments, I've created a test control to show the entire code and reproduce the problem. I'm using visual studio 2010. <UserControl x:Class="ArchetypesUI.TestControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:c="clr-namespace:ArchetypesUI" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300"> <c:TestControl.TestObject> </c:TestControl.TestObject> <Grid> </Grid> </UserControl> - namespace ArchetypesUI { /// <summary> /// Interaction logic for TestControl.xaml /// </summary> public partial class TestControl : UserControl { public Object TestObject { get; set; } public TestControl() { InitializeComponent(); } } } Now the error I get is "Error 2 The attached property 'TestControl.TestObject' is not defined on 'UserControl' or one of its base classes."

    Read the article

  • Fetched Property in XCode Data Model Editor for minimum value

    - by wal
    How do I add a Fetched Property in XCode's Data Model Editor for minimum value of one attribute?? My model: Item (name, note, storedItem) StoredItem (price, item) Item 1 ---> N StoredITem (1->N Relationship) I want that Item has a fetched property named minPrice and its value is the minimum value setted for price in the storedItems. Example: Item1 (banana, storedItem1 ... storedItem4, 10) StoredItem1 (10,item1) StoredItem2 (15,item1) StoredItem3 (30,item1) StoredItem4 (54,item1) What do I put in Destination?? StoredItem? And what do I put in Expression??

    Read the article

  • How can I bind a custom property of a windows form to a second property?

    - by jeroko
    I want to bind a custom property of a windows form to a second property, so when I update the former the latter gets the same value. This is the simplest example of what I'm trying to do: public partial class Form2 : Form { public string MyTargetProperty { get; set; } public string OtherProperty { get; set; } public Form2() { InitializeComponent(); this.DataBindings.Add("MyTargetProperty", this, "OtherProperty"); } private void button1_Click(object sender, EventArgs e) { MyTargetProperty = "test"; Console.WriteLine("OtherProperty " + OtherProperty); } } When I click button1 I should be able to see that 'OtherProperty' has the same value as 'MyTargetProperty'. Am I doing something wrong? Do I miss something?

    Read the article

  • Auto wiring of Property does not work for me

    - by Xabatcha
    Hi All, In my Asp.Net project I wanna use Property Auto-wiring, e.g. for my ILogger. Basically I placed Property into my base classes. One for Page, one for UserControl. Like below. public class UserControlBase : UserControl { public ILogger CLogger { get; set; } .... } However when calling in inherited control, logger is null. I checked the container and it'a definitely set. Below is setting which is called from Global.asax. public static void SetupForIoC() { Debug.WriteLine("SetupForIoC"); ObjectFactory.Initialize(x => { x.FillAllPropertiesOfType<ILogger>().TheDefaultIsConcreteType<EntLibLogger>().AsSingletons(); x.FillAllPropertiesOfType<ISiteService>().TheDefaultIsConcreteType<SiteService>().AsSingletons(); }); Debug.WriteLine(ObjectFactory.WhatDoIHave()); } Thanks for any advice, tip? X.

    Read the article

  • C# - Erase all property values from a class?

    - by John M
    In a C# Winforms (3.5) application I have added a class that contains many properties (get/set) used to stored values from a 12 form long process. After form 12 I would like wipe out all the property values in the storing class so that the next user won't accidentally record values when starting the process at form 1. Is it possible to erase/destroy/dispose of all property values in a class? My class looks like this: private static int battery; public int Battery { get { return storeInspectionValues.battery; } set { storeInspectionValues.battery = value; } }

    Read the article

  • Another Custom Property Locator: a Library of Books

    - by Cindy McMullen
    Introduction The previous post gave an introduction to custom property locators and showed how create one using JDeveloper.  This post continues on the custom locator theme, with a slightly more complex locator: a library of books.  It demonstrates using the DAO pattern to delegate data access from the Locator, which is likely how many actual backing stores will integrate with the Locator.  You can imagine, rather than a library of books, the data store might be a user database of sorts.  The same sort of pattern would apply. This post uses the BookLocator example originally shown in the WebCenter documentation, but has: updated the source code to reflect the final Property APIs includes the steps for generating the namespace and property definition files via JDeveloper detailed usage of the PropertyService APIs Getting Started If you're new to JDeveloper, you might want to check out this tutorial.  There is also the "Jump-Start to using Personalization" blog post that you might find useful.  Otherwise, if you're already familiar with both, you can skip those tutorials and jump right in to using JDeveloper. Download the BookLocator.zip file (which has been updated from the original post) and unzip it to a new directory.  Start JDeveloper, navigate to the BookLocator.jws file, and open it.   It should look something like this: The Properties Namespace file contains the property definitions and property set definitions you define.  It is explained more in detail in the Namespace documentation.  Although this example doesn't show it, the property set definitions have the ability to reference multiple locators per property.   This can be done by right-clicking on the 'Locator Info' box.  Configure the contents of the Locator Map  by editing locators and mapping them to available property names in the property set definition. Compiling, deploying, and running your locator The rest of the steps in this tutorial basically follow those in the previous blog on custom locators, and won't be repeated here.   A scenario to invoke your locator is included with the sample app: see BookProperties.scenarios_diagram above.  Summary This post demonstrates a simple library of books accessed by the BookPropertyLocator via the DAO layer.  This is a useful pattern for more realistic property retrievals, such as a backing user store.  It also points out the possibility of retrieving properties from multiple locators, which would be quite handy to retrieve user attributes from multiple sources.

    Read the article

  • Dynamic Linq Property Converting to Sql

    - by Matthew Hood
    I am trying to understand dynamic linq and expression trees. Very basically trying to do an equals supplying the column and value as strings. Here is what I have so far private IQueryable<tblTest> filterTest(string column, string value) { TestDataContext db = new TestDataContext(); // The IQueryable data to query. IQueryable<tblTest> queryableData = db.tblTests.AsQueryable(); // Compose the expression tree that represents the parameter to the predicate. ParameterExpression pe = Expression.Parameter(typeof(tblTest), "item"); Expression left = Expression.Property(pe, column); Expression right = Expression.Constant(value); Expression e1 = Expression.Equal(left, right); MethodCallExpression whereCallExpression = Expression.Call( typeof(Queryable), "Where", new Type[] { queryableData.ElementType }, queryableData.Expression, Expression.Lambda<Func<tblTest, bool>>(e1, new ParameterExpression[] { pe })); // Create an executable query from the expression tree. IQueryable<tblTest> results = queryableData.Provider.CreateQuery<tblTest>(whereCallExpression); return results; } That works fine for columns in the DB. But fails for properties in my code eg public partial class tblTest { public string name_test { get { return name; } } } Giving an error cannot be that it cannot be converted into SQL. I have tried rewriting the property as a Expression<Func but with no luck, how can I convert simple properties so they can be used with linq in this dynamic way? Many Thanks

    Read the article

  • Bind to a property of a parent element in wpf

    - by msfanboy
    Hello all, I want to bind the Height property of the RichTextBox to the Height Property of the GridViews Row. How can I do that? I do not know how to get the Rows Height as I can not access the Row in xaml what I would like to do. <my:RadGridView Height="524" ItemsSource="{Binding Lessons}" AutoGenerateColumns="False" Name="dataGrid1" VerticalAlignment="Top" SelectionMode="Single" CanUserSortColumns="False" IsFilteringAllowed="False"> <my:RadGridView.Columns> <my:GridViewDataColumn Name="ContentColumn" Width="0.3*" Header="Content"> <my:GridViewDataColumn.CellTemplate> <DataTemplate> <RichTextBox Height="{Binding ElementName=MyRowNameToBindTo,Path=Height}"> <FlowDocument> <Paragraph> <Run Text="{Binding Content}"/> </Paragraph> </FlowDocument> </RichTextBox> </DataTemplate> </my:GridViewDataColumn.CellTemplate> ...

    Read the article

  • JavaScript - Settting property on Object in Image load function, property not set once outside funct

    - by Sunday Ironfoot
    Sometimes JavaScript doesn't make sense to me, consider the following code that generates a photo mosaic based on x/y tiles. I'm trying to set a .Done property to true once each Mosaic image has been downloaded, but it's always false for some reason, what am I doing wrong? var tileData = []; function generate() { var image = new Image(); image.onload = function() { // Build up the 'tileData' array with tile objects from this Image for (var i = 0; i < tileData.length; i++) { var tile = tileData[i]; var tileImage = new Image(); tileImage.onload = function() { // Do something with this tile Image tile.Done = true; }; tileImage.src = tile.ImageUrl; } }; image.src = 'Penguins.jpg'; tryDisplayMosaic(); } function tryDisplayMosaic() { setTimeout(function() { for (var i = 0; i < tileData.length; i++) { var tile = tileData[i]; if (!tile.Done) { tryDisplayMosaic(); return; } } // If we get here then all the tiles have been downloaded alert('All images downloaded'); }, 2000); } Now for some reason the .Done property on the tile object is always false, even though it is explicitly being set to true inside tileImage.onload = function(). And I can ensure you that this function DOES get called because I've placed an alert() call inside it. Right now it's just stuck inside an infinite loop calling tryDisplayMosaic() constantly. Also if I place a loop just before tryDisplayMosaic() is called, and in that loop I set .Done = true, then .Done property is true and alert('All images downloaded'); will get called.

    Read the article

  • property inject in Autofac

    - by Benny
    I am compiling: PropertyInject wiki page why this line: builder.RegisterType().InjectProperties(); doesn't compile? how to do property inject in autofac? I am using vs2010, autofac 2.1.13.813. thanks. EDIT: PropertyInjection should be like this in new version of AutoFac: builder.RegisterType().PropertiesAutowired(false);

    Read the article

  • Weird result comparing property values using reflection

    - by Brian
    Can someone explain why this is occurring? The code below was executed in the immediate window in vs2008. The prop is an Int32 property (id column) on an object created by the entity framework. The objects entity and defaultEntity were created using Activator.CreateInstance(); Convert.ChangeType(prop.GetValue(entity, null), prop.PropertyType) 0 Convert.ChangeType(prop.GetValue(defaultEntity, null), prop.PropertyType) 0 Convert.ChangeType(prop.GetValue(entity, null), prop.PropertyType) == Convert.ChangeType(prop.GetValue(defaultEntity, null), prop.PropertyType) false

    Read the article

  • Generic Property in C#

    - by ml123
    Hi, I'm not quite sure how to do that, but what I would like to do is to create a special type of property that will perform specific tasks at the get and set, and will be defined on generic type. For example, when writing this: MyProp<String name; a pre-defined get and set will be performed on the string value. How can that be done? Thanks!

    Read the article

  • Movies from property lists?

    - by Tronic
    hi, is it possible to play movies out of a property list? Like is there's a "tag" with the filename in it which gets replaced by the actual iphone/ipad player? The movies are h.265 codec... thanks

    Read the article

  • how can I get instance from the property.

    - by viky
    In my application I have a class which has properties of user-defined types like this: class MyType { public A MyProperty { get; set; } } class A { .....some methods and proeprties } for some operations that I need to perform from my main program, I create a List of MyProperty whenever creating object of MyType and pass it to my main program and there I perform different operation on these properties which reflects in there instances also. Is there any way by which I could get the object instance for any particular MyProperty from that property in the list.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >