Click here to Skip to main content
15,312,017 members
Home / Discussions / WPF
   

WPF

 
QuestionSetting DataGrid Cell Style From Code Behind Pin
Kevin Marois20-Dec-21 10:56
professionalKevin Marois20-Dec-21 10:56 
AnswerRe: Setting DataGrid Cell Style From Code Behind Pin
#realJSOP22-Dec-21 2:06
mva#realJSOP22-Dec-21 2:06 
QuestionInput Question Pin
Super Lloyd19-Dec-21 4:17
MemberSuper Lloyd19-Dec-21 4:17 
AnswerRe: Input Question Pin
#realJSOP19-Dec-21 22:26
mva#realJSOP19-Dec-21 22:26 
GeneralRe: Input Question Pin
Super Lloyd19-Dec-21 23:05
MemberSuper Lloyd19-Dec-21 23:05 
GeneralRe: Input Question Pin
#realJSOP19-Dec-21 23:18
mva#realJSOP19-Dec-21 23:18 
GeneralRe: Input Question Pin
Super Lloyd19-Dec-21 23:23
MemberSuper Lloyd19-Dec-21 23:23 
Question(Advanced?) Layout question Pin
Super Lloyd17-Dec-21 20:02
MemberSuper Lloyd17-Dec-21 20:02 
I have a FrameworkElement (subclass) in my app which is a host for custom Visuals (my app is a sort of drawing program).

Now I just put the first UIElement in the visual container. A UserControl which host a bunch of Controls, including a TextBox.

Now when the Text change and the text box resize and go outside the containing UserControl, it is clipped and does not show anymore.

I tried to set Clip to false on the UserControl, didn't help (in fact it was already false).

Now in my UIElement I can be aware of the need to resize, thanks to
C#
protected virtual void OnChildDesiredSizeChanged(UIElement child);

But I need to know that in my visual container.

At the moment it looks like it should only really be able to host & resize UIElement which implement some sort of INotifyResize interface, which I could inform thanks to this OnChildDesiredSizeChanged() method.

I wonder if there is already a way I can know that, with just any UIElement, not just the one made specifically to be hosted by that container.

EDIT / REMARK
5 minutes later... I think I might had answered my own question! OMG | :OMG: Roll eyes | :rolleyes: Big Grin | :-D
I could just override OnChildDesiredSizeChanged() in the visual container....
I think there might be some issues, because some ContainerVisual are involved in the Visual hierarchy... let's see...

EDIT2
So I tried that and it is really strange
C#
protected override void OnChildDesiredSizeChanged(UIElement child)
{
    base.OnChildDesiredSizeChanged(child);
    child.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
    child.Arrange(new Rect(BoundedVisual.GetLocation(child), child.DesiredSize));
}
This method is called only once and the child didn't resize...

EDIT3
Ha, I see, this didn't work, it this was another child (the one which display the scollbar). got nothing for the text...

EDIT / FOUND a solution
I am using this UIElement event to do my reArrange(), it seems to be working Smile | :)
C#
public event EventHandler LayoutUpdated;
A new .NET Serializer
All in one Menu-Ribbon Bar
Taking over the world since 1371!


modified 18-Dec-21 7:49am.

QuestionAbout RichTextBox size in a canvas Pin
Super Lloyd12-Dec-21 1:23
MemberSuper Lloyd12-Dec-21 1:23 
AnswerRe: About RichTextBox size in a canvas Pin
Richard Deeming12-Dec-21 21:49
mveRichard Deeming12-Dec-21 21:49 
GeneralRe: About RichTextBox size in a canvas Pin
Super Lloyd12-Dec-21 21:58
MemberSuper Lloyd12-Dec-21 21:58 
AnswerRe: About RichTextBox size in a canvas Pin
Gerry Schmitz13-Dec-21 7:22
mveGerry Schmitz13-Dec-21 7:22 
GeneralRe: About RichTextBox size in a canvas Pin
Super Lloyd13-Dec-21 11:42
MemberSuper Lloyd13-Dec-21 11:42 
GeneralRe: About RichTextBox size in a canvas Pin
Gerry Schmitz13-Dec-21 14:28
mveGerry Schmitz13-Dec-21 14:28 
GeneralRe: About RichTextBox size in a canvas Pin
Super Lloyd13-Dec-21 14:40
MemberSuper Lloyd13-Dec-21 14:40 
GeneralRe: About RichTextBox size in a canvas Pin
Gerry Schmitz14-Dec-21 7:28
mveGerry Schmitz14-Dec-21 7:28 
GeneralRe: About RichTextBox size in a canvas Pin
Super Lloyd14-Dec-21 12:28
MemberSuper Lloyd14-Dec-21 12:28 
AnswerRe: About RichTextBox size in a canvas Pin
Mycroft Holmes13-Dec-21 13:16
professionalMycroft Holmes13-Dec-21 13:16 
GeneralRe: About RichTextBox size in a canvas Pin
Super Lloyd13-Dec-21 13:27
MemberSuper Lloyd13-Dec-21 13:27 
AnswerRe: About RichTextBox size in a canvas Pin
#realJSOP14-Dec-21 0:37
mva#realJSOP14-Dec-21 0:37 
GeneralRe: About RichTextBox size in a canvas Pin
Super Lloyd14-Dec-21 0:52
MemberSuper Lloyd14-Dec-21 0:52 
GeneralRe: About RichTextBox size in a canvas Pin
#realJSOP14-Dec-21 8:42
mva#realJSOP14-Dec-21 8:42 
GeneralRe: About RichTextBox size in a canvas Pin
Super Lloyd14-Dec-21 12:26
MemberSuper Lloyd14-Dec-21 12:26 
GeneralRe: About RichTextBox size in a canvas Pin
#realJSOP14-Dec-21 23:49
mva#realJSOP14-Dec-21 23:49 
GeneralRe: About RichTextBox size in a canvas Pin
Super Lloyd15-Dec-21 0:02
MemberSuper Lloyd15-Dec-21 0:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.