Click here to Skip to main content
       

Silverlight / WPF

 
GeneralRe: WPF Components For WinForm Pinmemberalirezamansoori14-Nov-12 21:40 
QuestionCan anyone suggest any good books or tutorials on WPF-MVVM please? PinmemberVijay Kanda11-Nov-12 20:22 
AnswerRe: Can anyone suggest any good books or tutorials on WPF-MVVM please? PinmemberRags151213-Nov-12 8:22 
GeneralRe: Can anyone suggest any good books or tutorials on WPF-MVVM please? PinmemberVijay Kanda13-Nov-12 22:56 
AnswerRe: Can anyone suggest any good books or tutorials on WPF-MVVM please? PinmvpAbhinav S13-Nov-12 22:19 
GeneralRe: Can anyone suggest any good books or tutorials on WPF-MVVM please? PinmemberVijay Kanda13-Nov-12 22:59 
GeneralRe: Can anyone suggest any good books or tutorials on WPF-MVVM please? PinmvpAbhinav S14-Nov-12 0:09 
QuestionDatabinding ICollectionView to DataGrid WPF C# [modified] Pinmembermaycockt8-Nov-12 6:57 
Hi,
 
I'm trying to bind my ICollectionView data to a DataGrid and am not getting any data displayed, even though the data is retrieved from my data source.
I am trying to populate my DataGrid with data received as the result of a Button press, and can only assume that the problem is that my ICollectionView data is received on a separate thread. The data is received correctly, and my list is populated fully, but just not displayed.
 
My XAML is this
 
<Window x:Class="UPC_Programmer.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:UPCP="http://schemas.microsoft.com/wpf/2008/toolkit"
        xmlns:GridLines="clr-namespace:UPC_Programmer" Closing="Window_OnClosing"
        xmlns:tree="clr-namespace:Aga.Controls.Tree;assembly=Aga.Controls" 
        x:Name="DataTree"
<ToolBarPanel Height="26" HorizontalAlignment="Stretch" Margin="1,22,0,4" 
        Name="toolBarPanel1" VerticalAlignment="Stretch" Width="800" Orientation="Horizontal"
        Background="Gray" Grid.ColumnSpan="4">
    <Button x:Name="Controller_Read" Height="25" Width="50" Click="OnReadBtnClk"
        IsEnabled="False">
    </Button>
</ToolBarPanel>
<DockPanel Height="448" Width="801" Grid.ColumnSpan="4" 
        Margin="0,51,0,29" Grid.RowSpan="2">
    <UPCP:DataGrid DataContext="{StaticResource GroupedCustomers}" ItemsSource="{Binding}"
            AutoGenerateColumns="False" Grid.Row="1" Height="447" HorizontalAlignment="Left"
            Name="dataGrid2" VerticalAlignment="Top" Width="799" Grid.ColumnSpan="4">
        <UPCP:DataGrid.Columns>
            <UPCP:DataGridTextColumn Header="Parameter" Width="400"
                Binding="{Binding Path=TagName}" Foreground="Black"/>
            <UPCP:DataGridTextColumn Header="Value" Width="50" 
                Binding="{Binding Path=Value}" Foreground="Black"/>
            <UPCP:DataGridTextColumn Header="" Width="50" 
                Binding="{Binding Path=Value3}" Foreground="Black"/>
        </UPCP:DataGrid.Columns>
   </UPCP:DataGrid>
</DockPanel>
</Window>
 
And my Code Behind is similar to that below
 
public partial class MyClass
{
    public ICollectionView GroupedCustomers { get; private set; }
    private MY_LIST<MY_VALUES> currentValueList = null;
 
    private void OnReadBtnClk(object sender, RoutedEventArgs e)
    { 
        //this code launches a request for data from my source (this works happily)
        RequestService(LIBRARY.LIB.OFFERED_SERVICES.GET_CURRENT_VALUES);
            
    }
 
