.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

RichTextBox - Attached Properties, Document and CaretPosition

Posted By:      Posted Date: August 30, 2010    Points: 0   Category :WPF
Hi I have created a couple of attached properties for the richtextbox control, to enable binding to the Document and CaretPosition native properties of the richtextbox. However, I am finding that, when I am programmatically updating the richtextbox document from the view model (rather than typing it into the richtextbox directly), I need to manually set the CaretPosition property of the richtextbox (see the underlined piece of code for the additional manual setting of CaretPosition) whereas the Document property appears to be updating automatically. At least when I step the code and break in on I'm concerned that I've not quite wired this together properly and would be grateful if someone could explain where I've got it wrong. The relevant  XAML is  <RichTextBox x:Name="rtb" Height="auto" Width="auto" local:RichTextBoxExtensions.CaretPosition="{Binding CaretPosition, Mode=TwoWay}" local:RichTextBoxExtensions.CurrentText="{Binding CurrentText, Mode=TwoWay}" cal:Message.Attach="[Event TextChanged] = [Action CheckForPopup]; [Event PreviewKeyUp] = [Action KeyPress($eventArgs)]"> <local:RichTextBoxExtensions.Document> <MultiBinding Converter="{StaticResource IntellisenseController}"> <Binding Path="CurrentDocument" Mode=&qu

View Complete Post

More Related Resource Links

Advanced Basics: Setting Word Document Properties the Office 2007 Way


The last time I wrote this column (March 2006), I shared an application that allows you to update all the Microsoft® Word documents in a folder and its subfolders. Each time the application finds a document in the specified path, it updates the document properties to match those you specified in the application.

Ken Getz

MSDN Magazine June 2006

Advanced Basics: Set Word Document Properties Programmatically


At the beginning of another lovely day of writing courseware in mad pursuit of unrealistic deadlines, I received a frantic call from a business partner. He was at the end of a long consulting project and had several hundred Microsoft® Word documents, all of which required their document properties to be set identically, except the Title property of the document, which was to be based on the document file name, minus the .

Ken Getz

MSDN Magazine March 2006

Unable to Edit the properties of a document using the ribbon


I have created a new web part page and added a document library to that page.  In the ribbon the "Edit Properties" icon is enabled and I can edit the document properties.

When I add another web part to the page and go back to select a document, on the ribbon the "Edit Properties" icon is no disabled.  I can still edit the document using the context menu of the document.

Permissions on the library did not change when I added the additional web part.  The only change to the page was adding an additional web part.

How do I get the Name link to go to document properties instead of the doc itself?

Hello.  I need to link my documents/photos/etc to their properties page (DispForm.aspx), not directly to the item itself.  How do I change my code to do this?  I have SharePoint Designer, but I'm no big expert.  I have looked through all the different column names and types and cannot find one that does this.  Thanks.  Oh, I'm on WSS 3.0.

Word 2010 Crashes When Editing Server or Document Properties

I don’t know if I’m doing something wrong or if this is a bug. We are using Metadata in our SharePoint 2010 implementation and I have linked this to the various document templates. If the template is a docx or dotx extension then, in a document library, going New Document and editing the Server or Document Properties causes Word to crash. Document templates based on .doc extensions work fine. Once the document has been created you can edit the properties but obviously this isn’t the best process. Does anyone have any advice on this? Thanks Neil

How do I upload and overwrite document while keeping the same document properties?


I need to upload a new version of an existing Word document (same file name) while keeping the properties that have already been set in Sharepoint for the document. I can only find that the properties are either deleted or reset to default values. How do I avoid this?

I have tried both with and without versioning activated. In either case the properties are reset.

I have also tried to overwrite the document throught the web interface and through Office/Explorer. Same apply here.


Document Library Missing Columns in Edit Properties

Hi, I'm having an issue with a specific Site Collection.  The issue is that some of the columns do not show up when you go to the Edit Properites page, or when the user creates a new document.  The items can be edited when opened in a data sheet, but the users would like to be able to edit them on the Edit Properties page.  They say they haven't made any changes, but this has happened at least 3 times with differenct document libraries on this specific site.  Has anyone else ever dealt with this?  Anyone got a solution?  Let me know if more info is needed.  Thanks.

Document attached to Infopath; will it work offline?


We have a user that has created an editing template using infopath. Part of the process involves uploading documents to the form template. It is part of an editing process they've created. The question is since the document is attached to the form what happens when SharePoint goes offline? I know you can sync the form to Outlook but if you work offline and then sync it back to SharePoint, will the changes you made to the document be recorded or just to the form itself? I hope I've explained this clearly.


I should mention were using MOSS 3.0 SharePoint 2007 server.

Search results doesn't show Word document Title Properties


The search result doesn't show the Word document's Title properties.

For example a Office 2007 Word document has Title properties as "Dell, Template (MN 520287) Test Method", the first word in the document is "Opearation".

The Search result shows the search result with the first word of the document as the search result as

The test sample plan is an general inspection for a normal inspection with a … http://mycorp.company.com/Document Library/MN-0330.00 bala (WN 11100 … Authors: James Wolf Date: 9/29/2010 Size: 169KB
http://mycorp.company.com/Document Library/MN-0330.00 bala (MN 520287) Test Method.docx

