|
Hi All,
I have one single UserControl library, it has more than 20 of controls. Some of client wants to hide the 2-3 controls. I have to bind the visibility properties of all the controls based on different client types. Which is the best approach to know the which client wants the particular controls.
Thanks
|
|
|
|
|
i want make Online examination system so which module we used help me .and it work flow of the system
|
|
|
|
|
With the demise of Silverlight online and this forum are not compatible, try ASP. You cannot expect a forum to of any use helping you with the minimal information you have supplied.
Look into ASP.net and MVC.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I have added an expander[^] vertically down the right side of my app. It looks fine like that.
But when I expand it[^], it appears wrong.
This [^]is how it should look.
Here's my XAML:
<Expander Grid.Row="1"
Grid.Column="2"
BorderThickness="1"
BorderBrush="SteelBlue"
Background="White"
ExpandDirection="Left"
IsExpanded="False"
HorizontalAlignment="Right"
MaxWidth="150"
Margin="0,0,5,5">
<pre>
<Expander.Effect>
<DropShadowEffect/>
</Expander.Effect>
<Expander.Header>
<TextBlock Text="My Stuff">
<TextBlock.LayoutTransform>
<RotateTransform Angle="90"/>
</TextBlock.LayoutTransform>
</TextBlock>
</Expander.Header>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<bc:DFTGrid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<bc:DFTComboBox Grid.Column="0"
Style="{StaticResource ComboBoxStyle}"
Margin="2"/>
</bc:DFTGrid>
<bc:DFTListBox Grid.Row="1"
MinWidth="250"
ItemsSource="{Binding Sensors, Mode=TwoWay}"
ScrollViewer.VerticalScrollBarVisibility="Auto">
</bc:DFTListBox>
</Grid>
how do I get the header to go to the top when it's expanded?
Thanks
If it's not broken, fix it until it is
|
|
|
|
|
The problem is down to the fact that you have applied a rotation to your Header. It's always going to appear at 90 degrees. You could simply apply a trigger that fires off IsExpanded, and translation at that point.
|
|
|
|
|
I thought the same thing, but removing the rotation simply causes the header text to become horizontal. The header is still down the right side and the content still appears at the top.
See this[^] and this[^].
If it's not broken, fix it until it is
|
|
|
|
|
This is pretty close[^], but there's still a problem:
<Expander Grid.Row="1"
Grid.Column="2"
x:Name="expander"
BorderThickness="1"
BorderBrush="SteelBlue"
Background="White"
ExpandDirection="Down"
IsExpanded="False"
HorizontalAlignment="Right"
Margin="0,0,5,7">
<pre>
<Expander.Effect>
<DropShadowEffect/>
</Expander.Effect>
<Expander.Style>
<Style TargetType="Expander">
<Setter Property="Header" Value="My Stuff"/>
<Style.Triggers>
<Trigger Property="IsExpanded" Value="False">
<Setter Property="Header" Value=""/>
</Trigger>
</Style.Triggers>
</Style>
</Expander.Style>
<Expander.Header>
<TextBlock Text="Sensors">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=IsExpanded, RelativeSource={RelativeSource TemplatedParent}}"
Value="False">
<Setter Property="LayoutTransform">
<Setter.Value>
<RotateTransform Angle="90"/>
</Setter.Value>
</Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Expander.Header>
<f6cc:FalconSensorList Width="150"/>
Now, the when expanded the header is at the top, and the content is below it. So far so good.
However, when NOT expanded, the header text appears horizontal - the rotate isn't working.
https://onedrive.live.com/redir?resid=F6FBCF1880A16630!238&authkey=!ANQDHrjshc7s5AI&v=3&ithint=photo%2cpng
Any idea what's wrong with the transform?
If it's not broken, fix it until it is
|
|
|
|
|
I made some changes to the given xaml code to make it work...
Hope the code snippet will help
<Expander x:Name="MyExpander" BorderThickness="1" BorderBrush="SteelBlue"
Background="White" IsExpanded="False" HorizontalAlignment="Right" MaxWidth="150" Margin="0,0,5,5">
<Expander.Style>
<Style>
<Style.Triggers>
<DataTrigger Binding="{Binding ElementName=MyExpander, Path=IsExpanded}" Value="False">
<Setter Property="Expander.ExpandDirection">
<Setter.Value>
Left
</Setter.Value>
</Setter>
</DataTrigger>
<DataTrigger Binding="{Binding ElementName=MyExpander, Path=IsExpanded}" Value="True">
<Setter Property="Expander.ExpandDirection">
<Setter.Value>
Down
</Setter.Value>
</Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</Expander.Style>
<Expander.Header>
<TextBlock Text="My Stuff">
<TextBlock.Style>
<Style>
<Style.Triggers>
<DataTrigger Binding="{Binding ElementName=MyExpander, Path=IsExpanded}" Value="True">
<Setter Property="TextBlock.LayoutTransform">
<Setter.Value>
<RotateTransform Angle="0"></RotateTransform>
</Setter.Value>
</Setter>
</DataTrigger>
<DataTrigger Binding="{Binding ElementName=MyExpander, Path=IsExpanded}" Value="False">
<Setter Property="TextBlock.LayoutTransform">
<Setter.Value>
<RotateTransform Angle="90"></RotateTransform>
</Setter.Value>
</Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Expander.Header>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<ComboBox Grid.Column="0"
Margin="2"/>
</Grid>
<ListBox Grid.Row="1"
MinWidth="250"
ItemsSource="{Binding Sensors, Mode=TwoWay}"
ScrollViewer.VerticalScrollBarVisibility="Auto">
</ListBox>
</Grid>
</Expander>
|
|
|
|
|
I have to following in my App.xaml code behind:
public partial class App : Application
{
public App()
{
}
private void Application_Startup(object sender, StartupEventArgs e)
{
Application.Current.DispatcherUnhandledException += dispatchUnhandled;
AppDomain.CurrentDomain.UnhandledException += applicationUnhandledException;
}
private void dispatchUnhandled(object sender, DispatcherUnhandledExceptionEventArgs e)
{
var errorMessage = getInnerException(e.Exception);
displayErrorMessage(errorMessage, e.Exception);
e.Handled = true;
}
private static void applicationUnhandledException(object sender, UnhandledExceptionEventArgs e)
{
var ex = e.ExceptionObject as Exception;
var errorMessage = getInnerException(ex);
displayErrorMessage(errorMessage, ex);
}
private static void displayErrorMessage(string errorMessage, Exception ex)
{
logException(errorMessage, ex);
ErrorHandlerViewModel vm = new ErrorHandlerViewModel();
vm.ErrorMessage = errorMessage;
vm.ErrorText = ex.ToString();
ErrorHandlerView view = new ErrorHandlerView();
view.DataContext = vm;
view.ShowDialog();
Application.Current.Shutdown();
}
private static string getInnerException(Exception e)
{
string msg = e.InnerException == null ? e.Message : getInnerException(e.InnerException);
return msg;
}
private static void logException(string errorMessage, Exception ex)
{
Logger.LogMessage(errorMessage);
Logger.LogMessage(ex.ToString());
}
}
Application_Startup DOES run, but no exceptions are caught. What's wrong here?
Thanks
If it's not broken, fix it until it is
|
|
|
|
|
Are any exceptions thrown? If so, where are they thrown from?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
yes, I added this in the MainWindowViewModel:
int x = 0;
int y = 10;
int z = y / x;
It throws, it doesn't get caught in the global exception handler.
If it's not broken, fix it until it is
|
|
|
|
|
What triggers that code to run?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
It's the main window in a WPF app. It's called from App.xaml
If it's not broken, fix it until it is
|
|
|
|
|
When an unhandled exception is thrown Application.Current.DispatcherUnhandledException is invoked. Hence the code written in your handler 'dispatchUnhandled' is executed.
Do i miss your specific question?
Manish Jain (MJ)
|
|
|
|
|
I want to sell a user control I created. I want to provide a registration key.
How do I keep someone from using my control without the key? There has to be something inside the code that checks the key
If it's not broken, fix it until it is
|
|
|
|
|
About
I created this range slider[^] control. It has 2 thumbs, thus allowing for a range,
Functionality
a) Clicking the track bar OUTSIDE the thumbs should center the thumbs on that point.
b) Dragging INSIDE the thumbs should move both thumbs equally.
Issues
When the window isn't too big, it all works OK. But, resize the window really wide and then try A & B above. It doesn't move right.
The code you need to see is in the RangeSlider control, in the Border_MouseDown and Border_MouseMove events.
I would appreciate any help or suggestions you can offer.
If it's not broken, fix it until it is
|
|
|
|
|
I have created a dual thumb slider as shown here[^].
I also added in some mouse events, and I'm close to done.
Now, I'd like to style it like this[^].
But it seems that the control template is preventing the style from showing.
How do I use this style and control together?
Thanks
If it's not broken, fix it until it is
|
|
|
|
|
I need to set a ListBox's Items heights so that they fill the entire listbox:
In this window[^], everything below the splitter is my control. On the left is the listbox.
You can see there's open space below the last list item. It's ever more evident here[^]
Here's my XAML:
<ListBox Grid.Column="0"
x:Name="categoryList"
BorderBrush="LightGray"
BorderThickness="0,0,1,0"
ItemsSource="{Binding Categories}"
ScrollViewer.VerticalScrollBarVisibility="Hidden"
IsEnabled="False"
Background="White"
Width="100"
Margin="0,-2,0,0">
<pre>
<ListBox.Style>
<Style TargetType="{x:Type ListBox}">
<Style.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background" Value="White" />
</Trigger>
</Style.Triggers>
</Style>
</ListBox.Style>
<ListBox.ItemContainerStyle>
<Style TargetType="{x:Type ListBoxItem}">
<Setter Property="Height" Value="{Binding Path=DataContext.ListItemHeight, RelativeSource={RelativeSource AncestorType=Grid}}"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="LightGray"/>
<Setter Property="BorderThickness" Value="0,0,0,1"/>
<Style.Triggers>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Foreground" Value="SteelBlue"/>
<Setter Property="Background" Value="White"/>
</Trigger>
</Style.Triggers>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding CategoryName}"
VerticalAlignment="Center"
FontSize="16"
Margin="10,0,0,0"/>
</DataTemplate>
</ListBox.ItemTemplate>
and the control's SizeChanged event:
private void sizeChanged(object sender, SizeChangedEventArgs e)
{
ListItemHeight = Math.Floor(this.ActualHeight / (Categories.Count + 1));
}
What am I doing wrong here?
Thanks
If it's not broken, fix it until it is
|
|
|
|
|
Sounds like you need to use a UniformGrid[^] as your ItemsPanel[^]:
<ListBox
Grid.Column="0"
x:Name="categoryList"
BorderBrush="LightGray"
BorderThickness="0,0,1,0"
ItemsSource="{Binding Categories}"
ScrollViewer.VerticalScrollBarVisibility="Hidden"
IsEnabled="False"
Background="White"
Width="100"
Margin="0,-2,0,0"
>
<ListBox.Style>
<Style TargetType="{x:Type ListBox}">
<Style.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background" Value="White" />
</Trigger>
</Style.Triggers>
</Style>
</ListBox.Style>
<ListBox.ItemContainerStyle>
<Style TargetType="{x:Type ListBoxItem}">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="LightGray"/>
<Setter Property="BorderThickness" Value="0,0,0,1"/>
<Style.Triggers>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Foreground" Value="SteelBlue"/>
<Setter Property="Background" Value="White"/>
</Trigger>
</Style.Triggers>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock
Text="{Binding CategoryName}"
VerticalAlignment="Center"
FontSize="16"
Margin="10,0,0,0"
/>
</DataTemplate>
</ListBox.ItemTemplate>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Columns="1" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
</ListBox>
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
That did it!!
You are a god!
Thanks
If it's not broken, fix it until it is
|
|
|
|
|
Using VS2013 on Win7:
I'm developing several WPF desktop apps at work (on a DoD network). Up until yesterday, everything was fine. This morning, when I tried to compile for the first time, I got this error for all of the XAML files in the solution:
Unknown build error, 'This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms.'
This happens even in freshly created solutions with absolutely nothing added to the template-provided code.
It does not happen in MVC, WinForms, or ASP.Net applications.
Does anyone have any clues? FWIW, any solution provided must NOT require admin rights, since I don't have/can't get those privileges on a DoD system. This means I can't change config files that live on the C drive, or edit the registry.
I've already tried specifying the following in the assemblyinfo.cs file:
using System.Configuration.Assemblies;
[assembly: AssemblyAlgorithmId(AssemblyHashAlgorithm.SHA512)]
I tried all of the possible values for the indicated enumerator with no change in behavior.
".45 ACP - because shooting twice is just silly" - JSOP, 2010
- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
It looks like changing config files or the registry is the only available workaround:
After the above modification devenv config would look like:
<configuration>
...
<runtime>
...
<enforceFIPSPolicy enabled="false"/>
</runtime>
</configuration>
According to this SO post[^], Visual Studio is using MD5 for "coordinating source files for debugging".
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Well, the security Nazis here won't allow that to be changed. I thought specifying the attribute in assemblyinfo.cs would be sufficient, but it wasn't.
".45 ACP - because shooting twice is just silly" - JSOP, 2010
- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
First: I am an absolute beginner and I want to learn basics.
I have created a Silverlight-App and embedded it in a asp.net MVC page on a WebServer (it works fine). Now I want to do my first steps: Loading an Xml-File from the WebServer into my SilverlightApp, which running in the Browser of a ClientComputer
Question:
How can I send some "basic kind of request" from the SilverlightApp to the Server to send the xml-file?
I surfed a lot in the internet, but I am confused about all of these very complex data-access-possibilities.
|
|
|
|
|
You do realise that Silverlight has a sunset date of 2020 and won't be supported in the newer browsers!
Do some research into WCF although you should be getting your data from the MVC component. Weird setup, I've never heard of this structure being used!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|