Click here to Skip to main content
11,478,066 members (69,835 online)

Silverlight / WPF

 
GeneralRe: WPF Components For WinForm Pin
alirezamansoori14-Nov-12 21:40
memberalirezamansoori14-Nov-12 21:40 
QuestionCan anyone suggest any good books or tutorials on WPF-MVVM please? Pin
Vijay Kanda11-Nov-12 20:22
memberVijay Kanda11-Nov-12 20:22 
AnswerRe: Can anyone suggest any good books or tutorials on WPF-MVVM please? Pin
Rags151213-Nov-12 8:22
memberRags151213-Nov-12 8:22 
GeneralRe: Can anyone suggest any good books or tutorials on WPF-MVVM please? Pin
Vijay Kanda13-Nov-12 22:56
memberVijay Kanda13-Nov-12 22:56 
AnswerRe: Can anyone suggest any good books or tutorials on WPF-MVVM please? Pin
Abhinav S13-Nov-12 22:19
mvpAbhinav S13-Nov-12 22:19 
GeneralRe: Can anyone suggest any good books or tutorials on WPF-MVVM please? Pin
Vijay Kanda13-Nov-12 22:59
memberVijay Kanda13-Nov-12 22:59 
GeneralRe: Can anyone suggest any good books or tutorials on WPF-MVVM please? Pin
Abhinav S14-Nov-12 0:09
mvpAbhinav S14-Nov-12 0:09 
QuestionDatabinding ICollectionView to DataGrid WPF C# [modified] Pin
maycockt8-Nov-12 6:57
membermaycockt8-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# Pin
maycockt8-Nov-12 23:42
membermaycockt8-Nov-12 23:42 
QuestionPrinting with more than 96 dpi in WPF [modified] Pin
Member 45210688-Nov-12 3:22
memberMember 45210688-Nov-12 3:22 
AnswerRe: Printing with more than 96 dpi in WPF Pin
Super Lloyd14-Nov-12 17:16
memberSuper Lloyd14-Nov-12 17:16 
GeneralRe: Printing with more than 96 dpi in WPF [modified] Pin
Member 452106819-Nov-12 23:26
memberMember 452106819-Nov-12 23:26 
QuestionI have issues with the C# WPF WebBrowser class Pin
Xarzu6-Nov-12 21:14
memberXarzu6-Nov-12 21:14 
AnswerRe: I have issues with the C# WPF WebBrowser class Pin
Gerry Schmitz7-Nov-12 12:04
memberGerry Schmitz7-Nov-12 12:04 
QuestionBlurry Borderline In FlowDocument Pin
FocusedWolf6-Nov-12 11:46
memberFocusedWolf6-Nov-12 11:46 
AnswerRe: Blurry Borderline In FlowDocument Pin
Gerry Schmitz7-Nov-12 14:13
memberGerry Schmitz7-Nov-12 14:13 
AnswerRe: Blurry Borderline In FlowDocument [modified] Pin
FocusedWolf7-Nov-12 17:00
memberFocusedWolf7-Nov-12 17:00 
QuestionBinding in a WPF TreeViewItem Pin
John Simmons / outlaw programmer6-Nov-12 9:16
mvpJohn Simmons / outlaw programmer6-Nov-12 9:16 
AnswerRe: Binding in a WPF TreeViewItem Pin
Pete O'Hanlon6-Nov-12 9:29
protectorPete O'Hanlon6-Nov-12 9:29 
GeneralRe: Binding in a WPF TreeViewItem Pin
John Simmons / outlaw programmer6-Nov-12 9:54
mvpJohn Simmons / outlaw programmer6-Nov-12 9:54 
GeneralRe: Binding in a WPF TreeViewItem Pin
Pete O'Hanlon6-Nov-12 10:00
protectorPete O'Hanlon6-Nov-12 10:00 
GeneralRe: Binding in a WPF TreeViewItem Pin
John Simmons / outlaw programmer6-Nov-12 10:22
mvpJohn Simmons / outlaw programmer6-Nov-12 10:22 
GeneralRe: Binding in a WPF TreeViewItem Pin
Pete O'Hanlon6-Nov-12 10:29
protectorPete O'Hanlon6-Nov-12 10:29 
GeneralRe: Binding in a WPF TreeViewItem Pin
John Simmons / outlaw programmer6-Nov-12 10:37
mvpJohn Simmons / outlaw programmer6-Nov-12 10:37 
GeneralRe: Binding in a WPF TreeViewItem Pin
Pete O'Hanlon6-Nov-12 10:44
protectorPete 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
Web02 | 2.8.150520.1 | Last Updated 21 May 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid