tag:blogger.com,1999:blog-46825042455799592312024-03-05T13:31:27.053+05:30Gaurav Khanna's BlogGaurav Khannahttp://www.blogger.com/profile/04250008487377659924noreply@blogger.comBlogger34125tag:blogger.com,1999:blog-4682504245579959231.post-61599398314244253292016-06-28T18:14:00.000+05:302016-06-28T18:18:59.088+05:30Update Sequence After Deleting Table Row<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: "arial";"><span style="color: black; text-align: justify;"><span style="font-family: inherit;">Often we have an autoincrement column in a table where next insert into the table will be one more than the previous one. In SQL Server we can have an identity property on a column which can help in generating value based on current seed & increment. But in many cases we need to have auto increment depending on another column. Say for example in below image we have books for different languages and we have sequence number based on Book Type. </span></span></span><br />
<span style="font-family: "arial";"><span style="color: black; text-align: justify;"><span style="font-family: inherit;"><br /></span></span></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmeLf-bDs7-3yss-KLlhtbPsE-pkN1wzJPq9LB0r6HTn8S6epwbIfn6N9bnJ9NFovANHlKdWHAXJ26rUhsCgTe_Fz6jsmc-Yq2WNEQrvZtsG9WGHxoHzj85cJ02gWHBbRXBXNqz2p-cE9j/s1600/Capture.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmeLf-bDs7-3yss-KLlhtbPsE-pkN1wzJPq9LB0r6HTn8S6epwbIfn6N9bnJ9NFovANHlKdWHAXJ26rUhsCgTe_Fz6jsmc-Yq2WNEQrvZtsG9WGHxoHzj85cJ02gWHBbRXBXNqz2p-cE9j/s1600/Capture.JPG" /></a></div>
<span style="font-family: "arial";"><span style="color: black; text-align: justify;"><span style="font-family: inherit;"><br /></span>
</span><span style="font-family: inherit;"><br />
</span></span><br />
<div style="color: black; margin: 0px; text-align: justify;">
<span style="font-family: "arial";"><span style="font-family: inherit;">Now if we delete a row from the table, the sequence number of subsequent rows will not change or get updated which will create a gap between two sequence number. This is one of the most common issues faced by developers and one of the most common question in various forums.</span>
<br />
</span></div>
<div style="color: black; margin: 0px; text-align: justify;">
<span style="font-family: "arial";"><br /></span></div>
<h3 style="color: black; line-height: normal;">
<span style="font-family: "arial";"><strong>Solution 1</strong></span></h3>
<div>
<span style="font-family: "arial";"><strong><br /></strong></span></div>
<div style="color: black; line-height: normal; text-align: left;">
<div style="text-align: left;">
<span style="font-family: Arial, Helvetica, sans-serif; font-size: small; font-weight: normal;">When we delete a row from the table, we can update the sequence number of subsequent rows by decrementing them by 1.</span></div>
</div>
<h3 style="color: black; line-height: normal;">
<span style="font-family: "arial"; font-size: 16px;"><span style="font-family: inherit; font-size: small; font-weight: normal;"><br /></span></span>
<div class="reCodeBlock" style="border: 1px solid #7f9db9; overflow-y: auto;">
<div style="background-color: white;">
<span style="font-family: "arial"; font-weight: normal; margin-left: 0px;"><code style="color: #006699;">DELETE</code> <code style="color: #006699;">FROM</code> <code style="color: black;">BookDetail </code><code style="color: #006699;">WHERE</code> <code style="color: black;">BookID=5</code></span></div>
<div style="background-color: #f8f8f8;">
<span style="font-family: "arial"; font-weight: normal; margin-left: 0px;"><code style="color: #006699;">UPDATE</code> <code style="color: black;">BookDetail </code><code style="color: #006699;">SET</code> <code style="color: black;">SequenceNo = SequenceNo - 1 </code><code style="color: #006699;">WHERE</code> <code style="color: black;">BookID > 5</code></span></div>
</div>
<span style="font-family: "arial";"><br /></span><div style="text-align: left;">
<span style="font-family: "arial";"><span style="font-family: inherit; font-size: small; font-weight: normal;">
But decrementing by 1 will not work when we have deleted multiple row. For example </span></span></div>
<span style="font-family: "arial";">
<br />
</span>
<div class="reCodeBlock" style="border: 1px solid #7f9db9; overflow-y: auto;">
<div style="background-color: white;">
<span style="font-family: "arial"; font-weight: normal; margin-left: 0px;"><code style="color: #006699;">DELETE</code> <code style="color: #006699;">FROM</code> <code style="color: black;">BookDetail </code><code style="color: #006699;">WHERE</code> <code style="color: black;">SequenceNo <= 3</code></span></div>
</div>
</h3>
<h3 style="color: black; line-height: normal;">
<strong><span style="font-family: "arial";"><br />
Solution 2</span></strong></h3>
<div>
<strong><span style="font-family: "arial";"><br /></span></strong></div>
<div style="color: black; line-height: normal; text-align: left;">
<span style="font-family: Arial, Helvetica, sans-serif;">When we have update multiple rows in SQL with auto increment sequence, we can use Local Variable in SQL Server which will get incremented on each update. </span></div>
<div style="color: black; line-height: normal; text-align: left;">
<span style="font-family: inherit;"><br /></span></div>
<h3 style="color: black; line-height: normal;">
<span style="font-family: "arial";"><span style="font-family: "arial";"><div class="reCodeBlock" style="border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 1px solid rgb(127, 157, 185); font-family: arial; overflow-y: auto;">
<div style="background-color: white;">
<span style="font-weight: normal; margin-left: 0px;"><code style="color: #006699;">DECLARE</code> <code style="color: black;">@SequenceNumber </code><code style="color: #006699;">INT</code> <code style="color: black;">= 0</code></span></div>
<div style="background-color: #f8f8f8;">
<span style="font-weight: normal; margin-left: 0px;"><code style="color: #006699;">UPDATE</code> <code style="color: black;">BookDetail </code><code style="color: #006699;">SET</code> <code style="color: black;">@SequenceNumber = @SequenceNumber + 1, SequenceNo = @SequenceNumber</code></span></div>
<div style="background-color: white;">
<span style="font-weight: normal; margin-left: 0px;"><code style="color: #006699;">WHERE</code> <code style="color: black;">BookType = </code><code style="color: blue;">'.NET'</code></span></div>
</div>
</span></span><div style="text-align: left;">
<span style="font-family: "arial";"><span style="font-family: "arial";"><span style="font-family: inherit; font-size: small; font-weight: normal;"><br /></span></span></span></div>
<div style="text-align: left;">
<span style="font-family: "arial";"><span style="font-family: "arial";"><span style="font-family: inherit; font-size: small; font-weight: normal;">
In this example, we have declared a SequenceNumber variable which will get incremented for each row, and we set that number in SequenceNo. Based on where condition in query, sequence number will get updated, and we will have sequence numbers without any gap.</span></span></span></div>
</h3>
<span style="font-family: "arial";"><strong>
<br />
</strong>
</span></div>
Gaurav Khannahttp://www.blogger.com/profile/04250008487377659924noreply@blogger.com0tag:blogger.com,1999:blog-4682504245579959231.post-307051664669464532014-08-15T23:50:00.001+05:302014-08-16T00:19:53.600+05:30Create Scheduled Toast Notification in Windows Phone Silverlight 8.1<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: justify;">
Windows Phone 8.1 has a new feature called Toast Notification where we can show notifications to user and also show it in action center. We can also schedule the toast notification to appear at specific time. We can have scheduled toast notification in both Windows 8.1 Runtime app and Windows 8.1 Silverlight app.</div>
<div style="text-align: justify;">
<br />
Unlike Windows 8, Windows Phone only has one template for toast notification i.e. “toastText02”. It has application icon on left and accepts two text string with first with bold text and another with normal text. It is advisable to have very short strings to avoid truncation. We can use XML functions to set above two text.</div>
<div style="text-align: justify;">
<span style="font-size: 12.1px; text-align: left;"><br />
</span><br />
<div class="reCodeBlock" style="border: 1px solid #7f9db9; overflow-y: auto;">
<div style="background-color: white;">
<span style="font-size: 12.1px; text-align: left;"><span style="margin-left: 0px !important;"><code style="color: #006699; font-weight: bold;"> Dim</code> <code style="color: black;">toastTemplate </code><code style="color: #006699; font-weight: bold;">As</code> <code style="color: black;">ToastTemplateType = ToastTemplateType.ToastImageAndText02</code></span></span></div>
<div style="background-color: #f8f8f8;">
<span style="font-size: 12.1px; text-align: left;"><code> </code><span style="margin-left: 3px !important;"><code style="color: #006699; font-weight: bold;">Dim</code> <code style="color: black;">toastXml </code><code style="color: #006699; font-weight: bold;">As</code> <code style="color: black;">XmlDocument = ToastNotificationManager.GetTemplateContent(toastTemplate)</code></span></span></div>
<div style="background-color: white;">
<span style="font-size: 12.1px; text-align: left;"><code> </code><span style="margin-left: 3px !important;"><code style="color: #006699; font-weight: bold;">Dim</code> <code style="color: black;">toastTextElements </code><code style="color: #006699; font-weight: bold;">As</code> <code style="color: black;">XmlNodeList = toastXml.GetElementsByTagName(</code><code style="color: blue;">"text"</code><code style="color: black;">)</code></span></span></div>
<div style="background-color: #f8f8f8;">
</div>
<div style="background-color: white;">
<span style="font-size: 12.1px; text-align: left;"><code> </code><span style="margin-left: 3px !important;"><code style="color: black;">toastTextElements(0).AppendChild(toastXml.CreateTextNode(</code><code style="color: blue;">"File Downloaded"</code><code style="color: black;">))</code></span></span></div>
<div style="background-color: #f8f8f8;">
<span style="font-size: 12.1px; text-align: left;"><code> </code><span style="margin-left: 3px !important;"><code style="color: black;">toastTextElements(1).AppendChild(toastXml.CreateTextNode(</code><code style="color: blue;">"Content.txt file downloaded from server"</code><code style="color: black;">))</code></span></span></div>
</div>
<br />
When user clicks on toast notification, the app gets launched. We can set launch attribute of toast element containing parameters which we can use to decide navigation page when the app is launched. We can write following code to set launch parameter.<br />
<br />
<div class="reCodeBlock" style="border: 1px solid #7f9db9; overflow-y: auto;">
<div style="background-color: white;">
<span style="font-size: 12.1px; text-align: left;"><span style="margin-left: 0px !important;"><code style="color: #006699; font-weight: bold;">Dim</code> <code style="color: black;">toastNode = toastXml.SelectSingleNode(</code><code style="color: blue;">"/toast"</code><code style="color: black;">)</code></span></span></div>
<div style="background-color: #f8f8f8;">
<span style="margin-left: 0px !important;"><code style="color: #006699; font-weight: bold;">CType</code><code style="color: black;">(toastNode, XmlElement).SetAttribute(</code><code style="color: blue;">"launch"</code><code style="color: black;">, </code><code style="color: blue;">"?FileID=1"</code><code style="color: black;">)</code></span></div>
</div>
<br />
So if our launch page is MainPage.xaml then uri would be “MainPage.xaml?FileID=1”. We can read the QueryString value in MainPage.xaml and do operation as per project requirement.<br />
<br />
<div class="reCodeBlock" style="border: 1px solid #7f9db9; overflow-y: auto;">
<div style="background-color: white;">
<span style="font-size: 12.1px; text-align: left;"><span style="margin-left: 0px !important;"><code style="color: #006699; font-weight: bold;">Protected</code> <code style="color: #006699; font-weight: bold;">Overrides</code> <code style="color: #006699; font-weight: bold;">Sub</code> <code style="color: black;">OnNavigatedTo(e </code><code style="color: #006699; font-weight: bold;">As</code> <code style="color: black;">NavigationEventArgs)</code></span></span></div>
<div style="background-color: #f8f8f8;">
<span style="font-size: 12.1px; text-align: left;"><code> </code><span style="margin-left: 24px !important;"><code style="color: #006699; font-weight: bold;">MyBase</code><code style="color: black;">.OnNavigatedTo(e)</code></span></span></div>
<div style="background-color: white;">
</div>
<div style="background-color: #f8f8f8;">
<span style="font-size: 12.1px; text-align: left;"><code> </code><span style="margin-left: 24px !important;"><code style="color: #006699; font-weight: bold;">If</code> <code style="color: black;">NavigationContext.QueryString.ContainsKey(</code><code style="color: blue;">"FileID"</code><code style="color: black;">) = </code><code style="color: #006699; font-weight: bold;">True</code> <code style="color: #006699; font-weight: bold;">Then</code></span></span></div>
<div style="background-color: white;">
<span style="font-size: 12.1px; text-align: left;"><code> </code><span style="margin-left: 36px !important;"><code style="color: #006699; font-weight: bold;">Dim</code> <code style="color: black;">fileID </code><code style="color: #006699; font-weight: bold;">As</code> <code style="color: #006699; font-weight: bold;">String</code> <code style="color: black;">= NavigationContext.QueryString(</code><code style="color: blue;">"FileID"</code><code style="color: black;">)</code></span></span></div>
<div style="background-color: #f8f8f8;">
<span style="font-size: 12.1px; text-align: left;"><code> </code><span style="margin-left: 36px !important;"><code style="color: #008200;">'Perform operation using fileID</code></span></span></div>
<div style="background-color: white;">
<span style="font-size: 12.1px; text-align: left;"><code> </code><span style="margin-left: 21px !important;"><code style="color: #006699; font-weight: bold;">End</code> <code style="color: #006699; font-weight: bold;">If</code></span></span></div>
<div style="background-color: #f8f8f8;">
<span style="font-size: 12.1px; text-align: left;"><code> </code><span style="margin-left: 3px !important;"><code style="color: #006699; font-weight: bold;">End</code> <code style="color: #006699; font-weight: bold;">Sub</code></span></span></div>
</div>
<br />
Now we can create a ScheduledToastNotification where we can pass XmlDocument object containing information about toast and scheduled time when the toast notification should be displayed. We can optional also set “ID” property for ScheduledToastNotification so that we can cancel it in future if required.<br />
<br />
<div class="reCodeBlock" style="border: 1px solid #7f9db9; overflow-y: auto;">
<div style="background-color: white;">
<span style="font-size: 12.1px; text-align: left;"><span style="margin-left: 0px !important;"><code style="color: #006699; font-weight: bold;">Dim</code> <code style="color: black;">notification </code><code style="color: #006699; font-weight: bold;">As</code> <code style="color: #006699; font-weight: bold;">New</code> <code style="color: black;">ScheduledToastNotification(toastXml, dueTime)</code></span></span></div>
<div style="background-color: #f8f8f8;">
<span style="font-size: 12.1px; text-align: left;"><span style="margin-left: 0px !important;"><code style="color: black;">notification.Id = notificationID</code></span></span></div>
</div>
<br />
We can also set <em style="font-size: 12.1px; text-align: left;">MaximumSnoozeCount</em> parameter to set maximum number of times notification should be displayed and <em style="font-size: 12.1px; text-align: left;">SnoozeInterval</em> parameter to set time interval between notifications. SnoozeInterval should be between 1 to 60 minutes and MaximumSnoozeCount should be between 1 to 5.</div>
</div>
<br />
<div class="reCodeBlock" style="border: 1px solid #7f9db9; overflow-y: auto;">
<div style="background-color: white;">
<span style="font-size: 12.1px; text-align: left;"><span style="font-size: 12.1px; text-align: left;"><span style="margin-left: 0px !important;"><code style="color: #006699; font-weight: bold;">Dim</code> <code style="color: black;">notification </code><code style="color: #006699; font-weight: bold;">As</code> <code style="color: #006699; font-weight: bold;">New</code> <code style="color: black;">ScheduledToastNotification(toastXml, dueTime, TimeSpan.FromMinutes(5), 3)</code></span></span></span></div>
</div>
If we don’t want to show ToastNotification popup and only show the details in action center then we can set SuppressPopup property.<br />
<br />
<div class="reCodeBlock" style="border: 1px solid #7f9db9; overflow-y: auto;">
<div style="background-color: white;">
<span style="font-size: 12.1px; text-align: left;"><span style="font-size: 12.1px; text-align: left;"><span style="margin-left: 0px !important;"><code style="color: black;">notification.SuppressPopup = </code><code style="color: #006699; font-weight: bold;">True</code></span></span></span></div>
</div>
<br />
It is advisable to check if any toast notification with similar ID is already created or not. If already created then you can notify the user or delete it.</div>
<br />
<div class="reCodeBlock" style="border: 1px solid #7f9db9; overflow-y: auto;">
<div style="background-color: white;">
<span style="font-size: 12.1px; text-align: left;"><span style="font-size: 12.1px; text-align: left;"><span style="margin-left: 0px !important;"><code style="color: #006699; font-weight: bold;">Dim</code> <code style="color: black;">task = ToastNotificationManager.CreateToastNotifier.GetScheduledToastNotifications().Where(</code><code style="color: #006699; font-weight: bold;">Function</code><code style="color: black;">(f) f.Id = notificationID)</code></span></span></span></div>
<div style="background-color: #f8f8f8;">
<span style="font-size: 12.1px; text-align: left;"><span style="font-size: 12.1px; text-align: left;"><span style="margin-left: 0px !important;"><code style="color: #006699; font-weight: bold;">If</code> <code style="color: black;">task.Count > 0 </code><code style="color: #006699; font-weight: bold;">Then</code></span></span></span></div>
<div style="background-color: white;">
<span style="font-size: 12.1px; text-align: left;"><span style="font-size: 12.1px; text-align: left;"><code> </code><span style="margin-left: 12px !important;"><code style="color: black;">ToastNotificationManager.CreateToastNotifier.RemoveFromSchedule(task.First)</code></span></span></span></div>
<div style="background-color: #f8f8f8;">
<span style="font-size: 12.1px; text-align: left;"><span style="font-size: 12.1px; text-align: left;"><span style="margin-left: 0px !important;"><code style="color: #006699; font-weight: bold;">End</code> <code style="color: #006699; font-weight: bold;">If</code></span></span></span></div>
</div>
<br />
Now we can create ToastNotifier object and add scheduled notification using following code</div>
<span style="font-size: 12.1px; text-align: left;"><br />
</span><br />
<div class="reCodeBlock" style="border: 1px solid #7f9db9; overflow-y: auto;">
<div style="background-color: white;">
<span style="font-size: 12.1px; text-align: left;"><span style="font-size: 12.1px; text-align: left;"><span style="margin-left: 0px !important;"><code style="color: black;">ToastNotificationManager.CreateToastNotifier().AddToSchedule(notification)</code></span></span></span></div>
</div>
<br />
For ToastNotification to work correctly we have to set Notification Service as “WNS” in WMAppManifest.xml file. This is one of the most important steps as your app could be reject in Certification process if “WNS” is not selected in Notification Service.</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQ9KHGJXvuwM2gmwyCCTuD_vF2Ph-OnBsnJQRotXe5mRlbQst-Xl1dHLksGOvN7746Ee2wyR2RIzCZSWmd4b1aBVKBV85fZIMImnluJaMXNyI2Yy0elI2v4dwz6cuEs_SNyuBnjeie5GFi/s1600/Image.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQ9KHGJXvuwM2gmwyCCTuD_vF2Ph-OnBsnJQRotXe5mRlbQst-Xl1dHLksGOvN7746Ee2wyR2RIzCZSWmd4b1aBVKBV85fZIMImnluJaMXNyI2Yy0elI2v4dwz6cuEs_SNyuBnjeie5GFi/s1600/Image.JPG" height="236" width="400" /></a></div>
<br />
<style type="text/css">
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<style type="text/css">
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<br />
Below is complete code to create ScheduledToastNotification in Windows Phone Silverlight 8.1 app.<br />
<br />
<div class="reCodeBlock" style="border: 1px solid #7f9db9; overflow-y: auto;">
<div style="background-color: white;">
<span style="margin-left: 0px !important;"><code style="color: #006699; font-weight: bold;">Private</code> <code style="color: #006699; font-weight: bold;">Sub</code> <code style="color: black;">CreateScheduleNotification(</code><code style="color: #006699; font-weight: bold;">ByVal</code> <code style="color: black;">dueTime </code><code style="color: #006699; font-weight: bold;">As</code> <code style="color: #006699; font-weight: bold;">Date</code><code style="color: black;">, </code><code style="color: #006699; font-weight: bold;">ByVal</code> <code style="color: black;">notificationID </code><code style="color: #006699; font-weight: bold;">As</code> <code style="color: #006699; font-weight: bold;">Integer</code><code style="color: black;">)</code></span></div>
<div style="background-color: #f8f8f8;">
<code> </code><span style="margin-left: 24px !important;"><code style="color: #006699; font-weight: bold;">Dim</code> <code style="color: black;">toastTemplate </code><code style="color: #006699; font-weight: bold;">As</code> <code style="color: black;">ToastTemplateType = ToastTemplateType.ToastImageAndText02</code></span></div>
<div style="background-color: white;">
<code> </code><span style="margin-left: 24px !important;"><code style="color: #006699; font-weight: bold;">Dim</code> <code style="color: black;">toastXml </code><code style="color: #006699; font-weight: bold;">As</code> <code style="color: black;">XmlDocument = ToastNotificationManager.GetTemplateContent(toastTemplate)</code></span></div>
<div style="background-color: #f8f8f8;">
<code> </code><span style="margin-left: 24px !important;"><code style="color: #006699; font-weight: bold;">Dim</code> <code style="color: black;">toastTextElements </code><code style="color: #006699; font-weight: bold;">As</code> <code style="color: black;">XmlNodeList = toastXml.GetElementsByTagName(</code><code style="color: blue;">"text"</code><code style="color: black;">)</code></span></div>
<div style="background-color: white;">
<code> </code><span style="margin-left: 24px !important;"><code style="color: black;">toastTextElements(0).AppendChild(toastXml.CreateTextNode(</code><code style="color: blue;">"File Downloaded"</code><code style="color: black;">))</code></span></div>
<div style="background-color: #f8f8f8;">
<code> </code><span style="margin-left: 24px !important;"><code style="color: black;">toastTextElements(1).AppendChild(toastXml.CreateTextNode(</code><code style="color: blue;">"Content.txt file downloaded from server"</code><code style="color: black;">))</code></span></div>
<div style="background-color: white;">
</div>
<div style="background-color: #f8f8f8;">
<code> </code><span style="margin-left: 24px !important;"><code style="color: #006699; font-weight: bold;">Dim</code> <code style="color: black;">toastNode = toastXml.SelectSingleNode(</code><code style="color: blue;">"/toast"</code><code style="color: black;">)</code></span></div>
<div style="background-color: white;">
<code> </code><span style="margin-left: 24px !important;"><code style="color: #006699; font-weight: bold;">CType</code><code style="color: black;">(toastNode, XmlElement).SetAttribute(</code><code style="color: blue;">"launch"</code><code style="color: black;">, </code><code style="color: blue;">"?FileID=1"</code><code style="color: black;">)</code></span></div>
<div style="background-color: #f8f8f8;">
</div>
<div style="background-color: white;">
<code> </code><span style="margin-left: 24px !important;"><code style="color: #008200;">'Dim notification As New ScheduledToastNotification(toastXml, dueTime)</code></span></div>
<div style="background-color: #f8f8f8;">
<code> </code><span style="margin-left: 24px !important;"><code style="color: #006699; font-weight: bold;">Dim</code> <code style="color: black;">notification </code><code style="color: #006699; font-weight: bold;">As</code> <code style="color: #006699; font-weight: bold;">New</code> <code style="color: black;">ScheduledToastNotification(toastXml, dueTime, TimeSpan.FromMinutes(5), 3)</code></span></div>
<div style="background-color: white;">
<code> </code><span style="margin-left: 24px !important;"><code style="color: black;">notification.Id = notificationID</code></span></div>
<div style="background-color: #f8f8f8;">
<code> </code><span style="margin-left: 24px !important;"><code style="color: #008200;">'notification.SuppressPopup =True 'To show notification only in action center</code></span></div>
<div style="background-color: white;">
</div>
<div style="background-color: #f8f8f8;">
<code> </code><span style="margin-left: 24px !important;"><code style="color: #006699; font-weight: bold;">Dim</code> <code style="color: black;">task = ToastNotificationManager.CreateToastNotifier.GetScheduledToastNotifications().Where(</code><code style="color: #006699; font-weight: bold;">Function</code><code style="color: black;">(f) f.Id = notificationID)</code></span></div>
<div style="background-color: white;">
<code> </code><span style="margin-left: 24px !important;"><code style="color: #006699; font-weight: bold;">If</code> <code style="color: black;">task.Count > 0 </code><code style="color: #006699; font-weight: bold;">Then</code></span></div>
<div style="background-color: #f8f8f8;">
<code> </code><span style="margin-left: 36px !important;"><code style="color: black;">ToastNotificationManager.CreateToastNotifier.RemoveFromSchedule(task.First)</code></span></div>
<div style="background-color: white;">
<code> </code><span style="margin-left: 24px !important;"><code style="color: #006699; font-weight: bold;">End</code> <code style="color: #006699; font-weight: bold;">If</code></span></div>
<div style="background-color: #f8f8f8;">
<code> </code><span style="margin-left: 24px !important;"><code style="color: black;">ToastNotificationManager.CreateToastNotifier().AddToSchedule(notification)</code></span></div>
<div style="background-color: white;">
<code> </code><span style="margin-left: 12px !important;"><code style="color: #006699; font-weight: bold;">End</code> <code style="color: #006699; font-weight: bold;">Sub</code></span></div>
</div>
<br />
<style type="text/css">
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<style type="text/css">
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<style type="text/css">
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<style type="text/css">
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<style type="text/css">
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<style type="text/css">
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<style type="text/css">
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
</div>
Gaurav Khannahttp://www.blogger.com/profile/04250008487377659924noreply@blogger.com0tag:blogger.com,1999:blog-4682504245579959231.post-70664879896753382432014-04-02T13:14:00.000+05:302014-04-02T13:29:25.434+05:30Use WinDBG to see crash dump details<div dir="ltr" style="text-align: left;" trbidi="on">
<div align="justify">
Recently one of my Windows Phone app had a crash and it was available for download in crash count on WP Dev Center. Crash count had an excel file containing links for .CAB file which can be downloaded and we can extract the .CAB file to get the dump file containing stack traces.</div>
<div align="justify">
We have to use WinDBG which is a free debugging tool from Microsoft. Following are the steps which need to be performed to get the exception details and stack traces.</div>
<ol>
<li> <div align="justify">
Download Cab File and extract mdmp file</div>
</li>
<li> <div align="justify">
Open command prompt and set _NT_Symbol_Path and _NT_ALT_Symbol_Path environment variable as below. <br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqHB5WBR6AWDyXWzreYCP8rxyIIU-jp-UXjgBCRsLH57FoREWccafa6A_24-I0cIgeM1yvZt1JCSc15CtW4BSFCKo3VcVOmpWwsBFkfmmm4SIpGpmmROb7Lg8CJgkDRqLXEIhTC5t4e5Pt/s1600-h/image%25255B14%25255D.png"><img alt="image" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhBv1dE2qIyHb6SK2vhcYAgkUdBjDZnOkhnvGtPaIyjHoWSX9oSdc8TlLQi5CIHSP7IwV-reUhDsIbP5X_pTLvs7fGtP-nX7ebQlIAR7kHDE0puSqQ-o4KLDjFr9ASjzMJFxblgdOPrabP/?imgmax=800" height="260" style="background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="504" /></a></div>
</li>
<li> <div align="justify">
As you can see in above image we have set symbol path as environment variable. We have set “<a href="http://msdl.microsoft.com/download/symbols">http://msdl.microsoft.com/download/symbols</a>” path which is a link for Microsoft Symbol Server.</div>
</li>
<li> <div align="justify">
Open WinDBG using "WinDBG -y" command</div>
</li>
<li> <div align="justify">
Open crash dump file "minidump.mdmp” file from “File -> Open Crash Dump…” (or Ctrl + D key)<br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhg0RmRDdAxxSISP9TKSz-UjVDT77tu1Z74xxhpfHYq5QYoCvMudtgaTOqJDDTv1l8RV156YiAD76tASnyG0Wm3Au1qre9kAPt4wIGYwVxMLlIkyMe5rIHu34B7HiSMJQ77RsUTRU8jtJJT/s1600-h/image%25255B21%25255D.png"><img alt="image" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKY4k_aTQWo2jQsM6MnHntwBxgPtBFQhLmUsR356O4CJzTixKV9fMim4JPFO-S7tkcYS0xmOU9C6BWjqjtvRNDKqV0Njj8avTr74s6zhQdVFpPX8DE-fcVHzmUpCDHsy9te41ZRZq1HlWg/?imgmax=800" height="315" style="background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="500" /></a></div>
</li>
<li> <div align="justify">
As you can see in above image you get a command line at bottom of screen with text “0.000>”.</div>
</li>
<li> <div align="justify">
Turn on the noisy symbol loading mode using <em>“!sym noisy</em>” command. This command instructs the debugger to display information about its search for symbols.<br />
<pre class="csharpcode">0.000> !sym noisy
</pre>
</div>
You can find more about this command from following link<br /><div align="justify">
<br />
<a href="http://msdn.microsoft.com/en-us/library/windows/hardware/ff565396(v=vs.85).aspx" title="http://msdn.microsoft.com/en-us/library/windows/hardware/ff565396(v=vs.85).aspx">http://msdn.microsoft.com/en-us/library/windows/hardware/ff565396(v=vs.85).aspx</a><br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAThkwttVsmpZMcJb0T325nTkm4afhtA5HWOqGISbTs4rvUnom8kBqi5hKk4SJGFMyoLS_h4NJX3pJIjC9jQ-dtuNrcF-pzoZhOvXTUgtggDcImYDsStMfqeCj8UOmSx2tGrCjXzN30zX4/s1600-h/image%25255B25%25255D.png"><img alt="image" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwNOGVyyAVpXcT-KGWlR0vNm3B8WokNA2bWweo_Nwual6rfv1x-8rk6w-Xe0TA6wOZNxxmLTB9zijUA0M2MzTzpu-Ftqeib3UB2i-cBVLlwVMUxICEdib6MFhAG9g0XXW3RiiiUpCTnF1z/?imgmax=800" height="285" style="background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="504" /></a></div>
</li>
<li><div align="justify">
Use .reload command to delete all symbol information for the specified module and reload these symbols as needed. Using “/f” parameter with .reload command will force the debugger to load the symbols immediately.<br />
<pre class="csharpcode">0.000> .reload /f</pre>
You can know more about this command from following link<br />
<br />
<a href="http://msdn.microsoft.com/en-us/library/windows/hardware/ff564805(v=vs.85).aspx" title="http://msdn.microsoft.com/en-us/library/windows/hardware/ff564805(v=vs.85).aspx">http://msdn.microsoft.com/en-us/library/windows/hardware/ff564805(v=vs.85).aspx</a><br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglioxDEVXWsRzccLTPaLQJ0a-ZZ2ibDGU-n52-LBj2LJmy4enzub9LBlmRn-00q_u-UxycDzqNDsU5o6VseD44ROMvb-QzPlST7oJ0S8uj4SyAd4kajPaIChqJ0vgIPinlhE7xNzAgD5WH/s1600-h/image%25255B29%25255D.png"><img alt="image" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiv-brULDPFieSAdURbObzT5j4g_ialTGnO1vecMvcVlbza92xK3K1fCT8UBpjhHYvDPNnYERro9yTG5mlokWEEnrZTYlk8NbA7pXb2WadjpFO2-EPlhUO0v_-sputuGDKo9G9l8vlC7-6Y/?imgmax=800" height="289" style="background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="504" /></a></div>
</li>
<li><div align="justify">
Use “KV” command to get stack frame information. It displays frame pointer omission (FPO) information.<br />
<pre class="csharpcode">0.000> kv</pre>
<span style="text-align: left;">You can find more about this command from following link</span><br />
<br />
<a href="http://msdn.microsoft.com/en-us/library/windows/hardware/ff551943(v=vs.85).aspx" title="http://msdn.microsoft.com/en-us/library/windows/hardware/ff551943(v=vs.85).aspx">http://msdn.microsoft.com/en-us/library/windows/hardware/ff551943(v=vs.85).aspx</a><br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2YsU4TLCPOpbLsEDijU2fyFd_SM8_k2vZdBtN5n9qwXMME10FDGMOLMbsxUJ9iISr7emqQOKUCRlJ4bej35hEUtHKjbLcvXCFMfZmK7s7k2Qgsx8L2pmGLQL8Inff5UM4p00Mx9g1iEPf/s1600-h/image%25255B33%25255D.png"><img alt="image" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGUkw4mWNmSUgRrLTHQSqI0phd3Z2PN3DsqwJeBqWsNJDt2Dfvfu01_s_KCqcdON70ZrvIS64jPCmsf5witiSL_AsCBRRTPDlYAhp1tNfP6GA5gIcCjux2MM9DlHKNy_-vxAevkbFbwEMG/?imgmax=800" height="206" style="background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="504" /></a></div>
</li>
<li><div align="justify">
Use “!analyze –v” to get information about current exception or bug check with verbose output.<br />
<pre class="csharpcode">0.000> !analyze -v</pre>
<span style="text-align: left;">You can find more about this command from following link</span><br />
<br />
<a href="http://msdn.microsoft.com/en-us/library/windows/hardware/ff562112(v=vs.85).aspx" title="http://msdn.microsoft.com/en-us/library/windows/hardware/ff562112(v=vs.85).aspx">http://msdn.microsoft.com/en-us/library/windows/hardware/ff562112(v=vs.85).aspx</a><br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjoEs333gPcZfIyNyHH-vTOWjix_Uo2Tkl_y3ptTr5v-ciTD6guBT4pfBRbcJ4PToEAnLwdj42mlrAGv76BHg6E3O00H_bkxfsTWJIsJLKowSkFP-xO85FelSDkj2fLHPOmH1PIZwcVSZUq/s1600-h/image%25255B37%25255D.png"><img alt="image" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjaeY2iVY5EgyM7U7Umu-dKS3LhA-12dm-T9TYfb_qfF_WMS5uAGgKtyazOS0QRnjQiAac0BUl9GEIp_LdWR8iuDk2l_wYFBkd3J6umbA10mP01ErTS2bZCvybkEmdilVgk9lnS8PSRQgWJ/?imgmax=800" height="204" style="background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="504" /></a></div>
</li>
</ol>
<br />
<div align="justify">
Hope above steps helps you finding exception information from dump file available in Dev Center.</div>
<br />
<div align="justify">
Special thanks to <a href="http://social.msdn.microsoft.com/profile/bret%20bentzinger/" target="_blank">Bret Bentzinger</a> and Eric Dunaway for providing lots of valuable input on the debugging process<br />
<br />
Other Useful link<br />
<a href="http://blogs.msdn.com/b/wsdevsol/archive/2013/08/15/dump-diving-into-cert-failure_3a00_--how-to-get-a-good-callstack-from-triagedump.dmp.aspx" title="http://blogs.msdn.com/b/wsdevsol/archive/2013/08/15/dump-diving-into-cert-failure_3a00_--how-to-get-a-good-callstack-from-triagedump.dmp.aspx">http://blogs.msdn.com/b/wsdevsol/archive/2013/08/15/dump-diving-into-cert-failure_3a00_--how-to-get-a-good-callstack-from-triagedump.dmp.aspx</a></div>
</div>Gaurav Khannahttp://www.blogger.com/profile/04250008487377659924noreply@blogger.com0tag:blogger.com,1999:blog-4682504245579959231.post-36199748987534788232013-10-16T17:37:00.000+05:302013-10-16T17:37:07.055+05:30Searching in Windows Phone ListBox<div dir="ltr" style="text-align: left;" trbidi="on">
One of the most common way of searching in ListBox is to type text in TextBox and filter the ListBox items. In this article we will see how we can do this in Windows Phone application.<br />
<br />
<div style="text-align: center;">
<a href="http://social.technet.microsoft.com/wiki/cfs-file.ashx/__key/communityserver-wikis-components-files/00-00-00-00-05/6232.ListBox.png"><img alt="" src="http://social.technet.microsoft.com/wiki/resized-image.ashx/__size/550x0/__key/communityserver-wikis-components-files/00-00-00-00-05/6232.ListBox.png" style="border-style: solid; border-width: 0px; height: 417px; width: 250px;" /></a><br />
<br />
<div style="text-align: left;">
As you can see in above image, we have a TextBox where user can type, and a ListBox which get filtered based on text entered.<br />
<br />
<strong>XAML Code<br />
<br />
</strong><br />
<div class="reCodeBlock" style="-ms-overflow-y: auto; border: 1px solid rgb(127, 157, 185);">
<div style="background-color: white;">
<strong><span style="margin-left: 0px !important;"><code style="color: black;"><</code><code style="color: #006699; font-weight: bold;">phone:PhoneApplicationPage</code></span></strong></div>
<div style="background-color: #f8f8f8;">
<strong><code> </code><span style="margin-left: 12px !important;"><code style="color: grey;">x:Class</code><code style="color: black;">=</code><code style="color: blue;">"PhoneApp1.MainPage"</code></span></strong></div>
<div style="background-color: white;">
<strong><code> </code><span style="margin-left: 12px !important;"><code style="color: grey;">xmlns</code><code style="color: black;">=</code><code style="color: blue;">"<a href="http://schemas.microsoft.com/winfx/2006/xaml/presentation">http://schemas.microsoft.com/winfx/2006/xaml/presentation</a>"</code></span></strong></div>
<div style="background-color: #f8f8f8;">
<strong><code> </code><span style="margin-left: 12px !important;"><code style="color: grey;">xmlns:x</code><code style="color: black;">=</code><code style="color: blue;">"<a href="http://schemas.microsoft.com/winfx/2006/xaml">http://schemas.microsoft.com/winfx/2006/xaml</a>"</code></span></strong></div>
<div style="background-color: white;">
<strong><code> </code><span style="margin-left: 12px !important;"><code style="color: grey;">xmlns:phone</code><code style="color: black;">=</code><code style="color: blue;">"clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"</code></span></strong></div>
<div style="background-color: #f8f8f8;">
<strong><code> </code><span style="margin-left: 12px !important;"><code style="color: grey;">xmlns:shell</code><code style="color: black;">=</code><code style="color: blue;">"clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"</code></span></strong></div>
<div style="background-color: white;">
<strong><code> </code><span style="margin-left: 12px !important;"><code style="color: grey;">xmlns:d</code><code style="color: black;">=</code><code style="color: blue;">"<a href="http://schemas.microsoft.com/expression/blend/2008">http://schemas.microsoft.com/expression/blend/2008</a>"</code></span></strong></div>
<div style="background-color: #f8f8f8;">
<strong><code> </code><span style="margin-left: 12px !important;"><code style="color: grey;">xmlns:mc</code><code style="color: black;">=</code><code style="color: blue;">"<a href="http://schemas.openxmlformats.org/markup-compatibility/2006">http://schemas.openxmlformats.org/markup-compatibility/2006</a>"</code></span></strong></div>
<div style="background-color: white;">
<strong><code> </code><span style="margin-left: 12px !important;"><code style="color: grey;">mc:Ignorable</code><code style="color: black;">=</code><code style="color: blue;">"d"</code>
<code style="color: grey;">d:DesignWidth</code><code style="color: black;">=</code><code style="color: blue;">"480"</code>
<code style="color: grey;">d:DesignHeight</code><code style="color: black;">=</code><code style="color: blue;">"768"</code></span></strong></div>
<div style="background-color: #f8f8f8;">
<strong><code> </code><span style="margin-left: 12px !important;"><code style="color: grey;">FontFamily</code><code style="color: black;">=</code><code style="color: blue;">"{StaticResource PhoneFontFamilyNormal}"</code></span></strong></div>
<div style="background-color: white;">
<strong><code> </code><span style="margin-left: 12px !important;"><code style="color: grey;">FontSize</code><code style="color: black;">=</code><code style="color: blue;">"{StaticResource PhoneFontSizeNormal}"</code></span></strong></div>
<div style="background-color: #f8f8f8;">
<strong><code> </code><span style="margin-left: 12px !important;"><code style="color: grey;">Foreground</code><code style="color: black;">=</code><code style="color: blue;">"{StaticResource PhoneForegroundBrush}"</code></span></strong></div>
<div style="background-color: white;">
<strong><code> </code><span style="margin-left: 12px !important;"><code style="color: grey;">SupportedOrientations</code><code style="color: black;">=</code><code style="color: blue;">"Portrait"</code>
<code style="color: grey;">Orientation</code><code style="color: black;">=</code><code style="color: blue;">"Portrait"</code></span></strong></div>
<div style="background-color: #f8f8f8;">
<strong><code> </code><span style="margin-left: 12px !important;"><code style="color: grey;">shell:SystemTray.IsVisible</code><code style="color: black;">=</code><code style="color: blue;">"True"</code><code style="color: black;">></code></span></strong></div>
<div style="background-color: white;">
</div>
<div style="background-color: #f8f8f8;">
<strong><code> </code><span style="margin-left: 12px !important;"><code style="color: #008200;"><!--LayoutRoot is the root grid where all page content is placed--></code></span></strong></div>
<div style="background-color: white;">
<strong><code> </code><span style="margin-left: 12px !important;"><code style="color: black;"><</code><code style="color: #006699; font-weight: bold;">Grid</code>
<code style="color: grey;">x:Name</code><code style="color: black;">=</code><code style="color: blue;">"LayoutRoot"</code>
<code style="color: grey;">Background</code><code style="color: black;">=</code><code style="color: blue;">"Transparent"</code><code style="color: black;">></code></span></strong></div>
<div style="background-color: #f8f8f8;">
<strong><code> </code><span style="margin-left: 24px !important;"><code style="color: black;"><</code><code style="color: #006699; font-weight: bold;">Grid.RowDefinitions</code><code style="color: black;">></code></span></strong></div>
<div style="background-color: white;">
<strong><code> </code><span style="margin-left: 36px !important;"><code style="color: black;"><</code><code style="color: #006699; font-weight: bold;">RowDefinition</code>
<code style="color: grey;">Height</code><code style="color: black;">=</code><code style="color: blue;">"Auto"</code><code style="color: black;">/></code></span></strong></div>
<div style="background-color: #f8f8f8;">
<strong><code> </code><span style="margin-left: 36px !important;"><code style="color: black;"><</code><code style="color: #006699; font-weight: bold;">RowDefinition</code>
<code style="color: grey;">Height</code><code style="color: black;">=</code><code style="color: blue;">"*"</code><code style="color: black;">/></code></span></strong></div>
<div style="background-color: white;">
<strong><code> </code><span style="margin-left: 24px !important;"><code style="color: black;"></</code><code style="color: #006699; font-weight: bold;">Grid.RowDefinitions</code><code style="color: black;">></code></span></strong></div>
<div style="background-color: #f8f8f8;">
</div>
<div style="background-color: white;">
<strong><code> </code><span style="margin-left: 24px !important;"><code style="color: #008200;"><!--TitlePanel contains the name of the application and page title--></code></span></strong></div>
<div style="background-color: #f8f8f8;">
<strong><code> </code><span style="margin-left: 24px !important;"><code style="color: black;"><</code><code style="color: #006699; font-weight: bold;">StackPanel</code>
<code style="color: grey;">x:Name</code><code style="color: black;">=</code><code style="color: blue;">"TitlePanel"</code>
<code style="color: grey;">Grid.Row</code><code style="color: black;">=</code><code style="color: blue;">"0"</code>
<code style="color: grey;">Margin</code><code style="color: black;">=</code><code style="color: blue;">"12"</code><code style="color: black;">></code></span></strong></div>
<div style="background-color: white;">
<strong><code> </code><span style="margin-left: 36px !important;"><code style="color: black;"><</code><code style="color: #006699; font-weight: bold;">TextBlock</code>
<code style="color: grey;">x:Name</code><code style="color: black;">=</code><code style="color: blue;">"ApplicationTitle"</code>
<code style="color: grey;">TextAlignment</code><code style="color: black;">=</code><code style="color: blue;">"Center"</code>
<code style="color: grey;">Text</code><code style="color: black;">=</code><code style="color: blue;">"SEARCHABLE LISTBOX"</code>
<code style="color: grey;">Style</code><code style="color: black;">=</code><code style="color: blue;">"{StaticResource PhoneTextNormalStyle}"</code><code style="color: black;">/></code></span></strong></div>
<div style="background-color: #f8f8f8;">
<strong><code> </code><span style="margin-left: 24px !important;"><code style="color: black;"></</code><code style="color: #006699; font-weight: bold;">StackPanel</code><code style="color: black;">></code></span></strong></div>
<div style="background-color: white;">
</div>
<div style="background-color: #f8f8f8;">
<strong><code> </code><span style="margin-left: 24px !important;"><code style="color: #008200;"><!--ContentPanel - place additional content here--></code></span></strong></div>
<div style="background-color: white;">
<strong><code> </code><span style="margin-left: 24px !important;"><code style="color: black;"><</code><code style="color: #006699; font-weight: bold;">Grid</code>
<code style="color: grey;">x:Name</code><code style="color: black;">=</code><code style="color: blue;">"ContentPanel"</code>
<code style="color: grey;">Grid.Row</code><code style="color: black;">=</code><code style="color: blue;">"1"</code>
<code style="color: grey;">Margin</code><code style="color: black;">=</code><code style="color: blue;">"12,0,12,0"</code><code style="color: black;">></code></span></strong></div>
<div style="background-color: #f8f8f8;">
<strong><code> </code><span style="margin-left: 36px !important;"><code style="color: black;"><</code><code style="color: #006699; font-weight: bold;">Grid.RowDefinitions</code><code style="color: black;">></code></span></strong></div>
<div style="background-color: white;">
<strong><code> </code><span style="margin-left: 48px !important;"><code style="color: black;"><</code><code style="color: #006699; font-weight: bold;">RowDefinition</code>
<code style="color: grey;">Height</code><code style="color: black;">=</code><code style="color: blue;">"Auto"</code><code style="color: black;">/></code></span></strong></div>
<div style="background-color: #f8f8f8;">
<strong><code> </code><span style="margin-left: 48px !important;"><code style="color: black;"><</code><code style="color: #006699; font-weight: bold;">RowDefinition</code>
<code style="color: grey;">Height</code><code style="color: black;">=</code><code style="color: blue;">"*"</code><code style="color: black;">/></code></span></strong></div>
<div style="background-color: white;">
<strong><code> </code><span style="margin-left: 36px !important;"><code style="color: black;"></</code><code style="color: #006699; font-weight: bold;">Grid.RowDefinitions</code><code style="color: black;">></code></span></strong></div>
<div style="background-color: #f8f8f8;">
<strong><code> </code><span style="margin-left: 36px !important;"> </span></strong></div>
<div style="background-color: white;">
<strong><code> </code><span style="margin-left: 36px !important;"><code style="color: black;"><</code><code style="color: #006699; font-weight: bold;">TextBox</code>
<code style="color: grey;">Grid.Row</code><code style="color: black;">=</code><code style="color: blue;">"0"</code>
<code style="color: grey;">Name</code><code style="color: black;">=</code><code style="color: blue;">"txtSearchText"</code><code style="color: black;">/></code></span></strong></div>
<div style="background-color: #f8f8f8;">
<strong><code> </code><span style="margin-left: 36px !important;"><code style="color: black;"><</code><code style="color: #006699; font-weight: bold;">ListBox</code>
<code style="color: grey;">Grid.Row</code><code style="color: black;">=</code><code style="color: blue;">"1"</code>
<code style="color: grey;">Background</code><code style="color: black;">=</code><code style="color: blue;">"LightGray"</code>
<code style="color: grey;">Name</code><code style="color: black;">=</code><code style="color: blue;">"lstData"</code>
<code style="color: grey;">Margin</code><code style="color: black;">=</code><code style="color: blue;">"12,0"</code><code style="color: black;">/></code></span></strong></div>
<div style="background-color: white;">
<strong><code> </code><span style="margin-left: 24px !important;"><code style="color: black;"></</code><code style="color: #006699; font-weight: bold;">Grid</code><code style="color: black;">></code></span></strong></div>
<div style="background-color: #f8f8f8;">
<strong><code> </code><span style="margin-left: 12px !important;"><code style="color: black;"></</code><code style="color: #006699; font-weight: bold;">Grid</code><code style="color: black;">></code></span></strong></div>
<div style="background-color: white;">
<strong><code> </code><span style="margin-left: 3px !important;"> </span></strong></div>
<div style="background-color: #f8f8f8;">
<strong><span style="margin-left: 0px !important;"><code style="color: black;"></</code><code style="color: #006699; font-weight: bold;">phone:PhoneApplicationPage</code><code style="color: black;">></code></span></strong></div>
</div>
<strong>
<br />
</strong></div>
</div>
<div style="text-align: left;">
Windows Phone has a class called CollectionView which allows grouping, sorting, filtering and navigation in a data collection. To create a collection view for a collection that implements IEnumerable, we can create a CollectionViewSource
object, and add collection to the Source property. To filter the data based on TextBox text, we have to add event handler for Filter event.<br />
<br />
<div class="reCodeBlock" style="-ms-overflow-y: auto; border: 1px solid rgb(127, 157, 185);">
<div style="background-color: white;">
<span style="margin-left: 0px !important;"><code style="color: #006699; font-weight: bold;">Private</code>
<code style="color: #006699; font-weight: bold;">Sub</code> <code style="color: black;">
BindListBox()</code></span></div>
<div style="background-color: #f8f8f8;">
<code> </code><span style="margin-left: 21px !important;"><code style="color: black;">mTechnologiesCollectionSource.Source = mTechnologies</code></span></div>
<div style="background-color: white;">
<code> </code><span style="margin-left: 21px !important;"><code style="color: #006699; font-weight: bold;">Dim</code>
<code style="color: black;">b </code><code style="color: #006699; font-weight: bold;">As</code>
<code style="color: #006699; font-weight: bold;">New</code> <code style="color: black;">
Binding</code></span></div>
<div style="background-color: #f8f8f8;">
<code> </code><span style="margin-left: 21px !important;"><code style="color: #006699; font-weight: bold;">AddHandler</code>
<code style="color: black;">mTechnologiesCollectionSource.Filter, </code><code style="color: #006699; font-weight: bold;">AddressOf</code>
<code style="color: black;">mTechnologiesCollectionSource_Filter</code></span></div>
<div style="background-color: white;">
<code> </code><span style="margin-left: 21px !important;"><code style="color: black;">b.Source = mTechnologiesCollectionSource</code></span></div>
<div style="background-color: #f8f8f8;">
<code> </code><span style="margin-left: 21px !important;"><code style="color: black;">lstData.SetBinding(ListBox.ItemsSourceProperty, b)</code></span></div>
<div style="background-color: white;">
<span style="margin-left: 9px !important;"><code style="color: #006699; font-weight: bold;">End</code>
<code style="color: #006699; font-weight: bold;">Sub</code></span></div>
<div style="background-color: #f8f8f8;">
<code> </code><span style="margin-left: 3px !important;"> </span></div>
<div style="background-color: white;">
<code> </code><span style="margin-left: 3px !important;"> </span></div>
<div style="background-color: #f8f8f8;">
<span style="margin-left: 0px !important;"><code style="color: #006699; font-weight: bold;">Private</code>
<code style="color: #006699; font-weight: bold;">Sub</code> <code style="color: black;">
mTechnologiesCollectionSource_Filter(sender </code><code style="color: #006699; font-weight: bold;">As</code>
<code style="color: #006699; font-weight: bold;">Object</code><code style="color: black;">, e
</code><code style="color: #006699; font-weight: bold;">As</code> <code style="color: black;">
FilterEventArgs)</code></span></div>
<div style="background-color: white;">
<code> </code><span style="margin-left: 21px !important;"><code style="color: #006699; font-weight: bold;">Dim</code>
<code style="color: black;">str </code><code style="color: #006699; font-weight: bold;">As</code>
<code style="color: #006699; font-weight: bold;">String</code> <code style="color: black;">
= e.Item</code></span></div>
<div style="background-color: #f8f8f8;">
<code> </code><span style="margin-left: 21px !important;"><code style="color: #006699; font-weight: bold;">If</code>
<code style="color: #006699; font-weight: bold;">String</code><code style="color: black;">.IsNullOrWhiteSpace(txtSearchText.Text) =
</code><code style="color: #006699; font-weight: bold;">True</code> <code style="color: #006699; font-weight: bold;">
OrElse</code> <code style="color: black;">str.ToUpperInvariant.StartsWith(txtSearchText.Text.ToUpperInvariant) =
</code><code style="color: #006699; font-weight: bold;">True</code> <code style="color: #006699; font-weight: bold;">
Then</code></span></div>
<div style="background-color: white;">
<code> </code><span style="margin-left: 33px !important;"><code style="color: black;">e.Accepted =
</code><code style="color: #006699; font-weight: bold;">True</code></span></div>
<div style="background-color: #f8f8f8;">
<code> </code><span style="margin-left: 21px !important;"><code style="color: #006699; font-weight: bold;">Else</code></span></div>
<div style="background-color: white;">
<code> </code><span style="margin-left: 33px !important;"><code style="color: black;">e.Accepted =
</code><code style="color: #006699; font-weight: bold;">False</code></span></div>
<div style="background-color: #f8f8f8;">
<code> </code><span style="margin-left: 21px !important;"><code style="color: #006699; font-weight: bold;">End</code>
<code style="color: #006699; font-weight: bold;">If</code></span></div>
<div style="background-color: white;">
<code> </code><span style="margin-left: 3px !important;"> </span></div>
<div style="background-color: #f8f8f8;">
<span style="margin-left: 0px !important;"><code style="color: #006699; font-weight: bold;">End</code>
<code style="color: #006699; font-weight: bold;">Sub</code></span></div>
</div>
<br />
In the above code, we are using "<em>StartsWith</em>" function to filter the Collection, and show the items which starts with text typed in TextBox. We can also use "<em>Contains</em>" function instead of "<em>StartsWith</em>" to show all the items which contains
text typed in TextBox.<br />
<br />
<div class="reCodeBlock" style="-ms-overflow-y: auto; border: 1px solid rgb(127, 157, 185);">
<div style="background-color: white;">
<span style="margin-left: 0px !important;"><code style="color: #006699; font-weight: bold;">Private</code>
<code style="color: #006699; font-weight: bold;">Sub</code> <code style="color: black;">
mTechnologiesCollectionSource_Filter(sender </code><code style="color: #006699; font-weight: bold;">As</code>
<code style="color: #006699; font-weight: bold;">Object</code><code style="color: black;">, e
</code><code style="color: #006699; font-weight: bold;">As</code> <code style="color: black;">
FilterEventArgs)</code></span></div>
<div style="background-color: #f8f8f8;">
<code> </code><span style="margin-left: 21px !important;"><code style="color: #006699; font-weight: bold;">Dim</code>
<code style="color: black;">str </code><code style="color: #006699; font-weight: bold;">As</code>
<code style="color: #006699; font-weight: bold;">String</code> <code style="color: black;">
= e.Item</code></span></div>
<div style="background-color: white;">
<code> </code><span style="margin-left: 21px !important;"><code style="color: #006699; font-weight: bold;">If</code>
<code style="color: #006699; font-weight: bold;">String</code><code style="color: black;">.IsNullOrWhiteSpace(txtSearchText.Text) =
</code><code style="color: #006699; font-weight: bold;">True</code> <code style="color: #006699; font-weight: bold;">
OrElse</code> <code style="color: black;">str.ToUpperInvariant.Contains(txtSearchText.Text.ToUpperInvariant) =
</code><code style="color: #006699; font-weight: bold;">True</code> <code style="color: #006699; font-weight: bold;">
Then</code></span></div>
<div style="background-color: #f8f8f8;">
<code> </code><span style="margin-left: 33px !important;"><code style="color: black;">e.Accepted =
</code><code style="color: #006699; font-weight: bold;">True</code></span></div>
<div style="background-color: white;">
<code> </code><span style="margin-left: 21px !important;"><code style="color: #006699; font-weight: bold;">Else</code></span></div>
<div style="background-color: #f8f8f8;">
<code> </code><span style="margin-left: 33px !important;"><code style="color: black;">e.Accepted =
</code><code style="color: #006699; font-weight: bold;">False</code></span></div>
<div style="background-color: white;">
<code> </code><span style="margin-left: 21px !important;"><code style="color: #006699; font-weight: bold;">End</code>
<code style="color: #006699; font-weight: bold;">If</code></span></div>
<div style="background-color: #f8f8f8;">
<code> </code><span style="margin-left: 3px !important;"> </span></div>
<div style="background-color: white;">
<span style="margin-left: 0px !important;"><code style="color: #006699; font-weight: bold;">End</code>
<code style="color: #006699; font-weight: bold;">Sub</code></span></div>
</div>
<br />
<span style="font-size: 12.1px;">On TextChanged event on TextBox to reapply the filter we have to refresh the view using "</span><em style="font-size: 12.1px;">CollectionViewSource.View.Refresh</em><span style="font-size: 12.1px;">" function. <br />
<br />
</span><br />
<div class="reCodeBlock" style="-ms-overflow-y: auto; border: 1px solid rgb(127, 157, 185);">
<div style="background-color: white;">
<span style="font-size: 12.1px;"><span style="margin-left: 0px !important;"><code style="color: #006699; font-weight: bold;">Imports</code>
<code style="color: black;">System.Collections.ObjectModel</code></span></span></div>
<div style="background-color: #f8f8f8;">
<span style="font-size: 12.1px;"><span style="margin-left: 0px !important;"><code style="color: #006699; font-weight: bold;">Imports</code>
<code style="color: black;">System.Windows.Data</code></span></span></div>
<div style="background-color: white;">
</div>
<div style="background-color: #f8f8f8;">
<span style="font-size: 12.1px;"><span style="margin-left: 0px !important;"><code style="color: black;">Partial
</code><code style="color: #006699; font-weight: bold;">Public</code> <code style="color: #006699; font-weight: bold;">
Class</code> <code style="color: black;">MainPage</code></span></span></div>
<div style="background-color: white;">
<span style="font-size: 12.1px;"><code> </code><span style="margin-left: 12px !important;"><code style="color: #006699; font-weight: bold;">Inherits</code>
<code style="color: black;">PhoneApplicationPage</code></span></span></div>
<div style="background-color: #f8f8f8;">
</div>
<div style="background-color: white;">
<span style="font-size: 12.1px;"><code> </code><span style="margin-left: 12px !important;"><code style="color: #006699; font-weight: bold;">Dim</code>
<code style="color: black;">mTechnologies </code><code style="color: #006699; font-weight: bold;">As</code>
<code style="color: #006699; font-weight: bold;">New</code> <code style="color: black;">
ObservableCollection(Of </code><code style="color: #006699; font-weight: bold;">String</code><code style="color: black;">)</code></span></span></div>
<div style="background-color: #f8f8f8;">
<span style="font-size: 12.1px;"><code> </code><span style="margin-left: 12px !important;"><code style="color: #006699; font-weight: bold;">Dim</code>
<code style="color: black;">mTechnologiesCollectionSource </code><code style="color: #006699; font-weight: bold;">As</code>
<code style="color: #006699; font-weight: bold;">New</code> <code style="color: black;">
CollectionViewSource</code></span></span></div>
<div style="background-color: white;">
</div>
<div style="background-color: #f8f8f8;">
<span style="font-size: 12.1px;"><code> </code><span style="margin-left: 12px !important;"><code style="color: #008200;">' Constructor</code></span></span></div>
<div style="background-color: white;">
<span style="font-size: 12.1px;"><code> </code><span style="margin-left: 12px !important;"><code style="color: #006699; font-weight: bold;">Public</code>
<code style="color: #006699; font-weight: bold;">Sub</code> <code style="color: #006699; font-weight: bold;">
New</code><code style="color: black;">()</code></span></span></div>
<div style="background-color: #f8f8f8;">
<span style="font-size: 12.1px;"><code> </code><span style="margin-left: 24px !important;"><code style="color: black;">InitializeComponent()</code></span></span></div>
<div style="background-color: white;">
<span style="font-size: 12.1px;"><code> </code><span style="margin-left: 24px !important;"><code style="color: black;">FillListBox()</code></span></span></div>
<div style="background-color: #f8f8f8;">
<span style="font-size: 12.1px;"><code> </code><span style="margin-left: 12px !important;"><code style="color: #006699; font-weight: bold;">End</code>
<code style="color: #006699; font-weight: bold;">Sub</code></span></span></div>
<div style="background-color: white;">
</div>
<div style="background-color: #f8f8f8;">
<span style="font-size: 12.1px;"><code> </code><span style="margin-left: 12px !important;"><code style="color: #006699; font-weight: bold;">Private</code>
<code style="color: #006699; font-weight: bold;">Sub</code> <code style="color: black;">
FillListBox()</code></span></span></div>
<div style="background-color: white;">
<span style="font-size: 12.1px;"><code> </code><span style="margin-left: 24px !important;"><code style="color: black;">mTechnologies.Add(</code><code style="color: blue;">"HTML"</code><code style="color: black;">)</code></span></span></div>
<div style="background-color: #f8f8f8;">
<span style="font-size: 12.1px;"><code> </code><span style="margin-left: 24px !important;"><code style="color: black;">mTechnologies.Add(</code><code style="color: blue;">"Silverlight"</code><code style="color: black;">)</code></span></span></div>
<div style="background-color: white;">
<span style="font-size: 12.1px;"><code> </code><span style="margin-left: 24px !important;"><code style="color: black;">mTechnologies.Add(</code><code style="color: blue;">"Visual Basic"</code><code style="color: black;">)</code></span></span></div>
<div style="background-color: #f8f8f8;">
<span style="font-size: 12.1px;"><code> </code><span style="margin-left: 24px !important;"><code style="color: black;">mTechnologies.Add(</code><code style="color: blue;">"Visual C#"</code><code style="color: black;">)</code></span></span></div>
<div style="background-color: white;">
<span style="font-size: 12.1px;"><code> </code><span style="margin-left: 24px !important;"><code style="color: black;">mTechnologies.Add(</code><code style="color: blue;">"Visual F#"</code><code style="color: black;">)</code></span></span></div>
<div style="background-color: #f8f8f8;">
<span style="font-size: 12.1px;"><code> </code><span style="margin-left: 24px !important;"><code style="color: black;">mTechnologies.Add(</code><code style="color: blue;">"Window Communication Foundation"</code><code style="color: black;">)</code></span></span></div>
<div style="background-color: white;">
<span style="font-size: 12.1px;"><code> </code><span style="margin-left: 24px !important;"><code style="color: black;">mTechnologies.Add(</code><code style="color: blue;">"Window Presentation Foundation"</code><code style="color: black;">)</code></span></span></div>
<div style="background-color: #f8f8f8;">
<span style="font-size: 12.1px;"><code> </code><span style="margin-left: 24px !important;"><code style="color: black;">mTechnologies.Add(</code><code style="color: blue;">"Window Phone"</code><code style="color: black;">)</code></span></span></div>
<div style="background-color: white;">
<span style="font-size: 12.1px;"><code> </code><span style="margin-left: 24px !important;"><code style="color: black;">mTechnologies.Add(</code><code style="color: blue;">"XML"</code><code style="color: black;">)</code></span></span></div>
<div style="background-color: #f8f8f8;">
<span style="font-size: 12.1px;"><code> </code><span style="margin-left: 24px !important;"><code style="color: black;">mTechnologies.Add(</code><code style="color: blue;">"XAML"</code><code style="color: black;">)</code></span></span></div>
<div style="background-color: white;">
<span style="font-size: 12.1px;"><code> </code><span style="margin-left: 12px !important;"><code style="color: #006699; font-weight: bold;">End</code>
<code style="color: #006699; font-weight: bold;">Sub</code></span></span></div>
<div style="background-color: #f8f8f8;">
</div>
<div style="background-color: white;">
<span style="font-size: 12.1px;"><code> </code><span style="margin-left: 12px !important;"><code style="color: #006699; font-weight: bold;">Private</code>
<code style="color: #006699; font-weight: bold;">Sub</code> <code style="color: black;">
MainPage_Loaded(sender </code><code style="color: #006699; font-weight: bold;">As</code>
<code style="color: #006699; font-weight: bold;">Object</code><code style="color: black;">, e
</code><code style="color: #006699; font-weight: bold;">As</code> <code style="color: black;">
RoutedEventArgs) </code><code style="color: #006699; font-weight: bold;">Handles</code>
<code style="color: #006699; font-weight: bold;">Me</code><code style="color: black;">.Loaded</code></span></span></div>
<div style="background-color: #f8f8f8;">
<span style="font-size: 12.1px;"><code> </code><span style="margin-left: 24px !important;"><code style="color: black;">BindListBox()</code></span></span></div>
<div style="background-color: white;">
<span style="font-size: 12.1px;"><code> </code><span style="margin-left: 12px !important;"><code style="color: #006699; font-weight: bold;">End</code>
<code style="color: #006699; font-weight: bold;">Sub</code></span></span></div>
<div style="background-color: #f8f8f8;">
</div>
<div style="background-color: white;">
<span style="font-size: 12.1px;"><code> </code><span style="margin-left: 12px !important;"><code style="color: #006699; font-weight: bold;">Private</code>
<code style="color: #006699; font-weight: bold;">Sub</code> <code style="color: black;">
BindListBox()</code></span></span></div>
<div style="background-color: #f8f8f8;">
<span style="font-size: 12.1px;"><code> </code><span style="margin-left: 24px !important;"><code style="color: black;">mTechnologiesCollectionSource.Source = mTechnologies</code></span></span></div>
<div style="background-color: white;">
<span style="font-size: 12.1px;"><code> </code><span style="margin-left: 24px !important;"><code style="color: #006699; font-weight: bold;">Dim</code>
<code style="color: black;">b </code><code style="color: #006699; font-weight: bold;">As</code>
<code style="color: #006699; font-weight: bold;">New</code> <code style="color: black;">
Binding</code></span></span></div>
<div style="background-color: #f8f8f8;">
<span style="font-size: 12.1px;"><code> </code><span style="margin-left: 24px !important;"><code style="color: #006699; font-weight: bold;">AddHandler</code>
<code style="color: black;">mTechnologiesCollectionSource.Filter, </code><code style="color: #006699; font-weight: bold;">AddressOf</code>
<code style="color: black;">mTechnologiesCollectionSource_Filter</code></span></span></div>
<div style="background-color: white;">
<span style="font-size: 12.1px;"><code> </code><span style="margin-left: 24px !important;"><code style="color: black;">b.Source = mTechnologiesCollectionSource</code></span></span></div>
<div style="background-color: #f8f8f8;">
<span style="font-size: 12.1px;"><code> </code><span style="margin-left: 24px !important;"><code style="color: black;">lstData.SetBinding(ListBox.ItemsSourceProperty, b)</code></span></span></div>
<div style="background-color: white;">
<span style="font-size: 12.1px;"><code> </code><span style="margin-left: 12px !important;"><code style="color: #006699; font-weight: bold;">End</code>
<code style="color: #006699; font-weight: bold;">Sub</code></span></span></div>
<div style="background-color: #f8f8f8;">
</div>
<div style="background-color: white;">
</div>
<div style="background-color: #f8f8f8;">
<span style="font-size: 12.1px;"><code> </code><span style="margin-left: 12px !important;"><code style="color: #006699; font-weight: bold;">Private</code>
<code style="color: #006699; font-weight: bold;">Sub</code> <code style="color: black;">
mTechnologiesCollectionSource_Filter(sender </code><code style="color: #006699; font-weight: bold;">As</code>
<code style="color: #006699; font-weight: bold;">Object</code><code style="color: black;">, e
</code><code style="color: #006699; font-weight: bold;">As</code> <code style="color: black;">
FilterEventArgs)</code></span></span></div>
<div style="background-color: white;">
<span style="font-size: 12.1px;"><code> </code><span style="margin-left: 24px !important;"><code style="color: #006699; font-weight: bold;">Dim</code>
<code style="color: black;">str </code><code style="color: #006699; font-weight: bold;">As</code>
<code style="color: #006699; font-weight: bold;">String</code> <code style="color: black;">
= e.Item</code></span></span></div>
<div style="background-color: #f8f8f8;">
<span style="font-size: 12.1px;"><code> </code><span style="margin-left: 24px !important;"><code style="color: #006699; font-weight: bold;">If</code>
<code style="color: #006699; font-weight: bold;">String</code><code style="color: black;">.IsNullOrWhiteSpace(txtSearchText.Text) =
</code><code style="color: #006699; font-weight: bold;">True</code> <code style="color: #006699; font-weight: bold;">
OrElse</code> <code style="color: black;">str.ToUpperInvariant.StartsWith(txtSearchText.Text.ToUpperInvariant) =
</code><code style="color: #006699; font-weight: bold;">True</code> <code style="color: #006699; font-weight: bold;">
Then</code></span></span></div>
<div style="background-color: white;">
<span style="font-size: 12.1px;"><code> </code><span style="margin-left: 36px !important;"><code style="color: black;">e.Accepted =
</code><code style="color: #006699; font-weight: bold;">True</code></span></span></div>
<div style="background-color: #f8f8f8;">
<span style="font-size: 12.1px;"><code> </code><span style="margin-left: 24px !important;"><code style="color: #006699; font-weight: bold;">Else</code></span></span></div>
<div style="background-color: white;">
<span style="font-size: 12.1px;"><code> </code><span style="margin-left: 36px !important;"><code style="color: black;">e.Accepted =
</code><code style="color: #006699; font-weight: bold;">False</code></span></span></div>
<div style="background-color: #f8f8f8;">
<span style="font-size: 12.1px;"><code> </code><span style="margin-left: 24px !important;"><code style="color: #006699; font-weight: bold;">End</code>
<code style="color: #006699; font-weight: bold;">If</code></span></span></div>
<div style="background-color: white;">
<span style="font-size: 12.1px;"><code> </code><span style="margin-left: 12px !important;"><code style="color: #006699; font-weight: bold;">End</code>
<code style="color: #006699; font-weight: bold;">Sub</code></span></span></div>
<div style="background-color: #f8f8f8;">
</div>
<div style="background-color: white;">
<span style="font-size: 12.1px;"><code> </code><span style="margin-left: 12px !important;"><code style="color: #006699; font-weight: bold;">Private</code>
<code style="color: #006699; font-weight: bold;">Sub</code> <code style="color: black;">
txtSearchText_TextChanged(sender </code><code style="color: #006699; font-weight: bold;">As</code>
<code style="color: #006699; font-weight: bold;">Object</code><code style="color: black;">, e
</code><code style="color: #006699; font-weight: bold;">As</code> <code style="color: black;">
TextChangedEventArgs) </code><code style="color: #006699; font-weight: bold;">Handles</code>
<code style="color: black;">txtSearchText.TextChanged</code></span></span></div>
<div style="background-color: #f8f8f8;">
<span style="font-size: 12.1px;"><code> </code><span style="margin-left: 24px !important;"><code style="color: black;">mTechnologiesCollectionSource.View.Refresh()</code></span></span></div>
<div style="background-color: white;">
<span style="font-size: 12.1px;"><code> </code><span style="margin-left: 12px !important;"><code style="color: #006699; font-weight: bold;">End</code>
<code style="color: #006699; font-weight: bold;">Sub</code></span></span></div>
<div style="background-color: #f8f8f8;">
<span style="font-size: 12.1px;"><span style="margin-left: 0px !important;"><code style="color: #006699; font-weight: bold;">End</code>
<code style="color: #006699; font-weight: bold;">Class</code></span></span></div>
</div>
<span style="font-size: 12.1px;">
<br />
</span>You can also refer following links to know more about CollectionViewSource<br />
<br />
<a href="http://msdn.microsoft.com/en-us/library/system.windows.data.collectionview.aspx">http://msdn.microsoft.com/en-us/library/system.windows.data.collectionview.aspx</a><br />
<a href="http://msdn.microsoft.com/en-us/library/ms752348.aspx">http://msdn.microsoft.com/en-us/library/ms752348.aspx</a><br />
<br /></div>
</div>
Gaurav Khannahttp://www.blogger.com/profile/04250008487377659924noreply@blogger.com0tag:blogger.com,1999:blog-4682504245579959231.post-15818826594173761632013-07-26T00:52:00.001+05:302013-07-26T12:08:41.243+05:30Editable Button in WPF<p>Today I am going to share a code snippet to create an Editable Button in WPF, where we can update the text of a Button at runtime. In this control the user would right-click a button and then click 'Edit' to make to control Editable, and later right-click it to save/cancel the change. <p>First step to make the Button editable is to change the Style of Button and add a TextBox inside it, which we will make visible when the user clicks on 'Edit'.</p> <div class="reCodeBlock" style="border-top: #7f9db9 1px solid; border-right: #7f9db9 1px solid; overflow-y: auto; border-bottom: #7f9db9 1px solid; border-left: #7f9db9 1px solid"> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">01.</code><span style="margin-left: 0px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Style</code> <code style="color: #808080">TargetType</code><code style="color: #000000">=</code><code style="color: blue">"my:EditableButton"</code><code style="color: #000000">></code></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">02.</code><span><code> </code><span style="margin-left: 12px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"FocusVisualStyle"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">03.</code><span><code> </code><span style="margin-left: 24px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter.Value</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">04.</code><span><code> </code><span style="margin-left: 36px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Style</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">05.</code><span><code> </code><span style="margin-left: 48px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Control.Template"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">06.</code><span><code> </code><span style="margin-left: 60px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter.Value</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">07.</code><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">ControlTemplate</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">08.</code><span><code> </code><span style="margin-left: 84px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Rectangle</code> <code style="color: #808080">Margin</code><code style="color: #000000">=</code><code style="color: blue">"2"</code> <code style="color: #808080">SnapsToDevicePixels</code><code style="color: #000000">=</code><code style="color: blue">"True"</code> <code style="color: #808080">Stroke</code><code style="color: #000000">=</code><code style="color: blue">"{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"</code> <code style="color: #808080">StrokeThickness</code><code style="color: #000000">=</code><code style="color: blue">"1"</code> <code style="color: #808080">StrokeDashArray</code><code style="color: #000000">=</code><code style="color: blue">"1 2"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">09.</code><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">ControlTemplate</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">10.</code><span><code> </code><span style="margin-left: 60px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Setter.Value</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">11.</code><span><code> </code><span style="margin-left: 48px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Setter</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">12.</code><span><code> </code><span style="margin-left: 36px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Style</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">13.</code><span><code> </code><span style="margin-left: 24px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Setter.Value</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">14.</code><span><code> </code><span style="margin-left: 12px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Setter</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">15.</code><span><code> </code><span style="margin-left: 12px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Background"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"#FFDDDDDD"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">16.</code><span><code> </code><span style="margin-left: 12px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"BorderBrush"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"#FF707070"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">17.</code><span><code> </code><span style="margin-left: 12px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Foreground"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">18.</code><span><code> </code><span style="margin-left: 12px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"BorderThickness"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"1"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">19.</code><span><code> </code><span style="margin-left: 12px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"HorizontalContentAlignment"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"Center"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">20.</code><span><code> </code><span style="margin-left: 12px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"VerticalContentAlignment"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"Center"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">21.</code><span><code> </code><span style="margin-left: 12px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Padding"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"1"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">22.</code><span><code> </code><span style="margin-left: 12px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Template"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">23.</code><span><code> </code><span style="margin-left: 24px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter.Value</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">24.</code><span><code> </code><span style="margin-left: 36px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">ControlTemplate</code> <code style="color: #808080">TargetType</code><code style="color: #000000">=</code><code style="color: blue">"{x:Type Button}"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">25.</code><span><code> </code><span style="margin-left: 48px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Border</code> <code style="color: #808080">x:Name</code><code style="color: #000000">=</code><code style="color: blue">"border"</code> <code style="color: #808080">BorderBrush</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding BorderBrush}"</code> <code style="color: #808080">BorderThickness</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding BorderThickness}"</code> <code style="color: #808080">Background</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding Background}"</code> <code style="color: #808080">SnapsToDevicePixels</code><code style="color: #000000">=</code><code style="color: blue">"True"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">26.</code><span><code> </code><span style="margin-left: 60px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Grid</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">27.</code><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">ContentPresenter</code> <code style="color: #808080">x:Name</code><code style="color: #000000">=</code><code style="color: blue">"tbkContent"</code> <code style="color: #808080">ContentTemplate</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding ContentTemplate}"</code> <code style="color: #808080">Content</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding Content}"</code> <code style="color: #808080">ContentStringFormat</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding ContentStringFormat}"</code> <code style="color: #808080">Focusable</code><code style="color: #000000">=</code><code style="color: blue">"False"</code> <code style="color: #808080">HorizontalAlignment</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding HorizontalContentAlignment}"</code> <code style="color: #808080">Margin</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding Padding}"</code> <code style="color: #808080">RecognizesAccessKey</code><code style="color: #000000">=</code><code style="color: blue">"True"</code> <code style="color: #808080">SnapsToDevicePixels</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding SnapsToDevicePixels}"</code> <code style="color: #808080">VerticalAlignment</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding VerticalContentAlignment}"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">28.</code><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">TextBox</code> <code style="color: #808080">Name</code><code style="color: #000000">=</code><code style="color: blue">"txtContent"</code> <code style="color: #808080">Height</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding Height}"</code> <code style="color: #808080">TextAlignment</code><code style="color: #000000">=</code><code style="color: blue">"Center"</code> <code style="color: #808080">Visibility</code><code style="color: #000000">=</code><code style="color: blue">"Collapsed"</code> <code style="color: #808080">Text</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding Content}"</code> <code style="color: #808080">Padding</code><code style="color: #000000">=</code><code style="color: blue">"0"</code> <code style="color: #808080">Background</code><code style="color: #000000">=</code><code style="color: blue">"Transparent"</code> <code style="color: #808080">BorderBrush</code><code style="color: #000000">=</code><code style="color: blue">"Transparent"</code> <code style="color: #808080">BorderThickness</code><code style="color: #000000">=</code><code style="color: blue">"0"</code> <code style="color: #808080">HorizontalContentAlignment</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding HorizontalContentAlignment}"</code> <code style="color: #808080">VerticalContentAlignment</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding VerticalContentAlignment}"</code> <code style="color: #808080">Margin</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding Padding}"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">29.</code><span><code> </code><span style="margin-left: 60px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Grid</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">30.</code><span><code> </code><span style="margin-left: 48px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Border</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">31.</code><span><code> </code><span style="margin-left: 48px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">ControlTemplate.Triggers</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">32.</code><span><code> </code><span style="margin-left: 60px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Trigger</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"IsDefaulted"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"True"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">33.</code><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"BorderBrush"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"border"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">34.</code><span><code> </code><span style="margin-left: 60px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Trigger</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">35.</code><span><code> </code><span style="margin-left: 60px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Trigger</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"IsMouseOver"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"True"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">36.</code><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Background"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"border"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"#FFBEE6FD"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">37.</code><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"BorderBrush"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"border"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"#FF3C7FB1"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">38.</code><span><code> </code><span style="margin-left: 60px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Trigger</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">39.</code><span><code> </code><span style="margin-left: 60px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Trigger</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"IsPressed"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"True"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">40.</code><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Background"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"border"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"#FFC4E5F6"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">41.</code><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"BorderBrush"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"border"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"#FF2C628B"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">42.</code><span><code> </code><span style="margin-left: 60px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Trigger</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">43.</code><span><code> </code><span style="margin-left: 60px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Trigger</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"ToggleButton.IsChecked"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"True"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">44.</code><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Background"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"border"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"#FFBCDDEE"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">45.</code><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"BorderBrush"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"border"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"#FF245A83"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">46.</code><span><code> </code><span style="margin-left: 60px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Trigger</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">47.</code><span><code> </code><span style="margin-left: 60px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Trigger</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"IsEnabled"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"False"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">48.</code><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Background"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"border"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"#FFF4F4F4"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">49.</code><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"BorderBrush"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"border"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"#FFADB2B5"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">50.</code><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"TextElement.Foreground"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"tbkContent"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"#FF838383"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">51.</code><span><code> </code><span style="margin-left: 60px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Trigger</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">52.</code><span><code> </code><span style="margin-left: 48px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">ControlTemplate.Triggers</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">53.</code><span><code> </code><span style="margin-left: 36px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">ControlTemplate</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">54.</code><span><code> </code><span style="margin-left: 24px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Setter.Value</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">55.</code><span><code> </code><span style="margin-left: 12px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Setter</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">56.</code><span style="margin-left: 0px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Style</code><code style="color: #000000">></code></span></div></div><br>As you can see in the above code, I have added a "txtContent" textbox which is hidden. Also to make editing look like a part of the Button, the Background and BorderBrush properties of textbox are transparent<br><br> <div class="reCodeBlock" style="border-top: #7f9db9 1px solid; border-right: #7f9db9 1px solid; overflow-y: auto; border-bottom: #7f9db9 1px solid; border-left: #7f9db9 1px solid"> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">01.</code><span style="margin-left: 0px !important"><code style="font-weight: bold; color: #006699">Public</code> <code style="font-weight: bold; color: #006699">Class</code> <code style="color: #000000">EditableButton</code></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">02.</code><span><code> </code><span style="margin-left: 12px !important"><code style="font-weight: bold; color: #006699">Inherits</code> <code style="color: #000000">Button</code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">03.</code><span><code> </code><span style="margin-left: 12px !important"><code style="font-weight: bold; color: #006699">Private</code> <code style="color: #000000">mButtonContentPresenter </code><code style="font-weight: bold; color: #006699">As</code> <code style="color: #000000">ContentPresenter</code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">04.</code><span><code> </code><span style="margin-left: 12px !important"><code style="font-weight: bold; color: #006699">Private</code> <code style="color: #000000">mButtonTextBox </code><code style="font-weight: bold; color: #006699">As</code> <code style="color: #000000">TextBox</code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">05.</code><span style="margin-left: 0px !important"> </span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">06.</code><span><code> </code><span style="margin-left: 12px !important"><code style="font-weight: bold; color: #006699">Public</code> <code style="font-weight: bold; color: #006699">Sub</code> <code style="font-weight: bold; color: #006699">New</code><code style="color: #000000">()</code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">07.</code><span><code> </code><span style="margin-left: 24px !important"><code style="font-weight: bold; color: #006699">Me</code><code style="color: #000000">.DefaultStyleKey = </code><code style="font-weight: bold; color: #006699">GetType</code><code style="color: #000000">(EditableButton)</code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">08.</code><span><code> </code><span style="margin-left: 24px !important"><code style="font-weight: bold; color: #006699">AddHandler</code> <code style="font-weight: bold; color: #006699">Me</code><code style="color: #000000">.Loaded, </code><code style="font-weight: bold; color: #006699">New</code> <code style="color: #000000">RoutedEventHandler(</code><code style="font-weight: bold; color: #006699">AddressOf</code> <code style="color: #000000">EditableButton_Loaded)</code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">09.</code><span><code> </code><span style="margin-left: 12px !important"><code style="font-weight: bold; color: #006699">End</code> <code style="font-weight: bold; color: #006699">Sub</code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">10.</code><span style="margin-left: 0px !important"> </span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">11.</code><span><code> </code><span style="margin-left: 12px !important"><code style="font-weight: bold; color: #006699">Private</code> <code style="font-weight: bold; color: #006699">Sub</code> <code style="color: #000000">EditableButton_Loaded(sender </code><code style="font-weight: bold; color: #006699">As</code> <code style="font-weight: bold; color: #006699">Object</code><code style="color: #000000">, e </code><code style="font-weight: bold; color: #006699">As</code> <code style="color: #000000">RoutedEventArgs)</code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">12.</code><span style="margin-left: 0px !important"> </span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">13.</code><span><code> </code><span style="margin-left: 24px !important"><code style="font-weight: bold; color: #006699">Me</code><code style="color: #000000">.OnApplyTemplate()</code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">14.</code><span><code> </code><span style="margin-left: 12px !important"><code style="font-weight: bold; color: #006699">End</code> <code style="font-weight: bold; color: #006699">Sub</code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">15.</code><span style="margin-left: 0px !important"> </span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">16.</code><span><code> </code><span style="margin-left: 12px !important"><code style="font-weight: bold; color: #006699">Public</code> <code style="font-weight: bold; color: #006699">Overrides</code> <code style="font-weight: bold; color: #006699">Sub</code> <code style="color: #000000">OnApplyTemplate()</code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">17.</code><span><code> </code><span style="margin-left: 24px !important"><code style="font-weight: bold; color: #006699">MyBase</code><code style="color: #000000">.OnApplyTemplate()</code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">18.</code><span><code> </code><span style="margin-left: 24px !important"><code style="color: #000000">mButtonContentPresenter = </code><code style="font-weight: bold; color: #006699">DirectCast</code><code style="color: #000000">(</code><code style="font-weight: bold; color: #006699">Me</code><code style="color: #000000">.GetTemplateChild(</code><code style="color: blue">"tbkContent"</code><code style="color: #000000">), ContentPresenter)</code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">19.</code><span><code> </code><span style="margin-left: 24px !important"><code style="color: #000000">mButtonTextBox = </code><code style="font-weight: bold; color: #006699">DirectCast</code><code style="color: #000000">(</code><code style="font-weight: bold; color: #006699">Me</code><code style="color: #000000">.GetTemplateChild(</code><code style="color: blue">"txtContent"</code><code style="color: #000000">), TextBox)</code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">20.</code><span><code> </code><span style="margin-left: 24px !important"><code style="color: #000000">CreateSaveContextMenu()</code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">21.</code><span><code> </code><span style="margin-left: 24px !important"><code style="color: #000000">CreateEditContextMenu()</code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">22.</code><span><code> </code><span style="margin-left: 12px !important"><code style="font-weight: bold; color: #006699">End</code> <code style="font-weight: bold; color: #006699">Sub</code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">23.</code><span style="margin-left: 0px !important"> </span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">24.</code><span><code> </code><span style="margin-left: 12px !important"><code style="font-weight: bold; color: #006699">Public</code> <code style="font-weight: bold; color: #006699">Property</code> <code style="color: #000000">IsEditMode() </code><code style="font-weight: bold; color: #006699">As</code> <code style="font-weight: bold; color: #006699">Boolean</code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">25.</code><span><code> </code><span style="margin-left: 24px !important"><code style="font-weight: bold; color: #006699">Get</code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">26.</code><span><code> </code><span style="margin-left: 36px !important"><code style="font-weight: bold; color: #006699">Return</code> <code style="font-weight: bold; color: #006699">CBool</code><code style="color: #000000">(GetValue(IsEditModeProperty))</code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">27.</code><span><code> </code><span style="margin-left: 24px !important"><code style="font-weight: bold; color: #006699">End</code> <code style="font-weight: bold; color: #006699">Get</code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">28.</code><span><code> </code><span style="margin-left: 24px !important"><code style="font-weight: bold; color: #006699">Private</code> <code style="font-weight: bold; color: #006699">Set</code><code style="color: #000000">(value </code><code style="font-weight: bold; color: #006699">As</code> <code style="font-weight: bold; color: #006699">Boolean</code><code style="color: #000000">)</code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">29.</code><span><code> </code><span style="margin-left: 36px !important"><code style="color: #000000">SetValue(IsEditModeProperty, value)</code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">30.</code><span><code> </code><span style="margin-left: 24px !important"><code style="font-weight: bold; color: #006699">End</code> <code style="font-weight: bold; color: #006699">Set</code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">31.</code><span><code> </code><span style="margin-left: 12px !important"><code style="font-weight: bold; color: #006699">End</code> <code style="font-weight: bold; color: #006699">Property</code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">32.</code><span style="margin-left: 0px !important"> </span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">33.</code><span><code> </code><span style="margin-left: 12px !important"><code style="color: #008200">' Using a DependencyProperty as the backing store for IsEditMode. This enables animation, styling, binding, etc...</code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">34.</code><span><code> </code><span style="margin-left: 12px !important"><code style="font-weight: bold; color: #006699">Public</code> <code style="font-weight: bold; color: #006699">Shared</code> <code style="font-weight: bold; color: #006699">ReadOnly</code> <code style="color: #000000">IsEditModeProperty </code><code style="font-weight: bold; color: #006699">As</code> <code style="color: #000000">DependencyProperty = DependencyProperty.Register(</code><code style="color: blue">"IsEditMode"</code><code style="color: #000000">, </code><code style="font-weight: bold; color: #006699">GetType</code><code style="color: #000000">(</code><code style="font-weight: bold; color: #006699">Boolean</code><code style="color: #000000">), </code><code style="font-weight: bold; color: #006699">GetType</code><code style="color: #000000">(EditableButton), </code><code style="font-weight: bold; color: #006699">New</code> <code style="color: #000000">PropertyMetadata(</code><code style="font-weight: bold; color: #006699">False</code><code style="color: #000000">))</code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">35.</code><span style="margin-left: 0px !important"> </span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">36.</code><span><code> </code><span style="margin-left: 12px !important"><code style="font-weight: bold; color: #006699">Private</code> <code style="font-weight: bold; color: #006699">Sub</code> <code style="color: #000000">CreateSaveContextMenu()</code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">37.</code><span><code> </code><span style="margin-left: 24px !important"><code style="font-weight: bold; color: #006699">Dim</code> <code style="color: #000000">menu </code><code style="font-weight: bold; color: #006699">As</code> <code style="font-weight: bold; color: #006699">New</code> <code style="color: #000000">ContextMenu</code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">38.</code><span><code> </code><span style="margin-left: 24px !important"><code style="font-weight: bold; color: #006699">Dim</code> <code style="color: #000000">itm </code><code style="font-weight: bold; color: #006699">As</code> <code style="font-weight: bold; color: #006699">New</code> <code style="color: #000000">MenuItem()</code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">39.</code><span><code> </code><span style="margin-left: 24px !important"><code style="color: #000000">itm.Header = </code><code style="color: blue">"Save"</code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">40.</code><span><code> </code><span style="margin-left: 24px !important"><code style="font-weight: bold; color: #006699">AddHandler</code> <code style="color: #000000">itm.Click, </code><code style="font-weight: bold; color: #006699">New</code> <code style="color: #000000">RoutedEventHandler(</code><code style="font-weight: bold; color: #006699">AddressOf</code> <code style="color: #000000">itmSave_Click)</code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">41.</code><span><code> </code><span style="margin-left: 24px !important"><code style="color: #000000">menu.Items.Add(itm)</code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">42.</code><span style="margin-left: 0px !important"> </span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">43.</code><span><code> </code><span style="margin-left: 24px !important"><code style="color: #000000">itm = </code><code style="font-weight: bold; color: #006699">New</code> <code style="color: #000000">MenuItem()</code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">44.</code><span><code> </code><span style="margin-left: 24px !important"><code style="color: #000000">itm.Header = </code><code style="color: blue">"Cancel"</code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">45.</code><span><code> </code><span style="margin-left: 24px !important"><code style="font-weight: bold; color: #006699">AddHandler</code> <code style="color: #000000">itm.Click, </code><code style="font-weight: bold; color: #006699">New</code> <code style="color: #000000">RoutedEventHandler(</code><code style="font-weight: bold; color: #006699">AddressOf</code> <code style="color: #000000">itmCancel_Click)</code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">46.</code><span><code> </code><span style="margin-left: 24px !important"><code style="color: #000000">menu.Items.Add(itm)</code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">47.</code><span style="margin-left: 0px !important"> </span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">48.</code><span><code> </code><span style="margin-left: 24px !important"><code style="color: #000000">ContextMenuService.SetContextMenu(mButtonTextBox, menu)</code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">49.</code><span><code> </code><span style="margin-left: 12px !important"><code style="font-weight: bold; color: #006699">End</code> <code style="font-weight: bold; color: #006699">Sub</code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">50.</code><span style="margin-left: 0px !important"> </span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">51.</code><span style="margin-left: 0px !important"> </span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">52.</code><span style="margin-left: 0px !important"> </span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">53.</code><span><code> </code><span style="margin-left: 12px !important"><code style="font-weight: bold; color: #006699">Private</code> <code style="font-weight: bold; color: #006699">Sub</code> <code style="color: #000000">CreateEditContextMenu()</code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">54.</code><span><code> </code><span style="margin-left: 24px !important"><code style="font-weight: bold; color: #006699">Dim</code> <code style="color: #000000">menu </code><code style="font-weight: bold; color: #006699">As</code> <code style="font-weight: bold; color: #006699">New</code> <code style="color: #000000">ContextMenu</code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">55.</code><span><code> </code><span style="margin-left: 24px !important"><code style="font-weight: bold; color: #006699">Dim</code> <code style="color: #000000">itm </code><code style="font-weight: bold; color: #006699">As</code> <code style="font-weight: bold; color: #006699">New</code> <code style="color: #000000">MenuItem</code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">56.</code><span><code> </code><span style="margin-left: 24px !important"><code style="color: #000000">itm.Header = </code><code style="color: blue">"Edit"</code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">57.</code><span><code> </code><span style="margin-left: 24px !important"><code style="font-weight: bold; color: #006699">AddHandler</code> <code style="color: #000000">itm.Click, </code><code style="font-weight: bold; color: #006699">New</code> <code style="color: #000000">RoutedEventHandler(</code><code style="font-weight: bold; color: #006699">AddressOf</code> <code style="color: #000000">itmEdit_Click)</code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">58.</code><span><code> </code><span style="margin-left: 24px !important"><code style="color: #000000">menu.Items.Add(itm)</code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">59.</code><span style="margin-left: 0px !important"> </span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">60.</code><span><code> </code><span style="margin-left: 24px !important"><code style="color: #000000">ContextMenuService.SetContextMenu(mButtonContentPresenter, menu)</code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">61.</code><span><code> </code><span style="margin-left: 12px !important"><code style="font-weight: bold; color: #006699">End</code> <code style="font-weight: bold; color: #006699">Sub</code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">62.</code><span style="margin-left: 0px !important"> </span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">63.</code><span><code> </code><span style="margin-left: 12px !important"><code style="font-weight: bold; color: #006699">Private</code> <code style="font-weight: bold; color: #006699">Sub</code> <code style="color: #000000">itmEdit_Click(sender </code><code style="font-weight: bold; color: #006699">As</code> <code style="font-weight: bold; color: #006699">Object</code><code style="color: #000000">, e </code><code style="font-weight: bold; color: #006699">As</code> <code style="color: #000000">RoutedEventArgs)</code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">64.</code><span><code> </code><span style="margin-left: 24px !important"><code style="color: #000000">mButtonContentPresenter.Visibility = Visibility.Collapsed</code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">65.</code><span><code> </code><span style="margin-left: 24px !important"><code style="color: #000000">mButtonTextBox.Visibility = Visibility.Visible</code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">66.</code><span><code> </code><span style="margin-left: 24px !important"><code style="color: #000000">IsEditMode = </code><code style="font-weight: bold; color: #006699">True</code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">67.</code><span><code> </code><span style="margin-left: 12px !important"><code style="font-weight: bold; color: #006699">End</code> <code style="font-weight: bold; color: #006699">Sub</code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">68.</code><span style="margin-left: 0px !important"> </span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">69.</code><span><code> </code><span style="margin-left: 12px !important"><code style="font-weight: bold; color: #006699">Private</code> <code style="font-weight: bold; color: #006699">Sub</code> <code style="color: #000000">itmSave_Click(sender </code><code style="font-weight: bold; color: #006699">As</code> <code style="font-weight: bold; color: #006699">Object</code><code style="color: #000000">, e </code><code style="font-weight: bold; color: #006699">As</code> <code style="color: #000000">RoutedEventArgs)</code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">70.</code><span><code> </code><span style="margin-left: 24px !important"><code style="color: #000000">mButtonContentPresenter.Visibility = Visibility.Visible</code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">71.</code><span><code> </code><span style="margin-left: 24px !important"><code style="color: #000000">mButtonTextBox.Visibility = Visibility.Collapsed</code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">72.</code><span><code> </code><span style="margin-left: 24px !important"><code style="font-weight: bold; color: #006699">Me</code><code style="color: #000000">.Content = mButtonTextBox.Text</code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">73.</code><span><code> </code><span style="margin-left: 24px !important"><code style="color: #000000">IsEditMode = </code><code style="font-weight: bold; color: #006699">False</code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">74.</code><span><code> </code><span style="margin-left: 12px !important"><code style="font-weight: bold; color: #006699">End</code> <code style="font-weight: bold; color: #006699">Sub</code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">75.</code><span style="margin-left: 0px !important"> </span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">76.</code><span><code> </code><span style="margin-left: 12px !important"><code style="font-weight: bold; color: #006699">Private</code> <code style="font-weight: bold; color: #006699">Sub</code> <code style="color: #000000">itmCancel_Click(sender </code><code style="font-weight: bold; color: #006699">As</code> <code style="font-weight: bold; color: #006699">Object</code><code style="color: #000000">, e </code><code style="font-weight: bold; color: #006699">As</code> <code style="color: #000000">RoutedEventArgs)</code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">77.</code><span><code> </code><span style="margin-left: 24px !important"><code style="color: #000000">mButtonContentPresenter.Visibility = Visibility.Visible</code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">78.</code><span><code> </code><span style="margin-left: 24px !important"><code style="color: #000000">mButtonTextBox.Visibility = Visibility.Collapsed</code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">79.</code><span><code> </code><span style="margin-left: 24px !important"><code style="color: #000000">IsEditMode = </code><code style="font-weight: bold; color: #006699">False</code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">80.</code><span><code> </code><span style="margin-left: 12px !important"><code style="font-weight: bold; color: #006699">End</code> <code style="font-weight: bold; color: #006699">Sub</code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">81.</code><span style="margin-left: 0px !important"><code style="font-weight: bold; color: #006699">End</code> <code style="font-weight: bold; color: #006699">Class</code></span></div></div><br> <p>In the above code we have an "IsEditMode" property which the user can use to know whether the control is in Edit Mode or not. Also, we have two different Context Menus, one to Edit the Control, and the another to Save/Cancel the changes. Based on the menuitems that are clicked, we are going to set the visibility of TextBox and ContentPresenter, defined in XAML. <p>Now we can use the control in our application as below</p><br> <div class="reCodeBlock" style="border-top: #7f9db9 1px solid; border-right: #7f9db9 1px solid; overflow-y: auto; border-bottom: #7f9db9 1px solid; border-left: #7f9db9 1px solid"> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">01.</code><span style="margin-left: 0px !important"><code style="color: #000000"><Window x:</code><code style="font-weight: bold; color: #006699">Class</code><code style="color: #000000">=</code><code style="color: blue">"MainWindow"</code></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">02.</code><span><code> </code><span style="margin-left: 12px !important"><code style="color: #000000">xmlns=</code><code style="color: blue">"<a href="http://schemas.microsoft.com/winfx/2006/xaml/presentation">http://schemas.microsoft.com/winfx/2006/xaml/presentation</a>"</code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">03.</code><span><code> </code><span style="margin-left: 12px !important"><code style="color: #000000">xmlns:x=</code><code style="color: blue">"<a href="http://schemas.microsoft.com/winfx/2006/xaml">http://schemas.microsoft.com/winfx/2006/xaml</a>"</code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">04.</code><span><code> </code><span style="margin-left: 12px !important"><code style="color: #000000">xmlns:my=</code><code style="color: blue">"clr-namespace:WpfApplication1"</code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">05.</code><span><code> </code><span style="margin-left: 12px !important"><code style="color: #000000">Title=</code><code style="color: blue">"MainWindow"</code> <code style="color: #000000">Height=</code><code style="color: blue">"350"</code> <code style="color: #000000">Width=</code><code style="color: blue">"525"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">06.</code><span><code> </code><span style="margin-left: 6px !important"> </span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">07.</code><span><code> </code><span style="margin-left: 12px !important"><code style="color: #000000"><Grid></code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">08.</code><span><code> </code><span style="margin-left: 24px !important"><code style="color: #000000"><my:EditableButton x:Name=</code><code style="color: blue">"MyButton"</code> <code style="color: #000000">Width=</code><code style="color: blue">"100"</code> <code style="color: #000000">Height=</code><code style="color: blue">"25"</code> <code style="color: #000000">Content=</code><code style="color: blue">"Edit Me"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">09.</code><span><code> </code><span style="margin-left: 12px !important"><code style="color: #000000"></Grid></code></span></span></div> <div style="background-color: #f8f8f8"><code style="float: left; color: #5c5c5c; text-align: right; display: block; padding-right: 0.3em; width: 3em">10.</code><span style="margin-left: 0px !important"><code style="color: #000000"></Window></code></span></div></div><br>Hope the above control helps you in your development. Gaurav Khannahttp://www.blogger.com/profile/04250008487377659924noreply@blogger.com0tag:blogger.com,1999:blog-4682504245579959231.post-20670598452432056332013-06-23T00:29:00.001+05:302013-06-23T00:29:49.266+05:30Set Brush for ScrollViewer ThumbIn WPF/Silverlight ScrollViewer and ScrollBar control doesn't have any property to change color of Thumb dynamically from XAML by setting property. We have to edit the Style of ScrollBar and set the Brush for it according to our requirement. Based on requirement of one of the user on MSDN Forum I decided to create a Custom ScrollViewer which has a property to set Brush for Thumb.<br><br> <div class="reCodeBlock" style="border-top: #7f9db9 1px solid; border-right: #7f9db9 1px solid; overflow-y: auto; border-bottom: #7f9db9 1px solid; border-left: #7f9db9 1px solid"> <div style="background-color: #ffffff"><span style="margin-left: 0px !important"><code style="font-weight: bold; color: #006699">Public</code> <code style="font-weight: bold; color: #006699">Class</code> <code style="color: #000000">CustomScrollViewer</code></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 12px !important"><code style="font-weight: bold; color: #006699">Inherits</code> <code style="color: #000000">ScrollViewer</code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 3px !important"> </span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 12px !important"><code style="font-weight: bold; color: #006699">Shared</code> <code style="font-weight: bold; color: #006699">Sub</code> <code style="font-weight: bold; color: #006699">New</code><code style="color: #000000">()</code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 24px !important"><code style="color: #000000">DefaultStyleKeyProperty.OverrideMetadata(</code><code style="font-weight: bold; color: #006699">GetType</code><code style="color: #000000">(CustomScrollViewer), </code><code style="font-weight: bold; color: #006699">New</code> <code style="color: #000000">FrameworkPropertyMetadata(</code><code style="font-weight: bold; color: #006699">GetType</code><code style="color: #000000">(CustomScrollViewer)))</code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 12px !important"><code style="font-weight: bold; color: #006699">End</code> <code style="font-weight: bold; color: #006699">Sub</code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 3px !important"> </span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 12px !important"><code style="font-weight: bold; color: #006699">Public</code> <code style="font-weight: bold; color: #006699">Property</code> <code style="color: #000000">ScrollBarThumbBrush </code><code style="font-weight: bold; color: #006699">As</code> <code style="color: #000000">Brush</code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 24px !important"><code style="font-weight: bold; color: #006699">Get</code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 36px !important"><code style="font-weight: bold; color: #006699">Return</code> <code style="color: #000000">GetValue(ScrollBarThumbBrushProperty)</code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 24px !important"><code style="font-weight: bold; color: #006699">End</code> <code style="font-weight: bold; color: #006699">Get</code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 3px !important"> </span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 24px !important"><code style="font-weight: bold; color: #006699">Set</code><code style="color: #000000">(</code><code style="font-weight: bold; color: #006699">ByVal</code> <code style="color: #000000">value </code><code style="font-weight: bold; color: #006699">As</code> <code style="color: #000000">Brush)</code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 36px !important"><code style="color: #000000">SetValue(ScrollBarThumbBrushProperty, value)</code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 24px !important"><code style="font-weight: bold; color: #006699">End</code> <code style="font-weight: bold; color: #006699">Set</code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 12px !important"><code style="font-weight: bold; color: #006699">End</code> <code style="font-weight: bold; color: #006699">Property</code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 3px !important"> </span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 12px !important"><code style="font-weight: bold; color: #006699">Public</code> <code style="font-weight: bold; color: #006699">Shared</code> <code style="font-weight: bold; color: #006699">ReadOnly</code> <code style="color: #000000">ScrollBarThumbBrushProperty </code><code style="font-weight: bold; color: #006699">As</code> <code style="color: #000000">DependencyProperty = DependencyProperty.Register(</code><code style="color: blue">"ScrollBarThumbBrush"</code><code style="color: #000000">, </code><code style="font-weight: bold; color: #006699">GetType</code><code style="color: #000000">(Brush), </code><code style="font-weight: bold; color: #006699">GetType</code><code style="color: #000000">(CustomScrollBar), </code><code style="font-weight: bold; color: #006699">New</code> <code style="color: #000000">PropertyMetadata(Brushes.Gray))</code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 3px !important"> </span></span></div> <div style="background-color: #f8f8f8"><span style="margin-left: 0px !important"><code style="font-weight: bold; color: #006699">End</code> <code style="font-weight: bold; color: #006699">Class</code></span></div></div><br><br>In the above class, I have created a ScrollBarThumbBrush property which we can use to set Brush for Thumb in ScrollBar. And following in the XAML style for CustomScrollViewer control<br><br> <div class="reCodeBlock" style="border-top: #7f9db9 1px solid; border-right: #7f9db9 1px solid; overflow-y: auto; border-bottom: #7f9db9 1px solid; border-left: #7f9db9 1px solid"> <div style="background-color: #ffffff"><span style="margin-left: 0px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Style</code> <code style="color: #808080">TargetType</code><code style="color: #000000">=</code><code style="color: blue">"my:CustomScrollViewer"</code><code style="color: #000000">></code></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 12px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Template"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 24px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter.Value</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 36px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">ControlTemplate</code> <code style="color: #808080">TargetType</code><code style="color: #000000">=</code><code style="color: blue">"my:CustomScrollViewer"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 48px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Grid</code> <code style="color: #808080">x:Name</code><code style="color: #000000">=</code><code style="color: blue">"Grid"</code> <code style="color: #808080">Background</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding Background}"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 60px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Grid.ColumnDefinitions</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">ColumnDefinition</code> <code style="color: #808080">Width</code><code style="color: #000000">=</code><code style="color: blue">"*"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">ColumnDefinition</code> <code style="color: #808080">Width</code><code style="color: #000000">=</code><code style="color: blue">"Auto"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 60px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Grid.ColumnDefinitions</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 60px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Grid.RowDefinitions</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">RowDefinition</code> <code style="color: #808080">Height</code><code style="color: #000000">=</code><code style="color: blue">"*"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">RowDefinition</code> <code style="color: #808080">Height</code><code style="color: #000000">=</code><code style="color: blue">"Auto"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 60px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Grid.RowDefinitions</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 60px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Rectangle</code> <code style="color: #808080">x:Name</code><code style="color: #000000">=</code><code style="color: blue">"Corner"</code> <code style="color: #808080">Grid.Column</code><code style="color: #000000">=</code><code style="color: blue">"1"</code> <code style="color: #808080">Fill</code><code style="color: #000000">=</code><code style="color: blue">"{DynamicResource {x:Static SystemColors.ControlBrushKey}}"</code> <code style="color: #808080">Grid.Row</code><code style="color: #000000">=</code><code style="color: blue">"1"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 60px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">ScrollContentPresenter</code> <code style="color: #808080">x:Name</code><code style="color: #000000">=</code><code style="color: blue">"PART_ScrollContentPresenter"</code> <code style="color: #808080">CanContentScroll</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding CanContentScroll}"</code> <code style="color: #808080">CanHorizontallyScroll</code><code style="color: #000000">=</code><code style="color: blue">"False"</code> <code style="color: #808080">CanVerticallyScroll</code><code style="color: #000000">=</code><code style="color: blue">"False"</code> <code style="color: #808080">ContentTemplate</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding ContentTemplate}"</code> <code style="color: #808080">Content</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding Content}"</code> <code style="color: #808080">Grid.Column</code><code style="color: #000000">=</code><code style="color: blue">"0"</code> <code style="color: #808080">Margin</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding Padding}"</code> <code style="color: #808080">Grid.Row</code><code style="color: #000000">=</code><code style="color: blue">"0"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 60px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">ScrollBar</code> <code style="color: #808080">x:Name</code><code style="color: #000000">=</code><code style="color: blue">"PART_VerticalScrollBar"</code> <code style="color: #808080">AutomationProperties.AutomationId</code><code style="color: #000000">=</code><code style="color: blue">"VerticalScrollBar"</code> <code style="color: #808080">Cursor</code><code style="color: #000000">=</code><code style="color: blue">"Arrow"</code> <code style="color: #808080">Grid.Column</code><code style="color: #000000">=</code><code style="color: blue">"1"</code> <code style="color: #808080">Maximum</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding ScrollableHeight}"</code> <code style="color: #808080">Minimum</code><code style="color: #000000">=</code><code style="color: blue">"0"</code> <code style="color: #808080">Grid.Row</code><code style="color: #000000">=</code><code style="color: blue">"0"</code> <code style="color: #808080">Visibility</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding ComputedVerticalScrollBarVisibility}"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}"</code> <code style="color: #808080">ViewportSize</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding ViewportHeight}"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 60px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">ScrollBar</code> <code style="color: #808080">x:Name</code><code style="color: #000000">=</code><code style="color: blue">"PART_HorizontalScrollBar"</code> <code style="color: #808080">AutomationProperties.AutomationId</code><code style="color: #000000">=</code><code style="color: blue">"HorizontalScrollBar"</code> <code style="color: #808080">Cursor</code><code style="color: #000000">=</code><code style="color: blue">"Arrow"</code> <code style="color: #808080">Grid.Column</code><code style="color: #000000">=</code><code style="color: blue">"0"</code> <code style="color: #808080">Maximum</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding ScrollableWidth}"</code> <code style="color: #808080">Minimum</code><code style="color: #000000">=</code><code style="color: blue">"0"</code> <code style="color: #808080">Orientation</code><code style="color: #000000">=</code><code style="color: blue">"Horizontal"</code> <code style="color: #808080">Grid.Row</code><code style="color: #000000">=</code><code style="color: blue">"1"</code> <code style="color: #808080">Visibility</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding ComputedHorizontalScrollBarVisibility}"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}"</code> <code style="color: #808080">ViewportSize</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding ViewportWidth}"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 48px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Grid</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 36px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">ControlTemplate</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 24px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Setter.Value</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 12px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Setter</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span style="margin-left: 0px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Style</code><code style="color: #000000">></code></span></div></div><br><span style="font-size: 12px; font-family: 'Segoe UI', 'Lucida Grande', verdana, arial, helvetica, sans-serif; line-height: 15px; background-color: #ffffff">Now to allow Thumb change color dynamically we need to change the Style of ScrollBar and read ScrollBarThumbBrush property. As you can see in above XAML Style CustomScrollViewer contains a ScrollBar control, so CustomScrollViewer is Ancestor of ScrollBar. So we are going to use following binding code to read ScrollBarThumbBrush property value in ScrollBar.<br></span><br> <div class="reCodeBlock" style="border-top: #7f9db9 1px solid; border-right: #7f9db9 1px solid; overflow-y: auto; border-bottom: #7f9db9 1px solid; border-left: #7f9db9 1px solid"> <div style="background-color: #ffffff"><span style="margin-left: 0px !important"><code style="color: #000000">Fill="{Binding Path=ScrollBarThumbBrush, RelativeSource={RelativeSource AncestorType=my:CustomScrollViewer}}"</code></span></div></div><br>Below is the complete Style of ScrollBar control<br><br> <div class="reCodeBlock" style="border-top: #7f9db9 1px solid; border-right: #7f9db9 1px solid; overflow-y: auto; border-bottom: #7f9db9 1px solid; border-left: #7f9db9 1px solid"> <div style="background-color: #ffffff"><span style="margin-left: 0px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Style</code> <code style="color: #808080">TargetType</code><code style="color: #000000">=</code><code style="color: blue">"ScrollBar"</code><code style="color: #000000">></code></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 12px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Stylus.IsPressAndHoldEnabled"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"False"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 12px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Stylus.IsFlicksEnabled"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"False"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 12px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Background"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"#FFF0F0F0"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 12px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"BorderBrush"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"#FFF0F0F0"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 12px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Foreground"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 12px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"BorderThickness"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"1,0"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 12px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Width"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 12px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"MinWidth"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 12px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Template"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 24px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter.Value</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 36px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">ControlTemplate</code> <code style="color: #808080">TargetType</code><code style="color: #000000">=</code><code style="color: blue">"ScrollBar"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 48px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Grid</code> <code style="color: #808080">x:Name</code><code style="color: #000000">=</code><code style="color: blue">"Bg"</code> <code style="color: #808080">SnapsToDevicePixels</code><code style="color: #000000">=</code><code style="color: blue">"True"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 60px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Grid.RowDefinitions</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">RowDefinition</code> <code style="color: #808080">MaxHeight</code><code style="color: #000000">=</code><code style="color: blue">"{DynamicResource {x:Static SystemParameters.VerticalScrollBarButtonHeightKey}}"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">RowDefinition</code> <code style="color: #808080">Height</code><code style="color: #000000">=</code><code style="color: blue">"1E-05*"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">RowDefinition</code> <code style="color: #808080">MaxHeight</code><code style="color: #000000">=</code><code style="color: blue">"{DynamicResource {x:Static SystemParameters.VerticalScrollBarButtonHeightKey}}"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 60px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Grid.RowDefinitions</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 60px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Border</code> <code style="color: #808080">BorderBrush</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding BorderBrush}"</code> <code style="color: #808080">BorderThickness</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding BorderThickness}"</code> <code style="color: #808080">Background</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding Background}"</code> <code style="color: #808080">Grid.Row</code><code style="color: #000000">=</code><code style="color: blue">"1"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 60px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">RepeatButton</code> <code style="color: #808080">x:Name</code><code style="color: #000000">=</code><code style="color: blue">"PART_LineUpButton"</code> <code style="color: #808080">Command</code><code style="color: #000000">=</code><code style="color: blue">"ScrollBar.LineUpCommand"</code> <code style="color: #808080">IsEnabled</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding IsMouseOver}"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">RepeatButton.Style</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 84px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Style</code> <code style="color: #808080">TargetType</code><code style="color: #000000">=</code><code style="color: blue">"{x:Type RepeatButton}"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"FocusVisualStyle"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 108px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter.Value</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 120px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Style</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 132px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Control.Template"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 144px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter.Value</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 156px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">ControlTemplate</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 168px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Rectangle</code> <code style="color: #808080">Margin</code><code style="color: #000000">=</code><code style="color: blue">"2"</code> <code style="color: #808080">SnapsToDevicePixels</code><code style="color: #000000">=</code><code style="color: blue">"True"</code> <code style="color: #808080">Stroke</code><code style="color: #000000">=</code><code style="color: blue">"{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"</code> <code style="color: #808080">StrokeThickness</code><code style="color: #000000">=</code><code style="color: blue">"1"</code> <code style="color: #808080">StrokeDashArray</code><code style="color: #000000">=</code><code style="color: blue">"1 2"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 156px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">ControlTemplate</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 144px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Setter.Value</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 132px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Setter</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 120px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Style</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 108px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Setter.Value</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Setter</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"BorderThickness"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"1"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"HorizontalContentAlignment"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"Center"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"VerticalContentAlignment"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"Center"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Padding"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"1"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Focusable"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"False"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"IsTabStop"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"False"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Template"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 108px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter.Value</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 120px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">ControlTemplate</code> <code style="color: #808080">TargetType</code><code style="color: #000000">=</code><code style="color: blue">"{x:Type RepeatButton}"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 132px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Border</code> <code style="color: #808080">x:Name</code><code style="color: #000000">=</code><code style="color: blue">"border"</code> <code style="color: #808080">BorderBrush</code><code style="color: #000000">=</code><code style="color: blue">"#FFF0F0F0"</code> <code style="color: #808080">BorderThickness</code><code style="color: #000000">=</code><code style="color: blue">"1"</code> <code style="color: #808080">Background</code><code style="color: #000000">=</code><code style="color: blue">"#FFF0F0F0"</code> <code style="color: #808080">SnapsToDevicePixels</code><code style="color: #000000">=</code><code style="color: blue">"True"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 144px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">ContentPresenter</code> <code style="color: #808080">x:Name</code><code style="color: #000000">=</code><code style="color: blue">"contentPresenter"</code> <code style="color: #808080">ContentTemplate</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding ContentTemplate}"</code> <code style="color: #808080">Content</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding Content}"</code> <code style="color: #808080">ContentStringFormat</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding ContentStringFormat}"</code> <code style="color: #808080">Focusable</code><code style="color: #000000">=</code><code style="color: blue">"False"</code> <code style="color: #808080">HorizontalAlignment</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding HorizontalContentAlignment}"</code> <code style="color: #808080">Margin</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding Padding}"</code> <code style="color: #808080">SnapsToDevicePixels</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding SnapsToDevicePixels}"</code> <code style="color: #808080">VerticalAlignment</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding VerticalContentAlignment}"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 132px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Border</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 132px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">ControlTemplate.Triggers</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 144px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Trigger</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"IsMouseOver"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"True"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 156px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Background"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"border"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"#FFDADADA"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 156px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"BorderBrush"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"border"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"#FFDADADA"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 144px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Trigger</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 144px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Trigger</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"IsPressed"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"True"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 156px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Background"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"border"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"#FF606060"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 156px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"BorderBrush"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"border"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"#FF606060"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 144px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Trigger</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 144px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Trigger</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"IsEnabled"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"False"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 156px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Opacity"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"contentPresenter"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"0.56"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 156px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Background"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"border"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"#FFF0F0F0"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 156px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"BorderBrush"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"border"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"#FFF0F0F0"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 144px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Trigger</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 132px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">ControlTemplate.Triggers</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 120px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">ControlTemplate</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 108px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Setter.Value</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Setter</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 84px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Style</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">RepeatButton.Style</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Path</code> <code style="color: #808080">x:Name</code><code style="color: #000000">=</code><code style="color: blue">"ArrowTop"</code> <code style="color: #808080">Data</code><code style="color: #000000">=</code><code style="color: blue">"M0,4C0,4 0,6 0,6 0,6 3.5,2.5 3.5,2.5 3.5,2.5 7,6 7,6 7,6 7,4 7,4 7,4 3.5,0.5 3.5,0.5 3.5,0.5 0,4 0,4z"</code> <code style="color: #808080">Fill</code><code style="color: #000000">=</code><code style="color: blue">"#FF606060"</code> <code style="color: #808080">Margin</code><code style="color: #000000">=</code><code style="color: blue">"3,4,3,3"</code> <code style="color: #808080">Stretch</code><code style="color: #000000">=</code><code style="color: blue">"Uniform"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 60px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">RepeatButton</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 60px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Track</code> <code style="color: #808080">x:Name</code><code style="color: #000000">=</code><code style="color: blue">"PART_Track"</code> <code style="color: #808080">IsDirectionReversed</code><code style="color: #000000">=</code><code style="color: blue">"True"</code> <code style="color: #808080">IsEnabled</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding IsMouseOver}"</code> <code style="color: #808080">Grid.Row</code><code style="color: #000000">=</code><code style="color: blue">"1"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Track.DecreaseRepeatButton</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 84px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">RepeatButton</code> <code style="color: #808080">Command</code><code style="color: #000000">=</code><code style="color: blue">"ScrollBar.PageUpCommand"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">RepeatButton.Style</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 108px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Style</code> <code style="color: #808080">TargetType</code><code style="color: #000000">=</code><code style="color: blue">"{x:Type RepeatButton}"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 120px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"OverridesDefaultStyle"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"True"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 120px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Background"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"Transparent"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 120px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Focusable"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"False"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 120px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"IsTabStop"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"False"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 120px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Template"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 132px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter.Value</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 144px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">ControlTemplate</code> <code style="color: #808080">TargetType</code><code style="color: #000000">=</code><code style="color: blue">"{x:Type RepeatButton}"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 156px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Rectangle</code> <code style="color: #808080">Fill</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding Background}"</code> <code style="color: #808080">Height</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding Height}"</code> <code style="color: #808080">Width</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding Width}"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 144px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">ControlTemplate</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 132px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Setter.Value</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 120px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Setter</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 108px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Style</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">RepeatButton.Style</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 84px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">RepeatButton</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Track.DecreaseRepeatButton</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Track.IncreaseRepeatButton</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 84px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">RepeatButton</code> <code style="color: #808080">Command</code><code style="color: #000000">=</code><code style="color: blue">"ScrollBar.PageDownCommand"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">RepeatButton.Style</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 108px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Style</code> <code style="color: #808080">TargetType</code><code style="color: #000000">=</code><code style="color: blue">"{x:Type RepeatButton}"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 120px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"OverridesDefaultStyle"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"True"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 120px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Background"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"Transparent"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 120px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Focusable"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"False"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 120px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"IsTabStop"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"False"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 120px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Template"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 132px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter.Value</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 144px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">ControlTemplate</code> <code style="color: #808080">TargetType</code><code style="color: #000000">=</code><code style="color: blue">"{x:Type RepeatButton}"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 156px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Rectangle</code> <code style="color: #808080">Fill</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding Background}"</code> <code style="color: #808080">Height</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding Height}"</code> <code style="color: #808080">Width</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding Width}"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 144px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">ControlTemplate</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 132px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Setter.Value</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 120px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Setter</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 108px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Style</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">RepeatButton.Style</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 84px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">RepeatButton</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Track.IncreaseRepeatButton</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Track.Thumb</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 84px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Thumb</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Thumb.Style</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 108px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Style</code> <code style="color: #808080">TargetType</code><code style="color: #000000">=</code><code style="color: blue">"{x:Type Thumb}"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 120px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"OverridesDefaultStyle"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"True"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 120px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"IsTabStop"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"False"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 120px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Template"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 132px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter.Value</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 144px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">ControlTemplate</code> <code style="color: #808080">TargetType</code><code style="color: #000000">=</code><code style="color: blue">"{x:Type Thumb}"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 156px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Rectangle</code> <code style="color: #808080">x:Name</code><code style="color: #000000">=</code><code style="color: blue">"rectangle"</code> <code style="color: #808080">Fill</code><code style="color: #000000">=</code><code style="color: blue">"{Binding Path=ScrollBarThumbBrush, RelativeSource={RelativeSource AncestorType=my:CustomScrollViewer}}"</code> <code style="color: #808080">Height</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding Height}"</code> <code style="color: #808080">SnapsToDevicePixels</code><code style="color: #000000">=</code><code style="color: blue">"True"</code> <code style="color: #808080">Width</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding Width}"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 156px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">ControlTemplate.Triggers</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 168px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Trigger</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"IsMouseOver"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"True"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 180px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Fill"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"rectangle"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"#FFA6A6A6"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 168px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Trigger</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 168px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Trigger</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"IsDragging"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"True"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 180px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Fill"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"rectangle"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"#FF606060"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 168px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Trigger</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 156px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">ControlTemplate.Triggers</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 144px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">ControlTemplate</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 132px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Setter.Value</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 120px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Setter</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 108px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Style</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Thumb.Style</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 84px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Thumb</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Track.Thumb</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 60px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Track</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 60px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">RepeatButton</code> <code style="color: #808080">x:Name</code><code style="color: #000000">=</code><code style="color: blue">"PART_LineDownButton"</code> <code style="color: #808080">Command</code><code style="color: #000000">=</code><code style="color: blue">"ScrollBar.LineDownCommand"</code> <code style="color: #808080">IsEnabled</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding IsMouseOver}"</code> <code style="color: #808080">Grid.Row</code><code style="color: #000000">=</code><code style="color: blue">"2"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">RepeatButton.Style</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 84px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Style</code> <code style="color: #808080">TargetType</code><code style="color: #000000">=</code><code style="color: blue">"{x:Type RepeatButton}"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"FocusVisualStyle"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 108px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter.Value</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 120px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Style</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 132px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Control.Template"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 144px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter.Value</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 156px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">ControlTemplate</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 168px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Rectangle</code> <code style="color: #808080">Margin</code><code style="color: #000000">=</code><code style="color: blue">"2"</code> <code style="color: #808080">SnapsToDevicePixels</code><code style="color: #000000">=</code><code style="color: blue">"True"</code> <code style="color: #808080">Stroke</code><code style="color: #000000">=</code><code style="color: blue">"{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"</code> <code style="color: #808080">StrokeThickness</code><code style="color: #000000">=</code><code style="color: blue">"1"</code> <code style="color: #808080">StrokeDashArray</code><code style="color: #000000">=</code><code style="color: blue">"1 2"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 156px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">ControlTemplate</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 144px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Setter.Value</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 132px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Setter</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 120px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Style</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 108px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Setter.Value</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Setter</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"BorderThickness"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"1"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"HorizontalContentAlignment"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"Center"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"VerticalContentAlignment"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"Center"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Padding"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"1"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Focusable"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"False"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"IsTabStop"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"False"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Template"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 108px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter.Value</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 120px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">ControlTemplate</code> <code style="color: #808080">TargetType</code><code style="color: #000000">=</code><code style="color: blue">"{x:Type RepeatButton}"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 132px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Border</code> <code style="color: #808080">x:Name</code><code style="color: #000000">=</code><code style="color: blue">"border"</code> <code style="color: #808080">BorderBrush</code><code style="color: #000000">=</code><code style="color: blue">"#FFF0F0F0"</code> <code style="color: #808080">BorderThickness</code><code style="color: #000000">=</code><code style="color: blue">"1"</code> <code style="color: #808080">Background</code><code style="color: #000000">=</code><code style="color: blue">"#FFF0F0F0"</code> <code style="color: #808080">SnapsToDevicePixels</code><code style="color: #000000">=</code><code style="color: blue">"True"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 144px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">ContentPresenter</code> <code style="color: #808080">x:Name</code><code style="color: #000000">=</code><code style="color: blue">"contentPresenter"</code> <code style="color: #808080">ContentTemplate</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding ContentTemplate}"</code> <code style="color: #808080">Content</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding Content}"</code> <code style="color: #808080">ContentStringFormat</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding ContentStringFormat}"</code> <code style="color: #808080">Focusable</code><code style="color: #000000">=</code><code style="color: blue">"False"</code> <code style="color: #808080">HorizontalAlignment</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding HorizontalContentAlignment}"</code> <code style="color: #808080">Margin</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding Padding}"</code> <code style="color: #808080">SnapsToDevicePixels</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding SnapsToDevicePixels}"</code> <code style="color: #808080">VerticalAlignment</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding VerticalContentAlignment}"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 132px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Border</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 132px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">ControlTemplate.Triggers</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 144px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Trigger</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"IsMouseOver"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"True"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 156px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Background"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"border"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"#FFDADADA"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 156px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"BorderBrush"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"border"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"#FFDADADA"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 144px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Trigger</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 144px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Trigger</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"IsPressed"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"True"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 156px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Background"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"border"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"#FF606060"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 156px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"BorderBrush"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"border"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"#FF606060"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 144px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Trigger</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 144px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Trigger</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"IsEnabled"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"False"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 156px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Opacity"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"contentPresenter"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"0.56"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 156px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Background"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"border"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"#FFF0F0F0"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 156px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"BorderBrush"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"border"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"#FFF0F0F0"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 144px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Trigger</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 132px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">ControlTemplate.Triggers</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 120px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">ControlTemplate</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 108px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Setter.Value</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Setter</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 84px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Style</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">RepeatButton.Style</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Path</code> <code style="color: #808080">x:Name</code><code style="color: #000000">=</code><code style="color: blue">"ArrowBottom"</code> <code style="color: #808080">Data</code><code style="color: #000000">=</code><code style="color: blue">"M0,2.5C0,2.5 0,0.5 0,0.5 0,0.5 3.5,4 3.5,4 3.5,4 7,0.5 7,0.5 7,0.5 7,2.5 7,2.5 7,2.5 3.5,6 3.5,6 3.5,6 0,2.5 0,2.5z"</code> <code style="color: #808080">Fill</code><code style="color: #000000">=</code><code style="color: blue">"#FF606060"</code> <code style="color: #808080">Margin</code><code style="color: #000000">=</code><code style="color: blue">"3,4,3,3"</code> <code style="color: #808080">Stretch</code><code style="color: #000000">=</code><code style="color: blue">"Uniform"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 60px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">RepeatButton</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 48px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Grid</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 48px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">ControlTemplate.Triggers</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 60px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">MultiDataTrigger</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">MultiDataTrigger.Conditions</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 84px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Condition</code> <code style="color: #808080">Binding</code><code style="color: #000000">=</code><code style="color: blue">"{Binding IsMouseOver, ElementName=PART_LineDownButton}"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"true"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 84px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Condition</code> <code style="color: #808080">Binding</code><code style="color: #000000">=</code><code style="color: blue">"{Binding IsPressed, ElementName=PART_LineDownButton}"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"true"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">MultiDataTrigger.Conditions</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Fill"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"ArrowBottom"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"White"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 60px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">MultiDataTrigger</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 60px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">MultiDataTrigger</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">MultiDataTrigger.Conditions</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 84px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Condition</code> <code style="color: #808080">Binding</code><code style="color: #000000">=</code><code style="color: blue">"{Binding IsMouseOver, ElementName=PART_LineUpButton}"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"true"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 84px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Condition</code> <code style="color: #808080">Binding</code><code style="color: #000000">=</code><code style="color: blue">"{Binding IsPressed, ElementName=PART_LineUpButton}"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"true"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">MultiDataTrigger.Conditions</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Fill"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"ArrowTop"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"White"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 60px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">MultiDataTrigger</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 60px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">MultiDataTrigger</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">MultiDataTrigger.Conditions</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 84px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Condition</code> <code style="color: #808080">Binding</code><code style="color: #000000">=</code><code style="color: blue">"{Binding IsMouseOver, ElementName=PART_LineDownButton}"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"true"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 84px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Condition</code> <code style="color: #808080">Binding</code><code style="color: #000000">=</code><code style="color: blue">"{Binding IsPressed, ElementName=PART_LineDownButton}"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"false"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">MultiDataTrigger.Conditions</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Fill"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"ArrowBottom"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"Black"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 60px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">MultiDataTrigger</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 60px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">MultiDataTrigger</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">MultiDataTrigger.Conditions</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 84px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Condition</code> <code style="color: #808080">Binding</code><code style="color: #000000">=</code><code style="color: blue">"{Binding IsMouseOver, ElementName=PART_LineUpButton}"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"true"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 84px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Condition</code> <code style="color: #808080">Binding</code><code style="color: #000000">=</code><code style="color: blue">"{Binding IsPressed, ElementName=PART_LineUpButton}"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"false"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">MultiDataTrigger.Conditions</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Fill"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"ArrowTop"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"Black"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 60px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">MultiDataTrigger</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 60px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Trigger</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"IsEnabled"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"False"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Fill"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"ArrowTop"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"#FFBFBFBF"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Fill"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"ArrowBottom"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"#FFBFBFBF"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 60px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Trigger</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 48px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">ControlTemplate.Triggers</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 36px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">ControlTemplate</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 24px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Setter.Value</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 12px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Setter</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 12px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Style.Triggers</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 24px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Trigger</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Orientation"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"Horizontal"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 36px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Width"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"Auto"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 36px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"MinWidth"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"0"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 36px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Height"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"{DynamicResource {x:Static SystemParameters.HorizontalScrollBarHeightKey}}"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 36px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"MinHeight"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"{DynamicResource {x:Static SystemParameters.HorizontalScrollBarHeightKey}}"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 36px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"BorderThickness"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"0,1"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 36px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Template"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 48px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter.Value</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 60px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">ControlTemplate</code> <code style="color: #808080">TargetType</code><code style="color: #000000">=</code><code style="color: blue">"{x:Type ScrollBar}"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Grid</code> <code style="color: #808080">x:Name</code><code style="color: #000000">=</code><code style="color: blue">"Bg"</code> <code style="color: #808080">SnapsToDevicePixels</code><code style="color: #000000">=</code><code style="color: blue">"True"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 84px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Grid.ColumnDefinitions</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">ColumnDefinition</code> <code style="color: #808080">MaxWidth</code><code style="color: #000000">=</code><code style="color: blue">"{DynamicResource {x:Static SystemParameters.HorizontalScrollBarButtonWidthKey}}"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">ColumnDefinition</code> <code style="color: #808080">Width</code><code style="color: #000000">=</code><code style="color: blue">"1E-05*"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">ColumnDefinition</code> <code style="color: #808080">MaxWidth</code><code style="color: #000000">=</code><code style="color: blue">"{DynamicResource {x:Static SystemParameters.HorizontalScrollBarButtonWidthKey}}"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 84px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Grid.ColumnDefinitions</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 84px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Border</code> <code style="color: #808080">BorderBrush</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding BorderBrush}"</code> <code style="color: #808080">BorderThickness</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding BorderThickness}"</code> <code style="color: #808080">Background</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding Background}"</code> <code style="color: #808080">Grid.Column</code><code style="color: #000000">=</code><code style="color: blue">"1"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 84px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">RepeatButton</code> <code style="color: #808080">x:Name</code><code style="color: #000000">=</code><code style="color: blue">"PART_LineLeftButton"</code> <code style="color: #808080">Command</code><code style="color: #000000">=</code><code style="color: blue">"ScrollBar.LineLeftCommand"</code> <code style="color: #808080">IsEnabled</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding IsMouseOver}"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">RepeatButton.Style</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 108px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Style</code> <code style="color: #808080">TargetType</code><code style="color: #000000">=</code><code style="color: blue">"{x:Type RepeatButton}"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 120px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"FocusVisualStyle"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 132px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter.Value</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 144px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Style</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 156px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Control.Template"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 168px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter.Value</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 180px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">ControlTemplate</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 192px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Rectangle</code> <code style="color: #808080">Margin</code><code style="color: #000000">=</code><code style="color: blue">"2"</code> <code style="color: #808080">SnapsToDevicePixels</code><code style="color: #000000">=</code><code style="color: blue">"True"</code> <code style="color: #808080">Stroke</code><code style="color: #000000">=</code><code style="color: blue">"{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"</code> <code style="color: #808080">StrokeThickness</code><code style="color: #000000">=</code><code style="color: blue">"1"</code> <code style="color: #808080">StrokeDashArray</code><code style="color: #000000">=</code><code style="color: blue">"1 2"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 180px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">ControlTemplate</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 168px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Setter.Value</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 156px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Setter</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 144px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Style</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 132px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Setter.Value</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 120px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Setter</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 120px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"BorderThickness"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"1"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 120px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"HorizontalContentAlignment"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"Center"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 120px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"VerticalContentAlignment"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"Center"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 120px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Padding"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"1"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 120px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Focusable"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"False"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 120px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"IsTabStop"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"False"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 120px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Template"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 132px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter.Value</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 144px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">ControlTemplate</code> <code style="color: #808080">TargetType</code><code style="color: #000000">=</code><code style="color: blue">"{x:Type RepeatButton}"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 156px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Border</code> <code style="color: #808080">x:Name</code><code style="color: #000000">=</code><code style="color: blue">"border"</code> <code style="color: #808080">BorderBrush</code><code style="color: #000000">=</code><code style="color: blue">"#FFF0F0F0"</code> <code style="color: #808080">BorderThickness</code><code style="color: #000000">=</code><code style="color: blue">"1"</code> <code style="color: #808080">Background</code><code style="color: #000000">=</code><code style="color: blue">"#FFF0F0F0"</code> <code style="color: #808080">SnapsToDevicePixels</code><code style="color: #000000">=</code><code style="color: blue">"True"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 168px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">ContentPresenter</code> <code style="color: #808080">x:Name</code><code style="color: #000000">=</code><code style="color: blue">"contentPresenter"</code> <code style="color: #808080">ContentTemplate</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding ContentTemplate}"</code> <code style="color: #808080">Content</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding Content}"</code> <code style="color: #808080">ContentStringFormat</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding ContentStringFormat}"</code> <code style="color: #808080">Focusable</code><code style="color: #000000">=</code><code style="color: blue">"False"</code> <code style="color: #808080">HorizontalAlignment</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding HorizontalContentAlignment}"</code> <code style="color: #808080">Margin</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding Padding}"</code> <code style="color: #808080">SnapsToDevicePixels</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding SnapsToDevicePixels}"</code> <code style="color: #808080">VerticalAlignment</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding VerticalContentAlignment}"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 156px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Border</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 156px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">ControlTemplate.Triggers</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 168px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Trigger</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"IsMouseOver"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"True"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 180px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Background"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"border"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"#FFDADADA"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 180px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"BorderBrush"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"border"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"#FFDADADA"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 168px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Trigger</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 168px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Trigger</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"IsPressed"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"True"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 180px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Background"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"border"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"#FF606060"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 180px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"BorderBrush"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"border"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"#FF606060"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 168px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Trigger</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 168px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Trigger</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"IsEnabled"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"False"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 180px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Opacity"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"contentPresenter"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"0.56"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 180px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Background"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"border"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"#FFF0F0F0"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 180px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"BorderBrush"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"border"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"#FFF0F0F0"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 168px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Trigger</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 156px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">ControlTemplate.Triggers</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 144px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">ControlTemplate</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 132px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Setter.Value</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 120px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Setter</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 108px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Style</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">RepeatButton.Style</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Path</code> <code style="color: #808080">x:Name</code><code style="color: #000000">=</code><code style="color: blue">"ArrowLeft"</code> <code style="color: #808080">Data</code><code style="color: #000000">=</code><code style="color: blue">"M3.18,7C3.18,7 5,7 5,7 5,7 1.81,3.5 1.81,3.5 1.81,3.5 5,0 5,0 5,0 3.18,0 3.18,0 3.18,0 0,3.5 0,3.5 0,3.5 3.18,7 3.18,7z"</code> <code style="color: #808080">Fill</code><code style="color: #000000">=</code><code style="color: blue">"#FF606060"</code> <code style="color: #808080">Margin</code><code style="color: #000000">=</code><code style="color: blue">"3"</code> <code style="color: #808080">Stretch</code><code style="color: #000000">=</code><code style="color: blue">"Uniform"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 84px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">RepeatButton</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 84px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Track</code> <code style="color: #808080">x:Name</code><code style="color: #000000">=</code><code style="color: blue">"PART_Track"</code> <code style="color: #808080">Grid.Column</code><code style="color: #000000">=</code><code style="color: blue">"1"</code> <code style="color: #808080">IsEnabled</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding IsMouseOver}"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Track.DecreaseRepeatButton</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 108px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">RepeatButton</code> <code style="color: #808080">Command</code><code style="color: #000000">=</code><code style="color: blue">"ScrollBar.PageLeftCommand"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 120px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">RepeatButton.Style</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 132px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Style</code> <code style="color: #808080">TargetType</code><code style="color: #000000">=</code><code style="color: blue">"{x:Type RepeatButton}"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 144px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"OverridesDefaultStyle"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"True"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 144px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Background"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"Transparent"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 144px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Focusable"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"False"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 144px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"IsTabStop"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"False"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 144px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Template"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 156px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter.Value</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 168px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">ControlTemplate</code> <code style="color: #808080">TargetType</code><code style="color: #000000">=</code><code style="color: blue">"{x:Type RepeatButton}"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 180px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Rectangle</code> <code style="color: #808080">Fill</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding Background}"</code> <code style="color: #808080">Height</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding Height}"</code> <code style="color: #808080">Width</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding Width}"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 168px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">ControlTemplate</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 156px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Setter.Value</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 144px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Setter</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 132px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Style</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 120px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">RepeatButton.Style</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 108px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">RepeatButton</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Track.DecreaseRepeatButton</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Track.IncreaseRepeatButton</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 108px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">RepeatButton</code> <code style="color: #808080">Command</code><code style="color: #000000">=</code><code style="color: blue">"ScrollBar.PageRightCommand"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 120px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">RepeatButton.Style</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 132px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Style</code> <code style="color: #808080">TargetType</code><code style="color: #000000">=</code><code style="color: blue">"{x:Type RepeatButton}"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 144px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"OverridesDefaultStyle"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"True"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 144px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Background"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"Transparent"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 144px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Focusable"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"False"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 144px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"IsTabStop"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"False"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 144px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Template"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 156px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter.Value</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 168px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">ControlTemplate</code> <code style="color: #808080">TargetType</code><code style="color: #000000">=</code><code style="color: blue">"{x:Type RepeatButton}"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 180px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Rectangle</code> <code style="color: #808080">Fill</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding Background}"</code> <code style="color: #808080">Height</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding Height}"</code> <code style="color: #808080">Width</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding Width}"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 168px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">ControlTemplate</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 156px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Setter.Value</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 144px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Setter</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 132px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Style</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 120px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">RepeatButton.Style</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 108px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">RepeatButton</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Track.IncreaseRepeatButton</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Track.Thumb</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 108px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Thumb</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 120px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Thumb.Style</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 132px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Style</code> <code style="color: #808080">TargetType</code><code style="color: #000000">=</code><code style="color: blue">"{x:Type Thumb}"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 144px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"OverridesDefaultStyle"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"True"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 144px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"IsTabStop"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"False"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 144px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Template"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 156px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter.Value</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 168px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">ControlTemplate</code> <code style="color: #808080">TargetType</code><code style="color: #000000">=</code><code style="color: blue">"{x:Type Thumb}"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 180px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Rectangle</code> <code style="color: #808080">x:Name</code><code style="color: #000000">=</code><code style="color: blue">"rectangle"</code> <code style="color: #808080">Fill</code><code style="color: #000000">=</code><code style="color: blue">"{Binding Path=ScrollBarThumbBrush, RelativeSource={RelativeSource AncestorType=my:CustomScrollViewer}}"</code> <code style="color: #808080">Height</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding Height}"</code> <code style="color: #808080">SnapsToDevicePixels</code><code style="color: #000000">=</code><code style="color: blue">"True"</code> <code style="color: #808080">Width</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding Width}"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 180px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">ControlTemplate.Triggers</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 192px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Trigger</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"IsMouseOver"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"True"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 204px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Fill"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"rectangle"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"#FFA6A6A6"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 192px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Trigger</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 192px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Trigger</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"IsDragging"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"True"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 204px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Fill"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"rectangle"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"#FF606060"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 192px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Trigger</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 180px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">ControlTemplate.Triggers</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 168px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">ControlTemplate</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 156px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Setter.Value</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 144px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Setter</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 132px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Style</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 120px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Thumb.Style</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 108px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Thumb</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Track.Thumb</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 84px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Track</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 84px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">RepeatButton</code> <code style="color: #808080">x:Name</code><code style="color: #000000">=</code><code style="color: blue">"PART_LineRightButton"</code> <code style="color: #808080">Grid.Column</code><code style="color: #000000">=</code><code style="color: blue">"2"</code> <code style="color: #808080">Command</code><code style="color: #000000">=</code><code style="color: blue">"ScrollBar.LineRightCommand"</code> <code style="color: #808080">IsEnabled</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding IsMouseOver}"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">RepeatButton.Style</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 108px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Style</code> <code style="color: #808080">TargetType</code><code style="color: #000000">=</code><code style="color: blue">"{x:Type RepeatButton}"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 120px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"FocusVisualStyle"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 132px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter.Value</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 144px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Style</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 156px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Control.Template"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 168px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter.Value</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 180px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">ControlTemplate</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 192px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Rectangle</code> <code style="color: #808080">Margin</code><code style="color: #000000">=</code><code style="color: blue">"2"</code> <code style="color: #808080">SnapsToDevicePixels</code><code style="color: #000000">=</code><code style="color: blue">"True"</code> <code style="color: #808080">Stroke</code><code style="color: #000000">=</code><code style="color: blue">"{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"</code> <code style="color: #808080">StrokeThickness</code><code style="color: #000000">=</code><code style="color: blue">"1"</code> <code style="color: #808080">StrokeDashArray</code><code style="color: #000000">=</code><code style="color: blue">"1 2"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 180px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">ControlTemplate</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 168px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Setter.Value</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 156px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Setter</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 144px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Style</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 132px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Setter.Value</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 120px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Setter</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 120px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"BorderThickness"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"1"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 120px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"HorizontalContentAlignment"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"Center"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 120px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"VerticalContentAlignment"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"Center"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 120px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Padding"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"1"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 120px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Focusable"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"False"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 120px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"IsTabStop"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"False"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 120px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Template"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 132px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter.Value</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 144px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">ControlTemplate</code> <code style="color: #808080">TargetType</code><code style="color: #000000">=</code><code style="color: blue">"{x:Type RepeatButton}"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 156px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Border</code> <code style="color: #808080">x:Name</code><code style="color: #000000">=</code><code style="color: blue">"border"</code> <code style="color: #808080">BorderBrush</code><code style="color: #000000">=</code><code style="color: blue">"#FFF0F0F0"</code> <code style="color: #808080">BorderThickness</code><code style="color: #000000">=</code><code style="color: blue">"1"</code> <code style="color: #808080">Background</code><code style="color: #000000">=</code><code style="color: blue">"#FFF0F0F0"</code> <code style="color: #808080">SnapsToDevicePixels</code><code style="color: #000000">=</code><code style="color: blue">"True"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 168px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">ContentPresenter</code> <code style="color: #808080">x:Name</code><code style="color: #000000">=</code><code style="color: blue">"contentPresenter"</code> <code style="color: #808080">ContentTemplate</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding ContentTemplate}"</code> <code style="color: #808080">Content</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding Content}"</code> <code style="color: #808080">ContentStringFormat</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding ContentStringFormat}"</code> <code style="color: #808080">Focusable</code><code style="color: #000000">=</code><code style="color: blue">"False"</code> <code style="color: #808080">HorizontalAlignment</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding HorizontalContentAlignment}"</code> <code style="color: #808080">Margin</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding Padding}"</code> <code style="color: #808080">SnapsToDevicePixels</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding SnapsToDevicePixels}"</code> <code style="color: #808080">VerticalAlignment</code><code style="color: #000000">=</code><code style="color: blue">"{TemplateBinding VerticalContentAlignment}"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 156px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Border</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 156px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">ControlTemplate.Triggers</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 168px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Trigger</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"IsMouseOver"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"True"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 180px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Background"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"border"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"#FFDADADA"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 180px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"BorderBrush"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"border"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"#FFDADADA"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 168px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Trigger</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 168px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Trigger</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"IsPressed"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"True"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 180px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Background"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"border"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"#FF606060"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 180px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"BorderBrush"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"border"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"#FF606060"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 168px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Trigger</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 168px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Trigger</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"IsEnabled"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"False"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 180px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Opacity"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"contentPresenter"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"0.56"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 180px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Background"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"border"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"#FFF0F0F0"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 180px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"BorderBrush"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"border"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"#FFF0F0F0"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 168px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Trigger</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 156px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">ControlTemplate.Triggers</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 144px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">ControlTemplate</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 132px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Setter.Value</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 120px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Setter</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 108px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Style</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">RepeatButton.Style</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Path</code> <code style="color: #808080">x:Name</code><code style="color: #000000">=</code><code style="color: blue">"ArrowRight"</code> <code style="color: #808080">Data</code><code style="color: #000000">=</code><code style="color: blue">"M1.81,7C1.81,7 0,7 0,7 0,7 3.18,3.5 3.18,3.5 3.18,3.5 0,0 0,0 0,0 1.81,0 1.81,0 1.81,0 5,3.5 5,3.5 5,3.5 1.81,7 1.81,7z"</code> <code style="color: #808080">Fill</code><code style="color: #000000">=</code><code style="color: blue">"#FF606060"</code> <code style="color: #808080">Margin</code><code style="color: #000000">=</code><code style="color: blue">"3"</code> <code style="color: #808080">Stretch</code><code style="color: #000000">=</code><code style="color: blue">"Uniform"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 84px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">RepeatButton</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Grid</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">ControlTemplate.Triggers</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 84px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">MultiDataTrigger</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">MultiDataTrigger.Conditions</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 108px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Condition</code> <code style="color: #808080">Binding</code><code style="color: #000000">=</code><code style="color: blue">"{Binding IsMouseOver, ElementName=PART_LineRightButton}"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"true"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 108px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Condition</code> <code style="color: #808080">Binding</code><code style="color: #000000">=</code><code style="color: blue">"{Binding IsPressed, ElementName=PART_LineRightButton}"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"true"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">MultiDataTrigger.Conditions</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Fill"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"ArrowRight"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"White"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 84px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">MultiDataTrigger</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 84px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">MultiDataTrigger</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">MultiDataTrigger.Conditions</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 108px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Condition</code> <code style="color: #808080">Binding</code><code style="color: #000000">=</code><code style="color: blue">"{Binding IsMouseOver, ElementName=PART_LineLeftButton}"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"true"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 108px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Condition</code> <code style="color: #808080">Binding</code><code style="color: #000000">=</code><code style="color: blue">"{Binding IsPressed, ElementName=PART_LineLeftButton}"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"true"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">MultiDataTrigger.Conditions</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Fill"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"ArrowLeft"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"White"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 84px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">MultiDataTrigger</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 84px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">MultiDataTrigger</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">MultiDataTrigger.Conditions</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 108px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Condition</code> <code style="color: #808080">Binding</code><code style="color: #000000">=</code><code style="color: blue">"{Binding IsMouseOver, ElementName=PART_LineRightButton}"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"true"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 108px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Condition</code> <code style="color: #808080">Binding</code><code style="color: #000000">=</code><code style="color: blue">"{Binding IsPressed, ElementName=PART_LineRightButton}"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"false"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">MultiDataTrigger.Conditions</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Fill"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"ArrowRight"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"Black"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 84px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">MultiDataTrigger</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 84px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">MultiDataTrigger</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">MultiDataTrigger.Conditions</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 108px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Condition</code> <code style="color: #808080">Binding</code><code style="color: #000000">=</code><code style="color: blue">"{Binding IsMouseOver, ElementName=PART_LineLeftButton}"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"true"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 108px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Condition</code> <code style="color: #808080">Binding</code><code style="color: #000000">=</code><code style="color: blue">"{Binding IsPressed, ElementName=PART_LineLeftButton}"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"false"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">MultiDataTrigger.Conditions</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Fill"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"ArrowLeft"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"Black"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 84px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">MultiDataTrigger</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 84px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Trigger</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"IsEnabled"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"False"</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Fill"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"ArrowLeft"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"#FFBFBFBF"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 96px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Setter</code> <code style="color: #808080">Property</code><code style="color: #000000">=</code><code style="color: blue">"Fill"</code> <code style="color: #808080">TargetName</code><code style="color: #000000">=</code><code style="color: blue">"ArrowRight"</code> <code style="color: #808080">Value</code><code style="color: #000000">=</code><code style="color: blue">"#FFBFBFBF"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 84px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Trigger</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 72px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">ControlTemplate.Triggers</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 60px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">ControlTemplate</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 48px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Setter.Value</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 36px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Setter</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span><code> </code><span style="margin-left: 24px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Trigger</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 12px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">Style.Triggers</code><code style="color: #000000">></code></span></span></div> <div style="background-color: #ffffff"><span style="margin-left: 0px !important"><code style="color: #000000"></Style></code></span></div></div><br>Now we can use the CustomScrollViewer control and set ScrollBarThumbBrush property as shown in following code in the project where we need Thumb color as per our requirement.<br><br> <div class="reCodeBlock" style="border-top: #7f9db9 1px solid; border-right: #7f9db9 1px solid; overflow-y: auto; border-bottom: #7f9db9 1px solid; border-left: #7f9db9 1px solid"> <div style="background-color: #ffffff"><span style="margin-left: 0px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">my:CustomScrollViewer</code> <code style="color: #808080">ScrollBarThumbBrush</code><code style="color: #000000">=</code><code style="color: blue">"Blue"</code> <code style="color: #808080">HorizontalScrollBarVisibility</code><code style="color: #000000">=</code><code style="color: blue">"Visible"</code> <code style="color: #808080">VerticalScrollBarVisibility</code><code style="color: #000000">=</code><code style="color: blue">"Visible"</code><code style="color: #000000">></code></span></div> <div style="background-color: #f8f8f8"><span><code> </code><span style="margin-left: 15px !important"><code style="color: #000000"><</code><code style="font-weight: bold; color: #006699">Grid</code> <code style="color: #808080">Width</code><code style="color: #000000">=</code><code style="color: blue">"600"</code> <code style="color: #808080">Height</code><code style="color: #000000">=</code><code style="color: blue">"600"</code><code style="color: #000000">/></code></span></span></div> <div style="background-color: #ffffff"><span style="margin-left: 0px !important"><code style="color: #000000"></</code><code style="font-weight: bold; color: #006699">my:CustomScrollViewer</code><code style="color: #000000">></code></span></div></div> Gaurav Khannahttp://www.blogger.com/profile/04250008487377659924noreply@blogger.com0tag:blogger.com,1999:blog-4682504245579959231.post-86982696979519019492013-05-06T17:43:00.000+05:302013-05-07T11:19:05.081+05:30MultiColumn ComboBox in WPF DataGrid<div style="text-align: left" dir="ltr" trbidi="on"> <div align="justify">Recently one of the user on MSDN forum wanted to have MultiColumn ComboBox in WPF DataGrid. Although there are many articles for creating Simple MultiColumn Combobox but not many article for having it inside Datagrid. So I decided to write a small snippet which can work for Datagrid.</div> <div align="justify"> </div> <div align="justify"><span style="text-align: left">DataGrid has DataGridTemplateColumn where we can host a Control. So to show Multi Column ComboBox in dropdown area, we can change the style of ComboBox as in below code.</span></div> <div id="codeSnippetWrapper" style="font-size: 8pt; border-top: silver 1px solid; font-family: 'Courier New', courier, monospace; border-right: silver 1px solid; border-bottom: silver 1px solid; padding-bottom: 4px; text-align: left; padding-top: 4px; padding-left: 4px; margin: 20px 0px 10px; border-left: silver 1px solid; padding-right: 4px; width: 97.5%"><pre class="csharpcode"><span class="kwrd"><</span><span class="html">DataGrid</span> <span class="attr">x:Name</span><span class="kwrd">="DGOrders"</span> <span class="attr">Margin</span><span class="kwrd">="30"</span> <span class="attr">AutoGenerateColumns</span><span class="kwrd">="False"</span> <span class="kwrd">></span><br /> <span class="kwrd"><</span><span class="html">DataGrid.Columns</span><span class="kwrd">></span><br /> <span class="kwrd"><</span><span class="html">DataGridTextColumn</span> <span class="attr">Binding</span><span class="kwrd">="{Binding OrderID}"</span> <span class="attr">Header</span><span class="kwrd">="Order ID"</span> <span class="kwrd">/></span><br /> <span class="kwrd"><</span><span class="html">DataGridTemplateColumn</span> <span class="attr">Header</span><span class="kwrd">="User"</span> <span class="attr">Width</span><span class="kwrd">="200"</span><span class="kwrd">></span><br /> <span class="kwrd"><</span><span class="html">DataGridTemplateColumn.CellTemplate</span><span class="kwrd">></span><br /> <span class="kwrd"><</span><span class="html">DataTemplate</span><span class="kwrd">></span><br /> <span class="kwrd"><</span><span class="html">ComboBox</span> <span class="attr">SelectedValue</span><span class="kwrd">="{Binding UserID}"</span> SelectedValuePath="UserID" <span class="attr">DisplayMemberPath</span><span class="kwrd">="CompanyName"</span> <span class="attr">HorizontalContentAlignment</span><span class="kwrd">="Stretch" <span class="attr">ItemsSource</span><span class="kwrd">="{Binding}" </span></span><span class="kwrd">></span><br /> <span class="kwrd"><</span><span class="html">ComboBox.ItemContainerStyle</span><span class="kwrd">></span><br /> <span class="kwrd"><</span><span class="html">Style</span> <span class="attr">TargetType</span><span class="kwrd">="{x:Type ComboBoxItem}"</span><span class="kwrd">></span><br /> <span class="kwrd"><</span><span class="html">Setter</span> <span class="attr">Property</span><span class="kwrd">="Template"</span><span class="kwrd">></span><br /> <span class="kwrd"><</span><span class="html">Setter.Value</span><span class="kwrd">></span><br /> <span class="kwrd"><</span><span class="html">ControlTemplate</span><span class="kwrd">></span><br /> <span class="kwrd"><</span><span class="html">Grid</span><span class="kwrd">></span><br /> <span class="kwrd"><</span><span class="html">Grid.ColumnDefinitions</span><span class="kwrd">></span><br /> <span class="kwrd"><</span><span class="html">ColumnDefinition</span> <span class="attr">Width</span><span class="kwrd">="Auto"</span><span class="kwrd">/></span><br /> <span class="kwrd"><</span><span class="html">ColumnDefinition</span> <span class="attr">Width</span><span class="kwrd">="*"</span><span class="kwrd">/></span><br /> <span class="kwrd"><</span><span class="html">ColumnDefinition</span> <span class="attr">Width</span><span class="kwrd">="*"</span><span class="kwrd">/></span><br /> <span class="kwrd"></</span><span class="html">Grid.ColumnDefinitions</span><span class="kwrd">></span><br /> <span class="kwrd"><</span><span class="html">TextBlock</span> <span class="attr">Margin</span><span class="kwrd">="5"</span> <span class="attr">Grid</span>.<span class="attr">Column</span><span class="kwrd">="0"</span> <span class="attr">Text</span><span class="kwrd">="{Binding UserID}"</span><span class="kwrd">/></span><br /> <span class="kwrd"><</span><span class="html">TextBlock</span> <span class="attr">Margin</span><span class="kwrd">="5"</span> <span class="attr">Grid</span>.<span class="attr">Column</span><span class="kwrd">="1"</span> <span class="attr">Text</span><span class="kwrd">="{Binding CompanyName}"</span><span class="kwrd">/></span><br /> <span class="kwrd"><</span><span class="html">TextBlock</span> <span class="attr">Margin</span><span class="kwrd">="5"</span> <span class="attr">Grid</span>.<span class="attr">Column</span><span class="kwrd">="2"</span> <span class="attr">Text</span><span class="kwrd">="{Binding UserName}"</span><span class="kwrd">/></span><br /> <span class="kwrd"></</span><span class="html">Grid</span><span class="kwrd">></span><br /> <span class="kwrd"></</span><span class="html">ControlTemplate</span><span class="kwrd">></span><br /> <span class="kwrd"></</span><span class="html">Setter.Value</span><span class="kwrd">></span><br /> <span class="kwrd"></</span><span class="html">Setter</span><span class="kwrd">></span><br /> <span class="kwrd"></</span><span class="html">Style</span><span class="kwrd">></span><br /> <span class="kwrd"></</span><span class="html">ComboBox.ItemContainerStyle</span><span class="kwrd">></span><br /> <span class="kwrd"></</span><span class="html">ComboBox</span><span class="kwrd">></span><br /> <span class="kwrd"></</span><span class="html">DataTemplate</span><span class="kwrd">></span><br /> <span class="kwrd"></</span><span class="html">DataGridTemplateColumn.CellTemplate</span><span class="kwrd">></span><br /> <span class="kwrd"></</span><span class="html">DataGridTemplateColumn</span><span class="kwrd">></span><br /> <span class="kwrd"></</span><span class="html">DataGrid.Columns</span><span class="kwrd">></span><br /> <span class="kwrd"></</span><span class="html">DataGrid</span><span class="kwrd">></span></pre><br><br /><style type="text/css">.csharpcode, .csharpcode pre<br />{<br /> font-size: small;<br /> color: black;<br /> font-family: consolas, "Courier New", courier, monospace;<br /> background-color: #ffffff;<br /> /*white-space: pre;*/<br />}<br />.csharpcode pre { margin: 0em; }<br />.csharpcode .rem { color: #008000; }<br />.csharpcode .kwrd { color: #0000ff; }<br />.csharpcode .str { color: #006080; }<br />.csharpcode .op { color: #0000c0; }<br />.csharpcode .preproc { color: #cc6633; }<br />.csharpcode .asp { background-color: #ffff00; }<br />.csharpcode .html { color: #800000; }<br />.csharpcode .attr { color: #ff0000; }<br />.csharpcode .alt <br />{<br /> background-color: #f4f4f4;<br /> width: 100%;<br /> margin: 0em;<br />}<br />.csharpcode .lnum { color: #606060; }<br /></style><br /><br><br></div><br /><div align="justify">In this example, we are changing the style by setting ItemContainerStyle property of ComboBox. So now when dropdown for ComboBox will get open, we will see UserID, CompanyName and UserName details. Here ComboBox selection will show what we have set in DisplayMemberPath like in following image</div><br><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjVs4tgslqktyyTDr09038OxMnVIjjAanGoKpB8YW9O_S3fYTs0ki_pDobSY2KPUs1cRwKftqcbUqebmYyqZZjXOHcWV-kqpGAFaijNaGAhejvnTCZA5HpnYi1p2lw6nt2bJsFYLwSy4bk8/s1600-h/Example1%25255B3%25255D.png"><img title="Example1" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Example1" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjIXE4H4_GVcOwfHp6Of88gdQOOpomLjnvHVwZWnjAJqRVx2E_VlKc0P04QGOJk2vhSg70RCeFB_opu2LeX5A_wPUYq8j7dBTuF267dexOnBdc__-7SBDRGmgpMgdaZjdtV-zGHn5KTDNir/?imgmax=800" width="528" height="346"></a><br><br /><div align="justify">Another way to have MultiColumn is to change ItemTemplate of ComboBox and display result from multiple columns. </div><br /><div id="codeSnippetWrapper" style="font-size: 8pt; border-top: silver 1px solid; font-family: 'Courier New', courier, monospace; border-right: silver 1px solid; border-bottom: silver 1px solid; padding-bottom: 4px; text-align: left; padding-top: 4px; padding-left: 4px; margin: 20px 0px 10px; border-left: silver 1px solid; padding-right: 4px; width: 97.5%"><pre class="csharpcode"> <span class="kwrd"><</span><span class="html">DataGrid</span> <span class="attr">x:Name</span><span class="kwrd">="DGOrders"</span> <span class="attr">Margin</span><span class="kwrd">="30"</span> <span class="attr">AutoGenerateColumns</span><span class="kwrd">="False"</span> <span class="kwrd">></span><br /> <span class="kwrd"><</span><span class="html">DataGrid.Columns</span><span class="kwrd">></span><br /> <span class="kwrd"><</span><span class="html">DataGridTextColumn</span> <span class="attr">Binding</span><span class="kwrd">="{Binding OrderID}"</span> <span class="attr">Header</span><span class="kwrd">="Order ID"</span> <span class="kwrd">/></span><br /> <span class="kwrd"><</span><span class="html">DataGridTemplateColumn</span> <span class="attr">Header</span><span class="kwrd">="User"</span> <span class="attr">Width</span><span class="kwrd">="200"</span><span class="kwrd">></span><br /> <span class="kwrd"><</span><span class="html">DataGridTemplateColumn.CellTemplate</span><span class="kwrd">></span><br /> <span class="kwrd"><</span><span class="html">DataTemplate</span><span class="kwrd">></span><br /> <span class="kwrd"><</span><span class="html">ComboBox</span> <span class="attr">SelectedValue</span><span class="kwrd">="{Binding UserID}" SelectedValuePath="UserID" </span><span class="attr">HorizontalContentAlignment</span><span class="kwrd">="Stretch" <span class="attr">ItemsSource</span><span class="kwrd">="{Binding}"></span></span><br /> <span class="kwrd"><</span><span class="html">ComboBox.ItemTemplate</span><span class="kwrd">></span><br /> <span class="kwrd"><</span><span class="html">DataTemplate</span><span class="kwrd">></span><br /> <span class="kwrd"><</span><span class="html">Grid</span><span class="kwrd">></span><br /> <span class="kwrd"><</span><span class="html">Grid.ColumnDefinitions</span><span class="kwrd">></span><br /> <span class="kwrd"><</span><span class="html">ColumnDefinition</span> <span class="attr">Width</span><span class="kwrd">="Auto"</span><span class="kwrd">/></span><br /> <span class="kwrd"><</span><span class="html">ColumnDefinition</span> <span class="attr">Width</span><span class="kwrd">="*"</span><span class="kwrd">/></span><br /> <span class="kwrd"><</span><span class="html">ColumnDefinition</span> <span class="attr">Width</span><span class="kwrd">="*"</span><span class="kwrd">/></span><br /> <span class="kwrd"></</span><span class="html">Grid.ColumnDefinitions</span><span class="kwrd">></span><br /><br /> <span class="kwrd"><</span><span class="html">TextBlock</span> <span class="attr">Margin</span><span class="kwrd">="5"</span> <span class="attr">Grid</span>.<span class="attr">Column</span><span class="kwrd">="0"</span> <span class="attr">Text</span><span class="kwrd">="{Binding UserID}"</span><span class="kwrd">/></span><br /> <span class="kwrd"><</span><span class="html">TextBlock</span> <span class="attr">Margin</span><span class="kwrd">="5"</span> <span class="attr">Grid</span>.<span class="attr">Column</span><span class="kwrd">="1"</span> <span class="attr">Text</span><span class="kwrd">="{Binding CompanyName}"</span><span class="kwrd">/></span><br /> <span class="kwrd"><</span><span class="html">TextBlock</span> <span class="attr">Margin</span><span class="kwrd">="5"</span> <span class="attr">Grid</span>.<span class="attr">Column</span><span class="kwrd">="2"</span> <span class="attr">Text</span><span class="kwrd">="{Binding UserName}"</span><span class="kwrd">/></span><br /> <span class="kwrd"></</span><span class="html">Grid</span><span class="kwrd">></span><br /> <span class="kwrd"></</span><span class="html">DataTemplate</span><span class="kwrd">></span><br /> <span class="kwrd"></</span><span class="html">ComboBox.ItemTemplate</span><span class="kwrd">></span><br /> <span class="kwrd"></</span><span class="html">ComboBox</span><span class="kwrd">></span><br /> <span class="kwrd"></</span><span class="html">DataTemplate</span><span class="kwrd">></span><br /> <span class="kwrd"></</span><span class="html">DataGridTemplateColumn.CellTemplate</span><span class="kwrd">></span><br /> <span class="kwrd"></</span><span class="html">DataGridTemplateColumn</span><span class="kwrd">></span><br /> <span class="kwrd"></</span><span class="html">DataGrid.Columns</span><span class="kwrd">></span><br /> <span class="kwrd"></</span><span class="html">DataGrid</span><span class="kwrd">></span></pre><br><br /><style type="text/css">.csharpcode, .csharpcode pre<br />{<br /> font-size: small;<br /> color: black;<br /> font-family: consolas, "Courier New", courier, monospace;<br /> background-color: #ffffff;<br /> /*white-space: pre;*/<br />}<br />.csharpcode pre { margin: 0em; }<br />.csharpcode .rem { color: #008000; }<br />.csharpcode .kwrd { color: #0000ff; }<br />.csharpcode .str { color: #006080; }<br />.csharpcode .op { color: #0000c0; }<br />.csharpcode .preproc { color: #cc6633; }<br />.csharpcode .asp { background-color: #ffff00; }<br />.csharpcode .html { color: #800000; }<br />.csharpcode .attr { color: #ff0000; }<br />.csharpcode .alt <br />{<br /> background-color: #f4f4f4;<br /> width: 100%;<br /> margin: 0em;<br />}<br />.csharpcode .lnum { color: #606060; }<br /></style><br /></div><br /><div>In this example, we are changing the ItemTemplate, so now we will see UserID, CompanyName and UserName details in ComboBox Selection and Dropdown result as in following image.</div><br><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbb8wSDmkXYCD0ykNYd2w6YgBWHTdbKTmVGkmsmcARovjUGfd7Lcl3CQNk2fmsjeY2fkB1j9WDPAmE4kQAFc-aXkjBuB7bpRIzvNkvlofv7D38BDwwdYisB-B4iPEQvDMImj2q_4KqrbJ2/s1600-h/Example2%25255B3%25255D.png"><img title="Example2" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="Example2" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQ1uSCt2PgHfPFd_3zZld7fjqXrQKcLPBkXsoPHiN-d0WEuCB953aHGBY7ZyY4yKTmpiBKwbzf4rD0qBsjdcjaEYK4-XEK-XPRJiel8a9TwpdbZglvcgsACiqOuR37w_BEXkIZOnmjfMZC/?imgmax=800" width="524" height="349"></a><br><br>Now when you have a requirement of showing Multiple Column in DataGridColumn you can try one of the above two methods.</div><br /><div align="justify">Another way to show Multiple Column in DataGridColumn is to host a DataGrid in DataGridTemplateColumn. I will have an example of it in one of my future articles.</div> Gaurav Khannahttp://www.blogger.com/profile/04250008487377659924noreply@blogger.com1tag:blogger.com,1999:blog-4682504245579959231.post-52699797177367737592012-10-16T12:20:00.000+05:302012-10-16T12:28:29.872+05:30Microsoft Community Contributor<img title="Contributor" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; padding-right: 0px" border="0" alt="Contributor" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-Nlcgvu1mKv97sgc6wAUbmeZAF3TIpGz7xwLTFiA0c5ENwwYsHhPhpxL2AX5QIrY8hYwwG64N7wdcMYueYZsdQfeKZufnglBUOjEUyRklPad_KwVx9idHD4o76wa0zLHdDeP999Y_wjXG/?imgmax=800" width="228" height="148"> <p align="justify">I am proud to announce that I am recognized with Microsoft Community Contributor badge by Microsoft for my contribution in MSDN Forum. I have answered above 2000 answers with 29K points on MSDN Forum so far. Microsoft Community Contributor is a quarterly recognition by Microsoft. <p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvwkrQGXr3_eAFkEjO-J0L0J7SxyCIEjr_6TyDv1imTk7hjHOOIupLUQIxZy12WRHB8nlC9aycYXy-aRszRW9KTp3nWIaOVpwg0U7XR_BAvdeagw1shA7LTlPBuFZVKkHxYuerwBqwqIJ9/s1600-h/Capture%25255B6%25255D.jpg"><img title="Capture" style="display: inline" alt="Capture" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgxheDNLmZGR9gfTIAGrkVNZMvxyrb5SG-sOMmXEBOY77sCIMxTHz13gQvm0zrvI_XQpIZy46-35hFX0FNOxYpwdH73ErIgZ6g5mV0xaT0919AO-iy2flypd1Gtely52PCXcD49TgvzuGZ5/?imgmax=800" width="640" height="251"></a></p> <p>More information about Microsoft Community Contributor is available on following link</p> <p><a href="https://www.microsoftcommunitycontributor.com/faq.aspx">https://www.microsoftcommunitycontributor.com/faq.aspx</a></p> Gaurav Khannahttp://www.blogger.com/profile/04250008487377659924noreply@blogger.com0tag:blogger.com,1999:blog-4682504245579959231.post-63453000647574970292012-10-07T14:18:00.000+05:302012-10-21T18:58:19.953+05:30MultiPanel Control in WPF/Silverlight<div dir="ltr" style="text-align: left;" trbidi="on">
<div align="justify">
Many time during designing we require different pages similar to a TabControl but without displaying Tabs. There are few article to create similar control for Windows Form and ASP.NET but not much for WPF or Silverlight. So I decide the create my own Custom MultiPanel.</div>
<div align="justify">
MultiPanel is a simple control which inherits an ItemsControl and has SelectedIndex and SelectedPanel property to change the selected panel.</div>
<div id="codeSnippetWrapper" style="border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; font-family: 'Courier New', courier, monospace; font-size: 8pt; margin: 5px 0px; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;">
<pre class="csharpcode"><span class="kwrd">Public</span> <span class="kwrd">Class</span> MultiPanel
<span class="kwrd">Inherits</span> ItemsControl
<span class="kwrd">Public</span> <span class="kwrd">Sub</span> <span class="kwrd">New</span>()
<span class="kwrd">MyBase</span>.<span class="kwrd">New</span>()
<span class="kwrd">Me</span>.DefaultStyleKey = <span class="kwrd">GetType</span>(MultiPanel)
<span class="kwrd">End</span> <span class="kwrd">Sub</span>
<span class="kwrd">Public</span> <span class="kwrd">Property</span> SelectedIndex() <span class="kwrd">As</span> <span class="kwrd">Integer</span>
<span class="kwrd">Get</span>
<span class="kwrd">Return</span> <span class="kwrd">CInt</span>(GetValue(SelectedIndexProperty))
<span class="kwrd">End</span> <span class="kwrd">Get</span>
<span class="kwrd">Set</span>(value <span class="kwrd">As</span> <span class="kwrd">Integer</span>)
SetValue(SelectedIndexProperty, value)
<span class="kwrd">End</span> <span class="kwrd">Set</span>
<span class="kwrd">End</span> <span class="kwrd">Property</span>
<span class="kwrd">Public</span> <span class="kwrd">Event</span> SelectionChanged <span class="kwrd">As</span> EventHandler(Of EventArgs)
<span class="kwrd">Public</span> <span class="kwrd">Shared</span> <span class="kwrd">ReadOnly</span> SelectedIndexProperty <span class="kwrd">As</span> DependencyProperty = DependencyProperty.Register(<span class="str">"SelectedIndex"</span>, <span class="kwrd">GetType</span>(<span class="kwrd">Integer</span>), <span class="kwrd">GetType</span>(MultiPanel), <span class="kwrd">New</span> PropertyMetadata(-1, <span class="kwrd">New</span> PropertyChangedCallback(<span class="kwrd">AddressOf</span> SelectedIndexChanged)))
<span class="kwrd">Public</span> <span class="kwrd">Property</span> SelectedPanel() <span class="kwrd">As</span> <span class="kwrd">Object</span>
<span class="kwrd">Get</span>
<span class="kwrd">Return</span> GetValue(SelectedPanelProperty)
<span class="kwrd">End</span> <span class="kwrd">Get</span>
<span class="kwrd">Set</span>(value <span class="kwrd">As</span> <span class="kwrd">Object</span>)
SetValue(SelectedPanelProperty, value)
<span class="kwrd">End</span> <span class="kwrd">Set</span>
<span class="kwrd">End</span> <span class="kwrd">Property</span>
<span class="kwrd">Public</span> <span class="kwrd">Shared</span> <span class="kwrd">ReadOnly</span> SelectedPanelProperty <span class="kwrd">As</span> DependencyProperty = DependencyProperty.Register(<span class="str">"SelectedPanel"</span>, <span class="kwrd">GetType</span>(<span class="kwrd">Object</span>), <span class="kwrd">GetType</span>(MultiPanel), <span class="kwrd">New</span> PropertyMetadata(<span class="kwrd">Nothing</span>, <span class="kwrd">New</span> PropertyChangedCallback(<span class="kwrd">AddressOf</span> SelectedPanelChanged)))
<span class="kwrd">Private</span> <span class="kwrd">Shared</span> <span class="kwrd">Sub</span> SelectedIndexChanged(sender <span class="kwrd">As</span> DependencyObject, e <span class="kwrd">As</span> DependencyPropertyChangedEventArgs)
<span class="kwrd">Dim</span> mp <span class="kwrd">As</span> MultiPanel = <span class="kwrd">DirectCast</span>(sender, MultiPanel)
<span class="kwrd">Dim</span> index <span class="kwrd">As</span> <span class="kwrd">Integer</span> = <span class="kwrd">Integer</span>.Parse(e.NewValue.ToString())
<span class="kwrd">Dim</span> oldIndex <span class="kwrd">As</span> <span class="kwrd">Integer</span> = <span class="kwrd">Integer</span>.Parse(e.OldValue.ToString())
<span class="kwrd">If</span> index <> -1 <span class="kwrd">AndAlso</span> index <> oldIndex <span class="kwrd">Then</span>
mp.SelectedPanel = mp.Items(index)
<span class="kwrd">ElseIf</span> index = -1 <span class="kwrd">Then</span>
mp.SelectedPanel = <span class="kwrd">Nothing</span>
<span class="kwrd">End</span> <span class="kwrd">If</span>
mp.RaiseSelectionChanged()
<span class="kwrd">End</span> <span class="kwrd">Sub</span>
<span class="kwrd">Private</span> <span class="kwrd">Sub</span> RaiseSelectionChanged()
<span class="kwrd">RaiseEvent</span> SelectionChanged(<span class="kwrd">Me</span>, <span class="kwrd">New</span> EventArgs())
<span class="kwrd">End</span> <span class="kwrd">Sub</span>
<span class="kwrd">Private</span> <span class="kwrd">Shared</span> <span class="kwrd">Sub</span> SelectedPanelChanged(sender <span class="kwrd">As</span> DependencyObject, e <span class="kwrd">As</span> DependencyPropertyChangedEventArgs)
<span class="kwrd">Dim</span> mp <span class="kwrd">As</span> MultiPanel = <span class="kwrd">DirectCast</span>(sender, MultiPanel)
<span class="kwrd">Dim</span> pnl <span class="kwrd">As</span> Panel = <span class="kwrd">DirectCast</span>(e.NewValue, Panel)
<span class="kwrd">If</span> pnl <span class="kwrd">Is</span> <span class="kwrd">Nothing</span> <span class="kwrd">OrElse</span> mp.Items.IndexOf(pnl) = -1 <span class="kwrd">Then</span>
mp.SelectedPanel = <span class="kwrd">Nothing</span>
mp.SelectedIndex = -1
<span class="kwrd">Else</span>
mp.SelectedPanel = pnl
mp.SelectedIndex = mp.Items.IndexOf(pnl)
<span class="kwrd">End</span> <span class="kwrd">If</span>
<span class="kwrd">End</span> <span class="kwrd">Sub</span>
<span class="kwrd">End</span> Class</pre>
<br />
<br /></div>
<br />
And below is the MultiPanel Style<br />
<br />
<div id="codeSnippetWrapper" style="border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; font-family: 'Courier New', courier, monospace; font-size: 8pt; margin: 5px 0px; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;">
<pre class="csharpcode"> <span class="kwrd"><</span><span class="html">Style</span> <span class="attr">TargetType</span><span class="kwrd">="local:MultiPanel"</span><span class="kwrd">></span>
<span class="kwrd"><</span><span class="html">Setter</span> <span class="attr">Property</span><span class="kwrd">="HorizontalAlignment"</span> <span class="attr">Value</span><span class="kwrd">="Stretch"</span><span class="kwrd">/></span>
<span class="kwrd"><</span><span class="html">Setter</span> <span class="attr">Property</span><span class="kwrd">="HorizontalContentAlignment"</span> <span class="attr">Value</span><span class="kwrd">="Stretch"</span><span class="kwrd">/></span>
<span class="kwrd"><</span><span class="html">Setter</span> <span class="attr">Property</span><span class="kwrd">="VerticalAlignment"</span> <span class="attr">Value</span><span class="kwrd">="Stretch"</span><span class="kwrd">/></span>
<span class="kwrd"><</span><span class="html">Setter</span> <span class="attr">Property</span><span class="kwrd">="VerticalContentAlignment"</span> <span class="attr">Value</span><span class="kwrd">="Stretch"</span><span class="kwrd">/></span>
<span class="kwrd"><</span><span class="html">Setter</span> <span class="attr">Property</span><span class="kwrd">="Template"</span><span class="kwrd">></span>
<span class="kwrd"><</span><span class="html">Setter.Value</span><span class="kwrd">></span>
<span class="kwrd"><</span><span class="html">ControlTemplate</span> <span class="attr">TargetType</span><span class="kwrd">="local:MultiPanel"</span><span class="kwrd">></span>
<span class="kwrd"><</span><span class="html">Border</span> <span class="attr">Background</span><span class="kwrd">="{TemplateBinding Background}"</span>
<span class="attr">BorderBrush</span><span class="kwrd">="{TemplateBinding BorderBrush}"</span>
<span class="attr">BorderThickness</span><span class="kwrd">="{TemplateBinding BorderThickness}"</span> <span class="attr">HorizontalAlignment</span><span class="kwrd">="{TemplateBinding HorizontalContentAlignment}"</span> <span class="attr">VerticalAlignment</span><span class="kwrd">="{TemplateBinding VerticalContentAlignment}"</span> <span class="kwrd">></span>
<span class="kwrd"><</span><span class="html">ContentPresenter</span> <span class="attr">Content</span><span class="kwrd">="{TemplateBinding SelectedPanel}"</span>
<span class="attr">Margin</span><span class="kwrd">="{TemplateBinding Padding}"</span> <span class="attr">HorizontalAlignment</span><span class="kwrd">="{TemplateBinding HorizontalContentAlignment}"</span> <span class="attr">VerticalAlignment</span><span class="kwrd">="{TemplateBinding VerticalContentAlignment}"</span> <span class="kwrd">/></span>
<span class="kwrd"></</span><span class="html">Border</span><span class="kwrd">></span>
<span class="kwrd"></</span><span class="html">ControlTemplate</span><span class="kwrd">></span>
<span class="kwrd"></</span><span class="html">Setter.Value</span><span class="kwrd">></span>
<span class="kwrd"></</span><span class="html">Setter</span><span class="kwrd">></span>
<span class="kwrd"></</span><span class="html">Style</span><span class="kwrd">></span></pre>
<br />
<style type="text/css">.csharpcode, .csharpcode pre<br />{<br /> font-size: small;<br /> color: black;<br /> font-family: consolas, "Courier New", courier, monospace;<br /> background-color: #ffffff;<br /> /*white-space: pre;*/<br />}<br />.csharpcode pre { margin: 0em; }<br />.csharpcode .rem { color: #008000; }<br />.csharpcode .kwrd { color: #0000ff; }<br />.csharpcode .str { color: #006080; }<br />.csharpcode .op { color: #0000c0; }<br />.csharpcode .preproc { color: #cc6633; }<br />.csharpcode .asp { background-color: #ffff00; }<br />.csharpcode .html { color: #800000; }<br />.csharpcode .attr { color: #ff0000; }<br />.csharpcode .alt <br />{<br /> background-color: #f4f4f4;<br /> width: 100%;<br /> margin: 0em;<br />}<br />.csharpcode .lnum { color: #606060; }<br /></style><br /></div>
<br />
Below is a simple XAML Code example of using this control<br />
<br />
<div id="codeSnippetWrapper" style="border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; font-family: 'Courier New', courier, monospace; font-size: 8pt; margin: 5px 0px; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;">
<pre class="csharpcode"><span class="kwrd"><</span><span class="html">Window</span> <span class="attr">x:Class</span><span class="kwrd">="MainWindow"</span>
<span class="attr">xmlns</span><span class="kwrd">="http://schemas.microsoft.com/winfx/2006/xaml/presentation"</span>
<span class="attr">xmlns:x</span><span class="kwrd">="http://schemas.microsoft.com/winfx/2006/xaml"</span>
<span class="attr">xmlns:my</span><span class="kwrd">="clr-namespace:WpfApplication2"</span>
<span class="attr">Title</span><span class="kwrd">="MainWindow"</span> <span class="attr">Height</span><span class="kwrd">="350"</span> <span class="attr">Width</span><span class="kwrd">="525"</span><span class="kwrd">></span>
<span class="kwrd"><</span><span class="html">Grid</span><span class="kwrd">></span>
<span class="kwrd"><</span><span class="html">my:MultiPanel</span> <span class="attr">x:Name</span><span class="kwrd">="MainMultiPanel"</span><span class="kwrd">></span>
<span class="kwrd"><</span><span class="html">my:MultiPanel.Items</span><span class="kwrd">></span>
<span class="kwrd"><</span><span class="html">Grid</span> <span class="attr">Name</span><span class="kwrd">="grdCustomer"</span><span class="kwrd">></span>
<span class="kwrd"><</span><span class="html">my:CustomerDetailControl</span> <span class="kwrd">/></span>
<span class="kwrd"></</span><span class="html">Grid</span><span class="kwrd">></span>
<span class="kwrd"><</span><span class="html">Grid</span> <span class="attr">Name</span><span class="kwrd">="grdEmployee"</span><span class="kwrd">></span>
<span class="kwrd"><</span><span class="html">my:EmployeeDetailControl</span> <span class="kwrd">/></span>
<span class="kwrd"></</span><span class="html">Grid</span><span class="kwrd">></span>
<span class="kwrd"><</span><span class="html">Grid</span> <span class="attr">Name</span><span class="kwrd">="grdOrder"</span><span class="kwrd">></span>
<span class="kwrd"><</span><span class="html">my:OrderDetailControl</span> <span class="kwrd">/></span>
<span class="kwrd"></</span><span class="html">Grid</span><span class="kwrd">></span>
<span class="kwrd"></</span><span class="html">my:MultiPanel.Items</span><span class="kwrd">></span>
<span class="kwrd"></</span><span class="html">my:MultiPanel</span><span class="kwrd">></span>
<span class="kwrd"></</span><span class="html">Grid</span><span class="kwrd">></span>
<span class="kwrd"></</span><span class="html">Window</span><span class="kwrd">></span></pre>
<br />
<br /></div>
<br />
Now you can use SelectedIndex or SelectedPanel property of MultiPanel to display the required grid<br />
<br />
<div id="codeSnippetWrapper" style="border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; font-family: 'Courier New', courier, monospace; font-size: 8pt; margin: 5px 0px; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;">
<pre class="csharpcode">MainMultiPanel.SelectedIndex = 2</pre>
<br /></div>
<br />
Hope this control help you in your designing task. Look forward to your feedbacks.<br />
<br /></div>
Gaurav Khannahttp://www.blogger.com/profile/04250008487377659924noreply@blogger.com0tag:blogger.com,1999:blog-4682504245579959231.post-46648962972423928632012-09-02T20:06:00.000+05:302012-10-21T19:27:43.806+05:30Common Converters in WPF/Silverlight<div dir="ltr" style="text-align: left;" trbidi="on">
<div align="justify">
In WPF/Silverlight many times we have to provides a way to apply custom logic to binding. In this situation Converters are very handy to use. For converters we have to create a class which implements IValueConverter class. Below are few common Converters used in WPF/Silverlight.<br />
<br /></div>
<h4>
Byte Array to Image Converter</h4>
<div id="codeSnippetWrapper" style="border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; font-family: 'Courier New', courier, monospace; font-size: 8pt; margin: 5px 0px; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;">
<pre class="csharpcode"><pre class="csharpcode"> <span class="kwrd">public</span> <span class="kwrd">class</span> ByteToImageConverter : IValueConverter
{
<span class="kwrd">public</span> BitmapImage ConvertByteArrayToBitMapImage(<span class="kwrd">byte</span>[] imageByteArray)
{
BitmapImage img = <span class="kwrd">new</span> BitmapImage();
<span class="kwrd">using</span> (MemoryStream memStream = <span class="kwrd">new</span> MemoryStream(imageByteArray))
{
img.SetSource(memStream);
}
<span class="kwrd">return</span> img;
}
<span class="kwrd">public</span> <span class="kwrd">object</span> Convert(<span class="kwrd">object</span> <span class="kwrd">value</span>, Type targetType, <span class="kwrd">object</span> parameter, CultureInfo culture)
{
BitmapImage img = <span class="kwrd">new</span> BitmapImage();
<span class="kwrd">if</span> (<span class="kwrd">value</span> != <span class="kwrd">null</span>)
{
img = <span class="kwrd">this</span>.ConvertByteArrayToBitMapImage(<span class="kwrd">value</span> <span class="kwrd">as</span> <span class="kwrd">byte</span>[]);
}
<span class="kwrd">else</span>
{
<span class="rem">//img = new BitmapImage(new Uri("/AssemblyName;component/Images/defaultImage.jpg", UriKind.Relative));</span>
img = <span class="kwrd">null</span>;
}
<span class="kwrd">return</span> img;
}
<span class="kwrd">public</span> <span class="kwrd">object</span> ConvertBack(<span class="kwrd">object</span> <span class="kwrd">value</span>, Type targetType, <span class="kwrd">object</span> parameter, CultureInfo culture)
{
<span class="kwrd">return</span> <span class="kwrd">null</span>;
}
}</pre>
</pre>
</div>
<br />
<strong>Example</strong><br />
<div id="codeSnippetWrapper" style="border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; font-family: 'Courier New', courier, monospace; font-size: 8pt; margin: 5px 0px; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;">
<pre class="csharpcode"><pre class="csharpcode"> <span class="kwrd"><</span><span class="html">Image</span> <span class="attr">Margin</span><span class="kwrd">="3"</span> <span style="color: red;">Source</span><span class="kwrd">="{Binding Path=ByteArray, Converter={StaticResource byteToImageConverter}}"</span><span class="kwrd">/></span></pre>
</pre>
</div>
<div align="justify">
ByteToImageConverter will convert byte array of image to a BitmapImage which can be used in Source property of an image. This can be used when we have an image saved in binary form in database and we want to bind that and show in image control. We can show a default image if byte array is null by uncommenting the code in “<em>else</em>” part of BitmapToImageConverter class.<br />
<br /></div>
<h4>
Null or Empty Visibility Converter</h4>
<div id="codeSnippetWrapper" style="border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; font-family: 'Courier New', courier, monospace; font-size: 8pt; margin: 5px 0px; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;">
<pre class="csharpcode"><pre class="csharpcode"> <span class="kwrd">public</span> <span class="kwrd">class</span> NullEmptyVisibilityConverter : IValueConverter
{
<span class="kwrd">public</span> <span class="kwrd">object</span> Convert(<span class="kwrd">object</span> <span class="kwrd">value</span>, Type targetType, <span class="kwrd">object</span> parameter, System.Globalization.CultureInfo culture)
{
<span class="kwrd">if</span> (<span class="kwrd">value</span> == <span class="kwrd">null</span>)
{
<span class="kwrd">return</span> Visibility.Collapsed;
}
<span class="kwrd">else</span> <span class="kwrd">if</span> (<span class="kwrd">value</span>.GetType() == <span class="kwrd">typeof</span>(<span class="kwrd">string</span>) && <span class="kwrd">string</span>.IsNullOrWhiteSpace(<span class="kwrd">value</span>.ToString()) == <span class="kwrd">true</span>)
{
<span class="kwrd">return</span> Visibility.Collapsed;
}
<span class="kwrd">else</span>
{
<span class="kwrd">return</span> Visibility.Visible;
}
}
<span class="kwrd">public</span> <span class="kwrd">object</span> ConvertBack(<span class="kwrd">object</span> <span class="kwrd">value</span>, Type targetType, <span class="kwrd">object</span> parameter, System.Globalization.CultureInfo culture)
{
<span class="kwrd">throw</span> <span class="kwrd">new</span> Exception(<span class="str">"Not implemented"</span>);
}
}</pre>
</pre>
</div>
<br />
<strong>Example</strong><br />
<div id="codeSnippetWrapper" style="border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; font-family: 'Courier New', courier, monospace; font-size: 8pt; margin: 5px 0px; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;">
<pre class="csharpcode"><pre class="csharpcode"> <span class="kwrd"><<span class="html">TextBlock</span> </span><span class="attr">Margin</span><span class="kwrd">="3"</span> <span style="color: red;">Text</span><span class="kwrd">="{Binding Path=Data, Converter={StaticResource nullVisibilityConverter}}"</span><span class="kwrd">/></span>
<span style="color: blue;"></span></pre>
<style type="text/css">.csharpcode, .csharpcode pre<br />{<br /> font-size: small;<br /> color: black;<br /> font-family: consolas, "Courier New", courier, monospace;<br /> background-color: #ffffff;<br /> /*white-space: pre;*/<br />}<br />.csharpcode pre { margin: 0em; }<br />.csharpcode .rem { color: #008000; }<br />.csharpcode .kwrd { color: #0000ff; }<br />.csharpcode .str { color: #006080; }<br />.csharpcode .op { color: #0000c0; }<br />.csharpcode .preproc { color: #cc6633; }<br />.csharpcode .asp { background-color: #ffff00; }<br />.csharpcode .html { color: #800000; }<br />.csharpcode .attr { color: #ff0000; }<br />.csharpcode .alt <br />{<br /> background-color: #f4f4f4;<br /> width: 100%;<br /> margin: 0em;<br />}<br />.csharpcode .lnum { color: #606060; }<br /></style></pre>
</div>
<br />
<div align="justify">
NullEmptyVisibilityConverter can be used if we don’t want to show the control if value in binding is null. In above class, we are setting Visibility property as Collapsed if value is null or if string type value is null or empty.<br />
<br /></div>
<h4>
Negative Converter</h4>
<div id="codeSnippetWrapper" style="border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; font-family: 'Courier New', courier, monospace; font-size: 8pt; margin: 5px 0px; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;">
<pre class="csharpcode"><pre class="csharpcode"><span class="kwrd">Public</span> <span class="kwrd">Class</span> NegativeConverter
<span class="kwrd">Implements</span> IValueConverter
<span class="kwrd">Public</span> <span class="kwrd">Function</span> Convert(value <span class="kwrd">As</span> <span class="kwrd">Object</span>, targetType <span class="kwrd">As</span> Type, parameter <span class="kwrd">As</span> <span class="kwrd">Object</span>, culture <span class="kwrd">As</span> System.Globalization.CultureInfo) <span class="kwrd">As</span> <span class="kwrd">Object</span> <span class="kwrd">Implements</span> IValueConverter.Convert
<span class="kwrd">If</span> value.[<span class="kwrd">GetType</span>]() <span class="kwrd">Is</span> <span class="kwrd">GetType</span>(<span class="kwrd">Boolean</span>) <span class="kwrd">Then</span>
<span class="kwrd">Dim</span> result <span class="kwrd">As</span> <span class="kwrd">Boolean</span> = <span class="kwrd">CBool</span>(value)
<span class="kwrd">Return</span> <span class="kwrd">Not</span> result
<span class="kwrd">Else</span>
<span class="kwrd">Return</span> value
<span class="kwrd">End</span> <span class="kwrd">If</span>
<span class="kwrd">End</span> <span class="kwrd">Function</span>
<span class="kwrd">Public</span> <span class="kwrd">Function</span> ConvertBack(value <span class="kwrd">As</span> <span class="kwrd">Object</span>, targetType <span class="kwrd">As</span> Type, parameter <span class="kwrd">As</span> <span class="kwrd">Object</span>, culture <span class="kwrd">As</span> System.Globalization.CultureInfo) <span class="kwrd">As</span> <span class="kwrd">Object</span> <span class="kwrd">Implements</span> IValueConverter.ConvertBack
<span class="kwrd">Throw</span> <span class="kwrd">New</span> Exception(<span class="str">"Not implemented"</span>)
<span class="kwrd">End</span> <span class="kwrd">Function</span>
<span class="kwrd">End</span> Class</pre>
</pre>
</div>
<strong><br /></strong>
<strong>Example</strong><br />
<div id="codeSnippetWrapper" style="border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; font-family: 'Courier New', courier, monospace; font-size: 8pt; margin: 5px 0px; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;">
<pre class="csharpcode"><pre class="csharpcode"> <span class="kwrd"><</span><span class="html">StackPanel</span> <span class="attr">Orientation</span><span class="kwrd">="Vertical"</span><span class="kwrd">></span>
<span class="kwrd"><</span><span class="html">CheckBox</span> <span class="attr">HorizontalAlignment</span><span class="kwrd">="Left"</span> <span class="attr">Margin</span><span class="kwrd">="3"</span> <span class="attr">Width</span><span class="kwrd">="100"</span> <span class="attr">Height</span><span class="kwrd">="25"</span> <span class="attr">Name</span><span class="kwrd">="chkFirst"</span><span class="kwrd">/></span>
<span class="kwrd"><</span><span class="html">CheckBox</span> <span class="attr">Name</span><span class="kwrd">="chkSecond"</span> <span class="attr">HorizontalAlignment</span><span class="kwrd">="Left"</span> <span class="attr">Margin</span><span class="kwrd">="3"</span> <span class="attr">Height</span><span class="kwrd">="25"</span> <span class="attr">IsChecked</span><span class="kwrd">="{Binding Path=IsChecked, ElementName=chkFirst, Converter={StaticResource negativeConverter}}"</span><span class="kwrd">/></span>
<span class="kwrd"></</span><span class="html">StackPanel</span><span class="kwrd">></span></pre>
</pre>
</div>
<div align="justify">
Sometime we want to display reverse result of the binded value. For example, we want to disable the control if value is true. Now the disable control we have to set IsEnabled = false and we have value of true to disable. So in this case we can use above NegativeConverter.</div>
<br />
<div align="justify">
In above example code, we are unchecking the chkSecond checkbox if chkFirst checkbox is checked and vice versa. So for this we are setting staticResource of NegativeConverter in binding converter property.<br />
<br /></div>
<h4>
Multiplication Converter</h4>
<div id="codeSnippetWrapper" style="border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; font-family: 'Courier New', courier, monospace; font-size: 8pt; margin: 5px 0px; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;">
<pre class="csharpcode"><pre class="csharpcode"><span class="kwrd">Public</span> <span class="kwrd">Class</span> MultiplyConverter
<span class="kwrd">Implements</span> IValueConverter
<span class="kwrd">Public</span> <span class="kwrd">Function</span> Convert(value <span class="kwrd">As</span> <span class="kwrd">Object</span>, targetType <span class="kwrd">As</span> Type, parameter <span class="kwrd">As</span> <span class="kwrd">Object</span>, culture <span class="kwrd">As</span> System.Globalization.CultureInfo) <span class="kwrd">As</span> <span class="kwrd">Object</span> <span class="kwrd">Implements</span> IValueConverter.Convert
<span class="kwrd">If</span> parameter IsNot <span class="kwrd">Nothing</span> <span class="kwrd">Then</span>
<span class="kwrd">Dim</span> result <span class="kwrd">As</span> <span class="kwrd">Double</span> = <span class="kwrd">Double</span>.Parse(parameter.ToString())
<span class="kwrd">Return</span> <span class="kwrd">CDbl</span>(value) * result
<span class="kwrd">Else</span>
<span class="kwrd">Return</span> <span class="kwrd">CDbl</span>(value)
<span class="kwrd">End</span> <span class="kwrd">If</span>
<span class="kwrd">End</span> <span class="kwrd">Function</span>
<span class="kwrd">Public</span> <span class="kwrd">Function</span> ConvertBack(value <span class="kwrd">As</span> <span class="kwrd">Object</span>, targetType <span class="kwrd">As</span> Type, parameter <span class="kwrd">As</span> <span class="kwrd">Object</span>, culture <span class="kwrd">As</span> System.Globalization.CultureInfo) <span class="kwrd">As</span> <span class="kwrd">Object</span> <span class="kwrd">Implements</span> IValueConverter.ConvertBack
<span class="kwrd">Throw</span> <span class="kwrd">New</span> Exception(<span class="str">"Not implemented"</span>)
<span class="kwrd">End</span> <span class="kwrd">Function</span>
<span class="kwrd">End</span> <span class="kwrd">Class</span>
</pre>
</pre>
</div>
<br />
<strong>Example</strong><br />
<div id="codeSnippetWrapper" style="border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; font-family: 'Courier New', courier, monospace; font-size: 8pt; margin: 5px 0px; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;">
<pre class="csharpcode"><pre class="csharpcode"> <span class="kwrd"><</span><span class="html">StackPanel</span> <span class="attr">Orientation</span><span class="kwrd">="Vertical"</span><span class="kwrd">></span>
<span class="kwrd"><</span><span class="html">TextBox</span> <span class="attr">HorizontalAlignment</span><span class="kwrd">="Left"</span> <span class="attr">Margin</span><span class="kwrd">="3"</span> <span class="attr">Width</span><span class="kwrd">="100"</span> <span class="attr">Height</span><span class="kwrd">="25"</span> <span class="attr">Name</span><span class="kwrd">="txtFirst"</span><span class="kwrd">/></span>
<span class="kwrd"><</span><span class="html">TextBox</span> <span class="attr">Name</span><span class="kwrd">="txtSecond" </span><span class="attr">HorizontalAlignment</span><span class="kwrd">="Left"</span> <span class="attr">Margin</span><span class="kwrd">="3"</span> <span class="attr">Height</span><span class="kwrd">="25"</span> <span class="attr">Width</span><span class="kwrd">="{Binding Path=ActualWidth, ElementName=txtFirst, Converter={StaticResource multiplyConverter}, ConverterParameter=2.0}"</span><span class="kwrd">/></span>
<span class="kwrd"></</span><span class="html">StackPanel</span><span class="kwrd">></span></pre>
</pre>
</div>
<br />
<div align="justify">
In the above code in txtSecond textbox we are binding it’s width property to txtFirst textbox width property. So we have set ElementName as <em>txtFirst</em> and Path as <em>ActualWidth. </em>And we want to have txtSecond width double of txtFirst. So we would be setting staticresource of MultiplyConverter in converter property and “2.0” as ConverterParameter property.</div>
<br />
<div align="justify">
Now in MultiplyConverter class we would have ActualWidth of txtFirst in value parameter and “2.0” in “parameter” parameter. So we will multiply the two value and return the result.<br />
<br /></div>
<h4>
Divide Converter</h4>
<div id="codeSnippetWrapper" style="border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; font-family: 'Courier New', courier, monospace; font-size: 8pt; margin: 5px 0px; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;">
<pre class="csharpcode"><pre class="csharpcode"><span class="kwrd">Public</span> <span class="kwrd">Class</span> DivideConverter
<span class="kwrd">Implements</span> IValueConverter
<span class="kwrd">Public</span> <span class="kwrd">Function</span> Convert(value <span class="kwrd">As</span> <span class="kwrd">Object</span>, targetType <span class="kwrd">As</span> Type, parameter <span class="kwrd">As</span> <span class="kwrd">Object</span>, culture <span class="kwrd">As</span> System.Globalization.CultureInfo) <span class="kwrd">As</span> <span class="kwrd">Object</span> <span class="kwrd">Implements</span> IValueConverter.Convert
<span class="kwrd">If</span> parameter IsNot <span class="kwrd">Nothing</span> <span class="kwrd">Then</span>
<span class="kwrd">Dim</span> result <span class="kwrd">As</span> <span class="kwrd">Double</span> = <span class="kwrd">Double</span>.Parse(parameter.ToString())
<span class="kwrd">If</span> result > 0 <span class="kwrd">Then</span>
<span class="kwrd">Return</span> <span class="kwrd">CDbl</span>(value) / result
<span class="kwrd">Else</span>
<span class="kwrd">Return</span> <span class="kwrd">CDbl</span>(value)
<span class="kwrd">End</span> <span class="kwrd">If</span>
<span class="kwrd">Else</span>
<span class="kwrd">Return</span> <span class="kwrd">CDbl</span>(value)
<span class="kwrd">End</span> <span class="kwrd">If</span>
<span class="kwrd">End</span> <span class="kwrd">Function</span>
<span class="kwrd">Public</span> <span class="kwrd">Function</span> ConvertBack(value <span class="kwrd">As</span> <span class="kwrd">Object</span>, targetType <span class="kwrd">As</span> Type, parameter <span class="kwrd">As</span> <span class="kwrd">Object</span>, culture <span class="kwrd">As</span> System.Globalization.CultureInfo) <span class="kwrd">As</span> <span class="kwrd">Object</span> <span class="kwrd">Implements</span> IValueConverter.ConvertBack
<span class="kwrd">Throw</span> <span class="kwrd">New</span> Exception(<span class="str">"Not implemented"</span>)
<span class="kwrd">End</span> <span class="kwrd">Function</span>
<span class="kwrd">End</span> <span class="kwrd">Class</span></pre>
</pre>
</div>
<br />
<strong>Example</strong><br />
<div id="codeSnippetWrapper" style="border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; font-family: 'Courier New', courier, monospace; font-size: 8pt; margin: 5px 0px; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;">
<pre class="csharpcode"><pre class="csharpcode"> <span class="kwrd"><</span><span class="html">StackPanel</span> <span class="attr">Orientation</span><span class="kwrd">="Vertical"</span><span class="kwrd">></span>
<span class="kwrd"><</span><span class="html">TextBox</span> <span class="attr">HorizontalAlignment</span><span class="kwrd">="Left"</span> <span class="attr">Margin</span><span class="kwrd">="3"</span> <span class="attr">Width</span><span class="kwrd">="100"</span> <span class="attr">Height</span><span class="kwrd">="25"</span> <span class="attr">Name</span><span class="kwrd">="txtFirst"</span><span class="kwrd">/></span>
<span class="kwrd"><</span><span class="html">TextBox</span> <span class="attr">Name</span><span class="kwrd">="txtSecond"</span> <span class="attr">HorizontalAlignment</span><span class="kwrd">="Left"</span> <span class="attr">Margin</span><span class="kwrd">="3"</span> <span class="attr">Height</span><span class="kwrd">="25"</span> <span class="attr">Width</span><span class="kwrd">="{Binding Path=ActualWidth, ElementName=txtFirst, Converter={StaticResource divideConverter}, ConverterParameter=2.0}"</span><span class="kwrd">/></span>
<span class="kwrd"></</span><span class="html">StackPanel</span><span class="kwrd">></span></pre>
</pre>
</div>
<br />
<div align="justify">
Similar to Multiplication Converter, in the above code in txtSecond textbox we are binding it’s width property to txtFirst textbox width property. So we have set ElementName as <em>txtFirst</em> and Path as <em>ActualWidth. </em>And we want to have txtSecond width half of txtFirst. So we would be setting staticresource of DivideConverter in converter property and “2.0” as ConverterParameter property.</div>
<br />
<div align="justify">
Now in DivideConverter class we would have ActualWidth of txtFirst in value parameter and “2.0” in “parameter” parameter. So we will divide the ActualWidth by “2.0” and return the result.<br />
<br /></div>
<h4>
Subtract Converter</h4>
<div id="codeSnippetWrapper" style="border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; font-family: 'Courier New', courier, monospace; font-size: 8pt; margin: 5px 0px; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;">
<pre class="csharpcode"><pre class="csharpcode"><span class="kwrd">Public</span> <span class="kwrd">Class</span> SubtractConverter
<span class="kwrd">Implements</span> IValueConverter
<span class="kwrd">Public</span> <span class="kwrd">Function</span> Convert(value <span class="kwrd">As</span> <span class="kwrd">Object</span>, targetType <span class="kwrd">As</span> Type, parameter <span class="kwrd">As</span> <span class="kwrd">Object</span>, culture <span class="kwrd">As</span> System.Globalization.CultureInfo) <span class="kwrd">As</span> <span class="kwrd">Object</span> <span class="kwrd">Implements</span> IValueConverter.Convert
<span class="kwrd">If</span> parameter IsNot <span class="kwrd">Nothing</span> <span class="kwrd">Then</span>
<span class="kwrd">Dim</span> result <span class="kwrd">As</span> <span class="kwrd">Double</span> = <span class="kwrd">Double</span>.Parse(parameter.ToString())
<span class="kwrd">Return</span> <span class="kwrd">CDbl</span>(value) - result
<span class="kwrd">Else</span>
<span class="kwrd">Return</span> <span class="kwrd">CDbl</span>(value)
<span class="kwrd">End</span> <span class="kwrd">If</span>
<span class="kwrd">End</span> <span class="kwrd">Function</span>
<span class="kwrd">Public</span> <span class="kwrd">Function</span> ConvertBack(value <span class="kwrd">As</span> <span class="kwrd">Object</span>, targetType <span class="kwrd">As</span> Type, parameter <span class="kwrd">As</span> <span class="kwrd">Object</span>, culture <span class="kwrd">As</span> System.Globalization.CultureInfo) <span class="kwrd">As</span> <span class="kwrd">Object</span> <span class="kwrd">Implements</span> IValueConverter.ConvertBack
<span class="kwrd">Throw</span> <span class="kwrd">New</span> Exception(<span class="str">"Not implemented"</span>)
<span class="kwrd">End</span> <span class="kwrd">Function</span>
<span class="kwrd">End</span> Class</pre>
</pre>
</div>
<br />
<strong>Example</strong><br />
<div id="codeSnippetWrapper" style="border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; font-family: 'Courier New', courier, monospace; font-size: 8pt; margin: 5px 0px; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;">
<pre class="csharpcode"><pre class="csharpcode"><span class="kwrd"><</span><span class="html">StackPanel</span> <span class="attr">Orientation</span><span class="kwrd">="Vertical"</span><span class="kwrd">></span>
<span class="kwrd"><</span><span class="html">TextBox</span> <span class="attr">HorizontalAlignment</span><span class="kwrd">="Left"</span> <span class="attr">Margin</span><span class="kwrd">="3"</span> <span class="attr">Width</span><span class="kwrd">="100"</span> <span class="attr">Height</span><span class="kwrd">="25"</span> <span class="attr">Name</span><span class="kwrd">="txtFirst"</span><span class="kwrd">/></span>
<span class="kwrd"><</span><span class="html">TextBox</span> <span class="attr">Name</span><span class="kwrd">="txtSecond" </span><span class="attr">HorizontalAlignment</span><span class="kwrd">="Left"</span> <span class="attr">Margin</span><span class="kwrd">="3"</span> <span class="attr">Height</span><span class="kwrd">="25"</span> <span class="attr">Width</span><span class="kwrd">="{Binding Path=ActualWidth, ElementName=txtFirst, Converter={StaticResource subtractConverter}, ConverterParameter=15.0}"</span><span class="kwrd">/></span>
<span class="kwrd"></</span><span class="html">StackPanel</span><span class="kwrd">></span></pre>
</pre>
</div>
<div align="justify">
Here we want txtSecond textbox, 15 pixels less than txtFirst. In above code in txtSecond textbox we are binding it’s width property to txtFirst textbox width property. So we have set ElementName as <em>txtFirst</em> and Path as <em>ActualWidth. </em>And as we want to have txtSecond 15 pixels less than txtFirst, we would be setting staticresource of SubtractConveter in converter property and “15.0” as ConverterParameter property.</div>
<br />
Now in SubtractConverter class we would have ActualWidth of txtFirst in value parameter and “15.0” in “parameter” parameter. So we will subtract 15 from ActualWidth and return the result.<br />
<h4>
Note:</h4>
In all the above converters we have to create it’s instance in resource and reference it using their key. For example you can write following code to create instance of SubtractConverter.<br />
<div id="codeSnippetWrapper" style="border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; font-family: 'Courier New', courier, monospace; font-size: 8pt; margin: 5px 0px; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;">
<pre class="csharpcode"><pre class="csharpcode"><span class="kwrd"><</span><span class="html">Window.Resources</span><span class="kwrd">></span>
<span class="kwrd"><</span><span class="html">local:SubtractConverter</span> <span class="attr">x:Key</span><span class="kwrd">="subtractConverter"</span> <span class="kwrd">/></span>
<span class="kwrd"></</span><span class="html">Window.Resources</span><span class="kwrd">></span></pre>
</pre>
</div>
</div>
Gaurav Khannahttp://www.blogger.com/profile/04250008487377659924noreply@blogger.com0tag:blogger.com,1999:blog-4682504245579959231.post-14004238877254782112012-02-26T14:28:00.000+05:302012-02-27T14:29:39.912+05:30Microsoft Forums Mobile Application<p align="justify">Microsoft Customer Services and Support have launch of Microsoft Forums Mobile Application. The web version of this application is available for all smart phones that support HTML5, in the web browser.</p> <p align="justify">“Microsoft Forums” Application allows you access MSDN, TechNet and Office365 forums directly right from your mobile devices. You can keep on track with the hottest topics, your own threads, favorite forums, in search with major topics, FAQs, and the latest news from OneCode & OneScript. Microsoft Forums connects you with our forum communities like never before. Access now and get started with all the Microsoft Forums<b> </b>right in your palms @ <a href="http://aka.ms/msforums">Aka.ms/msforums</a> <p align="justify"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5krd-xsKPCBazkvlMU7bhH0Ly9ZPCSNcE_zOqizf6mWaMqPPjKxHyiAqI58B_Qjh-gObJJfKnh7OOgifTgKLfznAuupDZ6JffgWEdbbWpUbIpE0AU-9Xezk-ktcbGFNrQAvZ380OLqCDH/s1600-h/MicrosoftForumFeatures%25255B7%25255D.jpg"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="MicrosoftForumFeatures" border="0" alt="MicrosoftForumFeatures" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7z5dim7kX6JnjSzgNW3s-5S68XCHouMnHUBdTbpQ8hGNtX5PUklgZSEKTGZYBKc4hDnN_scnW1lwpPpWo-umFCxv2f0rjbLIT_PXtnlOsLqpHfUl0x3jwUhvxGXsdAQG0gNSWTAh3n30I/?imgmax=800" width="521" height="516"></a> <p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUoSg7Oo1dUvg8WBsruJZfiTh_hX-jOMNNoeFAbjWQqB8_RUCBPypAfQglYMqbpWggHKfWVkNXiezXdkLZq608Ysl9WjQCZtW5skgqLWnJhrhKuRr_S8zNBCbwvevatoxyXrQTt3KzuRWV/s1600-h/Capture%25255B4%25255D.jpg"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="Capture" border="0" alt="Capture" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgf0bt2mzcv4JenOB4cmmQllAGVtGPeZY_QOM3CobZM3FWUXGpc-GlmqPNdolANCMLUiOlV_bAFZ9PS3ys10Ou_jUCrQdACqbmk8kSTodrlkDeHzdFU-oMSH_P_SNwzFEwLLK3xPFJ8t9Ms/?imgmax=800" width="522" height="486"></a></p> <p align="justify">By simply inserting your Forum Display Name in the Settings Menu, without further saving. It’s done! For better experience, Wifi or 3G network environment is preferable. <p>Also, experience “Microsoft Forums” from your PC desktop: <p><a href="http://www.microsoft.com/download/en/details.aspx?id=27747">MSDN Gadget</a> <a href="http://www.microsoft.com/download/en/details.aspx?id=27747">TechNet Gadget</a> <a href="http://www.microsoft.com/download/en/details.aspx?id=27547">Office 365 Gadget</a></p> Gaurav Khannahttp://www.blogger.com/profile/04250008487377659924noreply@blogger.com0tag:blogger.com,1999:blog-4682504245579959231.post-45820752567962308912012-02-04T00:15:00.001+05:302012-02-04T00:15:04.689+05:30Windows Phone Camp in Ahmedabad<p align="justify">Windows Phone Camp is coming to Ahmedabad on February 24, 2012. Developers and Designers can directly interact with domain experts in this event. These experts will share their knowledge, answer questions which could be helpful to everyone in creating future Windows Phone app and games.</p> <h4>Event Agenda</h4><br> <table border="0" cellspacing="0" cellpadding="2" width="479"> <tbody> <tr> <td style="background-color: #f3a447" valign="top" width="141"><strong>Time</strong></td> <td style="background-color: #f3a447" valign="top" width="336"><strong>Session</strong></td></tr> <tr> <td valign="top" width="141">09:00am - 10:00am</td> <td valign="top" width="336">Registration</td></tr> <tr> <td valign="top" width="141">10:00am - 11:00am</td> <td valign="top" width="336">The Windows Phone opportunity</td></tr> <tr> <td valign="top" width="141">11:00am - 12:00pm</td> <td valign="top" width="336">Getting Started - tools & marketplace</td></tr> <tr> <td valign="top" width="141">12:00pm - 01:00pm</td> <td valign="top" width="336">Designing Applications for Windows Phone</td></tr> <tr> <td valign="top" width="141">02:00pm - 03:00pm</td> <td valign="top" width="336">Developing Applications for Windows Phone</td></tr> <tr> <td valign="top" width="141">03:00pm - 04:00pm</td> <td valign="top" width="336">Making your application submission ready</td></tr></tbody></table> <p><strong>Venue: </strong>Le Meridien, Near Nehru Bridge, Ahmedabad, Gujarat </p> <p>You can find more details about the event from following link </p> <p> <table border="0" cellspacing="0" cellpadding="2" width="456"> <tbody> <tr> <td valign="top" width="99"> <p align="center"><a href="http://www.microsoft.com/india/events/windowsphonecamps/Default.aspx" target="_blank">Event Page</a></p></td> <td valign="top" width="109"> <p align="center"><a href="http://www.microsoft.com/india/events/windowsphonecamps/speakers.aspx" target="_blank">Speaker</a></p></td> <td valign="top" width="120"> <p align="center"><a href="http://www.microsoft.com/india/events/windowsphonecamps/event-agenda.aspx" target="_blank">Event Agenda</a></p></td> <td valign="top" width="126"> <p align="center"><a href="http://www.microsoft.com/india/events/windowsphonecamps/registration.aspx" target="_blank">Registration</a></p></td></tr></tbody></table></p> Gaurav Khannahttp://www.blogger.com/profile/04250008487377659924noreply@blogger.com0tag:blogger.com,1999:blog-4682504245579959231.post-25298472567790902052012-01-02T12:09:00.001+05:302012-01-02T12:12:25.439+05:30Microsoft MVP Hat-trick<p align="justify">I am proud to announce that I am awarded Microsoft MVP for the third consecutive year in VB.NET Category. I would like to thank <a href="http://abhishekkant.net" target="_blank">Mr. Abhishek Kant</a> and <a href="https://www.facebook.com/MVPAwardProgram" target="_blank">Microsoft MVP Community</a>, without their support this journey would be quite difficult to achieve. I got this award because of my contribution on <a href="http://social.msdn.microsoft.com/profile/khanna%20gaurav" target="_blank">MSDN Forum</a> so I would like to thank all the Moderators and MSFT associated with the forum. Also congratulation to all the new and renewed MVP awarded in this quarter.</p> <p align="justify"><strong>Email from Microsoft</strong></p> <blockquote> <p><em>Dear Gaurav Khanna,</em></p> <p align="justify"><em>Congratulations! We are pleased to present you with the 2012 Microsoft® MVP Award! This award is given to exceptional technical community leaders who actively share their high quality, real world expertise with others. We appreciate your outstanding contributions in Visual Basic technical communities during the past year.</em></p> <p align="justify"><em>The Microsoft MVP Award provides us the unique opportunity to celebrate and honor your significant contributions and say "Thank you for your technical leadership."</em></p> <p><em>Nestor Portillo<br>Director<br>Community & Online Support</em></p></blockquote> <p><strong>What is MVP Award?</strong></p> <p align="justify">The Microsoft Most Valuable Professional (MVP) is the award given by Microsoft to those it considers "the best from technology communities around the world who actively share their technical expertise with the community and with Microsoft. An MVP is awarded for contributions over the previous year. Each year, around 4,000 MVPs are honoured.</p> <p align="justify">More information about the Microsoft MVP Program are available on following links</p> <ul> <li> <div align="justify"><a href="http://microsoft.com/mvp" target="_blank">Microsoft MVP Site</a></div> <li> <div align="justify"><a href="http://www.youtube.com/watch?v=wYbUsFN1QWI" target="_blank">YouTube Video</a></div> <li> <div align="justify"><a href="http://blogs.msdn.com/b/mvpawardprogram/archive/2012/01/01/congratulations-to-the-first-new-and-re-awarded-mvp-awardees-of-2012.aspx" target="_blank">MVPAward Program Blog</a></div></li></ul> Gaurav Khannahttp://www.blogger.com/profile/04250008487377659924noreply@blogger.com2tag:blogger.com,1999:blog-4682504245579959231.post-14180765073554912352011-12-09T00:49:00.000+05:302011-12-10T00:49:54.114+05:30ApplicationContext to run background task<p align="justify">Many of times we need to create an application which need to run in background and doesn’t require a form or a GUI. We have an option of creating a Windows Service but sometime it’s difficult to use it for a normal user. So in this situation we have an option of creating an application by inheriting a ApplicationContext class which is available in Windows Form. </p> <p align="justify">To create a project to run a background task we can perform following steps</p> <ol> <li> <div align="justify">Create a new Windows Form project </div> <li> <div align="justify">Delete the available Forms and Application class. </div> <li> <div align="justify">Create a new class which will inherit ApplicationContext where we can perform background task.</div> <li> <div align="justify">Create a new module which will contain main method to run the application.</div></li></ol> <p align="justify">Below is a simple example where we are inheriting ApplicationContext class. In the constructor of class we are starting a new thread where we can perform some long running task and when the task get completed we can call ExitThread which will close the application.</p><pre class="code"><span style="color: blue">Public Class </span><span style="color: #2b91af">CustomApplicationContext<br /> </span><span style="color: blue">Inherits </span><span style="color: #2b91af">ApplicationContext<br /><br /> </span><span style="color: blue">Public Sub New</span>()<br /> <span style="color: blue">MyBase</span>.New()<br /><br /> <span style="color: blue">Try<br /> Dim </span>th <span style="color: blue">As New </span><span style="color: #2b91af">Thread</span>(<span style="color: blue">AddressOf </span>StartBackgroundTask)<br /> th.Start()<br /> <span style="color: blue">Catch </span>ex <span style="color: blue">As </span><span style="color: #2b91af">IOException<br /> </span>ExitThread()<br /> <span style="color: blue">End Try<br /> End Sub<br /><br /> Private Sub </span>StartBackgroundTask()<br /> <span style="color: blue">Try<br /> </span><span style="color: green">'Some background Task<br /> </span><span style="color: blue">For </span>i <span style="color: blue">As Integer </span>= 0 <span style="color: blue">To </span>5<br /> Threading.<span style="color: #2b91af">Thread</span>.Sleep(1000)<br /> <span style="color: blue">Next<br /> Finally<br /><br /> </span><span style="color: green">'Task completed. Close the application<br /> </span>ExitThread()<br /> <span style="color: blue">End Try<br /> End Sub<br />End Class<br /></span></pre><br /><p align="justify">We also have to create a new Module which will contain Main method to start the application using Application.Run and having CustomApplicationContext class as it’s parameter.</p><pre class="code"><span style="color: blue">Module </span><span style="color: #2b91af">MainModule<br /> </span><span style="color: blue">Public Sub </span>Main()<br /> <span style="color: blue">Dim </span>context <span style="color: blue">As New </span><span style="color: #2b91af">CustomApplicationContext<br /> Application</span>.Run(context)<br /> <span style="color: blue">End Sub<br />End Module<br /></span></pre><br /><p>Download Code: <a href="https://skydrive.live.com/embed?cid=C32051ECA7C55D97&resid=C32051ECA7C55D97%21137&authkey=AO9CoGsPIIuO1Rg\" target="_blank">CustomApplicationContext.rar</a></p> Gaurav Khannahttp://www.blogger.com/profile/04250008487377659924noreply@blogger.com0tag:blogger.com,1999:blog-4682504245579959231.post-19586064818553143302011-11-29T19:24:00.000+05:302011-11-29T19:47:28.189+05:30Multiple Columns in WPF ListBox<p align="justify">In this article we will discuss ways to have multiple columns in WPF ListBox control and layout the ListBox such that each row has 3 items. All WPF controls deriving from ItemsControl provide an ItemsPanel property that allows us to replace the internal layout panel that arranges the items. So to have multiple columns in a ListBox we have to change the ItemsPanel property of the control. </p> <p align="justify"><strong>WrapPanel</strong></p> <p align="justify">One of the most simple way of displaying content horizontally in ListBox is to have WrapPanel in ItemsPanel property of Listbox. But if we need to display fixed number of items in a row then we have to disable the horizontal scrollBar so that item get wrap to next row and set fixed width for ListBox. But as item get wrap the ListBoxItem are not positioned uniformly. So we have to set Width for each ListBoxItem so that all the items are positioned in a tabular way.</p> <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; font-size: 8pt; border-top: silver 1px solid; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"><pre class="code"><span style="color: blue"> <</span><span style="color: #a31515">ListBox </span><span style="color: red">Width</span><span style="color: blue">="300" </span><span style="color: red">ScrollViewer.HorizontalScrollBarVisibility</span><span style="color: blue">="Disabled"><br /> <</span><span style="color: #a31515">ListBox.ItemsPanel</span><span style="color: blue">><br /> <</span><span style="color: #a31515">ItemsPanelTemplate</span><span style="color: blue">><br /> <</span><span style="color: #a31515">WrapPanel </span><span style="color: red">Orientation</span><span style="color: blue">="Horizontal"/><br /> </</span><span style="color: #a31515">ItemsPanelTemplate</span><span style="color: blue">><br /> </</span><span style="color: #a31515">ListBox.ItemsPanel</span><span style="color: blue">><br /> <br /> <</span><span style="color: #a31515">ListBoxItem </span><span style="color: red">Content</span><span style="color: blue">="Visual Basic" </span><span style="color: red">Width</span><span style="color: blue">="80"/><br /> <</span><span style="color: #a31515">ListBoxItem </span><span style="color: red">Content</span><span style="color: blue">="Silverlight" </span><span style="color: red">Width</span><span style="color: blue">="80"/><br /> <</span><span style="color: #a31515">ListBoxItem </span><span style="color: red">Content</span><span style="color: blue">="ASP.NET" </span><span style="color: red">Width</span><span style="color: blue">="80"/><br /> <</span><span style="color: #a31515">ListBoxItem </span><span style="color: red">Content</span><span style="color: blue">="WCF" </span><span style="color: red">Width</span><span style="color: blue">="80"/><br /> <</span><span style="color: #a31515">ListBoxItem </span><span style="color: red">Content</span><span style="color: blue">="Web Services" </span><span style="color: red">Width</span><span style="color: blue">="80"/><br /> <</span><span style="color: #a31515">ListBoxItem </span><span style="color: red">Content</span><span style="color: blue">="Windows Service" </span><span style="color: red">Width</span><span style="color: blue">="80"/><br /> </</span><span style="color: #a31515">ListBox</span><span style="color: blue">><br /></span></pre></div><br /><p><strong>UniformGrid</strong></p><br /><p align="justify">One of the drawback with WrapPanel was we had to disable horizontal scrollbar, set Width for ListBox and also width for ListBoxItem. So we can use UniformGrid instead of WrapPanel in ItemsPanel property and set Columns property of it to the number of items we need to display in a row. Using UniformGrid all the items in the ListBox will have same width and height.</p><br /><div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; font-size: 8pt; border-top: silver 1px solid; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"><pre class="code"> <span style="color: blue"><</span><span style="color: #a31515">ListBox</span><span style="color: blue">><br /> <</span><span style="color: #a31515">ListBox.ItemsPanel</span><span style="color: blue">><br /> <</span><span style="color: #a31515">ItemsPanelTemplate</span><span style="color: blue">><br /> <</span><span style="color: #a31515">UniformGrid </span><span style="color: red">Columns</span><span style="color: blue">="3"/><br /> </</span><span style="color: #a31515">ItemsPanelTemplate</span><span style="color: blue">><br /> </</span><span style="color: #a31515">ListBox.ItemsPanel</span><span style="color: blue">><br /> <br /> <</span><span style="color: #a31515">ListBoxItem </span><span style="color: red">Content</span><span style="color: blue">="Visual Basic" /><br /> <</span><span style="color: #a31515">ListBoxItem </span><span style="color: red">Content</span><span style="color: blue">="Silverlight" /><br /> <</span><span style="color: #a31515">ListBoxItem </span><span style="color: red">Content</span><span style="color: blue">="ASP.NET" /><br /> <</span><span style="color: #a31515">ListBoxItem </span><span style="color: red">Content</span><span style="color: blue">="WCF" /><br /> <</span><span style="color: #a31515">ListBoxItem </span><span style="color: red">Content</span><span style="color: blue">="Web Services" /><br /> <</span><span style="color: #a31515">ListBoxItem </span><span style="color: red">Content</span><span style="color: blue">="Windows Service" /><br /> </</span><span style="color: #a31515">ListBox</span><span style="color: blue">><br /></span></pre></div><strong>Grid</strong><br><br /><p align="justify">Although UniformGrid is the best solution for multiple column ListBox but sometime we don’t want all the columns in the ListBox of same size. Also in some scenario we could have a requirement where we need to merge two or more columns (or rows) for a larger text. In this situation using Grid is very useful option. </p><br /><div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; font-size: 8pt; border-top: silver 1px solid; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"><pre class="code"> <span style="color: blue"><</span><span style="color: #a31515">ListBox</span><span style="color: blue">><br /> <</span><span style="color: #a31515">ListBox.ItemsPanel</span><span style="color: blue">><br /> <</span><span style="color: #a31515">ItemsPanelTemplate</span><span style="color: blue">><br /> <</span><span style="color: #a31515">Grid</span><span style="color: blue">><br /> <</span><span style="color: #a31515">Grid.RowDefinitions</span><span style="color: blue">><br /> <</span><span style="color: #a31515">RowDefinition </span><span style="color: red">Height</span><span style="color: blue">="*"/><br /> <</span><span style="color: #a31515">RowDefinition </span><span style="color: red">Height</span><span style="color: blue">="*"/><br /> <</span><span style="color: #a31515">RowDefinition </span><span style="color: red">Height</span><span style="color: blue">="*"/><br /> </</span><span style="color: #a31515">Grid.RowDefinitions</span><span style="color: blue">><br /> <</span><span style="color: #a31515">Grid.ColumnDefinitions</span><span style="color: blue">><br /> <</span><span style="color: #a31515">ColumnDefinition </span><span style="color: red">Width</span><span style="color: blue">="0.8*"/><br /> <</span><span style="color: #a31515">ColumnDefinition </span><span style="color: red">Width</span><span style="color: blue">="*"/><br /> <</span><span style="color: #a31515">ColumnDefinition </span><span style="color: red">Width</span><span style="color: blue">="Auto"/><br /> </</span><span style="color: #a31515">Grid.ColumnDefinitions</span><span style="color: blue">><br /> </</span><span style="color: #a31515">Grid</span><span style="color: blue">><br /> </</span><span style="color: #a31515">ItemsPanelTemplate</span><span style="color: blue">><br /> </</span><span style="color: #a31515">ListBox.ItemsPanel</span><span style="color: blue">><br /><br /> <</span><span style="color: #a31515">ListBoxItem </span><span style="color: red">Content</span><span style="color: blue">="WCF" </span><span style="color: red">Grid.Row</span><span style="color: blue">="0" </span><span style="color: red">Grid.Column</span><span style="color: blue">="0"/><br /> <</span><span style="color: #a31515">ListBoxItem </span><span style="color: red">Content</span><span style="color: blue">="ASP.NET" </span><span style="color: red">Grid.Row</span><span style="color: blue">="0" </span><span style="color: red">Grid.Column</span><span style="color: blue">="1"/><br /> <</span><span style="color: #a31515">ListBoxItem </span><span style="color: red">Content</span><span style="color: blue">="VB.NET" </span><span style="color: red">Grid.Row</span><span style="color: blue">="0" </span><span style="color: red">Grid.Column</span><span style="color: blue">="2"/><br /> <</span><span style="color: #a31515">ListBoxItem </span><span style="color: red">Content</span><span style="color: blue">="Silverlight" </span><span style="color: red">Grid.Row</span><span style="color: blue">="1" </span><span style="color: red">Grid.Column</span><span style="color: blue">="0"/><br /> <</span><span style="color: #a31515">ListBoxItem </span><span style="color: red">Content</span><span style="color: blue">="Web Services" </span><span style="color: red">Grid.Row</span><span style="color: blue">="1" </span><span style="color: red">Grid.Column</span><span style="color: blue">="1"/><br /> <</span><span style="color: #a31515">ListBoxItem </span><span style="color: red">Content</span><span style="color: blue">="Windows Service" </span><span style="color: red">Grid.Row</span><span style="color: blue">="1" </span><span style="color: red">Grid.Column</span><span style="color: blue">="2"/><br /> <</span><span style="color: #a31515">ListBoxItem </span><span style="color: red">Content</span><span style="color: blue">="Windows Presentation Foundation" </span><span style="color: red">Grid.Row</span><span style="color: blue">="2" </span><span style="color: red">Grid.ColumnSpan</span><span style="color: blue">="3"/><br /> </</span><span style="color: #a31515">ListBox</span><span style="color: blue">><br /></span></pre></div><br /><p align="justify">Only headache of using Grid in ItemsPanel is that we have to set RowDefinitions and ColumnDefinitions for the Grid. Also we have to set the Grid.Row and Grid.Column for each item to position them in the ListBox. But in some scenario as described above it is very useful.</p> Gaurav Khannahttp://www.blogger.com/profile/04250008487377659924noreply@blogger.com0tag:blogger.com,1999:blog-4682504245579959231.post-78945230310355519132011-11-06T11:00:00.000+05:302011-11-07T12:15:16.660+05:30I unlock Joy<p align="justify">At the recent Mobile Developer Summit which took place on November 2, 2011 at Bangalore Microsoft announced the details of the developer programme for Windows Mobile in India with <b>‘I unlock Joy’</b>, a unique<b> </b>Application Development and Submission Program, where technology professionals and students get an opportunity to develop applications and showcase creativity. <p align="justify"><b>‘I unlock Joy’ </b>programme for developers has started from November 1, 2011 and will continue till June 30, 2012 whereas the program for students will begin on December 18, 2011 and conclude on March 30 next year. <p align="justify"><b></b> <p align="justify"><b>Developer competitive categories:</b> <p align="justify">· <b>“SUBMIT & WIN” CATEGORY</b>: A registered participant submits <b>THREE </b>qualified Windows Phone Application in the Marketplace and gets a chance to win a Windows Phone. In this category, the Applications must be distinct and of non-trivial utility value for the Application User. <p align="justify">· <b>“PORT 2 APPS & WIN” CATEGORY</b>: A registered participant submitting <b>TWO </b>qualified Windows Phone Applications in the Marketplace which are ported from existing Android or iPhone Applications get to win a Windows Phone. <p align="justify">· <b>“WOMEN SPECIAL” CATEGORY</b>: A first of its kind in the developer space. The first 100 registered Woman Developers who submit <b>ONE (1)</b> qualified Windows Phone Application each in the Marketplace qualify to win a Windows Phone each. The applications can be based on Entertainment, Fashion, Leisure, Sports, Recreation or Travel themes. <p align="justify"><b>Student competitive categories:</b> <p align="justify"><b></b> <p align="justify">· <b>“STUDENT” CATEGORY: </b>Calling on the community to be a part of the initiative, the “I unlock Joy” programme is customized to unfold their innovative and creative best and become among the select first few proud owners of the Windows Phone. <p align="justify">The contestants need to build one or more applications using <a href="http://create.msdn.com/en-us/home/getting_started">Dev Tools</a> and submit on AppHub. If their apps get certified and published on the Windows Phone Marketplace during the contest period which ends November 18, they can <a href="http://www.microsoft.com/india/student/windowsphone/#youget">claim goodies</a> like a brand new Windows Phone, certificate of acknowledgment from Microsoft and Windows Phone T-Shirts as well as USB flash drives. <p align="justify">You can find more information from official Website <p align="justify"><a href="http://www.microsoft.com/india/iunlockjoy/">http://www.microsoft.com/india/iunlockjoy/</a></p> Gaurav Khannahttp://www.blogger.com/profile/04250008487377659924noreply@blogger.com0tag:blogger.com,1999:blog-4682504245579959231.post-82002618357203937282011-10-02T19:35:00.000+05:302012-10-18T12:58:59.149+05:30WPF Collapsible Panel<div dir="ltr" style="text-align: left;" trbidi="on">
<div align="justify">
In this article I have describe way to create a collapsible panel in WPF. This is one of the most common questions asked by many developers. Collapsible Panel can be used by user to collapse the content which he doesn't want to use and see only core information and hence keep the screen clean.</div>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjd-ub_HQJs7qYLSEmhDlfurIO4Uhf8KsCScu3OyMh04kq7IxxCHUnvrr2d1qhAsdGLzkQPKxX37nTB1EOPmusxx__HLC-0Krj4TgU0I-GLWn33yasVDuMq6fbSlVB05mYxm5R5ob7fD3yt/s1600-h/WPFCollapsiblePanel3.jpg"><img alt="WPFCollapsiblePanel" border="0" height="294" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEissBTiOCIPP8RpY4XaNIlKeQwLDkx-xx5xa1z5sK88jMbZWE_igEjC-q_numBc_Keo5rkRFs6LTJsNIyYUbQItar3flKCB2COsYdBNMicBeg4rvQfNvidz_LZoaMvCgIouz-ZMvJrSSjcx/?imgmax=800" style="background-image: none; border-width: 0px; display: block; float: none; margin: 5px auto; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="WPFCollapsiblePanel" width="411" /></a><br />
This sample inherits the Expander control which is available in WPF. It support panel collapse in all the four directions (left, right, top and bottom).<br />
<div id="codeSnippetWrapper" style="border: 1px solid silver; font-family: "Courier New", courier, monospace; font-size: 8pt; margin: 20px 0px 10px; padding: 4px; text-align: left; width: 97.5%;">
<pre class="code"><span style="color: blue;">public class </span><span style="color: #2b91af;">CollapsiblePanel </span>: <span style="color: #2b91af;">Expander
</span>{
<span style="color: blue;">static </span>CollapsiblePanel()
{
DefaultStyleKeyProperty.OverrideMetadata(<span style="color: blue;">typeof</span>(<span style="color: #2b91af;">CollapsiblePanel</span>), <span style="color: blue;">new </span><span style="color: #2b91af;">FrameworkPropertyMetadata</span>(<span style="color: blue;">typeof</span>(<span style="color: #2b91af;">CollapsiblePanel</span>)));
}
}
</pre>
</div>
<br />
Here is the XAML for CollapsiblePanel<br />
<br />
<div id="codeSnippetWrapper" style="border: 1px solid silver; font-family: "Courier New", courier, monospace; font-size: 8pt; margin: 20px 0px 10px; padding: 4px; text-align: left; width: 97.5%;">
<pre class="code"><span style="color: blue;"><</span><span style="color: #a31515;">ResourceDictionary
</span><span style="color: red;">xmlns</span><span style="color: blue;">="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
</span><span style="color: red;">xmlns</span><span style="color: blue;">:</span><span style="color: red;">x</span><span style="color: blue;">="http://schemas.microsoft.com/winfx/2006/xaml" </span><span style="color: red;">xmlns</span><span style="color: blue;">:</span><span style="color: red;">sys</span><span style="color: blue;">="clr-namespace:System;assembly=mscorlib"
</span><span style="color: red;">xmlns</span><span style="color: blue;">:</span><span style="color: red;">local</span><span style="color: blue;">="clr-namespace:CollapsiblePanelDemo">
<</span><span style="color: #a31515;">local</span><span style="color: blue;">:</span><span style="color: #a31515;">MultiplyConverter </span><span style="color: red;">x</span><span style="color: blue;">:</span><span style="color: red;">Key</span><span style="color: blue;">="multiplyConverter" />
<</span><span style="color: #a31515;">Style </span><span style="color: red;">x</span><span style="color: blue;">:</span><span style="color: red;">Key</span><span style="color: blue;">="ExpanderHeaderFocusVisual">
<</span><span style="color: #a31515;">Setter </span><span style="color: red;">Property</span><span style="color: blue;">="Control.Template">
<</span><span style="color: #a31515;">Setter.Value</span><span style="color: blue;">>
<</span><span style="color: #a31515;">ControlTemplate</span><span style="color: blue;">>
<</span><span style="color: #a31515;">Border</span><span style="color: blue;">>
<</span><span style="color: #a31515;">Rectangle </span><span style="color: red;">SnapsToDevicePixels</span><span style="color: blue;">="true" </span><span style="color: red;">Margin</span><span style="color: blue;">="0" </span><span style="color: red;">Stroke</span><span style="color: blue;">="Black" </span><span style="color: red;">StrokeDashArray</span><span style="color: blue;">="1 2" </span><span style="color: red;">StrokeThickness</span><span style="color: blue;">="1" />
</</span><span style="color: #a31515;">Border</span><span style="color: blue;">>
</</span><span style="color: #a31515;">ControlTemplate</span><span style="color: blue;">>
</</span><span style="color: #a31515;">Setter.Value</span><span style="color: blue;">>
</</span><span style="color: #a31515;">Setter</span><span style="color: blue;">>
</</span><span style="color: #a31515;">Style</span><span style="color: blue;">>
<</span><span style="color: #a31515;">Style </span><span style="color: red;">x</span><span style="color: blue;">:</span><span style="color: red;">Key</span><span style="color: blue;">="ExpanderUpHeaderStyle" </span><span style="color: red;">TargetType</span><span style="color: blue;">="{</span><span style="color: #a31515;">x</span><span style="color: blue;">:</span><span style="color: #a31515;">Type </span><span style="color: red;">ToggleButton</span><span style="color: blue;">}">
<</span><span style="color: #a31515;">Setter </span><span style="color: red;">Property</span><span style="color: blue;">="Template">
<</span><span style="color: #a31515;">Setter.Value</span><span style="color: blue;">>
<</span><span style="color: #a31515;">ControlTemplate </span><span style="color: red;">TargetType</span><span style="color: blue;">="{</span><span style="color: #a31515;">x</span><span style="color: blue;">:</span><span style="color: #a31515;">Type </span><span style="color: red;">ToggleButton</span><span style="color: blue;">}">
<</span><span style="color: #a31515;">Border </span><span style="color: red;">Padding</span><span style="color: blue;">="{</span><span style="color: #a31515;">TemplateBinding </span><span style="color: red;">Padding</span><span style="color: blue;">}">
<</span><span style="color: #a31515;">Grid </span><span style="color: red;">Background</span><span style="color: blue;">="Transparent" </span><span style="color: red;">SnapsToDevicePixels</span><span style="color: blue;">="False">
<</span><span style="color: #a31515;">Grid.LayoutTransform</span><span style="color: blue;">>
<</span><span style="color: #a31515;">RotateTransform </span><span style="color: red;">Angle</span><span style="color: blue;">="90"/>
</</span><span style="color: #a31515;">Grid.LayoutTransform</span><span style="color: blue;">>
<</span><span style="color: #a31515;">Path </span><span style="color: red;">x</span><span style="color: blue;">:</span><span style="color: red;">Name</span><span style="color: blue;">="trapazoid" </span><span style="color: red;">Fill</span><span style="color: blue;">="{</span><span style="color: #a31515;">Binding </span><span style="color: red;">Path</span><span style="color: blue;">=Background, </span><span style="color: red;">RelativeSource</span><span style="color: blue;">={</span><span style="color: #a31515;">RelativeSource </span><span style="color: red;">FindAncestor</span><span style="color: blue;">, </span><span style="color: red;">AncestorType</span><span style="color: blue;">=local:CollapsiblePanel}}" </span><span style="color: red;">HorizontalAlignment</span><span style="color: blue;">="Center" </span><span style="color: red;">VerticalAlignment</span><span style="color: blue;">="Center">
<</span><span style="color: #a31515;">Path.Data</span><span style="color: blue;">>
<</span><span style="color: #a31515;">PathGeometry</span><span style="color: blue;">>
<</span><span style="color: #a31515;">PathGeometry.Figures</span><span style="color: blue;">>
<</span><span style="color: #a31515;">PathFigure </span><span style="color: red;">StartPoint</span><span style="color: blue;">="0,0" >
<</span><span style="color: #a31515;">PathFigure.Segments</span><span style="color: blue;">>
<</span><span style="color: #a31515;">ArcSegment </span><span style="color: red;">Size</span><span style="color: blue;">="25,25" </span><span style="color: red;">RotationAngle</span><span style="color: blue;">="45" </span><span style="color: red;">IsLargeArc</span><span style="color: blue;">="False" </span><span style="color: red;">SweepDirection</span><span style="color: blue;">="Clockwise" </span><span style="color: red;">Point</span><span style="color: blue;">="0,48"/>
</</span><span style="color: #a31515;">PathFigure.Segments</span><span style="color: blue;">>
</</span><span style="color: #a31515;">PathFigure </span><span style="color: blue;">>
</</span><span style="color: #a31515;">PathGeometry.Figures</span><span style="color: blue;">>
</</span><span style="color: #a31515;">PathGeometry</span><span style="color: blue;">>
</</span><span style="color: #a31515;">Path.Data</span><span style="color: blue;">>
</</span><span style="color: #a31515;">Path</span><span style="color: blue;">>
<</span><span style="color: #a31515;">Path </span><span style="color: red;">x</span><span style="color: blue;">:</span><span style="color: red;">Name</span><span style="color: blue;">="arrow" </span><span style="color: red;">Data</span><span style="color: blue;">="M 1,1.5 L 9,9 L 1,16 1, 1" </span><span style="color: red;">HorizontalAlignment</span><span style="color: blue;">="Center" </span><span style="color: red;">SnapsToDevicePixels</span><span style="color: blue;">="false" </span><span style="color: red;">Fill</span><span style="color: blue;">="{</span><span style="color: #a31515;">Binding </span><span style="color: red;">Path</span><span style="color: blue;">=BorderBrush, </span><span style="color: red;">RelativeSource</span><span style="color: blue;">={</span><span style="color: #a31515;">RelativeSource </span><span style="color: red;">FindAncestor</span><span style="color: blue;">, </span><span style="color: red;">AncestorType</span><span style="color: blue;">=local:CollapsiblePanel}}" </span><span style="color: red;">StrokeThickness</span><span style="color: blue;">="2" </span><span style="color: red;">VerticalAlignment</span><span style="color: blue;">="Center"/>
</</span><span style="color: #a31515;">Grid</span><span style="color: blue;">>
</</span><span style="color: #a31515;">Border</span><span style="color: blue;">>
<</span><span style="color: #a31515;">ControlTemplate.Triggers</span><span style="color: blue;">>
<</span><span style="color: #a31515;">Trigger </span><span style="color: red;">Property</span><span style="color: blue;">="IsChecked" </span><span style="color: red;">Value</span><span style="color: blue;">="true">
<</span><span style="color: #a31515;">Setter </span><span style="color: red;">Property</span><span style="color: blue;">="Data" </span><span style="color: red;">TargetName</span><span style="color: blue;">="arrow" </span><span style="color: red;">Value</span><span style="color: blue;">="M 9,1 L 1,8 L 9,16, 9,1"/>
</</span><span style="color: #a31515;">Trigger</span><span style="color: blue;">>
</</span><span style="color: #a31515;">ControlTemplate.Triggers</span><span style="color: blue;">>
</</span><span style="color: #a31515;">ControlTemplate</span><span style="color: blue;">>
</</span><span style="color: #a31515;">Setter.Value</span><span style="color: blue;">>
</</span><span style="color: #a31515;">Setter</span><span style="color: blue;">>
</</span><span style="color: #a31515;">Style</span><span style="color: blue;">>
<</span><span style="color: #a31515;">Style </span><span style="color: red;">x</span><span style="color: blue;">:</span><span style="color: red;">Key</span><span style="color: blue;">="ExpanderLeftHeaderStyle" </span><span style="color: red;">TargetType</span><span style="color: blue;">="{</span><span style="color: #a31515;">x</span><span style="color: blue;">:</span><span style="color: #a31515;">Type </span><span style="color: red;">ToggleButton</span><span style="color: blue;">}">
<</span><span style="color: #a31515;">Setter </span><span style="color: red;">Property</span><span style="color: blue;">="Template">
<</span><span style="color: #a31515;">Setter.Value</span><span style="color: blue;">>
<</span><span style="color: #a31515;">ControlTemplate </span><span style="color: red;">TargetType</span><span style="color: blue;">="{</span><span style="color: #a31515;">x</span><span style="color: blue;">:</span><span style="color: #a31515;">Type </span><span style="color: red;">ToggleButton</span><span style="color: blue;">}">
<</span><span style="color: #a31515;">Border </span><span style="color: red;">Padding</span><span style="color: blue;">="{</span><span style="color: #a31515;">TemplateBinding </span><span style="color: red;">Padding</span><span style="color: blue;">}">
<</span><span style="color: #a31515;">Grid </span><span style="color: red;">Background</span><span style="color: blue;">="Transparent" </span><span style="color: red;">SnapsToDevicePixels</span><span style="color: blue;">="False">
<</span><span style="color: #a31515;">Path </span><span style="color: red;">x</span><span style="color: blue;">:</span><span style="color: red;">Name</span><span style="color: blue;">="trapazoid" </span><span style="color: red;">Fill</span><span style="color: blue;">="{</span><span style="color: #a31515;">Binding </span><span style="color: red;">Path</span><span style="color: blue;">=Background, </span><span style="color: red;">RelativeSource</span><span style="color: blue;">={</span><span style="color: #a31515;">RelativeSource </span><span style="color: red;">FindAncestor</span><span style="color: blue;">, </span><span style="color: red;">AncestorType</span><span style="color: blue;">=local:CollapsiblePanel}}" </span><span style="color: red;">HorizontalAlignment</span><span style="color: blue;">="Center" </span><span style="color: red;">VerticalAlignment</span><span style="color: blue;">="Center">
<</span><span style="color: #a31515;">Path.Data</span><span style="color: blue;">>
<</span><span style="color: #a31515;">PathGeometry</span><span style="color: blue;">>
<</span><span style="color: #a31515;">PathGeometry.Figures</span><span style="color: blue;">>
<</span><span style="color: #a31515;">PathFigure </span><span style="color: red;">StartPoint</span><span style="color: blue;">="0,0" >
<</span><span style="color: #a31515;">PathFigure.Segments</span><span style="color: blue;">>
<</span><span style="color: #a31515;">ArcSegment </span><span style="color: red;">Size</span><span style="color: blue;">="25,25" </span><span style="color: red;">RotationAngle</span><span style="color: blue;">="45" </span><span style="color: red;">IsLargeArc</span><span style="color: blue;">="False" </span><span style="color: red;">SweepDirection</span><span style="color: blue;">="Clockwise" </span><span style="color: red;">Point</span><span style="color: blue;">="0,48"/>
</</span><span style="color: #a31515;">PathFigure.Segments</span><span style="color: blue;">>
</</span><span style="color: #a31515;">PathFigure </span><span style="color: blue;">>
</</span><span style="color: #a31515;">PathGeometry.Figures</span><span style="color: blue;">>
</</span><span style="color: #a31515;">PathGeometry</span><span style="color: blue;">>
</</span><span style="color: #a31515;">Path.Data</span><span style="color: blue;">>
</</span><span style="color: #a31515;">Path</span><span style="color: blue;">>
<</span><span style="color: #a31515;">Path </span><span style="color: red;">x</span><span style="color: blue;">:</span><span style="color: red;">Name</span><span style="color: blue;">="arrow" </span><span style="color: red;">Data</span><span style="color: blue;">="M 1,1.5 L 9,9 L 1,16 1, 1" </span><span style="color: red;">HorizontalAlignment</span><span style="color: blue;">="Center" </span><span style="color: red;">SnapsToDevicePixels</span><span style="color: blue;">="false" </span><span style="color: red;">Fill</span><span style="color: blue;">="{</span><span style="color: #a31515;">Binding </span><span style="color: red;">Path</span><span style="color: blue;">=BorderBrush, </span><span style="color: red;">RelativeSource</span><span style="color: blue;">={</span><span style="color: #a31515;">RelativeSource </span><span style="color: red;">FindAncestor</span><span style="color: blue;">, </span><span style="color: red;">AncestorType</span><span style="color: blue;">=local:CollapsiblePanel}}" </span><span style="color: red;">StrokeThickness</span><span style="color: blue;">="2" </span><span style="color: red;">VerticalAlignment</span><span style="color: blue;">="Center"/>
</</span><span style="color: #a31515;">Grid</span><span style="color: blue;">>
</</span><span style="color: #a31515;">Border</span><span style="color: blue;">>
<</span><span style="color: #a31515;">ControlTemplate.Triggers</span><span style="color: blue;">>
<</span><span style="color: #a31515;">Trigger </span><span style="color: red;">Property</span><span style="color: blue;">="IsChecked" </span><span style="color: red;">Value</span><span style="color: blue;">="true">
<</span><span style="color: #a31515;">Setter </span><span style="color: red;">Property</span><span style="color: blue;">="Data" </span><span style="color: red;">TargetName</span><span style="color: blue;">="arrow" </span><span style="color: red;">Value</span><span style="color: blue;">="M 9,1 L 1,8 L 9,16, 9,1"/>
</</span><span style="color: #a31515;">Trigger</span><span style="color: blue;">>
</</span><span style="color: #a31515;">ControlTemplate.Triggers</span><span style="color: blue;">>
</</span><span style="color: #a31515;">ControlTemplate</span><span style="color: blue;">>
</</span><span style="color: #a31515;">Setter.Value</span><span style="color: blue;">>
</</span><span style="color: #a31515;">Setter</span><span style="color: blue;">>
</</span><span style="color: #a31515;">Style</span><span style="color: blue;">>
<</span><span style="color: #a31515;">Style </span><span style="color: red;">x</span><span style="color: blue;">:</span><span style="color: red;">Key</span><span style="color: blue;">="ExpanderRightHeaderStyle" </span><span style="color: red;">TargetType</span><span style="color: blue;">="{</span><span style="color: #a31515;">x</span><span style="color: blue;">:</span><span style="color: #a31515;">Type </span><span style="color: red;">ToggleButton</span><span style="color: blue;">}">
<</span><span style="color: #a31515;">Setter </span><span style="color: red;">Property</span><span style="color: blue;">="Template">
<</span><span style="color: #a31515;">Setter.Value</span><span style="color: blue;">>
<</span><span style="color: #a31515;">ControlTemplate </span><span style="color: red;">TargetType</span><span style="color: blue;">="{</span><span style="color: #a31515;">x</span><span style="color: blue;">:</span><span style="color: #a31515;">Type </span><span style="color: red;">ToggleButton</span><span style="color: blue;">}">
<</span><span style="color: #a31515;">Border </span><span style="color: red;">Padding</span><span style="color: blue;">="{</span><span style="color: #a31515;">TemplateBinding </span><span style="color: red;">Padding</span><span style="color: blue;">}">
<</span><span style="color: #a31515;">Grid </span><span style="color: red;">Background</span><span style="color: blue;">="Transparent" </span><span style="color: red;">SnapsToDevicePixels</span><span style="color: blue;">="False">
<</span><span style="color: #a31515;">Grid.LayoutTransform</span><span style="color: blue;">>
<</span><span style="color: #a31515;">RotateTransform </span><span style="color: red;">Angle</span><span style="color: blue;">="180"/>
</</span><span style="color: #a31515;">Grid.LayoutTransform</span><span style="color: blue;">>
<</span><span style="color: #a31515;">Path </span><span style="color: red;">x</span><span style="color: blue;">:</span><span style="color: red;">Name</span><span style="color: blue;">="trapazoid" </span><span style="color: red;">Fill</span><span style="color: blue;">="{</span><span style="color: #a31515;">Binding </span><span style="color: red;">Path</span><span style="color: blue;">=Background, </span><span style="color: red;">RelativeSource</span><span style="color: blue;">={</span><span style="color: #a31515;">RelativeSource </span><span style="color: red;">FindAncestor</span><span style="color: blue;">, </span><span style="color: red;">AncestorType</span><span style="color: blue;">=local:CollapsiblePanel}}" </span><span style="color: red;">HorizontalAlignment</span><span style="color: blue;">="Center" </span><span style="color: red;">VerticalAlignment</span><span style="color: blue;">="Center">
<</span><span style="color: #a31515;">Path.Data</span><span style="color: blue;">>
<</span><span style="color: #a31515;">PathGeometry</span><span style="color: blue;">>
<</span><span style="color: #a31515;">PathGeometry.Figures</span><span style="color: blue;">>
<</span><span style="color: #a31515;">PathFigure </span><span style="color: red;">StartPoint</span><span style="color: blue;">="0,0" >
<</span><span style="color: #a31515;">PathFigure.Segments</span><span style="color: blue;">>
<</span><span style="color: #a31515;">ArcSegment </span><span style="color: red;">Size</span><span style="color: blue;">="25,25" </span><span style="color: red;">RotationAngle</span><span style="color: blue;">="45" </span><span style="color: red;">IsLargeArc</span><span style="color: blue;">="False" </span><span style="color: red;">SweepDirection</span><span style="color: blue;">="Clockwise" </span><span style="color: red;">Point</span><span style="color: blue;">="0,48"/>
</</span><span style="color: #a31515;">PathFigure.Segments</span><span style="color: blue;">>
</</span><span style="color: #a31515;">PathFigure </span><span style="color: blue;">>
</</span><span style="color: #a31515;">PathGeometry.Figures</span><span style="color: blue;">>
</</span><span style="color: #a31515;">PathGeometry</span><span style="color: blue;">>
</</span><span style="color: #a31515;">Path.Data</span><span style="color: blue;">>
</</span><span style="color: #a31515;">Path</span><span style="color: blue;">>
<</span><span style="color: #a31515;">Path </span><span style="color: red;">x</span><span style="color: blue;">:</span><span style="color: red;">Name</span><span style="color: blue;">="arrow" </span><span style="color: red;">Data</span><span style="color: blue;">="M 1,1.5 L 9,9 L 1,16 1, 1" </span><span style="color: red;">HorizontalAlignment</span><span style="color: blue;">="Center" </span><span style="color: red;">SnapsToDevicePixels</span><span style="color: blue;">="false" </span><span style="color: red;">Fill</span><span style="color: blue;">="{</span><span style="color: #a31515;">Binding </span><span style="color: red;">Path</span><span style="color: blue;">=BorderBrush, </span><span style="color: red;">RelativeSource</span><span style="color: blue;">={</span><span style="color: #a31515;">RelativeSource </span><span style="color: red;">FindAncestor</span><span style="color: blue;">, </span><span style="color: red;">AncestorType</span><span style="color: blue;">=local:CollapsiblePanel}}" </span><span style="color: red;">StrokeThickness</span><span style="color: blue;">="2" </span><span style="color: red;">VerticalAlignment</span><span style="color: blue;">="Center"/>
</</span><span style="color: #a31515;">Grid</span><span style="color: blue;">>
</</span><span style="color: #a31515;">Border</span><span style="color: blue;">>
<</span><span style="color: #a31515;">ControlTemplate.Triggers</span><span style="color: blue;">>
<</span><span style="color: #a31515;">Trigger </span><span style="color: red;">Property</span><span style="color: blue;">="IsChecked" </span><span style="color: red;">Value</span><span style="color: blue;">="true">
<</span><span style="color: #a31515;">Setter </span><span style="color: red;">Property</span><span style="color: blue;">="Data" </span><span style="color: red;">TargetName</span><span style="color: blue;">="arrow" </span><span style="color: red;">Value</span><span style="color: blue;">="M 9,1 L 1,8 L 9,16, 9,1"/>
</</span><span style="color: #a31515;">Trigger</span><span style="color: blue;">>
</</span><span style="color: #a31515;">ControlTemplate.Triggers</span><span style="color: blue;">>
</</span><span style="color: #a31515;">ControlTemplate</span><span style="color: blue;">>
</</span><span style="color: #a31515;">Setter.Value</span><span style="color: blue;">>
</</span><span style="color: #a31515;">Setter</span><span style="color: blue;">>
</</span><span style="color: #a31515;">Style</span><span style="color: blue;">>
<</span><span style="color: #a31515;">Style </span><span style="color: red;">x</span><span style="color: blue;">:</span><span style="color: red;">Key</span><span style="color: blue;">="ExpanderDownHeaderStyle" </span><span style="color: red;">TargetType</span><span style="color: blue;">="{</span><span style="color: #a31515;">x</span><span style="color: blue;">:</span><span style="color: #a31515;">Type </span><span style="color: red;">ToggleButton</span><span style="color: blue;">}">
<</span><span style="color: #a31515;">Setter </span><span style="color: red;">Property</span><span style="color: blue;">="Template">
<</span><span style="color: #a31515;">Setter.Value</span><span style="color: blue;">>
<</span><span style="color: #a31515;">ControlTemplate </span><span style="color: red;">TargetType</span><span style="color: blue;">="{</span><span style="color: #a31515;">x</span><span style="color: blue;">:</span><span style="color: #a31515;">Type </span><span style="color: red;">ToggleButton</span><span style="color: blue;">}">
<</span><span style="color: #a31515;">Border </span><span style="color: red;">Padding</span><span style="color: blue;">="{</span><span style="color: #a31515;">TemplateBinding </span><span style="color: red;">Padding</span><span style="color: blue;">}">
<</span><span style="color: #a31515;">Grid </span><span style="color: red;">Background</span><span style="color: blue;">="Transparent" </span><span style="color: red;">SnapsToDevicePixels</span><span style="color: blue;">="False">
<</span><span style="color: #a31515;">Grid.LayoutTransform</span><span style="color: blue;">>
<</span><span style="color: #a31515;">RotateTransform </span><span style="color: red;">Angle</span><span style="color: blue;">="-90"/>
</</span><span style="color: #a31515;">Grid.LayoutTransform</span><span style="color: blue;">>
<</span><span style="color: #a31515;">Path </span><span style="color: red;">x</span><span style="color: blue;">:</span><span style="color: red;">Name</span><span style="color: blue;">="trapazoid" </span><span style="color: red;">Fill</span><span style="color: blue;">="{</span><span style="color: #a31515;">Binding </span><span style="color: red;">Path</span><span style="color: blue;">=Background, </span><span style="color: red;">RelativeSource</span><span style="color: blue;">={</span><span style="color: #a31515;">RelativeSource </span><span style="color: red;">FindAncestor</span><span style="color: blue;">, </span><span style="color: red;">AncestorType</span><span style="color: blue;">=local:CollapsiblePanel}}" </span><span style="color: red;">HorizontalAlignment</span><span style="color: blue;">="Center" </span><span style="color: red;">VerticalAlignment</span><span style="color: blue;">="Center">
<</span><span style="color: #a31515;">Path.Data</span><span style="color: blue;">>
<</span><span style="color: #a31515;">PathGeometry</span><span style="color: blue;">>
<</span><span style="color: #a31515;">PathGeometry.Figures</span><span style="color: blue;">>
<</span><span style="color: #a31515;">PathFigure </span><span style="color: red;">StartPoint</span><span style="color: blue;">="0,0" >
<</span><span style="color: #a31515;">PathFigure.Segments</span><span style="color: blue;">>
<</span><span style="color: #a31515;">ArcSegment </span><span style="color: red;">Size</span><span style="color: blue;">="25,25" </span><span style="color: red;">RotationAngle</span><span style="color: blue;">="45" </span><span style="color: red;">IsLargeArc</span><span style="color: blue;">="False" </span><span style="color: red;">SweepDirection</span><span style="color: blue;">="Clockwise" </span><span style="color: red;">Point</span><span style="color: blue;">="0,48"/>
</</span><span style="color: #a31515;">PathFigure.Segments</span><span style="color: blue;">>
</</span><span style="color: #a31515;">PathFigure </span><span style="color: blue;">>
</</span><span style="color: #a31515;">PathGeometry.Figures</span><span style="color: blue;">>
</</span><span style="color: #a31515;">PathGeometry</span><span style="color: blue;">>
</</span><span style="color: #a31515;">Path.Data</span><span style="color: blue;">>
</</span><span style="color: #a31515;">Path</span><span style="color: blue;">>
<</span><span style="color: #a31515;">Path </span><span style="color: red;">x</span><span style="color: blue;">:</span><span style="color: red;">Name</span><span style="color: blue;">="arrow" </span><span style="color: red;">Data</span><span style="color: blue;">="M 1,1.5 L 9,9 L 1,16 1, 1" </span><span style="color: red;">HorizontalAlignment</span><span style="color: blue;">="Center" </span><span style="color: red;">SnapsToDevicePixels</span><span style="color: blue;">="false" </span><span style="color: red;">Fill</span><span style="color: blue;">="{</span><span style="color: #a31515;">Binding </span><span style="color: red;">Path</span><span style="color: blue;">=BorderBrush, </span><span style="color: red;">RelativeSource</span><span style="color: blue;">={</span><span style="color: #a31515;">RelativeSource </span><span style="color: red;">FindAncestor</span><span style="color: blue;">, </span><span style="color: red;">AncestorType</span><span style="color: blue;">=local:CollapsiblePanel}}" </span><span style="color: red;">StrokeThickness</span><span style="color: blue;">="2" </span><span style="color: red;">VerticalAlignment</span><span style="color: blue;">="Center"/>
</</span><span style="color: #a31515;">Grid</span><span style="color: blue;">>
</</span><span style="color: #a31515;">Border</span><span style="color: blue;">>
<</span><span style="color: #a31515;">ControlTemplate.Triggers</span><span style="color: blue;">>
<</span><span style="color: #a31515;">Trigger </span><span style="color: red;">Property</span><span style="color: blue;">="IsChecked" </span><span style="color: red;">Value</span><span style="color: blue;">="true">
<</span><span style="color: #a31515;">Setter </span><span style="color: red;">Property</span><span style="color: blue;">="Data" </span><span style="color: red;">TargetName</span><span style="color: blue;">="arrow" </span><span style="color: red;">Value</span><span style="color: blue;">="M 9,1 L 1,8 L 9,16, 9,1"/>
</</span><span style="color: #a31515;">Trigger</span><span style="color: blue;">>
</</span><span style="color: #a31515;">ControlTemplate.Triggers</span><span style="color: blue;">>
</</span><span style="color: #a31515;">ControlTemplate</span><span style="color: blue;">>
</</span><span style="color: #a31515;">Setter.Value</span><span style="color: blue;">>
</</span><span style="color: #a31515;">Setter</span><span style="color: blue;">>
</</span><span style="color: #a31515;">Style</span><span style="color: blue;">>
<</span><span style="color: #a31515;">Style </span><span style="color: red;">TargetType</span><span style="color: blue;">="{</span><span style="color: #a31515;">x</span><span style="color: blue;">:</span><span style="color: #a31515;">Type </span><span style="color: red;">local</span><span style="color: blue;">:</span><span style="color: red;">CollapsiblePanel</span><span style="color: blue;">}">
<</span><span style="color: #a31515;">Setter </span><span style="color: red;">Property</span><span style="color: blue;">="Background" </span><span style="color: red;">Value</span><span style="color: blue;">="LightGray"/>
<</span><span style="color: #a31515;">Setter </span><span style="color: red;">Property</span><span style="color: blue;">="BorderBrush" </span><span style="color: red;">Value</span><span style="color: blue;">="White"/>
<</span><span style="color: #a31515;">Setter </span><span style="color: red;">Property</span><span style="color: blue;">="HorizontalContentAlignment" </span><span style="color: red;">Value</span><span style="color: blue;">="Stretch"/>
<</span><span style="color: #a31515;">Setter </span><span style="color: red;">Property</span><span style="color: blue;">="VerticalContentAlignment" </span><span style="color: red;">Value</span><span style="color: blue;">="Stretch"/>
<</span><span style="color: #a31515;">Setter </span><span style="color: red;">Property</span><span style="color: blue;">="Template">
<</span><span style="color: #a31515;">Setter.Value</span><span style="color: blue;">>
<</span><span style="color: #a31515;">ControlTemplate </span><span style="color: red;">TargetType</span><span style="color: blue;">="{</span><span style="color: #a31515;">x</span><span style="color: blue;">:</span><span style="color: #a31515;">Type </span><span style="color: red;">Expander</span><span style="color: blue;">}">
<</span><span style="color: #a31515;">Border </span><span style="color: red;">SnapsToDevicePixels</span><span style="color: blue;">="true">
<</span><span style="color: #a31515;">DockPanel</span><span style="color: blue;">>
<</span><span style="color: #a31515;">ToggleButton </span><span style="color: red;">x</span><span style="color: blue;">:</span><span style="color: red;">Name</span><span style="color: blue;">="HeaderSite" </span><span style="color: red;">ContentTemplate</span><span style="color: blue;">="{</span><span style="color: #a31515;">TemplateBinding </span><span style="color: red;">HeaderTemplate</span><span style="color: blue;">}" </span><span style="color: red;">ContentTemplateSelector</span><span style="color: blue;">="{</span><span style="color: #a31515;">TemplateBinding </span><span style="color: red;">HeaderTemplateSelector</span><span style="color: blue;">}" </span><span style="color: red;">Content</span><span style="color: blue;">="{</span><span style="color: #a31515;">TemplateBinding </span><span style="color: red;">Header</span><span style="color: blue;">}" </span><span style="color: red;">DockPanel.Dock</span><span style="color: blue;">="Top" </span><span style="color: red;">Foreground</span><span style="color: blue;">="{</span><span style="color: #a31515;">TemplateBinding </span><span style="color: red;">Foreground</span><span style="color: blue;">}" </span><span style="color: red;">FontWeight</span><span style="color: blue;">="{</span><span style="color: #a31515;">TemplateBinding </span><span style="color: red;">FontWeight</span><span style="color: blue;">}" </span><span style="color: red;">FocusVisualStyle</span><span style="color: blue;">="{</span><span style="color: #a31515;">StaticResource </span><span style="color: red;">ExpanderHeaderFocusVisual</span><span style="color: blue;">}" </span><span style="color: red;">FontStyle</span><span style="color: blue;">="{</span><span style="color: #a31515;">TemplateBinding </span><span style="color: red;">FontStyle</span><span style="color: blue;">}" </span><span style="color: red;">FontStretch</span><span style="color: blue;">="{</span><span style="color: #a31515;">TemplateBinding </span><span style="color: red;">FontStretch</span><span style="color: blue;">}" </span><span style="color: red;">FontSize</span><span style="color: blue;">="{</span><span style="color: #a31515;">TemplateBinding </span><span style="color: red;">FontSize</span><span style="color: blue;">}" </span><span style="color: red;">FontFamily</span><span style="color: blue;">="{</span><span style="color: #a31515;">TemplateBinding </span><span style="color: red;">FontFamily</span><span style="color: blue;">}" </span><span style="color: red;">HorizontalContentAlignment</span><span style="color: blue;">="{</span><span style="color: #a31515;">TemplateBinding </span><span style="color: red;">HorizontalContentAlignment</span><span style="color: blue;">}" </span><span style="color: red;">IsChecked</span><span style="color: blue;">="{</span><span style="color: #a31515;">Binding </span><span style="color: red;">IsExpanded</span><span style="color: blue;">, </span><span style="color: red;">Mode</span><span style="color: blue;">=TwoWay, </span><span style="color: red;">RelativeSource</span><span style="color: blue;">={</span><span style="color: #a31515;">RelativeSource </span><span style="color: red;">TemplatedParent</span><span style="color: blue;">}}" </span><span style="color: red;">Margin</span><span style="color: blue;">="0" </span><span style="color: red;">MinWidth</span><span style="color: blue;">="0" </span><span style="color: red;">MinHeight</span><span style="color: blue;">="0" </span><span style="color: red;">Padding</span><span style="color: blue;">="{</span><span style="color: #a31515;">TemplateBinding </span><span style="color: red;">Padding</span><span style="color: blue;">}" </span><span style="color: red;">Style</span><span style="color: blue;">="{</span><span style="color: #a31515;">StaticResource </span><span style="color: red;">ExpanderDownHeaderStyle</span><span style="color: blue;">}" </span><span style="color: red;">VerticalContentAlignment</span><span style="color: blue;">="{</span><span style="color: #a31515;">TemplateBinding </span><span style="color: red;">VerticalContentAlignment</span><span style="color: blue;">}"/>
<</span><span style="color: #a31515;">Grid
</span><span style="color: red;">x</span><span style="color: blue;">:</span><span style="color: red;">Name</span><span style="color: blue;">="ExpandSiteContainer"
</span><span style="color: red;">Visibility</span><span style="color: blue;">="Visible"
</span><span style="color: red;">HorizontalAlignment</span><span style="color: blue;">="{</span><span style="color: #a31515;">TemplateBinding </span><span style="color: red;">HorizontalContentAlignment</span><span style="color: blue;">}"
</span><span style="color: red;">Margin</span><span style="color: blue;">="{</span><span style="color: #a31515;">TemplateBinding </span><span style="color: red;">Padding</span><span style="color: blue;">}"
</span><span style="color: red;">VerticalAlignment</span><span style="color: blue;">="{</span><span style="color: #a31515;">TemplateBinding </span><span style="color: red;">VerticalContentAlignment</span><span style="color: blue;">}"
</span><span style="color: red;">DockPanel.Dock</span><span style="color: blue;">="Bottom"
>
<</span><span style="color: #a31515;">Grid.Tag</span><span style="color: blue;">>
<</span><span style="color: #a31515;">sys</span><span style="color: blue;">:</span><span style="color: #a31515;">Double</span><span style="color: blue;">></span><span style="color: #a31515;">0.0</span><span style="color: blue;"></</span><span style="color: #a31515;">sys</span><span style="color: blue;">:</span><span style="color: #a31515;">Double</span><span style="color: blue;">>
</</span><span style="color: #a31515;">Grid.Tag</span><span style="color: blue;">>
<</span><span style="color: #a31515;">ScrollViewer
</span><span style="color: red;">VerticalScrollBarVisibility</span><span style="color: blue;">="Hidden"
</span><span style="color: red;">HorizontalScrollBarVisibility</span><span style="color: blue;">="Hidden"
>
<</span><span style="color: #a31515;">ContentPresenter
</span><span style="color: red;">x</span><span style="color: blue;">:</span><span style="color: red;">Name</span><span style="color: blue;">="ExpandSite"
</span><span style="color: red;">Focusable</span><span style="color: blue;">="false"
</span><span style="color: red;">HorizontalAlignment</span><span style="color: blue;">="{</span><span style="color: #a31515;">TemplateBinding </span><span style="color: red;">HorizontalContentAlignment</span><span style="color: blue;">}" </span><span style="color: red;">Margin</span><span style="color: blue;">="{</span><span style="color: #a31515;">TemplateBinding </span><span style="color: red;">Padding</span><span style="color: blue;">}" </span><span style="color: red;">VerticalAlignment</span><span style="color: blue;">="{</span><span style="color: #a31515;">TemplateBinding </span><span style="color: red;">VerticalContentAlignment</span><span style="color: blue;">}"
>
</</span><span style="color: #a31515;">ContentPresenter</span><span style="color: blue;">>
</</span><span style="color: #a31515;">ScrollViewer</span><span style="color: blue;">>
</</span><span style="color: #a31515;">Grid</span><span style="color: blue;">>
</</span><span style="color: #a31515;">DockPanel</span><span style="color: blue;">>
</</span><span style="color: #a31515;">Border</span><span style="color: blue;">>
<</span><span style="color: #a31515;">ControlTemplate.Triggers</span><span style="color: blue;">>
<</span><span style="color: #a31515;">Trigger </span><span style="color: red;">Property</span><span style="color: blue;">="IsExpanded" </span><span style="color: red;">Value</span><span style="color: blue;">="true">
<</span><span style="color: #a31515;">Trigger.EnterActions</span><span style="color: blue;">>
<</span><span style="color: #a31515;">BeginStoryboard</span><span style="color: blue;">>
<</span><span style="color: #a31515;">Storyboard</span><span style="color: blue;">>
<</span><span style="color: #a31515;">DoubleAnimation </span><span style="color: red;">Storyboard.TargetName </span><span style="color: blue;">="ExpandSiteContainer"
</span><span style="color: red;">Storyboard.TargetProperty </span><span style="color: blue;">="Tag"
</span><span style="color: red;">To</span><span style="color: blue;">="1.0" </span><span style="color: red;">Duration </span><span style="color: blue;">="0:0:0.45" />
</</span><span style="color: #a31515;">Storyboard</span><span style="color: blue;">>
</</span><span style="color: #a31515;">BeginStoryboard</span><span style="color: blue;">>
</</span><span style="color: #a31515;">Trigger.EnterActions</span><span style="color: blue;">>
<</span><span style="color: #a31515;">Trigger.ExitActions</span><span style="color: blue;">>
<</span><span style="color: #a31515;">BeginStoryboard</span><span style="color: blue;">>
<</span><span style="color: #a31515;">Storyboard</span><span style="color: blue;">>
<</span><span style="color: #a31515;">DoubleAnimation </span><span style="color: red;">Storyboard.TargetName </span><span style="color: blue;">="ExpandSiteContainer"
</span><span style="color: red;">Storyboard.TargetProperty </span><span style="color: blue;">="Tag"
</span><span style="color: red;">To</span><span style="color: blue;">="0" </span><span style="color: red;">Duration </span><span style="color: blue;">="0:0:0.45"/>
</</span><span style="color: #a31515;">Storyboard</span><span style="color: blue;">>
</</span><span style="color: #a31515;">BeginStoryboard</span><span style="color: blue;">>
</</span><span style="color: #a31515;">Trigger.ExitActions</span><span style="color: blue;">>
</</span><span style="color: #a31515;">Trigger</span><span style="color: blue;">>
<</span><span style="color: #a31515;">Trigger </span><span style="color: red;">Property</span><span style="color: blue;">="ExpandDirection" </span><span style="color: red;">Value</span><span style="color: blue;">="Down">
<</span><span style="color: #a31515;">Setter </span><span style="color: red;">Property</span><span style="color: blue;">="Height" </span><span style="color: red;">TargetName</span><span style="color: blue;">="ExpandSiteContainer">
<</span><span style="color: #a31515;">Setter.Value</span><span style="color: blue;">>
<</span><span style="color: #a31515;">MultiBinding </span><span style="color: red;">Converter</span><span style="color: blue;">="{</span><span style="color: #a31515;">StaticResource </span><span style="color: red;">multiplyConverter</span><span style="color: blue;">}">
<</span><span style="color: #a31515;">Binding </span><span style="color: red;">Path</span><span style="color: blue;">="ActualHeight" </span><span style="color: red;">ElementName</span><span style="color: blue;">="ExpandSite"/>
<</span><span style="color: #a31515;">Binding </span><span style="color: red;">Path</span><span style="color: blue;">="Tag" </span><span style="color: red;">RelativeSource</span><span style="color: blue;">="{</span><span style="color: #a31515;">RelativeSource </span><span style="color: red;">Self</span><span style="color: blue;">}" />
</</span><span style="color: #a31515;">MultiBinding</span><span style="color: blue;">>
</</span><span style="color: #a31515;">Setter.Value</span><span style="color: blue;">>
</</span><span style="color: #a31515;">Setter</span><span style="color: blue;">>
</</span><span style="color: #a31515;">Trigger</span><span style="color: blue;">>
<</span><span style="color: #a31515;">Trigger </span><span style="color: red;">Property</span><span style="color: blue;">="ExpandDirection" </span><span style="color: red;">Value</span><span style="color: blue;">="Right">
<</span><span style="color: #a31515;">Setter </span><span style="color: red;">Property</span><span style="color: blue;">="DockPanel.Dock" </span><span style="color: red;">TargetName</span><span style="color: blue;">="ExpandSite" </span><span style="color: red;">Value</span><span style="color: blue;">="Right"/>
<</span><span style="color: #a31515;">Setter </span><span style="color: red;">Property</span><span style="color: blue;">="DockPanel.Dock" </span><span style="color: red;">TargetName</span><span style="color: blue;">="HeaderSite" </span><span style="color: red;">Value</span><span style="color: blue;">="Left"/>
<</span><span style="color: #a31515;">Setter </span><span style="color: red;">Property</span><span style="color: blue;">="Style" </span><span style="color: red;">TargetName</span><span style="color: blue;">="HeaderSite" </span><span style="color: red;">Value</span><span style="color: blue;">="{</span><span style="color: #a31515;">StaticResource </span><span style="color: red;">ExpanderRightHeaderStyle</span><span style="color: blue;">}"/>
<</span><span style="color: #a31515;">Setter </span><span style="color: red;">Property</span><span style="color: blue;">="Width" </span><span style="color: red;">TargetName</span><span style="color: blue;">="ExpandSiteContainer">
<</span><span style="color: #a31515;">Setter.Value</span><span style="color: blue;">>
<</span><span style="color: #a31515;">MultiBinding </span><span style="color: red;">Converter</span><span style="color: blue;">="{</span><span style="color: #a31515;">StaticResource </span><span style="color: red;">multiplyConverter</span><span style="color: blue;">}">
<</span><span style="color: #a31515;">Binding </span><span style="color: red;">Path</span><span style="color: blue;">="ActualWidth" </span><span style="color: red;">ElementName</span><span style="color: blue;">="ExpandSite"/>
<</span><span style="color: #a31515;">Binding </span><span style="color: red;">Path</span><span style="color: blue;">="Tag" </span><span style="color: red;">RelativeSource</span><span style="color: blue;">="{</span><span style="color: #a31515;">RelativeSource </span><span style="color: red;">Self</span><span style="color: blue;">}" />
</</span><span style="color: #a31515;">MultiBinding</span><span style="color: blue;">>
</</span><span style="color: #a31515;">Setter.Value</span><span style="color: blue;">>
</</span><span style="color: #a31515;">Setter</span><span style="color: blue;">>
</</span><span style="color: #a31515;">Trigger</span><span style="color: blue;">>
<</span><span style="color: #a31515;">Trigger </span><span style="color: red;">Property</span><span style="color: blue;">="ExpandDirection" </span><span style="color: red;">Value</span><span style="color: blue;">="Up">
<</span><span style="color: #a31515;">Setter </span><span style="color: red;">Property</span><span style="color: blue;">="DockPanel.Dock" </span><span style="color: red;">TargetName</span><span style="color: blue;">="ExpandSite" </span><span style="color: red;">Value</span><span style="color: blue;">="Top"/>
<</span><span style="color: #a31515;">Setter </span><span style="color: red;">Property</span><span style="color: blue;">="DockPanel.Dock" </span><span style="color: red;">TargetName</span><span style="color: blue;">="HeaderSite" </span><span style="color: red;">Value</span><span style="color: blue;">="Bottom"/>
<</span><span style="color: #a31515;">Setter </span><span style="color: red;">Property</span><span style="color: blue;">="Style" </span><span style="color: red;">TargetName</span><span style="color: blue;">="HeaderSite" </span><span style="color: red;">Value</span><span style="color: blue;">="{</span><span style="color: #a31515;">StaticResource </span><span style="color: red;">ExpanderUpHeaderStyle</span><span style="color: blue;">}"/>
<</span><span style="color: #a31515;">Setter </span><span style="color: red;">Property</span><span style="color: blue;">="Height" </span><span style="color: red;">TargetName</span><span style="color: blue;">="ExpandSiteContainer">
<</span><span style="color: #a31515;">Setter.Value</span><span style="color: blue;">>
<</span><span style="color: #a31515;">MultiBinding </span><span style="color: red;">Converter</span><span style="color: blue;">="{</span><span style="color: #a31515;">StaticResource </span><span style="color: red;">multiplyConverter</span><span style="color: blue;">}">
<</span><span style="color: #a31515;">Binding </span><span style="color: red;">Path</span><span style="color: blue;">="ActualHeight" </span><span style="color: red;">ElementName</span><span style="color: blue;">="ExpandSite"/>
<</span><span style="color: #a31515;">Binding </span><span style="color: red;">Path</span><span style="color: blue;">="Tag" </span><span style="color: red;">RelativeSource</span><span style="color: blue;">="{</span><span style="color: #a31515;">RelativeSource </span><span style="color: red;">Self</span><span style="color: blue;">}" />
</</span><span style="color: #a31515;">MultiBinding</span><span style="color: blue;">>
</</span><span style="color: #a31515;">Setter.Value</span><span style="color: blue;">>
</</span><span style="color: #a31515;">Setter</span><span style="color: blue;">>
</</span><span style="color: #a31515;">Trigger</span><span style="color: blue;">>
<</span><span style="color: #a31515;">Trigger </span><span style="color: red;">Property</span><span style="color: blue;">="ExpandDirection" </span><span style="color: red;">Value</span><span style="color: blue;">="Left">
<</span><span style="color: #a31515;">Setter </span><span style="color: red;">Property</span><span style="color: blue;">="DockPanel.Dock" </span><span style="color: red;">TargetName</span><span style="color: blue;">="ExpandSite" </span><span style="color: red;">Value</span><span style="color: blue;">="Left"/>
<</span><span style="color: #a31515;">Setter </span><span style="color: red;">Property</span><span style="color: blue;">="DockPanel.Dock" </span><span style="color: red;">TargetName</span><span style="color: blue;">="HeaderSite" </span><span style="color: red;">Value</span><span style="color: blue;">="Right"/>
<</span><span style="color: #a31515;">Setter </span><span style="color: red;">Property</span><span style="color: blue;">="Style" </span><span style="color: red;">TargetName</span><span style="color: blue;">="HeaderSite" </span><span style="color: red;">Value</span><span style="color: blue;">="{</span><span style="color: #a31515;">StaticResource </span><span style="color: red;">ExpanderLeftHeaderStyle</span><span style="color: blue;">}"/>
<</span><span style="color: #a31515;">Setter </span><span style="color: red;">Property</span><span style="color: blue;">="Width" </span><span style="color: red;">TargetName</span><span style="color: blue;">="ExpandSiteContainer">
<</span><span style="color: #a31515;">Setter.Value</span><span style="color: blue;">>
<</span><span style="color: #a31515;">MultiBinding </span><span style="color: red;">Converter</span><span style="color: blue;">="{</span><span style="color: #a31515;">StaticResource </span><span style="color: red;">multiplyConverter</span><span style="color: blue;">}">
<</span><span style="color: #a31515;">Binding </span><span style="color: red;">Path</span><span style="color: blue;">="ActualWidth" </span><span style="color: red;">ElementName</span><span style="color: blue;">="ExpandSite"/>
<</span><span style="color: #a31515;">Binding </span><span style="color: red;">Path</span><span style="color: blue;">="Tag" </span><span style="color: red;">RelativeSource</span><span style="color: blue;">="{</span><span style="color: #a31515;">RelativeSource </span><span style="color: red;">Self</span><span style="color: blue;">}" />
</</span><span style="color: #a31515;">MultiBinding</span><span style="color: blue;">>
</</span><span style="color: #a31515;">Setter.Value</span><span style="color: blue;">>
</</span><span style="color: #a31515;">Setter</span><span style="color: blue;">>
</</span><span style="color: #a31515;">Trigger</span><span style="color: blue;">>
<</span><span style="color: #a31515;">Trigger </span><span style="color: red;">Property</span><span style="color: blue;">="IsEnabled" </span><span style="color: red;">Value</span><span style="color: blue;">="false">
<</span><span style="color: #a31515;">Setter </span><span style="color: red;">Property</span><span style="color: blue;">="Foreground" </span><span style="color: red;">Value</span><span style="color: blue;">="{</span><span style="color: #a31515;">DynamicResource </span><span style="color: blue;">{</span><span style="color: #a31515;">x</span><span style="color: blue;">:</span><span style="color: #a31515;">Static </span><span style="color: red;">SystemColors</span><span style="color: blue;">.GrayTextBrushKey}}"/>
</</span><span style="color: #a31515;">Trigger</span><span style="color: blue;">>
</</span><span style="color: #a31515;">ControlTemplate.Triggers</span><span style="color: blue;">>
</</span><span style="color: #a31515;">ControlTemplate</span><span style="color: blue;">>
</</span><span style="color: #a31515;">Setter.Value</span><span style="color: blue;">>
</</span><span style="color: #a31515;">Setter</span><span style="color: blue;">>
</</span><span style="color: #a31515;">Style</span><span style="color: blue;">>
</</span><span style="color: #a31515;">ResourceDictionary</span><span style="color: blue;">>
</span></pre>
</div>
<br />
Following is the example of using CollapsiblePanel control in WPF.<br />
<br />
<div id="codeSnippetWrapper" style="border: 1px solid silver; font-family: "Courier New", courier, monospace; font-size: 8pt; margin: 20px 0px 10px; padding: 4px; text-align: left; width: 97.5%;">
<pre class="code"><span style="color: blue;"><</span><span style="color: #a31515;">my</span><span style="color: blue;">:</span><span style="color: #a31515;">CollapsiblePanel </span><span style="color: red;">Grid.Row</span><span style="color: blue;">="2" </span><span style="color: red;">Grid.Column</span><span style="color: blue;">="1" </span><span style="color: red;">Header</span><span style="color: blue;">="Toolbar Demo" </span><span style="color: red;">ExpandDirection</span><span style="color: blue;">="Down" </span><span style="color: red;">x</span><span style="color: blue;">:</span><span style="color: red;">Name</span><span style="color: blue;">="Expander2" </span><span style="color: red;">BorderBrush</span><span style="color: blue;">="Yellow" </span><span style="color: red;">Background</span><span style="color: blue;">="{</span><span style="color: #a31515;">StaticResource </span><span style="color: red;">ToggleButtonBrush</span><span style="color: blue;">}" </span><span style="color: red;">IsExpanded</span><span style="color: blue;">="False">
<</span><span style="color: #a31515;">my</span><span style="color: blue;">:</span><span style="color: #a31515;">CollapsiblePanel.Content</span><span style="color: blue;">>
<</span><span style="color: #a31515;">Image </span><span style="color: red;">Source</span><span style="color: blue;">="/CollapsiblePanelDemo;component/Images/Koala.jpg" </span><span style="color: red;">Height</span><span style="color: blue;">="240" </span><span style="color: red;">Stretch</span><span style="color: blue;">="Fill" />
</</span><span style="color: #a31515;">my</span><span style="color: blue;">:</span><span style="color: #a31515;">CollapsiblePanel.Content</span><span style="color: blue;">>
</</span><span style="color: #a31515;">my</span><span style="color: blue;">:</span><span style="color: #a31515;">CollapsiblePanel</span><span style="color: blue;">>
<span style="color: #333333; font-family: Arial;"></span></span></pre>
</div>
<br />
You can download complete source code from following link <br />
Download <a href="https://skydrive.live.com/?cid=c32051eca7c55d97&sc=documents&id=C32051ECA7C55D97%21136#">Source Code</a><br />
<br /></div>
Unknownnoreply@blogger.com5tag:blogger.com,1999:blog-4682504245579959231.post-84118015239423677072011-07-31T12:29:00.000+05:302011-10-14T15:15:06.594+05:30Encrypt & Serialize an object<p>Serialization can be defined as the process of storing the state of an object instance to a storage medium. During this process, the public and private fields of the object and the name of the class, including the assembly containing the class, is converted to a stream of bytes, which is then written to a data stream. When the object is subsequently deserialized, an exact clone of the original object is created.</p><p>But many of the time we need to encrypt the object before saving it in the file, database, etc to protect from misuse. So we have first serialize the object into bytes and then we can encrypt the bytes using Cryptography.</p><p>Below is the code snippet to encrypt/decrypt the object in VB.net. Key in the code snippet is like a password which should be same during encryption and decryption.</p><p><strong>Encrypt Code</strong></p><div id="codeSnippetWrapper" style="text-align: left;margin: 20px 0px 10px;width: 97.5%;font-family: 'Courier New', courier, monospace;font-size: 8pt;border: silver 1px solid;padding: 4px"><pre class="code"><span style="color: blue">Public Function </span>Encrypt(<span style="color: blue">Of </span>T)(<span style="color: blue">ByVal </span>value <span style="color: blue">As </span><span style="color: #2b91af">T</span>, <span style="color: blue">ByVal </span>key <span style="color: blue">As String</span>) <span style="color: blue">As Byte</span>()
<span style="color: blue">Using </span>strm <span style="color: blue">As New </span>MemoryStream
<span style="color: blue">Dim </span>crypt <span style="color: blue">As New </span>TripleDESCryptoServiceProvider
<span style="color: blue">Dim </span>slt() <span style="color: blue">As Byte </span>= {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}
<span style="color: blue">Dim </span>pdb <span style="color: blue">As New </span>Rfc2898DeriveBytes(key, slt)
<span style="color: blue">Dim </span>bytDerivedKey() <span style="color: blue">As Byte </span>= pdb.GetBytes(24)
crypt.Key = bytDerivedKey
crypt.IV = pdb.GetBytes(8)
<span style="color: blue">Using </span>cstream <span style="color: blue">As New </span>CryptoStream(strm, crypt.CreateEncryptor, CryptoStreamMode.Write)
<span style="color: blue">Dim </span>bFormatter <span style="color: blue">As New </span>BinaryFormatter
bFormatter.Serialize(cstream, value)
cstream.Close()
strm.Close()
<span style="color: blue">End Using
Return </span>strm.ToArray
<span style="color: blue">End Using
End Function
</span></pre></div><p><strong>Decrypt Code</strong></p><div id="codeSnippetWrapper" style="text-align: left;margin: 20px 0px 10px;width: 97.5%;font-family: 'Courier New', courier, monospace;font-size: 8pt;border: silver 1px solid;padding: 4px"><pre class="code"><span style="color: blue">Public Function </span>Decrypt(<span style="color: blue">Of </span>T)(<span style="color: blue">ByVal </span>bytes() <span style="color: blue">As Byte</span>, <span style="color: blue">ByVal </span>key <span style="color: blue">As String</span>) <span style="color: blue">As </span><span style="color: #2b91af">T
</span><span style="color: blue">Dim </span>value <span style="color: blue">As </span><span style="color: #2b91af">T
</span><span style="color: blue">Using </span>strm <span style="color: blue">As New </span>MemoryStream(bytes)
<span style="color: blue">Dim </span>crypt <span style="color: blue">As New </span>TripleDESCryptoServiceProvider
<span style="color: blue">Dim </span>slt() <span style="color: blue">As Byte </span>= {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}
<span style="color: blue">Dim </span>pdb <span style="color: blue">As New </span>Rfc2898DeriveBytes(key, slt)
<span style="color: blue">Dim </span>bytDerivedKey() <span style="color: blue">As Byte </span>= pdb.GetBytes(24)
crypt.Key = bytDerivedKey
crypt.IV = pdb.GetBytes(8)
<span style="color: blue">Using </span>cstream <span style="color: blue">As New </span>CryptoStream(strm, crypt.CreateDecryptor, CryptoStreamMode.Read)
<span style="color: blue">Dim </span>bFormatter <span style="color: blue">As New </span>BinaryFormatter
value = bFormatter.Deserialize(cstream)
cstream.Close()
strm.Close()
<span style="color: blue">End Using
End Using
Return </span>value
<span style="color: blue">End Function
</span></pre></div><p><strong>Example to use above functions</strong></p><p><div id="codeSnippetWrapper" style="text-align: left;margin: 20px 0px 10px;width: 97.5%;font-family: 'Courier New', courier, monospace;font-size: 8pt;border: silver 1px solid;padding: 4px"><<span style="color: #2b91af">Serializable</span>()><br />
<span style="color: blue">Public Class</span><span style="color: #2b91af">Customer<br />
</span><span style="color: blue">Public Property</span>CustomerID <span style="color: blue">As Integer<br />
Public Property</span>CustomerName <span style="color: blue">As String<br />
End Class<br />
<br />
Private Sub </span>SaveCustomer()<br />
<span style="color: blue">Dim </span>d <span style="color: blue">As New </span><span style="color: #2b91af">Customer<br />
</span>d.CustomerID = 1<br />
d.CustomerName = <span style="color: #a31515">"GAURAV"<br />
</span><span style="color: blue">Dim </span>bytes() <span style="color: blue">As Byte </span>= Encrypt(<span style="color: blue">Of </span><span style="color: #2b91af">Customer</span>)(d, <span style="color: #a31515">"54321"</span>)<br />
<span style="color: blue">My</span>.Computer.FileSystem.WriteAllBytes(<span style="color: #a31515">"E:\Test.dat"</span>, bytes, <span style="color: blue">False</span>)<br />
<span style="color: blue">End Sub<br />
<br />
Private Sub </span>LoadCustomer()<br />
<span style="color: blue">Dim </span>bytes() <span style="color: blue">As Byte </span>= <span style="color: blue">My</span>.Computer.FileSystem.ReadAllBytes(<span style="color: #a31515">"E:\Test.dat"</span>)<br />
<span style="color: blue">Dim </span>objCustomer <span style="color: blue">As </span><span style="color: #2b91af">Customer </span>= Decrypt(<span style="color: blue">Of </span><span style="color: #2b91af">Customer</span>)(bytes, <span style="color: #a31515">"54321"</span>)<br />
<span style="color: blue">End Sub<br />
<br />
</span><br />
</div></p>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4682504245579959231.post-36096492415837376892011-05-05T12:36:00.000+05:302011-10-14T12:37:13.613+05:30ProcessCmdKey in Windows Form<p>Many time we need to trap the key pressed in Windows Form and based on it perform some operation. For example, stop user from closing the application when user press Alt+F4. Or want to stop user from moving from one child form to another child in a mdi form using Ctrl+Tab or stop user from moving from one tabpage to another tabpage in TabControl control. In this case ProcessCmdKey method is the best option.</p> <p>ProcessCmdKey is a method in .NET which process the command key. This method is called during message preprocessing to handle command keys. Command keys are keys that always take precedence over regular input keys. The method return true to indicate that it has processed the command key, or false to indicate that the key is not a command key. This method is only called when the control is hosted in a Windows Forms application or as an ActiveX control.</p> <p>The following example with stop user from closing the form when user press Alt+F4 and also stop user from navigate to another tabpage or child form by using Ctrl+Tab.</p><pre class="code"> <span style="color: blue">Public Class </span><span style="color: #2b91af">Form1<br /> </span><span style="color: blue">Protected Overrides Function </span>ProcessCmdKey(<span style="color: blue">ByRef </span>msg <span style="color: blue">As </span><span style="color: #2b91af">Message</span>, <span style="color: blue">ByVal </span>keyData <span style="color: blue">As </span><span style="color: #2b91af">Keys</span>) <span style="color: blue">As Boolean<br /> If </span>keyData = (<span style="color: #2b91af">Keys</span>.Alt <span style="color: blue">Or </span><span style="color: #2b91af">Keys</span>.F4) <span style="color: blue">Then<br /> Return True<br /> ElseIf </span>keyData = (<span style="color: #2b91af">Keys</span>.Control <span style="color: blue">Or </span><span style="color: #2b91af">Keys</span>.Tab) <span style="color: blue">Then<br /> Return True<br /> Else<br /> Return MyBase</span>.ProcessCmdKey(msg, keyData)<br /> <span style="color: blue">End If<br /> End Function<br /> End Class<br /></span></pre> Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4682504245579959231.post-71127350046706835352011-04-29T12:40:00.000+05:302011-10-14T15:16:56.073+05:30Programmically toggling capslock button<p>VB.NET doesn’t contain any function through which we can On/Off capslock button in the keyboard. VB.NET has one function called My.Computer.Keyboard.CapsLock but it is readonly so we cannot change it. Capslock key also cannot be toggled by using SendKeys,Send() method. So only way to toggle the capslock key is by using WinAPIs. There is a function called keybd_event which can toggle the capslock key<div id="codeSnippetWrapper" style="text-align: left;margin: 20px 0px 10px;width: 97.5%;font-family: 'Courier New', courier, monospace;font-size: 8pt;border: silver 1px solid;padding: 4px"><span style="color: blue">Private Declare Sub </span>keybd_event <span style="color: blue">Lib </span><span style="color: #a31515">"user32" </span>(<span style="color: blue">ByVal </span>key <span style="color: blue">As Byte</span>, <span style="color: blue">ByVal </span>bScan <span style="color: blue">As Byte</span>, <span style="color: blue">ByVal </span>dwFlags <span style="color: blue">As Long</span>, <span style="color: blue">ByVal </span>dwExtraInfo <span style="color: blue">As Long</span>)<br />
<br />
<span style="color: blue">Private Sub </span>ToggleCapslock()<br />
keybd_event(<span style="color: #2b91af">Keys</span>.Capital, 0, 0, 0)<br />
keybd_event(<span style="color: #2b91af">Keys</span>.Capital, 0, &H2, 0)<br />
<span style="color: blue">End Sub<br />
</span></div></p><p>In the above example we have called the keybd_event function twice. First for Keydown and second time for KeyUp (&H2 is value for KeyUp). If we want the code to work only to set capslock Off then we can change the code as below</p><div id="codeSnippetWrapper" style="text-align: left;margin: 20px 0px 10px;width: 97.5%;font-family: 'Courier New', courier, monospace;font-size: 8pt;border: silver 1px solid;padding: 4px"><pre class="code"><span style="color: blue"> Private Sub </span>SetCapslockOff()
<span style="color: blue">If My</span>.Computer.Keyboard.CapsLock = <span style="color: blue">True Then
</span>keybd_event(<span style="color: #2b91af">Keys</span>.Capital, 0, 0, 0)
keybd_event(<span style="color: #2b91af">Keys</span>.Capital, 0, &H2, 0)
<span style="color: blue">Else
</span><span style="color: green">'Already off
</span><span style="color: blue">End If
End Sub
</span></pre></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4682504245579959231.post-31406361864686114612011-04-10T12:21:00.000+05:302011-10-14T15:17:36.173+05:30Tab key work as an Enter key in Datagridview<p>To make the Tab key work as Enter key, we have to inherit DataGridView controls and override two methods ProcessDataGridViewKey and ProcessDialogKey. In both the methods if the user has click Tab then we have to ProcessEnterKey of Datagridview.</p><p><div id="codeSnippetWrapper" style="text-align: left;margin: 20px 0px 10px;width: 97.5%;font-family: 'Courier New', courier, monospace;font-size: 8pt;border: silver 1px solid;padding: 4px"><pre class="code"><span style="color: blue">Public Class </span><span style="color: #2b91af">NewDataGridView
</span><span style="color: blue">Inherits </span><span style="color: #2b91af">DataGridView
</span><span style="color: blue">Protected Overrides Function </span>ProcessDataGridViewKey(<span style="color: blue">ByVal </span>e <span style="color: blue">As </span>System.Windows.Forms.<span style="color: #2b91af">KeyEventArgs</span>) <span style="color: blue">As Boolean
If </span>e.KeyCode = <span style="color: #2b91af">Keys</span>.Tab <span style="color: blue">Then
Me</span>.ProcessEnterKey(e.KeyData)
<span style="color: blue">Return True
End If
Return MyBase</span>.ProcessDataGridViewKey(e)
<span style="color: blue">End Function
Protected Overrides Function </span>ProcessDialogKey(<span style="color: blue">ByVal </span>keyData <span style="color: blue">As </span>System.Windows.Forms.<span style="color: #2b91af">Keys</span>) <span style="color: blue">As Boolean
If </span>keyData = <span style="color: #2b91af">Keys</span>.Tab <span style="color: blue">Then
Me</span>.ProcessEnterKey(keyData)
<span style="color: blue">Return True
End If
Return MyBase</span>.ProcessDialogKey(keyData)
<span style="color: blue">End Function
End Class
</span></pre></div></p>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4682504245579959231.post-77141652203529463362011-03-03T13:57:00.000+05:302011-10-14T15:19:53.377+05:30HttpWebRequest AddRange with Long values<p>HttpWebRequest contains a method called AddRange which is very useful when we want to download a file in segments or want to resume the download from where it was stopped previously. But HttpWebRequest.AddRange has one drawback, the parameters for range of bytes is in integer which means only range upto approximately 2 GB is allowed. So we cannot use this method if we want to use it for downloading files in Range greater than 2 GB. If we try to add value greater than “2147483647” we will get following exception.</p><p>System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.</p><p>So the solution for this problem is to extend the AddRange method with support for long parameters. HttpWebRequest has a private function AddRange which have three string parameters which we can use with Reflection classes.</p><p><div id="codeSnippetWrapper" style="text-align: left;margin: 20px 0px 10px;width: 97.5%;font-family: 'Courier New', courier, monospace;font-size: 8pt;border: silver 1px solid;padding: 4px"><span style="color: blue">Private Function </span>AddRange(<span style="color: blue">ByVal </span>rangeSpecifier <span style="color: blue">As String</span>, <span style="color: blue">ByVal </span>fromValue <span style="color: blue">As String</span>, <span style="color: blue">ByVal </span>toValue <span style="color: blue">As String</span>) <span style="color: blue">As Boolean<br />
</span></div></p><p>So now we can use Reflection and add two method with parameter in Long to allow larger value.</p><div id="codeSnippetWrapper" style="text-align: left;margin: 20px 0px 10px;width: 97.5%;font-family: 'Courier New', courier, monospace;font-size: 8pt;border: silver 1px solid;padding: 4px"><pre class="code"><span style="color: blue">Imports </span>System.Reflection
<span style="color: blue">Imports </span>System.Net
<span style="color: blue">Imports </span>System.Runtime.CompilerServices
<span style="color: blue">Public Module </span><span style="color: #2b91af">MyModule
</span><span style="color: blue">#Region </span><span style="color: #a31515">"HttpWebRequest AddRange"
</span><<span style="color: #2b91af">Extension</span>()> _
<span style="color: blue">Public Sub </span>AddRange(<span style="color: blue">ByVal </span>request <span style="color: blue">As </span><span style="color: #2b91af">HttpWebRequest</span>, <span style="color: blue">ByVal </span>from <span style="color: blue">As Long</span>, <span style="color: blue">ByVal </span>[to] <span style="color: blue">As Long</span>)
<span style="color: blue">Dim </span>info <span style="color: blue">As </span><span style="color: #2b91af">MethodInfo </span>= <span style="color: blue">Nothing
Dim </span>methods() <span style="color: blue">As </span><span style="color: #2b91af">MethodInfo </span>= <span style="color: blue">GetType</span>(Net.<span style="color: #2b91af">HttpWebRequest</span>).GetMethods(<span style="color: #2b91af">BindingFlags</span>.Instance <span style="color: blue">Or </span><span style="color: #2b91af">BindingFlags</span>.NonPublic)
<span style="color: blue">For Each </span>mi <span style="color: blue">As </span><span style="color: #2b91af">MethodInfo </span><span style="color: blue">In </span>methods
<span style="color: blue">If </span>mi.Name = <span style="color: #a31515">"AddRange" </span><span style="color: blue">Then
</span>info = mi
<span style="color: blue">Exit For
End If
Next
If </span>info <span style="color: blue">IsNot Nothing Then
Dim </span>parameters(2) <span style="color: blue">As Object
</span>parameters(0) = <span style="color: #a31515">"bytes"
</span>parameters(1) = from.ToString
parameters(2) = [to].ToString
info.Invoke(request, parameters)
<span style="color: blue">End If
End Sub
</span><<span style="color: #2b91af">Extension</span>()> _
<span style="color: blue">Public Sub </span>AddRange(<span style="color: blue">ByVal </span>request <span style="color: blue">As </span><span style="color: #2b91af">HttpWebRequest</span>, <span style="color: blue">ByVal </span>from <span style="color: blue">As Long</span>)
<span style="color: blue">Dim </span>info <span style="color: blue">As </span><span style="color: #2b91af">MethodInfo </span>= <span style="color: blue">Nothing
Dim </span>methods() <span style="color: blue">As </span><span style="color: #2b91af">MethodInfo </span>= <span style="color: blue">GetType</span>(Net.<span style="color: #2b91af">HttpWebRequest</span>).GetMethods(<span style="color: #2b91af">BindingFlags</span>.Instance <span style="color: blue">Or </span><span style="color: #2b91af">BindingFlags</span>.NonPublic)
<span style="color: blue">For Each </span>mi <span style="color: blue">As </span><span style="color: #2b91af">MethodInfo </span><span style="color: blue">In </span>methods
<span style="color: blue">If </span>mi.Name = <span style="color: #a31515">"AddRange" </span><span style="color: blue">Then
</span>info = mi
<span style="color: blue">Exit For
End If
Next
If </span>info <span style="color: blue">IsNot Nothing Then
Dim </span>parameters(2) <span style="color: blue">As Object
</span>parameters(0) = <span style="color: #a31515">"bytes"
</span>parameters(1) = from.ToString
parameters(2) = <span style="color: blue">String</span>.Empty
info.Invoke(request, parameters)
<span style="color: blue">End If
End Sub
#End Region
End Module
</span></pre></div><p>After adding above code in the project, two new HttpWebRequest.AddRange method will get added with long parameter.</p><p><div id="codeSnippetWrapper" style="text-align: left;margin: 20px 0px 10px;width: 97.5%;font-family: 'Courier New', courier, monospace;font-size: 8pt;border: silver 1px solid;padding: 4px">HttpWebRequest.AddRange(byval <span style="color: blue">from as Long</span>)<br />
HttpWebRequest.AddRange(byval <span style="color: blue">from as Long</span>,byval <span style="color: blue">to as Long</span>)</div></p><p>Now you can use this methods as shown in following code</p><div id="codeSnippetWrapper" style="text-align: left;margin: 20px 0px 10px;width: 97.5%;font-family: 'Courier New', courier, monospace;font-size: 8pt;border: silver 1px solid;padding: 4px"><pre class="code"><span style="color: blue">Dim </span>startPosition <span style="color: blue">As Long </span>= <span style="color: blue">Integer</span>.MaxValue
<span style="color: blue">Dim </span>endPosition <span style="color: blue">As Long </span>= startPosition + 1000
<span style="color: blue">Dim </span>request <span style="color: blue">As </span>HttpWebRequest = WebRequest.Create(<span style="color: #a31515">"Url"</span>)
request.AddRange(startPosition, endPosition)
</pre></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4682504245579959231.post-44531658415508270842011-03-01T12:43:00.001+05:302011-10-15T15:11:51.087+05:30Review: Crypto Obfuscator for .NET 2011<div dir="ltr" style="text-align: left;" trbidi="on">All .NET codes written in .Net language when compiled are converted to MSIL. But there are many decompilers available through which we can reverse engineer the code, which means software licensing code, copy protection mechanisms, proprietary business logic, passwords, etc. get accessible to everyone. So to protect from code from misuse Obfuscator are available that provides for seamless renaming of symbols in assemblies as well as other tricks to foil decompilers. Properly applied obfuscation can increase the protection against decompilation by many orders of magnitude, while leaving the application intact.<br />
There are many .NET obfuscators available today. Crypto Obfuscator For .Net is one of the great obfuscator which supports all versions of the .Net framework from v1.0 to v4.0. It also supports the .Net Compact Framework, Silverlight and XNA. It can protect assemblies created with any .Net language including C#, VB.Net, Managed C++, J#, etc.<br />
Following are few key features available in “Crypto Obfuscator for .NET 2011” <br />
<strong>Symbol Renaming</strong> – Crypto Obfuscator renames all your class, field, method, properties, methods, parameter and generic parameter names to totally different strings. It is impossible to determine the original names from the new names. This makes it impossible for someone to try to determine the purpose or functionality of the renamed entity from its name. <br />
<strong>String Encryption</strong> – Literal strings often contain sensitive information such as login information, passwords, SQL queries, algorithm parameters. They also facilitate reverse-engineering of your .Net code. Crypto Obfuscator solves all these issues by encrypting all literal strings in your .Net code. <br />
<strong>Anti-Reflection Protection</strong> – Many decompilers, dissassemblers and memory dumpers use Reflection to extract information about a .Net assembly. Crypto Obfuscator can modify the assembly in such a way that such tools will fail when trying to work on your assembly. <br />
<strong>Anti-Decompiler Protection</strong> – Advanced decompilers such as the freely available .Net Reflector are your enemy in the battle against the hackers, crackers and competitors. Crypto Obfuscator can modify your assembly in such a way that such tools fail to work on your assembly – many times they are not even able to open your assembly, let alone examine it. <br />
<strong>Advanced</strong> <strong>Tamper Detection</strong> – Crypto Obfuscator can perform strong name verification of the assembly itself even if strong-name verification has been turned OFF on the machine on which the assembly is running or if the assembly has been registered in the verification ’skip-list’ – this is typically done by hackers or crackers. Furthermore, the strong name verification is done using the original key used to sign the assembly when it was processed by Crypto Obfuscator. Thus, strong name verification fails even if the key is removed or replaced – again something typically done by hackers or crackers. <br />
<strong>Advanced Anti-Debug + Anti-Tracer Protection</strong> – Crypto Obfuscator’s performs more than 10 advanced heuristic tests to detect if your software is running under a debugger or tracer. If detected, an exception is throw and your software will terminate. Both managed as well as native/unmanaged debuggers (including advanced debuggers such as OllyDbg) are detected. This provides a strong defense against crackers and hackers trying to debug or trace your software for various malicious purposes. <br />
<strong>Advanced Overload Renaming</strong> – Crypto Obfuscator can also rename fields or methods with different signatures to the same name. For example two fields having types int and boolean will be given the same name. Similarly two methods will different parameters will be given the same name. In the case of methods, the method return type is also used in the signature even though high-level languages such as C# and VB.Net do not support overloading by return type. The .Net runtime is able to differentiate between the fields/methods without any problem since the signatures are different. Needless to say, this scheme makes it even harder to reverse-engineer your code. <br />
<strong>Control Flow Obfuscation – </strong>Many advanced decompilers can reconstruct the code in your methods including the exact structure of your loops, if-else statements, method calls, try-catch blocks, etc. This makes it very easy to revere-engineer your code. Crypto Obfuscator changes the structure of your code into spaghetti code while maintaining 100% the logic and output of the code. The result is that decompilers are unable to reconstruct the code structure and most of the times they crash while trying to do so. <br />
<strong>Watermarking – </strong>Crypto Obfuscator can embed watermark strings into your deployed assemblies. This can be used to track each assembly instance – this is commonly used for licensing by embedding user name and license codes as watermarks to deter license violations. The watermarks embedded in the assembly can be used in literal strings and constants to be used in your UI, message boxes, etc.<strong></strong> <br />
<strong>ILDASM Protection – </strong>ILDASM (Microsoft IL Dissassembler) is a free tool to disassembly any .Net assembly into MSIL (Microsoft Intermediate Language). Crypto Obfuscator can modify the assembly in such a way that ILDASM refuses to disassemble the assembly. <br />
<strong>Metadata Reduction – </strong>Crypto Obfuscator can remove unnecessary or redundant information such as parameter names, property/event placeholders, etc from your .Net assembly . During symbol-renaming, Crypto Obfuscator will often assign extremely short (often single-character names) to your classes, fields, methods, etc. All these features can reduce the size of your .Net assembly considerably.</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4682504245579959231.post-5774560743965748712011-01-30T19:02:00.000+05:302011-10-14T19:03:14.624+05:30Nested menuitem in WPF ToolBar<p align="justify">One of the most common question asked on various WPF Forums is “How can we have Submenu or nested menuitems in WPF Toolbar”. Toolbar in WPF doesn’t show sub menuitems on mouseover or click event. So following code for Toolbar doesn’t work.</p> <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; font-size: 8pt; border-top: silver 1px solid; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"> <p align="justify"> <span style="color: blue"><</span><span style="color: #a31515">ToolBar </span><span style="color: red">Name</span><span style="color: blue">="ToolBar1" </span><span style="color: red">Height</span><span style="color: blue">="25"><br> </span><span style="color: green"><!-- Regular Items --><br> </span><span style="color: blue"><</span><span style="color: #a31515">Button </span><span style="color: red">Content</span><span style="color: blue">="Item A"/><br> <</span><span style="color: #a31515">Button </span><span style="color: red">Content</span><span style="color: blue">="Item B"/><br> </span><span style="color: green"><!-- SubItems Menu For Special Items --><br> </span><span style="color: blue"><</span><span style="color: #a31515">MenuItem </span><span style="color: red">Header</span><span style="color: blue">="Special Items"><br> <</span><span style="color: #a31515">MenuItem </span><span style="color: red">Header</span><span style="color: blue">="Special Item A" /><br> <</span><span style="color: #a31515">MenuItem </span><span style="color: red">Header</span><span style="color: blue">="Special Item B" /><br> </</span><span style="color: #a31515">MenuItem</span><span style="color: blue">><br> </</span><span style="color: #a31515">ToolBar</span><span style="color: blue">><br></span></p></div> <p align="justify">So I decide to create my own custom control which Inherits MenuItem and can handle mouseover or click event. MenuItem has a property IsSubMenuOpen which we can use to open submenu for MenuItem. Another useful property is StayOpenOnClick, which if we set to False then whenever user click outside of MenuItem, submenu will automatically get closed.</p> <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; font-size: 8pt; border-top: silver 1px solid; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"><pre class="code"><span style="color: blue">Imports </span>System.Windows.Controls.Primitives<br /><br /><span style="color: blue">Public Class </span><span style="color: #2b91af">ToolBarMenuItem<br /> </span><span style="color: blue">Inherits </span>System.Windows.Controls.<span style="color: #2b91af">MenuItem<br /><br /> </span><span style="color: blue">Shared Sub New</span>()<br /> <span style="color: green">'This OverrideMetadata call tells the system that this element wants to provide a style that is different than its base class.<br /> 'This style is defined in themes\generic.xaml<br /> </span>DefaultStyleKeyProperty.OverrideMetadata(<span style="color: blue">GetType</span>(<span style="color: #2b91af">ToolBarMenuItem</span>), <span style="color: blue">New </span><span style="color: #2b91af">FrameworkPropertyMetadata</span>(<span style="color: blue">GetType</span>(<span style="color: #2b91af">ToolBarMenuItem</span>)))<br /> <span style="color: blue">End Sub<br /><br /> Public Enum </span><span style="color: #2b91af">PlacementMode<br /> </span>Bottom = 0<br /> Top = 1<br /> Right = 2<br /> Left = 3<br /> <span style="color: blue">End Enum<br /><br /> Public Shared ReadOnly </span>SubMenuPlacementModeProperty <span style="color: blue">As </span><span style="color: #2b91af">DependencyProperty </span>= <span style="color: #2b91af">DependencyProperty</span>.Register(<span style="color: #a31515">"SubMenuPlacementMode"</span>, <span style="color: blue">GetType</span>(<span style="color: #2b91af">PlacementMode</span>), <span style="color: blue">GetType</span>(<span style="color: #2b91af">ToolBarMenuItem</span>), <span style="color: blue">New </span><span style="color: #2b91af">FrameworkPropertyMetadata</span>(<span style="color: #2b91af">PlacementMode</span>.Bottom))<br /> <span style="color: blue">Public Property </span>SubMenuPlacementMode <span style="color: blue">As </span><span style="color: #2b91af">PlacementMode<br /> </span><span style="color: blue">Get<br /> Return </span>GetValue(SubMenuPlacementModeProperty)<br /> <span style="color: blue">End Get<br /> Set</span>(<span style="color: blue">ByVal </span>value <span style="color: blue">As </span><span style="color: #2b91af">PlacementMode</span>)<br /> SetValue(SubMenuPlacementModeProperty, value)<br /> <span style="color: blue">End Set<br /> End Property<br /><br /> Private Sub </span>ToolBarMenuItem_Click(<span style="color: blue">ByVal </span>sender <span style="color: blue">As Object</span>, <span style="color: blue">ByVal </span>e <span style="color: blue">As </span>System.Windows.<span style="color: #2b91af">RoutedEventArgs</span>) <span style="color: blue">Handles Me</span>.Click<br /> <span style="color: blue">Me</span>.IsSubmenuOpen = <span style="color: blue">False<br /> End Sub<br /><br /> Private Sub </span>ToolBarMenuItem_MouseLeave(<span style="color: blue">ByVal </span>sender <span style="color: blue">As Object</span>, <span style="color: blue">ByVal </span>e <span style="color: blue">As </span>System.Windows.Input.<span style="color: #2b91af">MouseEventArgs</span>) <span style="color: blue">Handles Me</span>.MouseLeave<br /> <span style="color: blue">Me</span>.IsSubmenuOpen = <span style="color: blue">False<br /> End Sub<br /><br /> Private Sub </span>ToolBarMenuItem_PreviewMouseLeftButtonDown(<span style="color: blue">ByVal </span>sender <span style="color: blue">As Object</span>, <span style="color: blue">ByVal </span>e <span style="color: blue">As </span>System.Windows.Input.<span style="color: #2b91af">MouseButtonEventArgs</span>) <span style="color: blue">Handles Me</span>.PreviewMouseLeftButtonDown<br /> <span style="color: blue">If Me</span>.IsSubmenuOpen = <span style="color: blue">False Then<br /> Me</span>.IsSubmenuOpen = <span style="color: blue">True<br /> Me</span>.StaysOpenOnClick = <span style="color: blue">False<br /> End If<br /> End Sub<br />End Class<br /></span></pre></div><br /><p>We also need to add a XAML Code which contain Style for our custom control which is available in the source at the end of the article. <br /><p>We can use the above custom control in following way. </p><br /><div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; font-size: 8pt; border-top: silver 1px solid; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"><pre class="code"><span style="color: blue"><</span><span style="color: #a31515">Window </span><span style="color: red">x</span><span style="color: blue">:</span><span style="color: red">Class</span><span style="color: blue">="MainWindow" </span><span style="color: red">xmlns</span><span style="color: blue">="http://schemas.microsoft.com/winfx/2006/xaml/presentation"<br /> </span><span style="color: red">xmlns</span><span style="color: blue">:</span><span style="color: red">x</span><span style="color: blue">="http://schemas.microsoft.com/winfx/2006/xaml"<br /> </span><span style="color: red">xmlns</span><span style="color: blue">:</span><span style="color: red">my</span><span style="color: blue">="clr-namespace:ToolBarMenuItemDemo"<br /> </span><span style="color: red">Title</span><span style="color: blue">="NestedToolBarItem Demo" </span><span style="color: red">Height</span><span style="color: blue">="350" </span><span style="color: red">Width</span><span style="color: blue">="525" </span><span style="color: red">Background</span><span style="color: blue">="Aquamarine"><br /> <</span><span style="color: #a31515">Grid </span><span style="color: red">VerticalAlignment</span><span style="color: blue">="Top"><br /> <</span><span style="color: #a31515">ToolBar </span><span style="color: red">Name</span><span style="color: blue">="ToolBar1" </span><span style="color: red">Height</span><span style="color: blue">="25" ><br /> </span><span style="color: green"><!--Regular Items--> <br /> </span><span style="color: blue"><</span><span style="color: #a31515">Button </span><span style="color: red">Content</span><span style="color: blue">="Item A"/><br /> <</span><span style="color: #a31515">Button </span><span style="color: red">Content</span><span style="color: blue">="Item B"/><br /> </span><span style="color: green"><!--SubItems Menu For Special Items--> <br /> </span><span style="color: blue"><</span><span style="color: #a31515">my</span><span style="color: blue">:</span><span style="color: #a31515">ToolBarMenuItem </span><span style="color: red">Header</span><span style="color: blue">="Special Items" </span><span style="color: red">VerticalContentAlignment</span><span style="color: blue">="Center" </span><span style="color: red">SubMenuPlacementMode</span><span style="color: blue">="Bottom"><br /> <</span><span style="color: #a31515">MenuItem </span><span style="color: red">Header</span><span style="color: blue">="Special Item 1" /><br /> <</span><span style="color: #a31515">MenuItem </span><span style="color: red">Header</span><span style="color: blue">="Special Item 2" /><br /> </</span><span style="color: #a31515">my</span><span style="color: blue">:</span><span style="color: #a31515">ToolBarMenuItem</span><span style="color: blue">><br /> </</span><span style="color: #a31515">ToolBar</span><span style="color: blue">><br /> </</span><span style="color: #a31515">Grid</span><span style="color: blue">><br /></</span><span style="color: #a31515">Window</span><span style="color: blue">><br /></span></pre></div><br /><p>Download <a href="https://skydrive.live.com/?cid=c32051eca7c55d97&sc=documents&uc=1&id=C32051ECA7C55D97%21110#" target="_blank">Source Code</a></p> Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4682504245579959231.post-23785132133015344152010-10-28T14:40:00.000+05:302011-10-14T15:10:10.429+05:30Comparing two Images<p>Few days back I was looking to compare two image and find difference between them in WPF. After searching and reading few articles I realized that comparing two image and find difference is much easier using methods of Graphics Class (i.e. using GDI+). So I decide to compare and find difference between two images using GDI+ and then convert into a BitmapImage. For faster comparing we have to use pointer and write code in unsafe block. As pointer and unsafe block are not supported in VB.NET so comparing code has to be in C# or C++.</p> <p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIxc0XEG6Y_DI2zljg06pwLaoLK01fLft3cpAO8QXj1XpWDlKd_Etf6RlVALzXGplMpI3zksgI396a_xloSvI4hk2RPiGXMVgl17_u6NHUOFMOiPRfsEoCN1aK22emr-rwF_FfN8zuQYX1/s1600-h/CompareImage19.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="CompareImage1" border="0" alt="CompareImage1" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTcNtRptwK-1HaUb7V1ROLMk_xT63PNfJTy4cJ4snGyFLitNGQu0dfj0Q8bIT6NrvlxH4H9jB31D0HzfD-0sqMHuDw_siLlWgTn4nPU5dRdnIV_Vsc4TmFvLHzieGOa7IMQHiuAbMXYi4I/?imgmax=800" width="240" height="192"></a></p> <p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5Y4KwHLPFvRaZV1goprH7DX36mekJdgSAqz5OxRzc8S0y_EEGN0vq03PQHYIZizoFQqogFxG8V7QNWq53JAyE8LrVgZRUk1w9mhKroSxCAj8FJpTnpHgsKYB38uxW9VUI__rW66joBxzw/s1600-h/CompareImage29.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="CompareImage2" border="0" alt="CompareImage2" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwY8CoFlDFEXY5nZk9FUYAHephZ5-m6TGJp4ro3Byg-IpnRf6xSnEDyqNu6DhZ9Tyk-ZmrdXkTRIuERM1YrSoaA_mp1sY8VVKNcVYuEmVQ3b7Pvie0Kge9SQB0YsnlfylHL5SmibIs2wxh/?imgmax=800" width="240" height="192"></a></p> <p><strong>Code</strong></p> <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; font-size: 8pt; border-top: silver 1px solid; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"><pre class="code"><span style="color: blue">public static </span><span style="color: #2b91af">Bitmap </span>BitmapDifference(<span style="color: #2b91af">Bitmap </span>first, <span style="color: #2b91af">Bitmap </span>second)<br /> {<br /> BitmapData data1 = first.LockBits(<span style="color: blue">new </span><span style="color: #2b91af">Rectangle</span>(0, 0, first.Width, first.Height), ImageLockMode.ReadWrite, first.PixelFormat);<br /> BitmapData data2 = second.LockBits(<span style="color: blue">new </span><span style="color: #2b91af">Rectangle</span>(0, 0, second.Width, second.Height), ImageLockMode.ReadWrite, second.PixelFormat);<br /> <span style="color: #2b91af">Bitmap </span>bmpresult = <span style="color: blue">new </span><span style="color: #2b91af">Bitmap</span>(first.Width, first.Height);<br /><br /> BitmapData data3 = bmpresult.LockBits(<span style="color: blue">new </span><span style="color: #2b91af">Rectangle</span>(0, 0, bmpresult.Width, bmpresult.Height), ImageLockMode.ReadWrite, first.PixelFormat);<br /><br /> <span style="color: blue">unsafe<br /> </span>{<br /> <span style="color: blue">int </span>remain1 = data1.Stride - data1.Width * 3;<br /> <span style="color: blue">int </span>remain2 = data2.Stride - data2.Width * 3;<br /> <span style="color: blue">int </span>remain3 = data3.Stride - data3.Width * 3;<br /><br /> <span style="color: blue">byte</span>* ptr1 = (<span style="color: blue">byte</span>*)data1.Scan0;<br /> <span style="color: blue">byte</span>* ptr2 = (<span style="color: blue">byte</span>*)data2.Scan0;<br /> <span style="color: blue">byte</span>* ptr3 = (<span style="color: blue">byte</span>*)data3.Scan0;<br /><br /> <span style="color: blue">for </span>(<span style="color: blue">int </span>i = 0; i < first.Height; i++)<br /> {<br /> <span style="color: blue">for </span>(<span style="color: blue">int </span>j = 0; j < first.Width * 3; j++)<br /> {<br /> <span style="color: blue">byte </span>ac = (<span style="color: blue">byte</span>)(<span style="color: #2b91af">Math</span>.Abs(ptr1[0] - ptr2[0]));<br /> <span style="color: blue">if </span>(ac < 15)<br /> {<br /> <span style="color: green">//Change Pixel Color to Black for all the pixel whose value is<br /> </span>ptr3[0] = 0;<br /> }<br /> <span style="color: blue">else<br /> </span>{<br /> ptr3[0] = ac;<br /> }<br /> ptr1++;<br /> ptr2++;<br /> ptr3++;<br /> }<br /> ptr1 += remain1;<br /> ptr2 += remain2;<br /> ptr3 += remain3;<br /> }<br /> }<br /> first.UnlockBits(data1);<br /> second.UnlockBits(data2);<br /> bmpresult.UnlockBits(data3);<br /><br /> bmpresult.MakeTransparent(<span style="color: #2b91af">Color</span>.Black);<br /> <span style="color: blue">return </span>bmpresult;<br /> }<br /></pre></div><pre class="code">Above function will return the difference between two images using following code </pre><br /><div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; font-size: 8pt; border-top: silver 1px solid; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"><pre class="code"><span style="color: blue">public void </span>GetDifference()<br />{<br /> <span style="color: #2b91af">Bitmap </span>bmp1 = <span style="color: blue">new </span><span style="color: #2b91af">Bitmap</span>(<span style="color: #a31515">@"C:\1.jpg"</span>);<br /> <span style="color: #2b91af">Bitmap </span>bmp2 = <span style="color: blue">new </span><span style="color: #2b91af">Bitmap</span>(<span style="color: #a31515">@"C:\2.jpg"</span>);<br /> <span style="color: #2b91af">Bitmap </span>result = BitmapDifference(bmp1, bmp2);<br /> result.Save(<span style="color: #a31515">@"C:\new.jpg"</span>);<br />}<br /></pre></div> Unknownnoreply@blogger.com0