|
Ok, Right! Got it
|
|
|
|
|
While the other answer you got will work correctly, it's not the WPF-ish way of doing it. Ideally you should bind the grid's Visibility to a public property on the data class where you also need to implement INotifyPropertyChanged. If this property is a bool, you'd also need to use a binding converter (to convert from bool to Visibility).
|
|
|
|
|
Thanks Nishant for you reply! Yes, I understand your point. This Grid and Visibility property was just a small example of my problem. Sometime I have a canvas and need to addChildren, removeChildren and many more thing from class. So, basically all drawing methods implemented inside class, while no objects accessible. In that case, i am really not sure how binding will work.
|
|
|
|
|
Ok, the name TempDataClass led me to believe that it was some kind of Model class. So it seems it's merely a UI helper class that dynamically manipulates your UI. In which case it's reasonable to just pass in the Grid instance to it and access it that way.
|
|
|
|
|
I am having trouble with a Datagrid within a stackpanel. I put a stackpanel around the datagrid because I want the datagrid size to collapse to accordingly to the amount of rows I bring back. My problem lies when I bring back a lot of rows because it displays everything in the datagrid and the datagrids scrollbar never shows. I know I could put a maxheight on the datagrid but if I need to take into account the actual size of the window because of screen resolution and size. If I put a maxheight on the datagrid it would not look right when the screen is maximized, there would be a lot of extra white space. I want the datagrid to expand proportionately to the bottom of the screen. I am using the MVVM pattern.
<Grid x:Name="PatientSearchResultsGrid" Grid.Row="2" Margin="0" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="1" Margin="0,12,0,46" >
<Grid Margin="0,3,4,23" Panel.ZIndex="596" x:Name="LayoutGrid" Visibility="{Binding HideShowDatagrid, Converter={StaticResource MyBooleanToVisibilityConverter}}" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<dg:DataGrid
Cursor="Hand"
Grid.Row="1"
AlternationCount="2"
SelectedItem="{Binding SelectedPerson}"
ItemsSource="{Binding SelectedPeople}"
Style="{DynamicResource DataGridStyle}"
AutoGenerateColumns="False"
x:Name="PatientSearchResultsDG"
Margin="2,-17.8,3,1.7" BorderThickness="1,0,1,1" BorderBrush="#FF202020" >
<dg:DataGrid.Resources>
<Style TargetType="{x:Type dg:DataGridRowHeader}">
<Setter Property="Background" Value="Transparent"/>
</Style>
</dg:DataGrid.Resources>
<dg:DataGrid.Columns>
<dg:DataGridTextColumn Binding="{Binding Name}" IsReadOnly="True" x:Name="PatientName" Width="*" Header="Name" />
<dg:DataGridTextColumn Binding="{Binding SidNumber}" IsReadOnly="True" x:Name="SID" Width="*" Header="SID" />
<dg:DataGridTextColumn Binding="{Binding InmateNumber}" IsReadOnly="True" x:Name="InmateNum" Width="*" Header="Inmate #" />
<dg:DataGridTextColumn Binding="{Binding Sex}" IsReadOnly="True" x:Name="Sex" Width="*" Header="Sex" />
<dg:DataGridTextColumn Binding="{Binding DateOfBirth, StringFormat=' \{0:MM/dd/yyyy\}'}" IsReadOnly="True" x:Name="DOB" Width="*" Header="Date of Birth" />
<dg:DataGridTextColumn Binding="{Binding FacilityName}" IsReadOnly="True" x:Name="Facility" Width="*" Header="Facility" />
<dg:DataGridTextColumn Binding="{Binding Housing}" IsReadOnly="True" x:Name="Housing" Width="*" Header="Housing" />
<dg:DataGridTextColumn Binding="{Binding Active}" IsReadOnly="True" x:Name="Active" Width="*" Header="Active" />
<dg:DataGridTextColumn Binding="{Binding Locked}" IsReadOnly="True" x:Name="Locked" Width="*" Header="Locked" />
</dg:DataGrid.Columns>
</dg:DataGrid>
</Grid>
</StackPanel>
</Grid>
|
|
|
|
|
Member 4540564 wrote: <grid.rowdefinitions>
<rowdefinition height="Auto">
Change the Height to * and then try again.
|
|
|
|
|
I was having the same problem and solved it by replacing the StackPanel with a Grid. It looks as though the StackPanel does not constrain the height of its children while the Grid does.
|
|
|
|
|
Hi
I am trying to change node indent for treeview control in wpf, but found that it has no NodeIndent property in wpf.
Does anyone who knows how to change the node indent?
jesse
|
|
|
|
|
|
Hi Peoples,
Got an doubt that,
i created one WPF browser application deployed in and UNC path.
i tried accessing the same from my IE browser its throwing me the error that
The application cannot be deployed because it is not trusted.
I googled and found that i should create some certification to do the same..
is it requires that certification neccessarily to be created or is there any other way???
if its mandatory can u please explain in simple steps..
Thanks in Advance...
|
|
|
|
|
Hi I have googled on net and found there about this issue that
All standalone WPF applications, whether installed by Windows Installer, XCopy, or ClickOnce, require FullTrust permissions, irrespective of their zone. This is because Window requires unmanaged code permission (eg SecurityPermission(SecurityPermissionFlag.UnmanagedCode)).
http://michaelweinhardt.spaces.live.com/blog/cns!BCB75D26D609CF01!132.entry[^]
Parwej Ahamad
ahamad.parwej@gmail.com
|
|
|
|
|
Hi Mr, parvej.
I tried reading the blog you mentioned .. i understand what you are coming to say..
but i cant work out with that..
i created one xbab application .if i publish the same and tried browsing from ie, its saying that the application cannot be deployed because it is not trusted..
Can you helm me regarding the same
|
|
|
|
|
|
Hi parwej,
thanks for your mail reply..
i tried with that steps and found my self working. though i went to the same site previous itself i was bit concerned to do with out certificate..
any how i tried but was not possible
its explained that i need to add the certificate all over the machines i am using(client).
is that mandatory?
and is it possible to by pass that and can use like asp.net applications?
|
|
|
|
|
I believe certificate need to install on all client machine because you are using trusted application deployement. Due to short time I am unable explain everything here. Jus find below link you will got your all query answer.
http://msdn2.microsoft.com/en-us/library/01daf08f.aspx[^]
Thanks, Feel free to post here for further queries, If possible I will give you.
Parwej Ahamad
ahamad.parwej@gmail.com
|
|
|
|
|
The certificate must be trusted on each computer the application gets deployed to. There are a few ways of going about this:
- Use the certificate that Visual Studio creates with the application.
- Get client computers to trust this certificate by having the users download and install the certificate themselves.
- Get client computers to trust this certificate by creating a Windows Forms program which installs the certificate. The user would then just have to run this program before running the main program. I have gone this route and it works just fine.
- Buy a certificate from a trusted certificate authority (e.g., Thawte). These can be expensive, but using such a certificate requires no extra step by the user (the certificate is already trusted on their computer, because it is signed by the trusted certificate authority).
I know it can be a pain to work with certificates. Good luck.
|
|
|
|
|
I've defined a Storyboard, and I want to call it based on data value. But it throws error ::- Unhandled Exception: System.InvalidOperationException: A Storyboard tree in a Style cannot specify a TargetName. Remove TargetName 'glow'.-::. The same storyboard works fine if I call it through EventTrigger. If I remove TargetName, obviously it doesn't work at all.
My StoryBoard:
<UserControl.Resources>
<Storyboard x:Key="Glow_move">
<PointAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="glow" Storyboard.TargetProperty="(Shape.Fill).(LinearGradientBrush.StartPoint)" RepeatBehavior="Forever">
<SplinePointKeyFrame KeyTime="00:00:00" Value="-0.2,0.5"/>
<SplinePointKeyFrame KeyTime="00:00:01" Value="0.8,0.5"/>
<SplinePointKeyFrame KeyTime="00:00:02" Value="-0.2,0.5"/>
</PointAnimationUsingKeyFrames>
<PointAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="glow" Storyboard.TargetProperty="(Shape.Fill).(LinearGradientBrush.EndPoint)" RepeatBehavior="Forever">
<SplinePointKeyFrame KeyTime="00:00:00" Value="0.2,0.5"/>
<SplinePointKeyFrame KeyTime="00:00:01" Value="1.2,0.5"/>
<SplinePointKeyFrame KeyTime="00:00:02" Value="0.2,0.5"/>
</PointAnimationUsingKeyFrames>
</Storyboard>
</UserControl.Resources>
My DataTrigger, with which it does not work:
<UserControl.Style>
<Style>
<Style.Triggers>
<DataTrigger Binding="{Binding Path=IsScanning}" Value="True">
<DataTrigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource Glow_move}"/>
</DataTrigger.EnterActions>
</DataTrigger>
<DataTrigger Binding="{Binding Path=IsScanning}" Value="False">
<DataTrigger.EnterActions>
<StopStoryboard BeginStoryboardName="Glow_Move"/>
</DataTrigger.EnterActions>
</DataTrigger>
</Style.Triggers>
</Style>
</UserControl.Style>
My EventTrigger, with which it works fine:
<UserControl.Triggers>
<EventTrigger RoutedEvent="Mouse.MouseUp">
<BeginStoryboard x:Name="Glow_Move" Storyboard="{StaticResource Glow move}"/>
</EventTrigger>
</UserControl.Triggers>
As I am new to WPF, it would be really nice if someone helps for this specific question and case.
|
|
|
|
|
Hi,
I am new to silverlight 3,in my application validations are firing, it shows the debugging error(it breaks the application running), and RIA services are loaded(Beta) in my system. can you please check the following code and Help me out, Thanks in advance.
Class File:
public class userValidation:INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
private void RaisePropertyChanged(string propertyName)
{
if (this.PropertyChanged != null)
{
this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
private string _name;
public string UserName
{
get { return _name; }
set
{
if (value.Length<4)
{
throw new ValidationException("Please set value");
}
_name = value;
RaisePropertyChanged("UserName");
}
}
}
UI:
<textbox x:name="txtEmpNo"
="" maxlength="5" style="{StaticResource txtBoxStyle}" grid.row="1" grid.column="1" width="200" height="30">
<textbox.text>
<binding path="UserName" mode="TwoWay" validatesonexceptions="True" notifyonvalidationerror="True">
In page load:
userValidation test = new userValidation();
LayoutRoot.DataContext = test;
Thanks and Regards
Murty
|
|
|
|
|
Go to debug -> Exceptions and turn on all type of exceptions.
Run your app then - check to see if it throws an error and breaks in your code somewhere.
|
|
|
|
|
Hi Abhinav,
Thank you, I have done, but it shows the same.
|
|
|
|
|
Check your txtBoxStyle style to make sure whatever static resources you use in there are available.
|
|
|
|
|
Hi Abhinav,
Thank for your reply, I have removed(styles) every thing, but the same problem persists, Can you tell me any other idea please? is there any problem with RIA services setup?
Regards
Murthy
|
|
|
|
|
I am just doing some testing with RIA services for a new app. Most of the fields have validation so i thought the validation attributes in RIA services would work well.
The app involves taking user input and creating an xml file that validates against an xsd. The xsd specifies regular expressions to validate some of the fields so i thought i could copy them and use them as regularexpression attributes in RIA services but its not working. For example according to the info i was given this regex:
([A-Z0-9\(\)\-/'&]+)|([A-Z0-9\(\)\-/'&][A-Z 0-9\(\)\-/'&]*[A-Z0-9\(\)\-/'&])
should allow upper case alpha and numbers plus some specific characters but when tested it alows either upper or lower case alpha.
any ideas on why its not working or what it actually breaks down to.
Jon
|
|
|
|
|
I've a storyboard with key 'Effect'. I want to start/stop it at button clicks. Everything works fine if 'btnStart/btnStop' buttons remain on same xaml code, in which this EventTrigger is. But my StoryBoard and EventTriggers are part of a UserControl and 'btnStart/btnStop' buttons are on Main XAML. So, my question is, what should I write to let WPF know that I mean buttons from Main?
Also, what do I need to write, if I wish to trigger it when a function get called from Main?
<EventTrigger RoutedEvent="ButtonBase.Click" SourceName="btnStart">
<BeginStoryboard x:Name="st_one" Storyboard="{StaticResource Effect}"/>
</EventTrigger>
<EventTrigger RoutedEvent="ButtonBase.Click" SourceName="btnStop">
<StopStoryboard BeginStoryboardName="Glow_Move"/>
</EventTrigger>
|
|
|
|
|
How about exposing the on/off as a dependency property in the user-control?
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|