This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
1. Open GridStyles sample project 2.Modify MainWindow.xaml.cs PropertyGrid.SelectedObject = Puppy.TestPuppy;//add custom node PropertyGrid.AddNode("Custom Node", "Some text"t); "Custom Node" text box displayed exatly the same as the rest of nodes 3. add data template resource <ResourceDictionary.MergedDictionaries><ms:PropertyGridStyles /> </ResourceDictionary.MergedDictionaries> <!-- ADD DATA TEMPLATE --> <DataTemplate x:Key="CustomTemplate"><ms:TextBox Text="{Binding Value}"> </ms:TextBox> </DataTemplate> 4. Modify MainWindow.xaml.cs PropertyGrid.AddNode( "Custom Node", "Some text", (DataTemplate)Resources["CustomTemplate"]); Default Windows Style is used to draw custom node. What is missing from custom DataTemplate?
|
|
|
Custom styles do not attempt to "take over" the templates of controls within the grid: they just apply styles to the editors they know about. So if you provide a custom editor you will need to style it explicitly. One limitation of the current custom styles is that they do not provide keys for you to reference the editor styles from external data templates. So for the time being you will need to copy the style definitions into your application and reference them as local resources. Thus, in your case: 1. Go into the XAML file for the style you're using (in the Source / Styles folder) and locate the/a style appropriate to your editor. For example, if you are using Blue.xaml and want to style a text box, look for the TextEditor key (it begins on line 762 of Blue.xaml). 2. Copy this style into your application or window resources. Note you may need to copy some other resources referenced by the style, e.g. the TextColor brush resource. 3. Reference the style from your DataTemplate: <DataTemplate x:Key="CustomTemplate"> |
|
|
is it possible to use application wide resources in app.xaml? <Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source=”Styles\Blue.xaml”></ResourceDictionary> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Application.Resources> |
|
|
Yes. |
|