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


Top 5 Contributors of the Month
Sharon Maxwell
Post New Web Links

Binding Issue

Posted By:      Posted Date: October 01, 2010    Points: 0   Category :WPF
 

Hey guys,

I'm using the Microsoft Fluent Ribbon in an app I'm writing with a great deal of success...that said; I'm little by little moving my code to MVVM and really liking some of the benefits but at the same time running into some walls in the process...here's my issue:

The MS Fluent Ribbon's Ribbon Control has a SelectedTabIndex property which I'm trying to use in order to bind a TabControl's SelectedIndex property...problem is, the TabControl never changes value when I change tabs on the ribbon.  Apparently the Ribbon control sets its SelectedTabIndex to -1 between switching tab values, and as a result (just guessing) my binding isn't working.  I tried using a FallbackValue but it's had no effect (or doesn't accomplish what I want anyway)...does anyone have any possible suggestions?

Thanks!

Aj


If at first you don't succeed, skydiving is definitely not for you!


View Complete Post


More Related Resource Links

Command binding issue with using CommandReference and CommandGroup

  
I'm trying to write an app using the MVVM pattern but I'm running into an command binding issue. I'm trying to bind a button to multiple commands. To do this I'm using the CommandReference class (this is from the MVVM toolkit) and the CommandGroup class (I found this CodeProject). Here is a simplified version of my xaml: <Window.Resources> <c:CommandReference x:Key="TestCommand" Command="{Binding Path=TestCommand}"/> <c:CommandGroup x:Key="TestCommandGroup"> <c:CommandReference Command="{StaticResource TestCommand}"/> <c:CommandReference Command="{StaticResource TestCommand}"/> </c:CommandGroup> </Window.Resources> <Grid> <Button Content="Command Test" Command="{StaticResource TestCommandGroup}"/> </Grid> If I set the DataContext of the window to itself, this works just fine and the TestCommand will execute twice. The problem occurs when I want to follow the MVVM pattern and I set the DataContext of the window to a ViewModel. When I do this the button becomes disabled (I don't see any binding errors in the output window). I tried debugging this to see what was going on. If I set a breakpoint on the PropertyChangedCallback for the Command, I noticed the sequence this gets called is diff

Binding ISSUE??? How To Bind Dictionary of Dictionary

  

Hi All I have Problem in binding 

i have object of Dictionary of Dictionary

like this 

ObservableSortedDictionary<string,Dictionary<string,string>>  coll = new ObservableSortedDictionary<string,Dictionary<string,string>>();

Dictionary<string,string> InnerData = new Dictionationry<string,string>():

innderData.add ( "Item1","Data1");

innderData.add ( "Item2","Data2");

coll.Add("ParentItem1",Data);

i want to bind the inner dictionary (Data) into a GRIDVIEW 

can any one help me to Bind This Object??

ASAP please


INotifyCollectionChanged binding issue

  

I have an Observable Collection bound to a Datgrid. I want to be able to edit the contents of the Grid and have the bound Collection updated. I understand that I need to make the controls editable and implement INotifyCollectionChanged.

 

As ever I cannot find a Visual Basic version of this on the web (Express 2010) to unravel so as to understand the syntax. (Below is a working code example how far I have got with this)

 

I would appreciate any help on this.

Endpoint Binding Issue

  

Hello,

      I have a create on wcf service. Which contains one operation contract named getEmployees(); which return me a list<Employee> collection.

     Than i have create a WCF Servive Application and host above WCF Service.

    Now i create a ASP.NET WebApplication and try to call getEmployees() method but i can't.

    I am using WsHttpbinding and configure a Client Endpoint address but still i am having same problem that my client can not able to connect that service.

    Can any one tell me what is the issue?

 


Ashish Patel, MCTS Software Engineer [Level - 2]

Strange DataGridColumn Binding issue

  

Hi all,

I'm looking for a way to debug this problem I'm having with binding expressions in my DataGrid.

I've got a data grid that I create columns for on the fly in c# code.  I create DataGridTemplateColumns based on a data class that has an internal dictionary and implements ICustomTypeDescriptor.  I create columns for each of the dictionary's keys.  This all works just dandy, except for one thing.  My output window gets a bunch of these (one for each property):

System.Windows.Data Error: 39 : BindingExpression path error: 'ID' property not found on 'object' ''Object' (HashCode=17704875)'. BindingExpression:Path=ID; DataItem='Object' (HashCode=17704875); target element is 'TextBlock' (Name=''); target property is 'Text' (type 'String')

To debug, I created a converter and removed the Path.  Usually, when I stop the debugger in the converter, the "object" parameter is what I would expect - an instance of my data object.  However, sometimes (as above), the "object" is just an "object" with no further defined type (thus causing this debug output).  I'm a bit at a loss as to why the "object" in the converter is not an instance of my data object. 

Again, all the code seems to work fine.  The data g

Simple WPF ListView Binding Issue

  

I've uploaded a very simple test project with the issue here: http://www.2shared.com/file/sRVEBh42/KvpTest.html (or here)

 

The basic problem is, I have a ListView bound to a property on my class. The property is of type ObservableCollection<ObservableKeyValuePair<string, string>>.

I created the ObservableKeyValuePair so I can do two-way binding.

 

My ListView has 2 columns, Key, and Value. The Value column has a custom DataTemplate which is simply a TextBox, with its Text property setup with a two-way binding (so the user can edit the values of the ObservableCollection<ObservableKeyValuePair<string, string>>.

In my property's setter, I place a breakpoint however it never gets it. The setter of the ObservableKeyValuePair<string, string> is getting hit instead. This seems right, but I need to also propagate that change to the class property my ListView is bound to so I can simply pass the property through to another class and it would contain the changes.

Any ideas how I can achieve this? The sample project is very simple and small if you don't mind downloading it.

 

-Catch


combo box custom template and binding issue

  

i have a custom styled combo box binding with an enum, issue is that when i select the item from the combo box the interface dnt get refereshed and evern after selection the dropdown list remains there. and if i remove the style it works fine.. 

below is the custom style i am using. can you please let me know 

 

 

    <Style TargetType="ComboBoxItem">

        <Setter Property="Background" Value="Transparent" />

        <Setter Property="HorizontalContentAlignment" Value="Left" />

        <Setter Property="Padding" Value="6,4" />

        <Setter Property="KeyboardNavigation.ControlTabNavigation" Value="Local" />

        <Setter Property="VerticalContentAlignment" Value="Top" />

        <Setter Property="Template">

            <Setter.Value>

                <ControlTemplate TargetType="ComboBoxItem">

          

combo box custom template and binding issue

  

i have a custom styled combo box binding with an enum, issue is that when i select the item from the combo box the interface dnt get refereshed and evern after selection the dropdown list remains there. and if i remove the style it works fine.. 

below is the custom style i am using. can you please let me know 

 

 

    <Style TargetType="ComboBoxItem">

        <Setter Property="Background" Value="Transparent" />

        <Setter Property="HorizontalContentAlignment" Value="Left" />

        <Setter Property="Padding" Value="6,4" />

        <Setter Property="KeyboardNavigation.ControlTabNavigation" Value="Local" />

        <Setter Property="VerticalContentAlignment" Value="Top" />

        <Setter Property="Template">

            <Setter.Value>

                <ControlTemplate TargetType="ComboBoxItem">

          

Combobox inside Listbox binding issue

  
I am lost...

I have the following two classes (simplified)

Class Parent
{
    String Description{get;set;} 
    ObservableCollection<Children> ListOfChildren = new ObservableCollection<Children>();
}

Class Children
{
    public string Name{get;set;}
}

And the following two lists :

public List<Parent> ListOfParents = new List<Parent>();
public static List<Children> StaticListOfChildren=new List<Children>();


Now I have a list in XAML, I set the datacontext of this list to the "ListOfParents" (in code) and set the ItemSource="{Binding}"
All works fine so far. Inside this list I have another list containing the "ListOfChildren" list. The itemtemplate of this list contains a combobox. This combobox binds to the "StaticListOfChildren" list. The problem is now I can't get the selecteditem of the combobox to bind to the Children item in the ListOfChildren.... Can anyone help ??

<ListBox x:Name="lbMaterialsBuildup" HorizontalContentAlignment="Stretch" ItemsSource="{Binding}">
    <ListBox.ItemTemplate>
        <DataTemplate>
&nb

UserControl Visibility binding Issue.

  
<UserControl x:Class="Org.Intermountain.ICM.Views.Authentication.LoginFormView"
             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:dc="clr-namespace:Org.Intermountain.ECISDesktop.ECISDestopComponent;assembly=ECISDestopComponent"
             xmlns:convtr="clr-namespace:Org.Intermountain.ICM.ValueConverters;assembly=Org.Intermountain.ICM.ValueConverters"
             mc:Ignorable="d" 
             d:DesignHeight="636" d:DesignWidth="946"
             IsEnabled="{Binding IsControlEnabled}" 
             Visibility=&

Binding WPF Controls to an Entity Data Model

  
In this interview, programming writer, McLean Schofield, demonstrates how to bind WPF controls to an entity data model, using Visual Studio 2010 Beta 1. You can also learn more in the topic: Walkthrough: Binding WPF Controls to an Entity Data Model.

Binding the multiple drop down boxes in GridView using JQuery in ASP.NET

  
Here is the code for binding the multiple drop down boxes in GridView using JQuery in ASP.NET

Binding WPF Controls to an Entity Data Model

  
In this interview, programming writer, McLean Schofield, demonstrates how to bind WPF controls to an entity data model, using Visual Studio 2010 Beta 1. You can also learn more in the topic: Walkthrough: Binding WPF Controls to an Entity Data Model.

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

IsapiModule Error 500 Issue

  

I am about exhausted trying to figure out this error:

HTTP Error 500.0 - Internal Server Error

Description: The page cannot be displayed because an internal server error has occurred.

Error Code: 0x8007007b

Notification: ExecuteRequestHandler

Module: IsapiModule

Requested URL: http://localhost:80/ReportServer

Physical Path: c:\Program Files\Microsoft SQL Server\MSSQL.2\Reporting Services\ReportServer

When I enable Failed Request Tracing Rules and view the log output I am supposing that the actual problem is in the 2nd call where there are 2 backslashes before the actual filename in the specified path:

ISAPI_START

CALL_ISAPI_EXTENSION DllName="C:\Windows\Microsoft.NET\Framework\v2.0.50727\\aspnet_isapi.dll"

 

Binding an array to dropdown list

  

I have the following string which is a list of urls. How do I get this to work so the url shows for the selection and also is the value?      

 

allLinks = newAllLinks
        Me.DropDownList1.Items.Clear()
        Me.DropDownList1.DataTextField = "Link"
        Me.DropDownList1.DataValueField = "LinkURL"
        Me.DropDownList1.Items.Insert(0, New ListItem(" - Select - ", 0))
        Me.DropDownList1.DataSource = allLinks
        Me.DropDownList1.DataBind()


 

 ArgumentNullException: Value cannot be null.
Parameter name: container]
   System.Web.UI.DataBinder.GetPropertyValue(Object container, String propName) +121
   System.Web.UI.DataBinder.GetPropertyValue(Object container, String propName, String format) +8
   System


Binding Nested Listviews in MVC ViewPage

  

I am a longtime .NET developer but for big applications and services.  This is my first asp.net project and I have chosen MVC.   I have a need for nesting a ListView within a ListView.  In this simple catalog app, I have EF 4 Entities that are Categories, SubCategories, ItemTypes, and Items.

My goal is to display a 5 column layout of SubCategories with their ItemTypes below them in a ViewPage.  I did just fine with it done out in C# as server directives such as:

    var subcats = Model.SubCategory.ToArray();
    var nrSubCats = subcats.Count();
    var rows = (nrSubCats/5) + (((nrSubCats % 5) > 0) ? 1 : 0);
    for (var row = 0; row < rows; row++)
    { %>
        <div style="width: 100%; float: left; clear: right;">
        <%
        var start = row * 5;
        for (var i = start; (i < start + 5) && (i < nrSubCats); i++)
        {
        var subcat = subcats[i];
        %>
            <div style="float: left; clear: right; width: 20%; margin-left: 5;">
                <h2> <%:subcat.Name%></h2>
                <ul>
                    <%
                    foreach (var its in subcat.ItemType)
                    {%>
                        <li>
                            <%:Html.
Categories: 
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