|
Hello J. Calhoun,
thannks for quick response.
i can only test out this when i am back to my office and will surely update feedback on this forum.
This solution seems to work but want to check for one case
If my button belongs to row 2 with position 1 and if i make visiblilty collapsed of button belongs to row 1 and second position than this position will be taken by row 2 , 1st button?
[In more simple words , button belongs to row 2 , column 1 should take the position of button belongs to row 1 , column 2 when existing button of row 1 , column 2 become collapsed]
I need this case to be meet. thanks
|
|
|
|
|
In that case it might be possible to put all of the buttons in a
<WrapPanel Orientation="Horizontal"> and size it to let the third and fourth button wrap to the second row, that way when the space is released they will filter back up to the top row.
|
|
|
|
|
Hi,
I tried your way of using wrappanel but using this it is aligning all the buttons to horizontal on default load itself.
below is my original code , it will help you to understand by button arrangement.
<UserControl x:Class="iPLAN20.Windows.LS.dckSafeDevt"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns ="http://schemas.microsoft.com/expression/blend/2008"
xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
xmlns:local="clr-namespace:iPLAN20.Model.LS"
xmlns:stb="clr-namespace:UIControls;assembly=iPLAN20UIControls" HorizontalAlignment="Left" VerticalAlignment="Top" Name="ucSafeDevt">
<UserControl.Resources>
<local:clsAppSiteModel x:Key="AppSiteModel"/>
</UserControl.Resources>
<Grid HorizontalAlignment="Left" Name="gridLandSafeguarding" DataContext="{StaticResource AppSiteModel}">
<Grid.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="..\..\Resources\ButtonStyle.xaml"/>
<ResourceDictionary Source="..\..\Resources\textbox.xaml"/>
<ResourceDictionary Source="..\..\Resources\Common.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Grid.Resources>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="0" Style="{StaticResource ASCIILabelStyle}" Content="Site No.:" HorizontalAlignment="Left" VerticalAlignment="Center"/>
<StackPanel Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="2" Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center">
<TextBox Text="{Binding TestText}" stb:AutoCompleteBehavior.AutoCompleteItemsSource="{Binding AppSiteList}" AutoWordSelection="True" Width="150" Name="txtSearchAppSite" TextAlignment="Center" Margin="5,5,0,5" VerticalContentAlignment="Center"/>
<Button IsDefault="True" x:Name="btnFind" Style="{StaticResource MetroButton}" Margin="1" Click="btnFind_Click">
<Button.Content>
<StackPanel Orientation="Horizontal">
<Image Source="/IPLAN20;component/Images/Search.png"/>
</StackPanel>
</Button.Content>
</Button>
</StackPanel>
<Label Style="{StaticResource ASCIILabelStyle}" Content="Commands:" Grid.Column="0" Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Center"/>
<Button Grid.Row="2" Grid.Column="0" Height="50" x:Name="btnNewSite" Width="100" IsEnabled="True" HorizontalAlignment="Left" VerticalAlignment="Center" Click="btnNewSite_Click" Style="{StaticResource ButtonStyle}">
<TextBlock TextWrapping="Wrap" TextAlignment="Center" Style="{StaticResource TextBlockStyle}">
New Site
</TextBlock>
</Button>
<Button Grid.Row="2" Grid.Column="1" x:Name="btnModifySite" Width="100" Height="50" IsEnabled="True" HorizontalAlignment="Left" VerticalAlignment="Center" Style="{StaticResource ButtonStyle}">
<TextBlock TextWrapping="Wrap" TextAlignment="Center" Style="{StaticResource TextBlockStyle}">
Modify Site
</TextBlock>
</Button>
<Button Grid.Row="2" Grid.Column="2" Height="50" x:Name="btnDraft" Width="100" IsEnabled="True" HorizontalAlignment="Left" VerticalAlignment="Center" Style="{StaticResource ButtonStyle}">
<TextBlock TextWrapping="Wrap" TextAlignment="Center" Style="{StaticResource TextBlockStyle}">
Save to Draft
</TextBlock>
</Button>
<Button Grid.Row="3" Grid.Column="0" Height="50" x:Name="btnLowHgtCtrl" Width="100" HorizontalAlignment="Left" VerticalAlignment="Center" Style="{StaticResource ButtonStyle}">
<TextBlock TextWrapping="Wrap" TextAlignment="Center" Style="{StaticResource TextBlockStyle}">
Lowest Height Control
</TextBlock>
</Button>
<Button Grid.Row="3" Grid.Column="1" Height="50" x:Name="btnQCReport" Width="100" HorizontalAlignment="Left" VerticalAlignment="Center" Style="{StaticResource ButtonStyle}">
<TextBlock TextWrapping="Wrap" TextAlignment="Center" Style="{StaticResource TextBlockStyle}">
QC Report
</TextBlock>
</Button>
<Button Grid.Row="3" Grid.Column="2" Height="50" x:Name="btnSendQC" Width="100" HorizontalAlignment="Left" VerticalAlignment="Center" Style="{StaticResource ButtonStyle}">
<TextBlock TextWrapping="Wrap" TextAlignment="Center" Style="{StaticResource TextBlockStyle}">
Send for QC
</TextBlock>
</Button>
<Button Grid.Row="4" Grid.Column="0" Height="50" x:Name="btnMaintainSchemechklst" Width="100" IsEnabled="True" HorizontalAlignment="Left" VerticalAlignment="Center" Style="{StaticResource ButtonStyle}">
<TextBlock TextWrapping="Wrap" TextAlignment="Center" Style="{StaticResource TextBlockStyle}">
Maintain Scheme Checklist
</TextBlock>
</Button>
<Button Grid.Row="4" Grid.Column="1" Height="50" x:Name="btnConfigureStryHghts" Width="100" IsEnabled="True" HorizontalAlignment="Left" VerticalAlignment="Center" Style="{StaticResource ButtonStyle}">
<TextBlock TextWrapping="Wrap" TextAlignment="Center" Style="{StaticResource TextBlockStyle}">
Configure Storey Heights
</TextBlock>
</Button>
<StackPanel Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="3" Orientation="Vertical" HorizontalAlignment="Stretch" >
<Label Style="{StaticResource ASCIILabelStyle}" Content="My Drafts:" HorizontalAlignment="Left" VerticalAlignment="Center"/>
<ListBox Name="listBoxDraftVersions" Height="200" Width="250" Background="Azure" Margin="3" ItemsSource="{Binding TheList}">
<ListBox.ItemTemplate>
<DataTemplate>
<CheckBox Name="CheckBoxZone" Content="{Binding TheText}" Tag="{Binding TheValue}"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</StackPanel>
<Button Content="Load" Grid.Row="6" Grid.Column="0" IsDefault="True" x:Name="btnLoad" Style="{StaticResource MetroButton}"/>
<Button Content="Reassign" Grid.Row="6" Grid.Column="1" IsDefault="True" x:Name="btnReassign" Style="{StaticResource MetroButton}"/>
<Button Content="Delete" Grid.Row="6" Grid.Column="2" IsDefault="True" x:Name="btnDelete" Style="{StaticResource MetroButton}"/>
</Grid>
</UserControl>
|
|
|
|
|
Thank you, this did help me to get a visual of what you are trying to accomplish. I still have one question and that is, the only buttons that you want to change the visibility on are the 8 buttons in the middle of your control correct? Under that assumption I have come up with a solution that I believe meets your requirements.
I made a User Control with the design height at 500 and the design width at 300 which allowed me to fit all your controls in the window and keep the same arrangement scheme that you provided.
Next, I created 3 rows and seperated your controls into the 3 Sections. The top controls will go in the first StackPanel like this:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center" Grid.Row="0">
<Label Content="Site No.:" HorizontalAlignment="Left" VerticalAlignment="Center"/>
<TextBox Width="150" Margin="5,5,0,5" HorizontalAlignment="Left" VerticalAlignment="Center"/>
<Button Margin="1" Content="YourImage"/>
</StackPanel>
<Label Content="Commands" HorizontalAlinment="Left" VerticalAlignment="Center"/>
</StackPanel>
The WrapPanel is where I host your 8 buttons, and the StackPanels will host your other controls.
<WrapPanel Orientation="Horizontal" Grid.Row="1">
<Button Height="50" Width="100" HorizontalAlignment="Left" VerticalAlignment="Center">
<TextBlock TextWrapping="Wrap" TextAlignment="Center">
New Site
</TextBlock>
</Button>
<Button Height="50" Width="100" HorizontalAlignment="Left" VerticalAlignment="Center">
<TextBlock TextWrapping="Wrap" TextAlignment="Center">
Modify Site
</TextBlock>
</Button>
<Button Height="50" Width="100" HorizontalAlignment="Left" VerticalAlignment="Center">
<TextBlock TextWrapping="Wrap" TextAlignment="Center">
Save To Draft
</TextBlock>
</Button>
<Button Height="50" Width="100" HorizontalAlignment="Left" VerticalAlignment="Center">
<TextBlock TextWrapping="Wrap" TextAlignment="Center">
Lowest Height Control
</TextBlock>
</Button>
<Button Height="50" Width="100" HorizontalAlignment="Left" VerticalAlignment="Center">
<TextBlock TextWrapping="Wrap" TextAlignment="Center">
QC Report
</TextBlock>
</Button>
<Button Height="50" Width="100" HorizontalAlignment="Left" VerticalAlignment="Center">
<TextBlock TextWrapping="Wrap" TextAlignment="Center">
Send for QC
</TextBlock>
</Button>
<Button Height="50" Width="100" HorizontalAlignment="Left" VerticalAlignment="Center">
<TextBlock TextWrapping="Wrap" TextAlignment="Center">
Maintain Scheme Checklist
</TextBlock>
</Button>
<Button Height="50" Width="100" HorizontalAlignment="Left" VerticalAlignment="Center">
<TextBlock TextWrapping="Wrap" TextAlignment="Center">
Configure Storey Heights
</TextBlock>
</Button>
This WrapPanel will cause your controls to take up the space that the collapsed button used to occupy and will move up rows if there is enough space on the row above it. The width of the WrapPanel will determine how many buttons per row as the buttons will fill in horizontally before moving down to the next row, this is possibly the reason for the vertical alignment you previously mentioned.
And Finally You can put your Last Section in another StackPanel:
<StackPanel Grid.Row="2" HorizontalAlignment="Stretch">
<Label Content"My Drafts:" HorizontalAlignment="Left" VerticalAlignment="Center"/>
<Listbox Height="200" Width="250" Background="Azure" Margin="3"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<Button Content="Load" Width="75" Margin="0,0,10,0"/>
<Button Content="Reassign" Width="75" Margin="0,0,10,0"/>
<Button Content="Delete" Width="75" Margin="0,0,10,0"/>
</StackPanel>
</StackPanel>
</Grid>
I hope this meets your requirements! If you have any other questions I will be happy to help!
|
|
|
|
|
Thanks a lot. You're amazing . This is working as i wanted.
My post started with 2 questions and i am still finding answer for 1st part , please see if you can help me this one too. Let me narrow down my problem:
ORIGINAL POST
"I am using usercontrol (do not want to use window) and want to stop resizing of it but cannot see any property. please help me in achieving the same."
MORE DETAILS
I am binding this usercontrol to dockablewindow of other libraries. How can i control resizing of System.Windows.Forms.Integration.ElementHost()?
here is the code
public class AddinImpl : ESRI.ArcGIS.Desktop.AddIns.DockableWindow
{
private System.Windows.Forms.Integration.ElementHost m_windowUI;
public AddinImpl()
{
}
protected override IntPtr OnCreateChild()
{
m_windowUI = new System.Windows.Forms.Integration.ElementHost();
m_windowUI.Child = new dckSafeDevt();
//m_windowUI.MaximumSize = new System.Drawing.Size(305, 500);
return m_windowUI.Handle;
}
protected override void Dispose(bool disposing)
{
if (m_windowUI != null)
m_windowUI.Dispose();
base.Dispose(disposing);
}
}
dckSafeDevt is my usercontrol. Anyhelp on same will be really appreciated. Thanks a ton.
Regards
|
|
|
|
|
First thing I noticed is the commented line:
This will only set the maximum size of the element host so that you can not size it any larger than this size. The same rule will apply to MinimumSize, it will not size any smaller than that size.
m_windowUI.Size = new System.Drawing.Size(305,500); is the event that I believe you are looking for. It has been a while since I worked with windows forms, but I believe when you set the size of a control it will not resize when the window does.
I suppose you could set a minimum and maximum that are the same size, but the real thing to understand here is that both the user control and the element host inherit from Control, so they should both be thought of as controls inside a window.
Now, that being said you can find a good reference of all of the properties of your element host here:
https://msdn.microsoft.com/en-us/library/vstudio/system.windows.forms.integration.elementhost%28v=vs.100%29.aspx[^]
And could possibly fix the client area of the control to a certain size, that way the UserControl would only fit inside that area?
Again it has been a while since I worked with Windows.Forms, but I will create a little dummy project and see if I can't find a solution, but hopefully these suggestions might get you on the right track.
If you could help me get a visual of what I need to recreate... Windows.Forms Window, element host, then WPF UserControl. The UserControl is in the element host that is docked inside a window with other winforms controls? or is the usercontrol hosted by itself inside the window?
I can't remember what I forgot...
|
|
|
|
|
G'Day,
Your suggestions are very helpfull but still i am not able to achieve this. I cannot able to stop resizing using m_windowUI.Size = new System.Drawing.Size(305,500).
As you asked , it is usercontrol only hosted within dockable window of esri using elementhost.
Thanks again for all your help
|
|
|
|
|
Is it possible to load various parts of a WPF UI in different threads?
I've got some UserControls loading that are slow, and I'd like to see if threading them would speed up the loading.
If it's not broken, fix it until it is
|
|
|
|
|
|
Rather than that, you should identify what the slowdown is and fix that. There are various optimisation techniques, but they are going to require you to do some root cause analysis first.
|
|
|
|
|
I can't. Some of this is an old third party WinForms control that we're forced to use right now.
If it's not broken, fix it until it is
|
|
|
|
|
Well, threading isn't going to do anything. Creating an instance of the control cannot be done on a separate thread. It has to done on the UI (startup) thread since the form you're going to stick the control to is on the UI thread.
Really, you HAVE to do root cause analysis here. Is it the creation of the control that is slow or is it retrieving data that the control is going to use that is slow?
If it's the creation of the control there's nothing you can do about it.
|
|
|
|
|
I have UserControl with it's VerticalAlignment set to Bottom so it's always along the bottom of the window.
At runtime the user can set a mode that causes it's height to increase. The problem is that all that does is extend it past the bottom of the window.
The control's Grid Height is "*".
How can I make all of it visible when it's height changes?
If it's not broken, fix it until it is
|
|
|
|
|
Not sure what you are doing with your control, but if it was like a Status bar or similar, Id either use RowDefinitions or a DockPanel to set it at the bottom. But without any code, or an exact explanation of what you want to achieve its hard to give you any better advice.
|
|
|
|
|
If you are trying to have a control, that is always aligned to the bottom of the window, yet when the height property changes, the height goes up instead of down I suggest you do something like this:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
Then on the bottom grid:
<Grid Grid.Row="2" x:Name="MyGrid" VerticalAlignment="Stretch" HorizontalAlignment="Stretch/>
On Runtime if you would like to change the height of the control, then all you would need to do is change the height of the Grid. By doing this you keep your control inside the bounds of the grid, yet if the grid height changes, so will the control since the property is set to stretch.
|
|
|
|
|
I have a WPF app that contains some slow WinForms controls in it. Later they'll be replaced with WPF controls.
The problem is that they're very slow and cause the UI to act strange at times. For example, when the main window is resized, the controls are resize, and they look horrible during resizing.
Is it possible in WPW to 'Freeze' the UI until resizing/loading is done?
Thanks
If it's not broken, fix it until it is
|
|
|
|
|
Hello Everyone,
I need a quick advice on following. Please help me out..
I am using following searchtextbox in my WPF application usercontrol and successfully able to reference it. I can see the searchtextbox on my usercontrol but i don't know how to use its functions, i mean how to bind this with list of data ? Following url only explained about customized textbox but not on how to consume and use it? Please help me on this . thanks
Saurabh
|
|
|
|
|
You need to ask the person who created it. If this refers to a CodeProject article then use the forum at the end of the article.
|
|
|
|
|
I take it that you are referring to this blog post[^]. The chances of someone here, just knowing how that works, is very slim. What you are asking is for someone to download the control, integrate it into an application and then figure out how it works. That seems like you're expecting us to do an awful lot of your research for you. That's not going to happen.
|
|
|
|
|
Hello all,
I am trying to determine if I can do a particular project in Windows phone/store or not.
I need to take a given video file, extract the audio in wave format, do some processing and put it back in the video.
Do you think this is an easy/feasible task to do? In this case, would you give me some key words (name of the library, Programming language) or anything else that I can use to narrow down my search?
Thanks,
Vahid
|
|
|
|
|
Member 11960247 wrote: Do you think this is an easy/feasible task to do? That all depends on your knowledge and experience. But the remainder of your question suggests that you have some way to go yet. How about some keywords such as "audio extract video"?
|
|
|
|
|
How about helping people instead of trying to be funny.
I am looking for specific toolboxes/libraries that more experienced user would recommend.
|
|
|
|
|
I'm not trying to be funny. You asked how easy it was, and I gave you an answer based on what we know about your skills, which is nothing. You asked for some keywords and I gave you some; have you tried using them?
|
|
|
|
|
Of course I have tried them. And suggesting those keywords seemed like an effort to be sarcastic.
Being easy is like: there is a library called "" that does extraction automatically. Go and learn about it.
Being hard is like: you should learn MPEG/AVI/FLV... standards, read the header files and decode the data yourself for all different formats of audio...
The third answer would be: I don't know.
|
|
|
|
|
Member 11960247 wrote: Do you think this is an easy/feasible task to do? Not easy
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|