Harsha projects

Yet another Tech blog !

Archive for the ‘WPF’ Category

WPF Performance Suite

leave a comment »

While reading more about the Rendercapability Tier, I bump into couple article where they mentioned about the WPF Performance Suite which comes with Windows SDK but I couldn’t find the Perforator tool alone.

Just lucky to find the link at the following site:
https://blogs.msdn.microsoft.com/kirillosenkov/2016/04/05/where-to-download-wpf-performance-suite-perforator-visual-profiler/

Direct link:
First install:
https://download.microsoft.com/download/A/6/A/A6AC035D-DA3F-4F0C-ADA4-37C8E5D34E3D/setup/WinSDKPerformanceToolKit_amd64/wpt_x64.msi

and then patch:
https://download.microsoft.com/download/1/8/9/189A7832-49D8-4978-85E8-3DFFF44E6C04/WpfPerf_timezone_patch.msp
When the patch installer prompts, choose “Repair”.
This WPF Performance Suite has two Tools: Perforator and Visual Profiler.

More details:
https://blogs.msdn.microsoft.com/jgoldb/2008/09/26/updated-wpfperf-performance-profiling-tools-for-wpf/

 

Advertisements

Written by Harsha

February 4, 2017 at 10:46 PM

Posted in C Sharp, WPF

Getting Property/Method Name

leave a comment »

Hope you are using INotifyPropertyChanged and also implemented same. When we are raising the event, we also need to supply the property name, usually we hard-code it. So this article about getting the property name from within the property block(setter block).

Here is the code and comments:

    private string _BindedStringProp;

        public string BindedStringProp
        {
            get 
            { 
                return _BindedStringProp; 
            }
            set 
            { 
                _BindedStringProp = value;
                //Following line, RawpropName will have value "set_BindedStringProp"
                string RawpropName = MethodBase.GetCurrentMethod().Name;
                //but we need correct property name which will get when we remove first 4 characters.
                string RequiredPropName = MethodBase.GetCurrentMethod().Name.Substring(4); 
                //Following is best way to get the Property Method.
                RaisePropertyChanged();
            }
        }

        private void RaisePropertyChanged([CallerMemberName] string propertyName = "")
        {
            //[CallerMemberName] is doing all the magic.
            if (PropertyChanged != null && !string.IsNullOrEmpty(propertyName))
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }

            //But when you check the same in a method, we will get correct method name and 
            //no substring is required.
            string propName = MethodBase.GetCurrentMethod().Name;
            
        }

Please leave your comments.

Thank you.

Written by Harsha

August 27, 2014 at 12:46 AM

Posted in C Sharp, WPF

Simple MVVM Application

leave a comment »

I have added a MVVM Example in GitHub:

https://github.com/HarshaProjects/LoginScreen

This simple project is an implementation of Log-in Screen in WPF using MVVM pattern. 

Log-inScreen

Please leave your comments.

 

Written by Harsha

August 26, 2014 at 1:50 PM

Posted in WPF

Tagged with , ,