.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

DataTemplate binding based on object property

Posted By:      Posted Date: September 21, 2010    Points: 0   Category :WPF

I have a collection of objects that I'm giving visual representation in my UI through DataTemplates. Each object has a string property "field". 

Is it possible for my UI to exclude specific objects in my collection from being shown based on the "field" property if it contains a string "foo"? 



View Complete Post

More Related Resource Links

WPF / Silverlight tutorial: Visibility property and binding

Visibility property is a very powerful and yet often overlooked property available in both WPF and Silverlight. It enables you to set Visibility of certain UIElement objects to different states like: Visible, Collapsed and Hidden (not supported by Silverlight). This tutorial shows you how to use it and how to bind to Visibility property

Jscript error: Object does not support property or method


 Hi, i have little knowledge on javascript but i need to use this code get from somewhere for a jquery to work.

I face this "Jscript runtime error: Object does not support property or method" whenever im trying to run this page.

In my experience, im get this error msg 9 out of 10 times i use javascript in my system.

Im using Microsoft Visual web developer 2008, i wonder if this is related to my problem, i not sure there is anything i need to add as reference or update anything.

But anyway, in short, i just couldn't use javascript code when using this development tool because of this sort of error.

Anyway, it happen that last time i tried use the same type of jquery code in another project and it seems to work well without an error.

But now when im try to use it again in this recent project i created, it come out with this error and i have no idea how to solve it even look through google and this forum.

It doesn't really seems like its the code problem itself although im not sure, because any javascript code just couldn't work.

So below is my code that i need to use.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" ></script>
<script type="text/javascript" src=&quo

Object or Property is not supported in IE8 - javascript error



I am using following code line in my web app through external javascript file.






both these methods are working fine in IE6 but failing in IE8 with a error: "Object or Property is not supported".


any solution would be appreciated!