instead of

Dell, Template (MN 520287) Test Method
The test sample plan is an general inspection for a normal inspection with a … http://mycorp.company.com/Document Library/MN-0330.00 bala (WN 11100 … Authors: James Wolf Date: 9/29/2010 Size: 169KB
http://mycorp.company.com/Document Library/MN-0330.00 bala (WN 11100) Test Method.docx 

Recover last version of file properties in MOSS document library


After an overwrite to several hundred files we need a quick way to either restore the entire file to the previous version or ideal just the custom property fields.

I tried to find a way to script a query into the document library and collect the previous version custom data into an excel spreadsheet but could not find a solution.

I came across this post that indicated he was able to restore only the file properties but retained the current version (which was not his gold but would be mine).


He included a snippet of his code:

Would this work? is there a powershell equivalent?

Whats the easies way to make this code into a useful solution.


int versionCount = item.Versions.Count;
if (versionCount > 0)
// this only restores properties

document.getElementById("div5") has no properties


Error: document.getElementById("div5") has no properties


i have a div element but i get the above error msg in firefox

how do i rectify

Document Properties becoming blank for Migrated Documents


Hi there,

PFB the description of the issue :

Basically, we do data migration(Mostly documents)from Webdocs to Sharepoint, So after migrating these docs(using importer tool) into sharepoint site, when we try to Edit the properties of the document(especially office 2007, eg. docx,xlsx)and then save, then this version's properties go blank and never get released. Alternatively, when I upload a doc this problem does not occur. What we tried to analyze is that, while clicking on the edit properties of the doc and save, looks like the document's properties(built-in) which is of blank values are overridden with the 'migrated properties' of the document. But when we upload a doc, since we are supplying all new values initially in the edit page, these values are absorbed into the document's built-in properties, so during the second time edit, there isn't a chance of the document having blank values. Also office 2007 docs can absorb all the customized fields and values that we provide, unlike 97-2003 docs which only has few built-in fields like Title and Author.

Is there a workaround for the Migrated docs ? We dont want the properties of the docs to go blank and go into draft mode. Happens even with simple check-out and check-in. Please share your views.




Event handler: properties.AfterProperties on a document library ItemUpdated/ItemAdded event


In a ItemUpdated event on a list i normally i use "properties.ListItem" to get data before the changes, and "properties.AfterProperties" to get data after the chages

But when working with document libraries things get a lot complicated. The ItemAdded handler gets called when a file is uploaded, not when the user specifies it's metadata. To handle these metadata i have to use the ItemUpdated handler.
But even there it happens that "properties.ListItem" and "properties.AfterProperties" result both null, so i cannot access any data i need

Is there a way to get a document metadata when it is added to a library?

Content Type Properties/Fields on Document Template


I have created a content type and added some custom site columns to it.  I have also created a document template (.dotx) where I have added some of the columns as fields that appear in the footer and header of the document template.  In the Advanced Settings of my Content Type I have added the .dotx template as the template for the Content Type.

In a document library I added the content type.  When I create a document from the content type in that document library the fields on the new document do not get updated when I select different data for any of the columns in the Document Information Panel.

Even when I save the document and reopen it the data in the columns on the Header or Footer does not get updated so there is a discrepancy between the data selected on the DIP and what is shown in the Header or Footer.

What am I doing wrong?

Change the order of fields in the 'edit properties' screen in a document library?


How can I change the order of the fields in the 'edit properties' screen on a document library?

In a standard list there is an option for 'column ordering'. This option does not exist in a document library! In my document library I have added some site columns to be used for filtering of documents in the library. But I'm not happy with the order they are being added into the 'edit properties' screen. The order looks different to the order that is shown in SharePoint Designer in the doc library when I click the 'edit list columns' link.

Any help much appreciated.


"You must fill out all required properties before checking in this document"


Hello All,

I am encountering an issue with multiple documents libraries not allowing any users to check in documents after editing properties. 

Before you jump to the standard responses please review the following conditions:

  • MOSS 2007 - Windows Server 2008 R2 - (SQL 2005 backend support) most recent updates applied as of 11/24/2010
  • Require Check out before making changes is set to NO.
  • ALL FIELDS ARE OPTIONAL (with the title hidden via content type)
  • All relative content types have been checked to verify that fields are set to optional or hidden.
  • ALL FIELDS approriate field data entered.
  • Issue occurs for all users at any permission level from Site Admin down -  Full Control - to contribute

Even with all of these things in place the error - You must fill out all required properties before checking in this document occurs and check in fails.

The only way to check the docs in successfully is to use the List Item editor off of code plex to perform the function.  Any help would be greatly appreciated.




How to add animations as attached properties for a Window??


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Animation;

public class MyClass : DependencyObject
 private static System.Windows.Media.Animation.Storyboard FadeIn;
    static MyClass()
      //Initializing the Fade in storyboard
      FadeIn = new System.Windows.Media.Animation.Storyboard();
      DoubleAnimation fadeinAnim = new DoubleAnimation();
      fadeinAnim.BeginTime = TimeSpan.FromMilliseconds(1);
      fadeinAnim.Duration = TimeSpan.FromMilliseconds(50);
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend