Telerik Forums
UI for WPF Forum
1 answer
138 views
Hi,

I am facing a problem while deleting a record from the GridView, after clicking on the delete button, methods get executed and record is successfully deleted from the XML File and from the Observable collection property but the grid is not getting refreshed.  
could you please suggest me asap.

File Code:

Binding to grid using MVVM pattern i.e. datasource list is observable collection which assign to the view datacontext.

View Model Class:

public class ScenerioViewModel : ViewModelBase
    {
        private IScenerioRepository _repository;
        ObservableCollection<Scenerio> scenerio = new ObservableCollection<Scenerio>();
        #region Constructor
        public ScenerioViewModel (): this(new ScenerioRepository())
        {
            // Blank
        }
        public ScenerioViewModel(IScenerioRepository repository)
        {
            _repository = repository;
            GetAllRecords();
        }
        #endregion Constructor
        public ObservableCollection<Scenerio> OCScenario
        {
            get { return scenerio; }
        }
        
        private void GetAllRecords()
        {
            scenerio.Clear();
            List<Scenerio> scenerioList = _repository.GetAllRecords();
            foreach (Scenerio sce in scenerioList)
            {
                scenerio.Add(sce);
            }
        }

        private RelayCommand deleteData;
        public ICommand ICDeleteData
        {
            get
            {
                if (deleteData == null)
                {
                    deleteData = new RelayCommand(param => DeleteData());
                }
                return deleteData;
            }
        }

        private void DeleteData()
        {
            _repository.DeleteRecord(scenerio.FirstOrDefault());
            GetAllRecords();
        } 

XAML File code:
<telerik:RadGridView x:Name="YeildCurveGrid"  ItemsSource="{Binding Path=OCScenario/ListYeildCurve}" AutoGenerateColumns="False" DataLoadMode="Asynchronous"  ColumnWidth="*" RowIndicatorVisibility="Collapsed" IsFilteringAllowed="False" ShowGroupPanel="False" >
<telerik:GridViewDataControl.Columns>
 <telerik:GridViewDataColumn Header="Select" DataMemberBinding="{Binding IsSelected}" IsFilterable="False" IsSortable="False">
    <telerik:GridViewDataColumn.CellTemplate>
          <DataTemplate>
               <CheckBox IsChecked="{Binding IsSelected}"/>
         </DataTemplate>
   </telerik:GridViewDataColumn.CellTemplate>
 </telerik:GridViewDataColumn>
<telerik:GridViewDataColumn Header="GUID" IsVisible="False" IsFilterable="False" DataMemberBinding="{Binding GUID}" IsReadOnly="True" IsSortable="False" ></telerik:GridViewDataColumn>
<telerik:GridViewDataColumn Header="Code" IsFilterable="False" DataMemberBinding="{Binding CrncyCode}" IsReadOnly="True" IsSortable="False"  Background="BlanchedAlmond" ></telerik:GridViewDataColumn>
</telerik:GridViewDataColumn>
</telerik:GridViewDataControl.Columns>
</grid:RadGridView>

<Button x:Name="btnDelete" Command="{Binding ICDeleteData}" Content="Delete" ></Button>


Thanks,
Gorakhnath Choudhary
Milan
Telerik team
 answered on 17 Dec 2009
3 answers
179 views
I'm working on application using Prism and yours Q3 WPF controls. Unfortunately when I'm trying to dock control in another dock region the InvalidOperationException is thrown. Exception message says I should use ItemsControl.ItemsSource instead of ItemsSource and I really don`t known how to solve this.

Below you'll find my region adapter class, dockable view class and docking container declaration in main window

Region adapter
namespace LTD.Desktop.Common 
    public class RadPaneGroupRegionAdapter : RegionAdapterBase<RadPaneGroup> 
    { 
        public RadPaneGroupRegionAdapter(IRegionBehaviorFactory regionBehaviorFactory) 
            : base(regionBehaviorFactory) 
        { 
        } 
 
        protected override void Adapt(IRegion region, RadPaneGroup regionTarget) 
        { 
            region.Views.CollectionChanged += (s, e) => 
            { 
                switch (e.Action) 
                { 
                    case NotifyCollectionChangedAction.Add: 
                        foreach (var item in e.NewItems.OfType<RadPane>()) 
                        { 
                            regionTarget.AddItem(item, Telerik.Windows.Controls.Docking.DockPosition.Center); 
                        } 
                        break
                    case NotifyCollectionChangedAction.Remove: 
                        foreach (var item in e.OldItems.OfType<RadPane>()) 
                        { 
                            item.RemoveFromParent(); 
                        } 
                        break
                    case NotifyCollectionChangedAction.Replace: 
                        { 
                            var oldItems = e.OldItems.OfType<RadPane>(); 
                            var newItems = e.NewItems.OfType<RadPane>(); 
                            var newItemsEnumerator = newItems.GetEnumerator(); 
                            foreach (var oldItem in oldItems) 
                            { 
                                var parent = oldItem.Parent as ItemsControl; 
                                if (parent != null && parent.Items.Contains(oldItem)) 
                                { 
                                    parent.Items[parent.Items.IndexOf(oldItem)] = newItemsEnumerator.Current; 
                                    if (!newItemsEnumerator.MoveNext()) 
                                    { 
                                        break
                                    } 
                                } 
                                else 
                                { 
                                    oldItem.RemoveFromParent(); 
                                    regionTarget.Items.Add(newItemsEnumerator.Current); 
                                } 
                            } 
                        } 
                        break
                    case NotifyCollectionChangedAction.Reset: 
                        regionTarget 
                            .EnumeratePanes() 
                            .ToList() 
                            .ForEach(p => p.RemoveFromParent()); 
                        break
                    default
                        break
                } 
            }; 
 
            foreach (var view in region.Views.OfType<RadPane>()) 
            { 
                regionTarget.Items.Add(view); 
            } 
        } 
 
        protected override IRegion CreateRegion() 
        { 
            return new AllActiveRegion(); 
        } 
    } 

Dockable view
namespace LTD.Examples.Modularity.Views 
    /// <summary> 
    /// Interaction logic for ExampleView.xaml 
    /// </summary> 
    public partial class ExampleView : RadDocumentPane 
    { 
        public ExampleView() 
        { 
            InitializeComponent(); 
        } 
    } 

<telerik:RadDocumentPane x:Class="LTD.Examples.Modularity.Views.ExampleView" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" 
    Header="Example panel"/> 
 

ExampleView class in design time also generate en error: Could not create an instance of type 'RadDocumentPane'

Views container:
<!-- Workspaces container --> 
        <telerik:RadDocking Name="Workspaces" DockPanel.Dock="Bottom" cal:RegionManager.RegionName="Workspaces"
            <telerik:RadDocking.DocumentHost> 
                <telerik:RadSplitContainer> 
                    <telerik:RadPaneGroup cal:RegionManager.RegionName="MainRegion" /> 
                </telerik:RadSplitContainer> 
            </telerik:RadDocking.DocumentHost> 
        </telerik:RadDocking> 

It's critical for me, so I'll be appreciate for any help.

Regards,
MC.
Maciej Czerwiakowski
Top achievements
Rank 1
 answered on 17 Dec 2009
1 answer
185 views
How do we commit the changes made to data in a datagrid when using a dataset as a datasource.?

Ive tried using the tableapapter.update()
and
the radgridview.commitchanges()
methods but the changes are not persisted to the database.

Do we need to use the Telereik ORM (which I have never looked at)..will ORM work with access MDB's?

or should I work towards updating my access to sql and use entity models. (of which I have spent some time working so I'm familiar with it) ??
then just use the context.save() and let entity framework handle the plumbing

Suggestions, advice..Success/horror stories? 
Nedyalko Nikolov
Telerik team
 answered on 17 Dec 2009
1 answer
134 views
I'd like to bind SelectTime to a DateTime value, how can I do this ?
4ward s.r.l.
Top achievements
Rank 1
 answered on 17 Dec 2009
1 answer
123 views
I watched the "What's new" and saw the Ctrl-Home and End but I am wondering if the arrow navigation made it into the current relase?

Thanks,
-Sid.
Nedyalko Nikolov
Telerik team
 answered on 17 Dec 2009
1 answer
155 views
I was wondering if someone of the Telerik team could post the entire code project of the example given at http://www.telerik.com/help/wpf/gridview-selection-via-checkbox.html.

Thanks in advance.
Milan
Telerik team
 answered on 17 Dec 2009
1 answer
126 views
So, here is my problem.
I am new to teleric RadCharts for WPF and I wanted to draw a chart that has points who have 
1. Different shapes based on their values
2. Different animated tooltips when the user hovers over them (again) based on their values

Is this possible to do? Can some one please walk me through an approach?

Thanks
Giuseppe
Telerik team
 answered on 17 Dec 2009
3 answers
129 views
Hello.  I'm using the RadNumericUpDown for entering measurements.  I've set the control's decimal places property to 3 (using a binding to a business object property).  when the control has no value (meaning the value I'm binding to is null), and the control's text itself is empty, the user is able to enter a number such as ".890" without the leading 0.  However, when there is already a value in the control, such as "123.432" and the user selects the control, either by tab or by mouse click.  THe user must type in a leading 0 in order to enter a value less then 1, such as "0.890".

My client wants to be able to enter values without needing a leading 0.  I've tried handling the "GotFocus" event, and clearing the RadNumericUpDown.ValueProperty, or setting my business object's binded value to null.  However, these changes do not take effect until the user leaves the control.  Thus we get the weird behavior of the control clearing when the user leaves the control, instead of when they enter it.

Any ideas would be great.  Thanks

Joshua
Boyan
Telerik team
 answered on 17 Dec 2009
3 answers
416 views
Hi Team,

I want to align content of RadNumericUpDown to Left align. I have tried HorizontalContentAlignment="Left", but it doesn't work. Please suggest needful.

Thanks.

Sample:
File name: window1.xaml
XAML Content:
<Window x:Class="TelerikUpDown.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
    Title="Window1" Height="300" Width="300">
    <Grid>
        <telerik:RadNumericUpDown Name="NumUpDown" Height="25"
                                  HorizontalContentAlignment="Left"
                                  SmallChange="1" Minimum="1" Maximum="10" Value="2"
                                  BorderThickness="0" LargeChange="5" ValueFormat="Numeric"
                                  Width="150">
        </telerik:RadNumericUpDown>
    </Grid>
</Window>
Dimitrina
Telerik team
 answered on 17 Dec 2009
2 answers
170 views

For some strange reason, the gridview edit mode for a column that is string binded, accepts only numeric values. What could be wrong

 <telerik:RadGridView Name="rgvSiteDetails" Margin="10,10,10,10" Height="340" RowIndicatorVisibility="Collapsed"   
                    ShowGroupPanel="False" AutoGenerateColumns="False" Visibility="Visible" Background="Transparent" 
                    AutoGenerateHierarchyFromDataSet="False" BorderBrush="LightGray" CanUserFreezeColumns="False" CanUserInsertRows="False" 
                    HorizontalContentAlignment="Stretch" ShowColumnHeaders="True" IsFilteringAllowed="False"   
                    VerticalGridlinesBrush="LightGray" > 
                    <telerik:RadGridView.Columns> 
                        <telerik:GridViewDataColumn UniqueName="IsSelected" DataMemberBinding="{Binding IsSelected}" Header="" Width="30" /> 
                        <telerik:GridViewDataColumn UniqueName="SiteSequence" Header="" Width="30" DataMemberBinding="{Binding SiteSequence}" /> 
                        <telerik:GridViewDataColumn UniqueName="SiteName" Header="SiteName" DataMemberBinding="{Binding SiteName}"  Width="120" /> 
                        <telerik:GridViewDataColumn UniqueName="SiteShortName" Header="SiteShortName" DataMemberBinding="{Binding SiteShortName}"  Width="120"/>  
                        <telerik:GridViewDataColumn IsReadOnly="True" UniqueName="ReceivedDate" IsVisible="True" Header="Received Date" Width="80"  DataMemberBinding="{Binding ReceivedDate}"  /> 
                        <telerik:GridViewDataColumn IsReadOnly="True" UniqueName="PatientLastName" Header="Patient Last Name" IsVisible="True" Width="120"  DataMemberBinding="{Binding PatientLastName}"  /> 
                          
                        <telerik:GridViewDataColumn x:Name="gdcCassetteId" UniqueName="CassetteID" IsVisible="False" Header="Cassette Id" Width="80"  DataMemberBinding="{Binding CassetteID}" /> 
                          
                        <telerik:GridViewDataColumn x:Name="gdcSlideId" UniqueName="DisplayName" Header="Display Name" IsVisible="False" DataMemberBinding="{Binding DisplayName}"  /> 
                        <telerik:GridViewDataColumn x:Name="gdcDisplayName" UniqueName="DisplayName" Header="Display Name" IsVisible="False" DataMemberBinding="{Binding DisplayName}"  /> 
                        <telerik:GridViewDataColumn x:Name="gdcProcedureName" UniqueName="ProcedureName" Header="Procedure Name" IsVisible="False" DataMemberBinding="{Binding DisplayName}"  /> 
                        <telerik:GridViewDataColumn x:Name="gdcLevelInfo" UniqueName="LevelInfo" Header="Level Info" IsVisible="False" DataMemberBinding="{Binding DisplayName}"  /> 
                        <telerik:GridViewDataColumn x:Name="gdcmagazineid" UniqueName="magazineid" IsVisible="False" Header="Magazine Id"  DataMemberBinding="{Binding magazineid}"  /> 
                        <telerik:GridViewDataColumn x:Name="gdcbin" UniqueName="bin" Header="Exit Bin" IsVisible="False"   DataMemberBinding="{Binding bin}"  /> 
 
                    </telerik:RadGridView.Columns> 
                </telerik:RadGridView> 
Below is the code behind

private void rgvSiteDetails_CurrentCellChanged(object sender, GridViewCurrentCellChangedEventArgs e)  
        {  
            this.rgvSiteDetails.BeginEdit();  
        } 
 SharedData.lstSelectedCaseData = new ObservableCollection<SharedData.SelectedCaseData>();  
 
                rgvSiteDetails.DataLoaded += new EventHandler<EventArgs>(rgvSiteDetails_DataLoaded);  
               foreach (CaseDataCase item in SharedData.objCurrent.Items)  
                        {  
                            if (item.Specimen != null)  
                                foreach (CaseDataCaseSpecimen item2 in item.Specimen)  
                                {  
                                    SharedData.SelectedCaseData a = new SharedData.SelectedCaseData();  
                                    a.CaseId = item.CaseId;  
                                    a.AccessionNumber = item.AccessionNumber;  
                                    a.ReceivedDate = item.ReceivedDate;  
                                    a.PatientLastName = item.Patient[0].PatientLastName;  
                                    a.IsSelected = true;  
                                    a.SiteName = item2.SiteName;  
                                    a.SiteSequence = item2.SiteSequence;  
                                    a.SiteShortName = item2.SiteShortName;  
                                    a.SiteID = item2.SiteID;  
                                    SharedData.lstSelectedCaseData.Add(a);         
                                }  
                              
                        }  
                        rgvSiteDetails.ItemsSource = SharedData.lstSelectedCaseData; 

void rgvSiteDetails_DataLoaded(object sender, EventArgs e)  
        {  
            try 
            {  
                SharedData.Log.Info("Entering rgvSiteDetails_DataLoaded");  
                rgvSiteDetails.ExpandAllGroups();  
                SharedData.Log.Info("Exiting rgvSiteDetails_DataLoaded");  
            }  
            catch (Exception ex)  
            {  
                SharedMethods.HandleExceptions(ex);  
            }  
              
        } 

Any help would be highly appreciated.
Pooran
Pooran
Top achievements
Rank 1
 answered on 17 Dec 2009
Narrow your results
Selected tags
Tags
GridView
General Discussions
Chart
RichTextBox
Docking
ScheduleView
ChartView
TreeView
Diagram
Map
ComboBox
TreeListView
Window
RibbonView and RibbonWindow
PropertyGrid
DragAndDrop
TabControl
TileView
Carousel
DataForm
PDFViewer
MaskedInput (Numeric, DateTime, Text, Currency)
AutoCompleteBox
DatePicker
Buttons
ListBox
GanttView
PivotGrid
Spreadsheet
Gauges
NumericUpDown
PanelBar
DateTimePicker
DataFilter
Menu
ContextMenu
TimeLine
Calendar
Installer and Visual Studio Extensions
ImageEditor
BusyIndicator
Expander
Slider
TileList
DataPager
PersistenceFramework
Styling
TimeBar
OutlookBar
TransitionControl
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
WatermarkTextBox
DesktopAlert
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
LayoutControl
ProgressBar
Sparkline
TabbedWindow
ToolTip
CloudUpload
ColorEditor
TreeMap and PivotMap
EntityFrameworkCoreDataSource (.Net Core)
HeatMap
Chat (Conversational UI)
VirtualizingWrapPanel
Calculator
NotifyIcon
TaskBoard
TimeSpanPicker
BulletGraph
Licensing
WebCam
CardView
DataBar
FilePathPicker
PasswordBox
SplashScreen
Callout
Rating
Accessibility
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?