Getting "wrong" data out of a microsoft.sqlserver.management.smo.database object property (using pow

My problem:I do something like this:$dbsvr = new-object microsoft.sqlserver.management.smo.server "servername"$dbsvr.databases | ft name,size -autosizeWhen i run this from two different PC's i get database sizes that are all the same (5.25 mb), the size of the first database listed - which is master.I started to try out a few things, and found out that when i run the same command from one of our servers it returns the correct sizes...Anyone have any idea if this a SMO issue, or maybe some package software version issue...- or what?

Error "Object reference not set" when I try to set a Navigation Property

I'm using Entity Framework. The following code throws a runtime error "System.NullReferenceException: Object reference not set to an instance of an object." The line before the error, it looks like newControl is in fact instantiated.My model has a Control entity and a ControlType entity. Control includes the Navigation Property "ControlType." I'm trying to set ControlType.Type = 2.SurveyFormControlsModel.Control newControl = new SurveyFormControlsModel.Control(); newControl = CreateControl(childTokenName, ControlTypeEnum.TextBox); newControl.ControlType.Type = 2; // <<--ERROR HERE context.Controls.AddObject(newControl);                                SurveyFormControlsModel.Control newControl = new SurveyFormControlsModel.Control();                                 if (listItems.Count == 0)                                 {                                     newControl = CreateControl(childTokenName, ControlTypeEnum.TextBox);                    &

Windows Workflow : Activity Binding Properties Window Ellipses button not visible for one property

I have created a custom activity, when I am using this activity in workflow designer I am not getting the ellipsis button to select a property.  I am getting the ellipses button for first property LongValue while not getting the option for "NavigationUrl" property. This is the code for my custom activity. public partial class SetLongAsResult: Activity {         public SetLongAsResult() { InitializeComponent(); }         public static DependencyProperty LongValueProperty = DependencyProperty.Register("LongValue", typeof(long), typeof(SetLongAsResult));           public static DependencyProperty NavigationUrlProperty = DependencyProperty.Register("NavigationUrl", typeof(string), typeof(SetLongAsResult));           [Description("long value to be returned")]         [Category("Set Result Data")]         [BrowsableAttribute(true)]         [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]         public long LongValue         {             get             {         

Creating a volume control slider/setting one template property based on another

So, what I want to do, is to make a volume control that looks like a right angle triangle with the 90 degree angle on the bottom right, and then when you click on it, the area to the left of the selected point is shown in a different color.  In other words, I've created a slider with the right background, what I can't do, is work out how to show the selected area by filling in the triangle.  I have worked out how to bind the height of my triangle on the left to the value of the control, but right now, the rate of rise is exactly half of what I need it to be.  I need to know how to change the template for the area to the left of the selection ( which is the repeat button ) so that the background is twice the height that it is right now.  No matter what size I make the slider, the area is always 1/2 the size it needs to be, so I am sure if I could get it to double inside my template, it would work fine. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">       <Style x:Key="SliderButtonStyle" TargetType="{x:Type RepeatButton}">         <Setter Property="SnapsToDevicePixels" Value="true"/>         <

Binding a property within a style - in code

So if I had a style as follows <Style TargetType={x:Type Button}> <Setter Property="Background" Value={Binding myproperty} /> </Style> How could I achieve this in code? So far I got Style x = new Style(); Setter a = new Setter(TextBox.Property, new Binding("myproperty")l but there seems to be something wrong with the way I set up the binding, how can I correct it? Thanks

Object does not support this property or method....

This is a pretty straightforward piece of code. Why am I getting this error on line 5 char1?<script type="text/javascript"> function resubmit() { var recip = document.getElementById("web_recip"); var ind=recip.indexof("?resubmit"); if (ind>0){ recip=recip.replace("?resubmit",""); var resub=document.getElementById("resub"); resub.value="Y"; } } </script>  

DataTrigger - Binding Value Property to Target Controls Content Property

This Gives me an error..   <Style x:Key="radioButtonSelctionKey" TargetType="{x:Type RadioButton}">       <Style.Triggers>       <DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}},Path=ValueText}" Value="{Binding Path=Content}">       <Setter Property="IsChecked" Value="True"></Setter>       </DataTrigger>       </Style.Triggers>       </Style> Is it valid to bind Value Property. If not then does it mean that the Value propety must always fix and can not be changed or Bound to any property Dose it mean that both of the way of setting Value proeprt are WRONG..? 1) Value="{Binding Path=Content}"> Or 2) Value="{Binding RelativeSource={RelativeSource Mode=Self},Path=Content}">

Calculate variance based on property of account

Hi all, I'm having a problem implementing a requirement in SSAS. The case: There is a parent-child dimension Account which contains different accounts on which figures can be booked. This dimension has a unary operator. In this example I have three accounts: "Net interest income" and "Global operation allocations". These two accounts have the same parent "Net result". Besides the account dimension there is a scenario dimension which contains three scenarios: Actual, Budget and Variance. On every account can be indicated whether it is a "Expense Reporting" account. If this is the case the Variance is calculated by "Budget - Actual", otherwise this is calculated by "Actual - Budget". I implemented this by the following calculation script in the cube: -- Calculate Variance scenario SCOPE ([Scenario].[Scenario].[Variance]); SCOPE ([Account].[Expense Reporting].&[True]); THIS = [Scenario].[Scenario].[Budget] - [Scenario].[Scenario].[Actual]; END SCOPE; SCOPE ([Account].[Expense Reporting].&[False]); THIS = [Scenario].[Scenario].[Actual] - [Scenario].[Scenario].[Budget]; END SCOPE; END SCOPE; So far, so good: the variance is calculated correctly for the accounts on which the data is loaded: "Net interest income" and "Global operation allocations". However, on the account

Dynamic Binding of a Public Property in a User Control

Hi, I am not sure how to pass a variable from an .aspx page to an .ascx page.  I have a Control that puts rotating banners on a page.  The control has several public properties.  However, only one of those properties changes on the page level.  All the other properties are the same for every page site-wide.  So, instead of setting all the properties on every page in my sites (many sites), I want to set it up so I only have to setup the sitewide properties once and only the page level properties on each page.   I want to create a control with a property of AdKeyword="somename" and pass it to another control that will grab that page-level property and add it to all the other site-wide properties.  I guess what I need could be called a Dynamic Control Property.   My .aspx page has:<%@ Register TagPrefix="uc1" TagName="Banner1" Src="banner1.ascx" %> <asp:Content ID="Leaderboard" runat="server" ContentPlaceHolderID="Leaderboard"> <uc1:Banner1 AdKeyword="L2Chamber" runat="server" OverrideHeight="90" /> </asp:Content> My banner1.ascx page has:<%@ Control Language="VB" ClassName="UserControl297" %> <%@ register tagprefix="uc1&

How can I get a user list based on a specific profile property.

Hi,I am trying to query a DB and get a list of users based on a specific boolean property stored in the aspnet_profile for that user.I am aware that it wasn't possible a few years ago (http://forums.asp.net/p/988051/1277359.aspx), but was wondering whether that had changed in recent releases, or it was still not possible without trawling through the entire list of users and testing them one by one.  (My DB may become way to big for that.)Thanks in advance for any help.Regards,Ben

set the Report URL property to a specific report dynamically based on the selection in the list.

Hi I want to use  embedding the Report Viewer Web Part in a Web page, and I know we  should set the Report URL property to a specific report. but  is there a way by which we can set the url  dynamically based on the selection of the report  from  the list How can I customize this  feature Any Help on this is appreciated. Thanks

UseExplicit property in infopath with form based context

Hi everyone, I have a problem with my infopath form. The context, user of the site mustn't have acces to lists that provision infopath form field. Administrator should have acces to these lists. When i test the useExplicit property of udc file for impersonate the connection to the list i have no problem ( all my account are local account) But when i try to integrate user from FBA, infopath form services don't take care of the UseExplicit property and try connect to the list with the credential of the connected user ( who don't have access to the list since only the user that i use to impersonate the connection have read acces). Here is my UseExplicit property :  <udc:Authentication>    <udc:UseExplicit CredentialType="NTLM">      <udc:UserId>dev\svc-reader</udc:UserId>      <udc:Password>password</udc:Password>    </udc:UseExplicit>  </udc:Authentication>    09/06/2010 15:06:50.46                w3wp.exe (0x09BC)                                      0x1A08 SharePoint Foundation                General                      

Binding to Dependency property

Dear all I have the follwoing xaml code in my main window : <Label Content="{Binding PlayerCount}" DataContext="{Binding ScatterViewModels}" Grid.Row="2" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="20"/> Then I have a class which is the datacontext of my label and host a dependcy property PlayerCount which is set as follow:  PlayerCount = ((Player)svi.Tag).Count Doing so I cannot get the value in my label, anything wrong with the binding ? thnaks for help regards SergeYour knowledge is enhanced by that of others.

How Would I Design a Trigger Based on Object Type?

I have doing some research trying to figure out how I could create a trigger or datatemplate that would react based on an Object's type, but haven't found a decent explanation. In code I could use "GetTyoe()" but I am unsure if that is possible in XAML. As a basic example, if the Object is of Type "A" I want to bind the content of a label to a certain property of object "A", but if the object is of Type "B" I want to bind to a different property. I guess the big question is: How do I determine an objects type from XAML?
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend