Click here to Skip to main content
15,886,963 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: WPF Components For WinForm Pin
alirezamansoori14-Nov-12 20:40
alirezamansoori14-Nov-12 20:40 
QuestionCan anyone suggest any good books or tutorials on WPF-MVVM please? Pin
Vijay Kanda11-Nov-12 19:22
Vijay Kanda11-Nov-12 19:22 
AnswerRe: Can anyone suggest any good books or tutorials on WPF-MVVM please? Pin
Praveen Raghuvanshi13-Nov-12 7:22
professionalPraveen Raghuvanshi13-Nov-12 7:22 
GeneralRe: Can anyone suggest any good books or tutorials on WPF-MVVM please? Pin
Vijay Kanda13-Nov-12 21:56
Vijay Kanda13-Nov-12 21:56 
AnswerRe: Can anyone suggest any good books or tutorials on WPF-MVVM please? Pin
Abhinav S13-Nov-12 21:19
Abhinav S13-Nov-12 21:19 
GeneralRe: Can anyone suggest any good books or tutorials on WPF-MVVM please? Pin
Vijay Kanda13-Nov-12 21:59
Vijay Kanda13-Nov-12 21:59 
GeneralRe: Can anyone suggest any good books or tutorials on WPF-MVVM please? Pin
Abhinav S13-Nov-12 23:09
Abhinav S13-Nov-12 23:09 
QuestionDatabinding ICollectionView to DataGrid WPF C# Pin
maycockt8-Nov-12 5:57
maycockt8-Nov-12 5: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

XML
<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

C#
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 22:42
maycockt8-Nov-12 22:42 
QuestionPrinting with more than 96 dpi in WPF Pin
Member 45210688-Nov-12 2:22
Member 45210688-Nov-12 2:22 
AnswerRe: Printing with more than 96 dpi in WPF Pin
Super Lloyd14-Nov-12 16:16
Super Lloyd14-Nov-12 16:16 
GeneralRe: Printing with more than 96 dpi in WPF Pin
Member 452106819-Nov-12 22:26
Member 452106819-Nov-12 22:26 
QuestionI have issues with the C# WPF WebBrowser class Pin
Xarzu6-Nov-12 20:14
Xarzu6-Nov-12 20:14 
AnswerRe: I have issues with the C# WPF WebBrowser class Pin
Gerry Schmitz7-Nov-12 11:04
mveGerry Schmitz7-Nov-12 11:04 
QuestionBlurry Borderline In FlowDocument Pin
FocusedWolf6-Nov-12 10:46
FocusedWolf6-Nov-12 10:46 
AnswerRe: Blurry Borderline In FlowDocument Pin
Gerry Schmitz7-Nov-12 13:13
mveGerry Schmitz7-Nov-12 13:13 
AnswerRe: Blurry Borderline In FlowDocument Pin
FocusedWolf7-Nov-12 16:00
FocusedWolf7-Nov-12 16:00 
QuestionBinding in a WPF TreeViewItem Pin
#realJSOP6-Nov-12 8:16
mve#realJSOP6-Nov-12 8:16 
AnswerRe: Binding in a WPF TreeViewItem Pin
Pete O'Hanlon6-Nov-12 8:29
mvePete O'Hanlon6-Nov-12 8:29 
GeneralRe: Binding in a WPF TreeViewItem Pin
#realJSOP6-Nov-12 8:54
mve#realJSOP6-Nov-12 8:54 
GeneralRe: Binding in a WPF TreeViewItem Pin
Pete O'Hanlon6-Nov-12 9:00
mvePete O'Hanlon6-Nov-12 9:00 
GeneralRe: Binding in a WPF TreeViewItem Pin
#realJSOP6-Nov-12 9:22
mve#realJSOP6-Nov-12 9:22 
GeneralRe: Binding in a WPF TreeViewItem Pin
Pete O'Hanlon6-Nov-12 9:29
mvePete O'Hanlon6-Nov-12 9:29 
GeneralRe: Binding in a WPF TreeViewItem Pin
#realJSOP6-Nov-12 9:37
mve#realJSOP6-Nov-12 9:37 
GeneralRe: Binding in a WPF TreeViewItem Pin
Pete O'Hanlon6-Nov-12 9:44
mvePete O'Hanlon6-Nov-12 9:44 

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

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