How can the category name be dynamically switched?
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- csharp
- Domain
- desktop, localization
Research direction
Start with PropertyGrid_PreparePropertyItem, ApplyPropertyItemLocalization, and RefreshPropertyGrid from the issue example, then reproduce switching the selected language while the property grid is displayed. Verify whether the category value is refreshed as parameter names and descriptions are, and consider the work done when category names update in real time after the language change.
Written by the indexing model from the issue text.
Description
How can the category name be dynamically switched?
I need to switch between multiple languages.
However, it was found that the category names could not be refreshed in real time.
Parameter names and parameter descriptions are acceptable.
please help me . Thank you.
private void PropertyGrid_PreparePropertyItem(object sender, Xceed.Wpf.Toolkit.PropertyGrid.PropertyItemEventArgs e)
{
if (e?.PropertyItem is not PropertyItem propertyItem) return;
PropertyDescriptor? propertyDescriptor = propertyItem.PropertyDescriptor;
if (propertyDescriptor == null)
return;
ApplyPropertyItemLocalization(propertyItem, propertyDescriptor);
}
private static void ApplyPropertyItemLocalization(PropertyItem propertyItem,PropertyDescriptor propertyDescriptor)
{
LocalizedDisplayNameAttribute? displayNameAttribute =propertyDescriptor.Attributes[typeof(LocalizedDisplayNameAttribute)]as LocalizedDisplayNameAttribute;
if (displayNameAttribute != null)
{
propertyItem.DisplayName =LocalizationResourceHelper.GetString(displayNameAttribute.ResourceKey,displayNameAttribute.ResourceKey);
}
LocalizedDescriptionAttribute? descriptionAttribute =propertyDescriptor.Attributes[typeof(LocalizedDescriptionAttribute)]as LocalizedDescriptionAttribute;
if (descriptionAttribute != null)
{
propertyItem.Description =LocalizationResourceHelper.GetString(descriptionAttribute.ResourceKey,descriptionAttribute.ResourceKey);
}
LocalizedCategoryAttribute? categoryAttribute =propertyDescriptor.Attributes[typeof(LocalizedCategoryAttribute)]as LocalizedCategoryAttribute;
if (categoryAttribute != null)
{
propertyItem.Category =LocalizationResourceHelper.GetString(categoryAttribute.ResourceKey,categoryAttribute.ResourceKey);
}
}
private void RefreshPropertyGrid()
{
object? oldObject = GlobalPropertyGrid.SelectedObject;
if (oldObject == null)
return;
TypeDescriptor.Refresh(oldObject);
TypeDescriptor.Refresh(oldObject.GetType());
GlobalPropertyGrid.SetCurrentValue(PropertyGrid.SelectedObjectProperty, null);
Dispatcher.BeginInvoke(new Action(() =>
{
TypeDescriptor.Refresh(oldObject);
TypeDescriptor.Refresh(oldObject.GetType());
GlobalPropertyGrid.SetCurrentValue(PropertyGrid.SelectedObjectProperty, oldObject);
GlobalPropertyGrid.UpdateLayout();
GlobalPropertyGrid.Update();
}), DispatcherPriority.ContextIdle);
}
- Dominant language
- C#
- Stars
- 4.2k
- Forks
- 912
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from xceedsoftware/wpftoolkit
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
xceedsoftware/wpftoolkit#1808 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
xceedsoftware/wpftoolkit#1806 · 1 comment ·
-
Difficulty 1/5 Under an hour Newbie friendliness 45/100
xceedsoftware/wpftoolkit#1804 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
xceedsoftware/wpftoolkit#1802 · 3 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
xceedsoftware/wpftoolkit#1801 · 2 comments ·
All issues in xceedsoftware/wpftoolkit
Similar issues
-
effort:S P3 refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
nightscout/nocturne#1532 ·
-
core dependencies
Difficulty 1/5 Under an hour Newbie friendliness 80/100
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
C#/.NET Roslyn LSP Open
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
DotNetNext/SqlSugar#1458 ·