Click here to Skip to main content
15,798,199 members
Home / Discussions / WPF
   

WPF

 
QuestionSetting DataGrid Cell Style From Code Behind Pin
Kevin Marois20-Dec-21 11:56
professionalKevin Marois20-Dec-21 11:56 
AnswerRe: Setting DataGrid Cell Style From Code Behind Pin
#realJSOP22-Dec-21 3:06
mve#realJSOP22-Dec-21 3:06 
QuestionInput Question Pin
Super Lloyd19-Dec-21 5:17
Super Lloyd19-Dec-21 5:17 
AnswerRe: Input Question Pin
#realJSOP19-Dec-21 23:26
mve#realJSOP19-Dec-21 23:26 
GeneralRe: Input Question Pin
Super Lloyd20-Dec-21 0:05
Super Lloyd20-Dec-21 0:05 
GeneralRe: Input Question Pin
#realJSOP20-Dec-21 0:18
mve#realJSOP20-Dec-21 0:18 
GeneralRe: Input Question Pin
Super Lloyd20-Dec-21 0:23
Super Lloyd20-Dec-21 0:23 
Question(Advanced?) Layout question Pin
Super Lloyd17-Dec-21 21:02
Super Lloyd17-Dec-21 21: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 2:23
Super Lloyd12-Dec-21 2:23 
AnswerRe: About RichTextBox size in a canvas Pin
Richard Deeming12-Dec-21 22:49
mveRichard Deeming12-Dec-21 22:49 
GeneralRe: About RichTextBox size in a canvas Pin
Super Lloyd12-Dec-21 22:58
Super Lloyd12-Dec-21 22:58 
AnswerRe: About RichTextBox size in a canvas Pin
Gerry Schmitz13-Dec-21 8:22
mveGerry Schmitz13-Dec-21 8:22 
GeneralRe: About RichTextBox size in a canvas Pin
Super Lloyd13-Dec-21 12:42
Super Lloyd13-Dec-21 12:42 
GeneralRe: About RichTextBox size in a canvas Pin
Gerry Schmitz13-Dec-21 15:28
mveGerry Schmitz13-Dec-21 15:28 
GeneralRe: About RichTextBox size in a canvas Pin
Super Lloyd13-Dec-21 15:40
Super Lloyd13-Dec-21 15:40 
GeneralRe: About RichTextBox size in a canvas Pin
Gerry Schmitz14-Dec-21 8:28
mveGerry Schmitz14-Dec-21 8:28 
GeneralRe: About RichTextBox size in a canvas Pin
Super Lloyd14-Dec-21 13:28
Super Lloyd14-Dec-21 13:28 
AnswerRe: About RichTextBox size in a canvas Pin
Mycroft Holmes13-Dec-21 14:16
professionalMycroft Holmes13-Dec-21 14:16 
GeneralRe: About RichTextBox size in a canvas Pin
Super Lloyd13-Dec-21 14:27
Super Lloyd13-Dec-21 14:27 
AnswerRe: About RichTextBox size in a canvas Pin
#realJSOP14-Dec-21 1:37
mve#realJSOP14-Dec-21 1:37 
GeneralRe: About RichTextBox size in a canvas Pin
Super Lloyd14-Dec-21 1:52
Super Lloyd14-Dec-21 1:52 
GeneralRe: About RichTextBox size in a canvas Pin
#realJSOP14-Dec-21 9:42
mve#realJSOP14-Dec-21 9:42 
GeneralRe: About RichTextBox size in a canvas Pin
Super Lloyd14-Dec-21 13:26
Super Lloyd14-Dec-21 13:26 
GeneralRe: About RichTextBox size in a canvas Pin
#realJSOP15-Dec-21 0:49
mve#realJSOP15-Dec-21 0:49 
GeneralRe: About RichTextBox size in a canvas Pin
Super Lloyd15-Dec-21 1:02
Super Lloyd15-Dec-21 1: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.