-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ucList design changes #3435
ucList design changes #3435
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -697,7 +697,12 @@ private void SetItemFullName() | |
{ | ||
try | ||
{ | ||
AlignGridandTextWidth(); | ||
xDetailsGrid.SizeChanged -= XDetailsGrid_SizeChanged; | ||
xDetailsGrid.SizeChanged += XDetailsGrid_SizeChanged; | ||
xItemNameTxtBlock.Text = string.Empty; | ||
xItemExtraInfoTxtBlock.Text = string.Empty; | ||
xItemExtraInfoTxtBlock.Visibility = Visibility.Collapsed; | ||
string fullname = string.Empty; | ||
if (!string.IsNullOrEmpty(mItemNameField)) | ||
{ | ||
Comment on lines
697
to
708
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The method
|
||
|
@@ -709,7 +714,6 @@ private void SetItemFullName() | |
FontSize = 15, | ||
Text = name.ToString() | ||
}); | ||
|
||
fullname += name; | ||
} | ||
} | ||
|
@@ -718,7 +722,8 @@ private void SetItemFullName() | |
bool isMandatory = (bool)Item.GetType().GetProperty(mItemMandatoryField).GetValue(Item); | ||
if (isMandatory) | ||
{ | ||
xItemNameTxtBlock.Inlines.Add(new System.Windows.Documents.Run | ||
xItemExtraInfoTxtBlock.Visibility = Visibility.Visible; | ||
xItemExtraInfoTxtBlock.Inlines.Add(new System.Windows.Documents.Run | ||
{ | ||
FontSize = 18, | ||
Text = "*", | ||
|
@@ -733,7 +738,8 @@ private void SetItemFullName() | |
Object extension = Item.GetType().GetProperty(mItemNameExtentionField).GetValue(Item); | ||
if (extension != null) | ||
{ | ||
xItemNameTxtBlock.Inlines.Add(new System.Windows.Documents.Run | ||
xItemExtraInfoTxtBlock.Visibility = Visibility.Visible; | ||
xItemExtraInfoTxtBlock.Inlines.Add(new System.Windows.Documents.Run | ||
{ | ||
FontSize = 11, | ||
Text = string.Format(" [{0}]", extension.ToString()) | ||
|
@@ -744,6 +750,7 @@ private void SetItemFullName() | |
} | ||
|
||
xItemNameTxtBlock.ToolTip = fullname; | ||
xItemExtraInfoTxtBlock.ToolTip = fullname; | ||
} | ||
catch (Exception ex) | ||
{ | ||
|
@@ -753,6 +760,20 @@ private void SetItemFullName() | |
}); | ||
} | ||
|
||
private void AlignGridandTextWidth() | ||
{ | ||
if (xItemNameColumn.ActualWidth > 200) | ||
{ | ||
xItemNameTxtBlock.MaxWidth = xItemNameColumn.ActualWidth - 100; | ||
xItemDescriptionTxtBlock.MaxWidth = xItemNameTxtBlock.MaxWidth; | ||
} | ||
} | ||
|
||
private void XDetailsGrid_SizeChanged(object sender, SizeChangedEventArgs e) | ||
{ | ||
AlignGridandTextWidth(); | ||
} | ||
|
||
private void SetItemDescription() | ||
{ | ||
this.Dispatcher.Invoke(() => | ||
Comment on lines
760
to
779
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The method - if (xItemNameColumn.ActualWidth > 200)
+ const int minWidthThreshold = 200; // This value should be adjusted to the appropriate threshold
+ const int widthOffset = 100; // This value should be adjusted to the appropriate offset
+ if (xItemNameColumn.ActualWidth > minWidthThreshold)
...
- xItemNameTxtBlock.MaxWidth = xItemNameColumn.ActualWidth - 100;
+ xItemNameTxtBlock.MaxWidth = xItemNameColumn.ActualWidth - widthOffset; |
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The event handler
XDetailsGrid_SizeChanged
is being unsubscribed and then immediately resubscribed. This is redundant and can be removed if the event handler is not being dynamically changed elsewhere in the code.If the intention is to ensure that the event handler is only subscribed once, consider checking if the event is already subscribed before adding it, or ensure that the event is unsubscribed when the control is disposed of to prevent memory leaks.
Committable suggestion