[{"data":1,"prerenderedAt":583},["ShallowReactive",2],{"article-xamarin-android-use-toolbar-in-place-of-actionbar":3},{"article":4,"tags":166,"previous":181,"next":524},{"id":5,"title":6,"author":7,"body":8,"createdAt":155,"description":156,"extension":157,"img":26,"meta":158,"navigation":159,"path":160,"seo":161,"stem":162,"tags":163,"updatedAt":155,"__hash__":165},"articles\u002Farticles\u002Fxamarin-android-use-toolbar-in-place-of-actionbar.md","Xamarin Android - Use Toolbar in place of ActionBar","[object Object]",{"type":9,"value":10,"toc":151},"minimark",[11,34,41,57,62,65,84,92,97,124,135,138,142],[12,13,14,15,18,31,33],"p",{},"Add references to Xamarin.Android.Support.v7.AppCompat (this will also include Xamarin.Android.Support.v4)",[16,17],"br",{},[19,20,22],"a",{"href":21},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-android-use-toolbar-in-place-o_b87d-image_2.png",[23,24],"img",{"style":25,"src":26,"border":27,"alt":28,"title":28,"width":29,"height":30},"background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;","\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-android-use-toolbar-in-place-o_b87d-image_thumb.png",0,"image",240,209,[16,32],{},"\nOpen Main.axml adding the following toolbar element",[35,36,40],"pre",{"className":37},[38,39],"brush:","xml;","\u003C?xml version=\"1.0\" encoding=\"utf-8\"?>  \n\u003Candroid.support.v7.widget.Toolbar xmlns:android=\"http:\u002F\u002Fschemas.android.com\u002Fapk\u002Fres\u002Fandroid\"  \n    xmlns:app=\"http:\u002F\u002Fschemas.android.com\u002Fapk\u002Fres-auto\"  \n    android:id=\"@+id\u002Ftoolbar\"  \n    android:layout_height=\"wrap_content\"  \n    android:minHeight=\"?attr\u002FactionBarSize\"  \n    android:background=\"?attr\u002FcolorPrimary\"  \n    android:layout_width=\"match_parent\" \u002F>",[12,42,43,44,46,54,56],{},"Opening in the designer we have",[16,45],{},[19,47,49],{"href":48},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-android-use-toolbar-in-place-o_b87d-image_4.png",[23,50],{"style":25,"src":51,"border":27,"alt":28,"title":28,"width":52,"height":53},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-android-use-toolbar-in-place-o_b87d-image_thumb_1.png",296,117,[16,55],{},"\nUpdating MainActivity.cs",[35,58,61],{"className":59},[38,60],"csharp;","using System;  \nusing Android.App;  \nusing Android.Content;  \nusing Android.Runtime;  \nusing Android.Views;  \nusing Android.Widget;  \nusing Android.OS;  \nusing SupportToolbar = Android.Support.V7.Widget.Toolbar;  \nusing Android.Support.V7.App;  \nusing Android.Support.V4.Widget;  \nusing System.Collections.Generic;  \n  \nnamespace AppDave  \n{      \n    [Activity(Label = \"AppDave\", MainLauncher = true, Icon = \"@drawable\u002Ficon\", Theme=\"@style\u002FMyTheme\")]  \n    public class MainActivity : ActionBarActivity  \n    {  \n        private SupportToolbar _toolbar;  \n  \n        protected override void OnCreate(Bundle bundle)  \n        {  \n            base.OnCreate(bundle);                      \n            SetContentView(Resource.Layout.Main);  \n  \n            _toolbar = FindViewById\u003CSupportToolbar>(Resource.Id.toolbar);  \n            \u002F\u002Fsets the actionbar to our toolbar  \n            SetSupportActionBar(_toolbar);    \n            \u002F\u002Fwe can now call our toolbar via SupportActionBar  \n            SupportActionBar.Title = \"MyToolbar\";  \n        }  \n  \n        public override bool OnCreateOptionsMenu(IMenu menu)  \n        {              \n            MenuInflater.Inflate(Resource.Menu.action_menu, menu);  \n            return base.OnCreateOptionsMenu(menu);  \n        }  \n    }  \n}",[12,63,64],{},"Notes:",[66,67,68,72,75,78,81],"ul",{},[69,70,71],"li",{},"I am deriving from ActionBarActivity instead of Activity (see above)",[69,73,74],{},"I am using a styles.xml. This will be used to specify the theme that will be applied to the activity.  The theme will inherit from the AppCompat.Light theme. Then at this point we can override the default values for that theme.",[69,76,77],{},"Note: instead of specifying .NoActionBar as shown below I have read that you can also specify the parent as Theme.AppCompat.Light then the first attribute would be \u003Citem name=”windowActionBar”>false\u003C\u002Fitem>  I found however by specifying no action bar in this manner I had the following exception “Java.Lang.IllegalArgumentException: AppCompat does not support the current theme features”.  As a result I did have to use the .NoActionBar option as shown in the xml snippet.",[69,79,80],{},"SetSupportActionBar will be used to actually set the action bar to our toolbar.  At this point, SupportActionBar will be used to call the toolbar.",[69,82,83],{},"In order to get the action menu to be inflated on the toolbar use public override OnCreateOptionsMenu",[85,86,87,88,87],"blockquote",{},"  \n",[35,89,91],{"className":90},[38,39],"\u003C?xml version=\"1.0\" encoding=\"utf-8\" ?>  \n\u003Cresources>    \n  \u003Cstyle name=\"MyTheme\" parent=\"Theme.AppCompat.Light.NoActionBar\">   \n    \u003Citem name=\"colorPrimary\">#2196F3\u003C\u002Fitem>  \n  \u003C\u002Fstyle>  \n\u003C\u002Fresources>  \n",[66,93,94],{},[69,95,96],{},"The menu within the toolbar is also specified via action_menu.xml.  This will be the quick menu on the top right.",[85,98,87,99],{},[35,100,102,103],{"className":101},[38,39],"\u003C?xml version=\"1.0\" encoding=\"UTF-8\" ?>  \n\u003Cmenu  \n    xmlns:android=\"http:\u002F\u002Fschemas.android.com\u002Fapk\u002Fres\u002Fandroid\"  \n    xmlns:app=\"http:\u002F\u002Fschemas.android.com\u002Fapk\u002Fres-auto\">  \n",[12,104,105,106,108,109,111,112,114,115,117,118,120,121,123],{},"\u003Citem android:id=\"@+id\u002Faction_help\"",[16,107],{},"\nandroid:icon=\"@drawable\u002Fic_action_help\"",[16,110],{},"\nandroid:title=\"Help\"\u002F>",[16,113],{},"\n\u003Citem android:id=\"@+id\u002Faction_refresh\"",[16,116],{},"\nandroid:icon=\"@drawable\u002Fic_action_refresh\"",[16,119],{},"\nandroid:title=\"Refresh\"\u002F>",[16,122],{},"\n\u003C\u002Fmenu>",[12,125,126],{},[19,127,129],{"href":128},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-android-use-toolbar-in-place-o_b87d-image_6.png",[23,130],{"style":131,"src":132,"border":27,"alt":28,"title":28,"width":133,"height":134},"background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;","\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-android-use-toolbar-in-place-o_b87d-image_thumb_2.png",199,318,[12,136,137],{},"Note: in the above action menu we did not override the app : showAsAction element.  If I specify showAsAction in the following manner you can see the differences.  When specifying as never the icon is visible to the left of the …",[35,139,141],{"className":140},[38,39],"\u003C?xml version=\"1.0\" encoding=\"UTF-8\" ?>  \n\u003Cmenu  \n    xmlns:android=\"http:\u002F\u002Fschemas.android.com\u002Fapk\u002Fres\u002Fandroid\"  \n    xmlns:app=\"http:\u002F\u002Fschemas.android.com\u002Fapk\u002Fres-auto\">  \n  \n  \u003Citem android:id=\"@+id\u002Faction_help\"  \n        android:icon=\"@drawable\u002Fic_action_help\"  \n        android:title=\"Help\"  \n        app:showAsAction=\"always\"  \n        \u002F>  \n  \n  \u003Citem android:id=\"@+id\u002Faction_refresh\"  \n        android:icon=\"@drawable\u002Fic_action_refresh\"  \n        android:title=\"Refresh\"  \n        app:showAsAction=\"never\"  \n        \u002F>  \n\u003C\u002Fmenu>  \n",[12,143,144],{},[19,145,147],{"href":146},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-android-use-toolbar-in-place-o_b87d-image_8.png",[23,148],{"style":131,"src":149,"border":27,"alt":28,"title":28,"width":29,"height":150},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-android-use-toolbar-in-place-o_b87d-image_thumb_3.png",77,{"title":152,"searchDepth":153,"depth":153,"links":154},"",2,[],"2016-02-07T09:50:32.1900000-05:00","A toolbar in place of an actionbar with a menu, the end result.","md",{},true,"\u002Farticles\u002Fxamarin-android-use-toolbar-in-place-of-actionbar",{"title":6,"description":156},"articles\u002Fxamarin-android-use-toolbar-in-place-of-actionbar",[164],"xamarin","3MdES8JhgEfxYHKgSOClj6WwiA-BKs6xZS5LaqZ_HSc",[167],{"id":168,"title":169,"body":170,"description":174,"extension":157,"img":175,"meta":176,"name":164,"navigation":159,"path":177,"seo":178,"stem":179,"__hash__":180},"tags\u002Ftags\u002Fxamarin.md","Xamarin",{"type":9,"value":171,"toc":172},[],{"title":152,"searchDepth":153,"depth":153,"links":173},[],"Xamarin is an open-source platform for building modern and performant applications for iOS, Android, and Windows with . NET. Xamarin is an abstraction layer that manages communication of shared code with underlying platform code.","https:\u002F\u002Fimages.unsplash.com\u002Fphoto-1598313183973-4effcded8d5e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=675&q=80",{},"\u002Ftags\u002Fxamarin",{"description":174},"tags\u002Fxamarin","deVB66I7cJMtWvqybFh5POf9LBCBwHNe-5ZGMOzV5G4",{"id":182,"title":183,"author":7,"body":184,"createdAt":514,"description":515,"extension":157,"img":516,"meta":517,"navigation":159,"path":518,"seo":519,"stem":520,"tags":521,"updatedAt":514,"__hash__":523},"articles\u002Farticles\u002Fsql-server-triggers-to-mirror-a-table.md","SQL Server Triggers To Mirror a Table",{"type":9,"value":185,"toc":512},[186,192,267,270,496,499,508],[12,187,188,189,191],{},"I had a need to mirror any changes to one Sql Server table to another Sql Server table of a different name. Both tables had similar columns and types. In this sample my table is called Dave_Test and my mirror table was Dave_Test_Audit.",[16,190],{},"\nI will provide the create table structures in the event you want to replicate my code.",[35,193,197],{"className":194,"code":195,"language":196,"meta":152,"style":152},"language-sql shiki shiki-themes github-light github-dark","CREATE TABLE [Dave_Test]( \n    [Emp_ID] [int] IDENTITY(1,1) NOT NULL, \n    [Emp_name] [varchar](100) NULL, \n    [Emp_Sal] [decimal](10, 2) NULL ) ON [PRIMARY]  \n   \nCREATE TABLE [Dave_Test_Audit](\n    [Emp_ID] [int] NULL,\n    [Emp_name] [varchar](100) NULL,\n    [Emp_Sal] [decimal](18, 0) NULL\n) ON [PRIMARY]  \nGO  \n","sql",[198,199,200,208,213,219,225,231,237,243,249,255,261],"code",{"__ignoreMap":152},[201,202,205],"span",{"class":203,"line":204},"line",1,[201,206,207],{},"CREATE TABLE [Dave_Test]( \n",[201,209,210],{"class":203,"line":153},[201,211,212],{},"    [Emp_ID] [int] IDENTITY(1,1) NOT NULL, \n",[201,214,216],{"class":203,"line":215},3,[201,217,218],{},"    [Emp_name] [varchar](100) NULL, \n",[201,220,222],{"class":203,"line":221},4,[201,223,224],{},"    [Emp_Sal] [decimal](10, 2) NULL ) ON [PRIMARY]  \n",[201,226,228],{"class":203,"line":227},5,[201,229,230],{},"   \n",[201,232,234],{"class":203,"line":233},6,[201,235,236],{},"CREATE TABLE [Dave_Test_Audit](\n",[201,238,240],{"class":203,"line":239},7,[201,241,242],{},"    [Emp_ID] [int] NULL,\n",[201,244,246],{"class":203,"line":245},8,[201,247,248],{},"    [Emp_name] [varchar](100) NULL,\n",[201,250,252],{"class":203,"line":251},9,[201,253,254],{},"    [Emp_Sal] [decimal](18, 0) NULL\n",[201,256,258],{"class":203,"line":257},10,[201,259,260],{},") ON [PRIMARY]  \n",[201,262,264],{"class":203,"line":263},11,[201,265,266],{},"GO\n",[12,268,269],{},"Here are my insert, update and delete triggers.",[35,271,273],{"className":194,"code":272,"language":196,"meta":152,"style":152},"Create TRIGGER [Dave_Test_Trigger_Delete]   \n   ON  [Dave_Test]   \n   AFTER DELETE  \nAS  \nBEGIN  \n     SET NOCOUNT ON;  \n     DELETE FROM Dave_Test_Audit   \n            WHERE emp_id IN (SELECT emp_id FROM deleted)  \nEND  \n  \nCreate TRIGGER [Dave_Test_Trigger_Insert]   \n   ON  [Dave_Test]   \n   AFTER INSERT  \nAS  \nBEGIN     SET NOCOUNT ON;  \n        INSERT INTO Dave_Test_Audit   \n         SELECT * FROM inserted END  \nEND  \n  \nCREATE TRIGGER [[Dave_Test_Trigger_Update]   \n   ON  [Dave_Test]   \n   AFTER UPDATE  \nAS  \nBEGIN  \n        SET NOCOUNT ON;  \n        IF EXISTS(SELECT * FROM Dave_Test_Audit a JOIN inserted AS i ON a.emp_id=i.emp_id)          \n        BEGIN  \n              UPDATE  Dave_Test_Audit   \n                SET emp_id = i.emp_id,  \n                emp_name = i.emp_name,  \n                emp_sal =  i.emp_sal  \n                FROM inserted i WHERE Dave_Test_Audit.emp_id=i.emp_id           \n              \n        END  \n        ELSE  \n             BEGIN  \n             INSERT INTO Dave_Test_Audit   \n                SELECT * FROM inserted   \n        END        \nEND\n",[198,274,275,280,285,290,295,300,305,310,315,320,324,329,334,340,345,351,357,363,368,373,379,384,390,395,400,406,412,418,424,430,436,442,448,454,460,466,472,478,484,490],{"__ignoreMap":152},[201,276,277],{"class":203,"line":204},[201,278,279],{},"Create TRIGGER [Dave_Test_Trigger_Delete]   \n",[201,281,282],{"class":203,"line":153},[201,283,284],{},"   ON  [Dave_Test]   \n",[201,286,287],{"class":203,"line":215},[201,288,289],{},"   AFTER DELETE  \n",[201,291,292],{"class":203,"line":221},[201,293,294],{},"AS  \n",[201,296,297],{"class":203,"line":227},[201,298,299],{},"BEGIN  \n",[201,301,302],{"class":203,"line":233},[201,303,304],{},"     SET NOCOUNT ON;  \n",[201,306,307],{"class":203,"line":239},[201,308,309],{},"     DELETE FROM Dave_Test_Audit   \n",[201,311,312],{"class":203,"line":245},[201,313,314],{},"            WHERE emp_id IN (SELECT emp_id FROM deleted)  \n",[201,316,317],{"class":203,"line":251},[201,318,319],{},"END  \n",[201,321,322],{"class":203,"line":257},[201,323,87],{},[201,325,326],{"class":203,"line":263},[201,327,328],{},"Create TRIGGER [Dave_Test_Trigger_Insert]   \n",[201,330,332],{"class":203,"line":331},12,[201,333,284],{},[201,335,337],{"class":203,"line":336},13,[201,338,339],{},"   AFTER INSERT  \n",[201,341,343],{"class":203,"line":342},14,[201,344,294],{},[201,346,348],{"class":203,"line":347},15,[201,349,350],{},"BEGIN     SET NOCOUNT ON;  \n",[201,352,354],{"class":203,"line":353},16,[201,355,356],{},"        INSERT INTO Dave_Test_Audit   \n",[201,358,360],{"class":203,"line":359},17,[201,361,362],{},"         SELECT * FROM inserted END  \n",[201,364,366],{"class":203,"line":365},18,[201,367,319],{},[201,369,371],{"class":203,"line":370},19,[201,372,87],{},[201,374,376],{"class":203,"line":375},20,[201,377,378],{},"CREATE TRIGGER [[Dave_Test_Trigger_Update]   \n",[201,380,382],{"class":203,"line":381},21,[201,383,284],{},[201,385,387],{"class":203,"line":386},22,[201,388,389],{},"   AFTER UPDATE  \n",[201,391,393],{"class":203,"line":392},23,[201,394,294],{},[201,396,398],{"class":203,"line":397},24,[201,399,299],{},[201,401,403],{"class":203,"line":402},25,[201,404,405],{},"        SET NOCOUNT ON;  \n",[201,407,409],{"class":203,"line":408},26,[201,410,411],{},"        IF EXISTS(SELECT * FROM Dave_Test_Audit a JOIN inserted AS i ON a.emp_id=i.emp_id)          \n",[201,413,415],{"class":203,"line":414},27,[201,416,417],{},"        BEGIN  \n",[201,419,421],{"class":203,"line":420},28,[201,422,423],{},"              UPDATE  Dave_Test_Audit   \n",[201,425,427],{"class":203,"line":426},29,[201,428,429],{},"                SET emp_id = i.emp_id,  \n",[201,431,433],{"class":203,"line":432},30,[201,434,435],{},"                emp_name = i.emp_name,  \n",[201,437,439],{"class":203,"line":438},31,[201,440,441],{},"                emp_sal =  i.emp_sal  \n",[201,443,445],{"class":203,"line":444},32,[201,446,447],{},"                FROM inserted i WHERE Dave_Test_Audit.emp_id=i.emp_id           \n",[201,449,451],{"class":203,"line":450},33,[201,452,453],{},"              \n",[201,455,457],{"class":203,"line":456},34,[201,458,459],{},"        END  \n",[201,461,463],{"class":203,"line":462},35,[201,464,465],{},"        ELSE  \n",[201,467,469],{"class":203,"line":468},36,[201,470,471],{},"             BEGIN  \n",[201,473,475],{"class":203,"line":474},37,[201,476,477],{},"             INSERT INTO Dave_Test_Audit   \n",[201,479,481],{"class":203,"line":480},38,[201,482,483],{},"                SELECT * FROM inserted   \n",[201,485,487],{"class":203,"line":486},39,[201,488,489],{},"        END        \n",[201,491,493],{"class":203,"line":492},40,[201,494,495],{},"END\n",[12,497,498],{},"So why does my Update trigger deal with inserts?  The master table (Dave_Test) already had rows existing before the triggers were created.  With the update trigger managing inserting and updating records if the record is updated and does yet belong in the master audit table then the recently updated row will be inserted into the audit table for us.",[12,500,501,502,507],{},"For those old enough – this is ",[19,503,506],{"href":504,"target":505},"http:\u002F\u002Fwww.happytrails.org\u002Ftrigger.html","_blank","Trigger"," (the smartest horse in the movies)",[509,510,511],"style",{},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":152,"searchDepth":153,"depth":153,"links":513},[],"2016-02-13T07:02:53.5100000-05:00","I had a need to mirror any changes to one Sql Server table to another Sql Server table of a different name.  Read on.","\u002Farticles\u002Fimages\u002FXp0SJTsB7n.png",{},"\u002Farticles\u002Fsql-server-triggers-to-mirror-a-table",{"title":183,"description":515},"articles\u002Fsql-server-triggers-to-mirror-a-table",[196,522],"sqlserver","oG-qazOpjUVf0yb-VL3IN5WX57TFCezPsA53rRrA00k",{"id":525,"title":526,"author":7,"body":527,"createdAt":574,"description":575,"extension":157,"img":576,"meta":577,"navigation":159,"path":578,"seo":579,"stem":580,"tags":581,"updatedAt":574,"__hash__":582},"articles\u002Farticles\u002Fxamarin-no-intellisense-in-axml-files.md","Xamarin No Intellisense in Xaml files",{"type":9,"value":528,"toc":572},[529,536,547,567],[12,530,531,535],{},[532,533,534],"strong",{},"Issue: ","Opening up AXML file and no intellisense in Visual Studio",[66,537,538,541,544],{},[69,539,540],{},"open file explorer, navigate to c:\\program files (x86)\\MSBuild\\Xamarin",[69,542,543],{},"copy android-layout-xml.xsd and schemas.android.com.apk.res.android.xsd to C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Xml\\Schemas",[69,545,546],{},"XML – Schemas and Add selecting the 2 xsd files",[85,548,87,549,87,558,87],{},[19,550,552],{"href":551},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin_bee7-image_thumb-3-_2.png",[23,553],{"style":554,"src":555,"border":27,"alt":556,"title":556,"width":29,"height":557},"background-image: none; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px; border: 0px;","\u002Farticles\u002Fimages\u002Fimages\u002Fwindows-live-writer-xamarin_bee7-image_thumb-3-_thumb.png","image_thumb[3]",111,[19,559,561],{"href":560},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin_bee7-image_thumb-6-_2.png",[23,562],{"style":554,"src":563,"border":27,"alt":564,"title":564,"width":565,"height":566},"\u002Farticles\u002Fimages\u002Fimages\u002Fwindows-live-writer-xamarin_bee7-image_thumb-6-_thumb.png","image_thumb[6]",414,112,[66,568,569],{},[69,570,571],{},"Restart Visual Studio and your intellisense should be working now.",{"title":152,"searchDepth":153,"depth":153,"links":573},[],"2016-02-07T06:35:18.3500000-05:00",null,"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin_bee7-image_thumb-3-_thumb.png",{},"\u002Farticles\u002Fxamarin-no-intellisense-in-axml-files",{"title":526,"description":575},"articles\u002Fxamarin-no-intellisense-in-axml-files",[164],"d2O3r4wtEPfVXQIoN_pal9vSxXjlFioRYQ0UIQJX7IQ",1781574770873]