Search Results

Search found 3 results on 1 pages for 'lostkaleb'.

Page 1/1 | 1 

  • WPF DataGrid ComboBox Column: Propagating Header Combobox throughout column...

    - by LostKaleb
    Hey there! Here's my question: I've got a Datagrid in WPF and I have a first column that is a DataGridComboBoxColumn. What I'd like to do is to have a header for that column also with a combobox: altering the header with propagate throughout the column. I can get this done visually, but when I submit the data, the list that is bound with the Datagrid does not carry the new combobox values. <dg:DataGridComboBoxColumn SelectedItemBinding="{Binding BIBStatus}" ItemsSource="{Binding Source={StaticResource typeStatus}}" Width="0.20*"> <dg:DataGridComboBoxColumn.HeaderTemplate> <DataTemplate> <StackPanel> <TextBlock Text="Built-In Bridge"/> <ComboBox SelectedItem="{Binding BIBStatus}" SelectionChanged="ComboBox_SelectionChanged" ItemsSource="{Binding Source={StaticResource typeStatus}}"/> </StackPanel> </DataTemplate> </dg:DataGridComboBoxColumn.HeaderTemplate> </dg:DataGridComboBoxColumn> In the ComboBox_SelectionChanged I have the following code: DataGridColumn comboCol = this.gridResults.Columns[0]; for (int i = 0; i < this.gridResults.Items.Count; i++) { ComboBox myCmBox = (comboCol.GetCellContent(this.gridResults.Items[i]) as ComboBox); myCmBox.SelectedValue = ((ComboBox)sender).SelectedValue; } When I submit the data, I submit the list that is DataContext to the Datagrid; if I change the value of the first column addressing a row at a time, i.e. clicking the cell with the combobox in each row, the values are propagated to the list in DataContext, however if I change the value of the first column by the header it does not. Can anyone tell me what I'm missing? I'm guessing it's the way I affect each row, but I've tried SelectedValue, SelectedItem and SelectedIndex... all to no avail. Thanks in advance...

    Read the article

  • How do I handle freeing unmanaged structures on application close?

    - by LostKaleb
    I have a C# project in which i use several unmanaged C++ functions. More so, I also have static IntPtr that I use as parameters for those functions. I know that whenever I use them, I should implement IDisposable in that class and use a destructor to invoke the Dispose method, where I free the used IntPtr, as is said in the MSDN page. public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } private void Dispose(bool disposing) { // Check to see if Dispose has already been called. if (!this.disposed) { if (disposing) { component.Dispose(); } CloseHandle(m_InstanceHandle); m_InstanceHandle = IntPtr.Zero; disposed = true; } } [System.Runtime.InteropServices.DllImport("Kernel32")] private extern static Boolean CloseHandle(IntPtr handle); However, when I terminate the application, I'm still left with a hanging process in TaskManager. I believe that it must be related to the used of the MarshalAs instruction in my structures: [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] public struct SipxAudioCodec { [MarshalAs(UnmanagedType.ByValTStr, SizeConst=32)] public string CodecName; public SipxAudioBandwidth Bandwidth; public int PayloadType; } When I create such a structure should I also be careful to free the space it allocs using a destructor? [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] public struct SipxAudioCodec { [MarshalAs(UnmanagedType.ByValTStr, SizeConst=32)] public string CodecName; public SipxAudioBandwidth Bandwidth; public int PayloadType; ~SipxAudioCodec() { Marshal.FreeGlobal(something...); } }

    Read the article

  • How do I handle freeing unmanaged structures in C# on application close?

    - by LostKaleb
    I have a C# project in which i use several unmanaged C++ functions. More so, I also have static IntPtr that I use as parameters for those functions. I know that whenever I use them, I should implement IDisposable in that class and use a destructor to invoke the Dispose method, where I free the used IntPtr, as is said in the MSDN page. public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } private void Dispose(bool disposing) { // Check to see if Dispose has already been called. if (!this.disposed) { if (disposing) { component.Dispose(); } CloseHandle(m_InstanceHandle); m_InstanceHandle = IntPtr.Zero; disposed = true; } } [System.Runtime.InteropServices.DllImport("Kernel32")] private extern static Boolean CloseHandle(IntPtr handle); However, when I terminate the application, I'm still left with a hanging process in TaskManager. I believe that it must be related to the used of the MarshalAs instruction in my structures: [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] public struct SipxAudioCodec { [MarshalAs(UnmanagedType.ByValTStr, SizeConst=32)] public string CodecName; public SipxAudioBandwidth Bandwidth; public int PayloadType; } When I create such a structure should I also be careful to free the space it allocs using a destructor? [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] public struct SipxAudioCodec { [MarshalAs(UnmanagedType.ByValTStr, SizeConst=32)] public string CodecName; public SipxAudioBandwidth Bandwidth; public int PayloadType; ~SipxAudioCodec() { Marshal.FreeGlobal(something...); } } Thanks in advance!

    Read the article

1