    //event handler that is called as a result of the data request (functions as expected)
    void OnValueListReceived(object sender, ValueListConnectionHandlerEventArgs e)
    {
        //for this list to be populated both the COS and FI need to be operational.

        if (e.GetValueList.List != null)
        {
            this.currentValueList = e.GetValueList;
 
            //check for some received data
            if (this.currentValueList.Count() > 0)
            {
                //call the function that populates my ICollectionView list
                LoadData();
            }
        }
    }
 
    //copy the data to my ICollectionView data list
    private void LoadData()
    {           
        _TagCollection.Clear();
        foreach(VALUES item in currentValueList)
        {
            try
            {
                if (item.GetValueType == TYPE_INT)
                {
                    MemoryStream ms = item.GetValueStreamed;
                    BinaryFormatter bFormatter = new BinaryFormatter();
                    ms.Position = 0;
                    String strParam = item.GetIndex.ToString();
                    String strValue = item.GetSubIndex.ToString();
                    String strValue2 = item.GetPoohId.ToString();
                    String strValue3 = item.GetNodeId.ToString();
                    Group eGroup = GetGroupEnumFromID("1");
                    _TagCollection.Add(new TagData { TagName = strParam, Value = strValue, Value2 = strValue2, Value3 = strValue3, Group = eGroup });
                }
           }
           catch
           {//capture an error 

           }
        }
        GroupedCustomers = new ListCollectionView(_TagCollection);
        dataGrid2.Items.Refresh();
        }
    }
}
 
My list, GroupedCustomers, is populated with the right amount of data, but my dataGrid doesn't display the data.
 
Any thoughts would be much appreciated.
 
Regards
 
Tony

modified 9-Nov-12 3:08am.

AnswerRe: Databinding ICollectionView to DataGrid WPF C# Pinmembermaycockt8-Nov-12 23:42 
QuestionPrinting with more than 96 dpi in WPF [modified] PinmemberMember 45210688-Nov-12 3:22 
AnswerRe: Printing with more than 96 dpi in WPF PinmemberSuper Lloyd14-Nov-12 17:16 
GeneralRe: Printing with more than 96 dpi in WPF [modified] PinmemberMember 452106819-Nov-12 23:26 
QuestionI have issues with the C# WPF WebBrowser class PinmemberXarzu6-Nov-12 21:14 
AnswerRe: I have issues with the C# WPF WebBrowser class PinmemberGerry Schmitz7-Nov-12 12:04 
QuestionBlurry Borderline In FlowDocument PinmemberFocusedWolf6-Nov-12 11:46 
AnswerRe: Blurry Borderline In FlowDocument PinmemberGerry Schmitz7-Nov-12 14:13 
AnswerRe: Blurry Borderline In FlowDocument [modified] PinmemberFocusedWolf7-Nov-12 17:00 
QuestionBinding in a WPF TreeViewItem PinmvpJohn Simmons / outlaw programmer6-Nov-12 9:16 
AnswerRe: Binding in a WPF TreeViewItem PinprotectorPete O'Hanlon6-Nov-12 9:29 
GeneralRe: Binding in a WPF TreeViewItem PinmvpJohn Simmons / outlaw programmer6-Nov-12 9:54 
GeneralRe: Binding in a WPF TreeViewItem PinprotectorPete O'Hanlon6-Nov-12 10:00 
GeneralRe: Binding in a WPF TreeViewItem PinmvpJohn Simmons / outlaw programmer6-Nov-12 10:22 
GeneralRe: Binding in a WPF TreeViewItem PinprotectorPete O'Hanlon6-Nov-12 10:29 
GeneralRe: Binding in a WPF TreeViewItem PinmvpJohn Simmons / outlaw programmer6-Nov-12 10:37 
GeneralRe: Binding in a WPF TreeViewItem PinprotectorPete O'Hanlon6-Nov-12 10:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web04 | 2.8.1411023.1 | Last Updated 26 Nov 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid