﻿<?xml version="1.0" encoding="utf-8"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Intersoft Community - Crosslight - How to Use Crosslight to Prevent Deleting an Item from DataListViewModelBase?</title><link>http://www.intersoftsolutions.com/Community/Crosslight/How-to-Use-Crosslight-to-Prevent-Deleting-an-Item-from-DataListViewModelBase/</link><description /><generator>http://www.intersoftsolutions.com</generator><language>en</language><copyright>Copyright 2002 - 2015 Intersoft Solutions Corp. All rights reserved.</copyright><ttl>60</ttl><item><title>How to Use Crosslight to Prevent Deleting an Item from DataListViewModelBase?</title><link>http://www.intersoftsolutions.com/Community/Crosslight/How-to-Use-Crosslight-to-Prevent-Deleting-an-Item-from-DataListViewModelBase/</link><pubDate>Wed, 19 Aug 2015 05:59:44 GMT</pubDate><dc:creator>jtungol@silentpartnersoft.com</dc:creator><description>That's great! We'll give it a try and see how it works. Good to hear from you Yudi. Hope you've been doing well.&lt;br&gt;</description></item><item><title>How to Use Crosslight to Prevent Deleting an Item from DataListViewModelBase?</title><link>http://www.intersoftsolutions.com/Community/Crosslight/How-to-Use-Crosslight-to-Prevent-Deleting-an-Item-from-DataListViewModelBase/</link><pubDate>Wed, 19 Aug 2015 02:18:06 GMT</pubDate><dc:creator>yudi</dc:creator><description>&lt;p&gt;&lt;span style="color: #1f497d;"&gt;Overriding CanExecuteDelete can be used in order to prevent delete on item from DataListViewModelBase.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color: #1f497d;"&gt;I use MyInventoryWebAPI Crosslight sample and apply this rule: prevent delete on item(s) that have been sold. Note that the &lt;em&gt;Item&lt;/em&gt; has a &lt;em&gt;Sold&lt;/em&gt; column/field name.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color: #1f497d;"&gt;Override CanExecuteDelete and insert following code:&lt;/span&gt;&lt;/p&gt;
&lt;pre&gt;protected override bool CanExecuteDelete(object parameter)
{
    // only return true if item is not sold
	// prevent delete on item(s) that has/have been sold
	// on multiple selection scenario, if any item from
	// the selected item is sold, delete will be disabled
	if (parameter is Item)
    {
        return !(parameter as Item).Sold;
    }
	else if (parameter is IEnumerable&amp;lt;Item&amp;gt; &amp;amp;&amp;amp; ((IEnumerable&amp;lt;Item&amp;gt;)parameter).Count() &amp;gt; 0)
		return !((IEnumerable&amp;lt;Item&amp;gt;)parameter).Any(p =&amp;gt; p.Sold == true);

    return false;
}&lt;/pre&gt;
&lt;p&gt;&lt;span style="color: #1f497d;"&gt;I uploaded the modified version of MyInventoryWebAPI sample at OneDrive: &lt;a href="https://onedrive.live.com/download?resid=A29317908CEA783A!438&amp;amp;authkey=!ABdV-gAX4q1YyjY&amp;amp;ithint=file%2czip" target="_blank"&gt;here&lt;/a&gt;, as reference. Hope this helps.&lt;/span&gt;&lt;/p&gt;</description></item><item><title>How to Use Crosslight to Prevent Deleting an Item from DataListViewModelBase?</title><link>http://www.intersoftsolutions.com/Community/Crosslight/How-to-Use-Crosslight-to-Prevent-Deleting-an-Item-from-DataListViewModelBase/</link><pubDate>Mon, 17 Aug 2015 22:25:05 GMT</pubDate><dc:creator>jtungol@silentpartnersoft.com</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;

&lt;p&gt;How do you prevent users from deleting specific items or an item that has a NotDeletable column/field name? Please provide a sample code snippet for iOS and Android only, since for WinPhone, WinRT... this should be straightforward. So yeah, samples for iOS and Android... please?&amp;nbsp;&lt;/p&gt;

&lt;p&gt;We understand for iOS that this might be possible by binding the CanDelete on cell item level, which is bound to a row. But not quite sure about that for iOS though. On Android, hmmm... this one might be tricky since it does not have customization for edit actions on cell level, but I could be wrong. We assume that's how it is for Android since holding/pressing on an item long enough will popup a new check list view where you can select the items that you can delete. But how do you disable checking an item that should not be deleted? Meaning you should not be able to check/select an item from the list if it's tagged as NotDeletable == true.&lt;/p&gt;

&lt;p&gt;Again, samples for both iOS and Android would be very much helpful. Thanks!&lt;/p&gt;</description></item></channel></rss>