Play Flask Video Feed in UWP Application using WebView/Media Source - flask

I'm attempting to stream a video feed in a UWP application from a webpage created on another machine using flask. The page loads in MS Edge however when the webView is pointed to the page it gets stuck perpetually on the spinning wheel.
In the appxmanifest I've enabled Private Networks(Client & Server), Internet(Client & Server),
and Internet(Client).
I've also tried loading the page using a media player source pointed at the address which throws an error for an invalid address format.
The source for the webpage that I am attempting to load is the following:
<html>
<head>
<title></title>
</head>
<body>
<img src="/video_feed">
</body>
</html>
Any advice on what type of object I should be using to try and display the video feed would be much appreciated.
Thanks!
Edit:
Below is the source code and xaml for the page that is attempting to use the webView. Currently the image updates at 20 frames per second but this is likely to increase.
Thanks for your help.
namespace GroundControl.Views
{
public sealed partial class CameraPage : Page, INotifyPropertyChanged
{
DispatcherTimer updateDataTimer;
private const string DefaultUrl = "http://127.0.0.1";
private Uri _source;
public Uri Source
{
get { return _source; }
set { Set(ref _source, value); }
}
private bool _isLoading;
public bool IsLoading
{
get
{
return _isLoading;
}
set
{
if (value)
{
IsShowingFailedMessage = false;
}
Set(ref _isLoading, value);
IsLoadingVisibility = value ? Visibility.Visible : Visibility.Collapsed;
}
}
private Visibility _isLoadingVisibility;
public Visibility IsLoadingVisibility
{
get { return _isLoadingVisibility; }
set { Set(ref _isLoadingVisibility, value); }
}
private bool _isShowingFailedMessage;
public bool IsShowingFailedMessage
{
get
{
return _isShowingFailedMessage;
}
set
{
if (value)
{
IsLoading = false;
}
Set(ref _isShowingFailedMessage, value);
FailedMesageVisibility = value ? Visibility.Visible : Visibility.Collapsed;
}
}
private Visibility _failedMesageVisibility;
public Visibility FailedMesageVisibility
{
get { return _failedMesageVisibility; }
set { Set(ref _failedMesageVisibility, value); }
}
private void OnNavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
{
IsLoading = false;
OnPropertyChanged(nameof(IsBackEnabled));
OnPropertyChanged(nameof(IsForwardEnabled));
}
private void OnNavigationFailed(object sender, WebViewNavigationFailedEventArgs e)
{
// Use `e.WebErrorStatus` to vary the displayed message based on the error reason
IsShowingFailedMessage = true;
}
private void OnRetry(object sender, RoutedEventArgs e)
{
IsShowingFailedMessage = false;
IsLoading = true;
webView.Refresh();
}
private async void OnOpenInBrowser(object sender, RoutedEventArgs e)
{
await Windows.System.Launcher.LaunchUriAsync(webView.Source);
}
public CameraPage()
{
InitializeComponent();
IsLoading = true;
Source = new Uri("http://192.168.1.100:5004");
}
public event PropertyChangedEventHandler PropertyChanged;
private void Set<T>(ref T storage, T value, [CallerMemberName]string propertyName = null)
{
if (Equals(storage, value))
{
return;
}
storage = value;
OnPropertyChanged(propertyName);
}
private void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:behaviors="using:GroundControl.Behaviors"
xmlns:Custom="using:Microsoft.Toolkit.Uwp.UI.Controls"
x:Class="GroundControl.Views.CameraPage"
mc:Ignorable="d">
<Page.Resources>
<Style x:Key="BrowserButtonStyle" TargetType="Button">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="{ThemeResource ButtonForeground}" />
<Setter Property="BorderBrush" Value="{ThemeResource ButtonBorderBrush}" />
<Setter Property="BorderThickness" Value="{ThemeResource ButtonBorderThemeThickness}" />
<Setter Property="Padding" Value="8,4,8,4" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}" />
<Setter Property="FontWeight" Value="Normal" />
<Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}" />
<Setter Property="UseSystemFocusVisuals" Value="True" />
<Setter Property="FocusVisualMargin" Value="-3" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid x:Name="RootGrid" Background="{TemplateBinding Background}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal">
<Storyboard>
<PointerUpThemeAnimation Storyboard.TargetName="RootGrid" />
</Storyboard>
</VisualState>
<VisualState x:Name="PointerOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonBorderBrushPointerOver}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonForegroundPointerOver}" />
</ObjectAnimationUsingKeyFrames>
<PointerUpThemeAnimation Storyboard.TargetName="RootGrid" />
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonBorderBrushPressed}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonForegroundPressed}" />
</ObjectAnimationUsingKeyFrames>
<PointerDownThemeAnimation Storyboard.TargetName="RootGrid" />
</Storyboard>
</VisualState>
<VisualState x:Name="Disabled">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonBorderBrushDisabled}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonForegroundDisabled}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<ContentPresenter x:Name="ContentPresenter" AutomationProperties.AccessibilityView="Raw" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" ContentTemplate="{TemplateBinding ContentTemplate}" ContentTransitions="{TemplateBinding ContentTransitions}" Content="{TemplateBinding Content}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Padding="{TemplateBinding Padding}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Page.Resources>
<Page.Style>
<StaticResource ResourceKey="PageStyle"/>
</Page.Style>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<WebView x:Name="webView" Source="{x:Bind Mode=OneWay, Path=Source}"
NavigationCompleted="OnNavigationCompleted"
NavigationFailed="OnNavigationFailed" />
<StackPanel Visibility="{x:Bind Mode=OneWay, Path=IsLoadingVisibility}"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<ProgressRing IsActive="{x:Bind Mode=OneWay, Path=IsLoading}" />
<TextBlock x:Uid="Camera_Loading" />
</StackPanel>
<StackPanel Visibility="{x:Bind Mode=OneWay, Path=FailedMesageVisibility}"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" x:Uid="Camera_FailedMessage" TextWrapping="WrapWholeWords" />
<HyperlinkButton Click="OnRetry" x:Uid="Camera_Retry" HorizontalAlignment="Center" />
</StackPanel>
<Grid VerticalAlignment="Bottom" Background="{ThemeResource SystemControlChromeHighAcrylicElementMediumBrush}">
<StackPanel Orientation="Horizontal">
<Button IsEnabled="{x:Bind Mode=OneWay, Path=IsBackEnabled}" Style="{StaticResource BrowserButtonStyle}" Click="OnGoBack" x:Uid="Camera_BrowserBackButton">
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="" />
</Button>
<Button IsEnabled="{x:Bind Mode=OneWay, Path=IsForwardEnabled}" Style="{StaticResource BrowserButtonStyle}" Click="OnGoForward" x:Uid="Camera_BrowserForwardButton">
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="" />
</Button>
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Button Style="{StaticResource BrowserButtonStyle}" Click="OnRefresh" x:Uid="Camera_RefreshBrowserButton">
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="" />
</Button>
<Button Style="{StaticResource BrowserButtonStyle}" Click="OnOpenInBrowser" x:Uid="Camera_OpenInBrowserButton">
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="" />
</Button>
</StackPanel>
</Grid>
<Custom:AdaptiveGridView x:Name="adaptiveGridView">
<StackPanel BorderBrush="Transparent" Height="370" Width="120">
<TextBlock x:Name="BatteryLabel" HorizontalAlignment="Left" Text="Battery: " Margin="5" TextWrapping="Wrap" VerticalAlignment="Top"/>
<TextBlock x:Name="LatitudeLabel" HorizontalAlignment="Left" Text="Latitude: " Margin="5" TextWrapping="Wrap" VerticalAlignment="Top"/>
<TextBlock x:Name="LongitudeLabel" HorizontalAlignment="Left" Text="Longitude: " Margin="5" TextWrapping="Wrap" VerticalAlignment="Top"/>
<TextBlock x:Name="AbsAltitudeLabel" HorizontalAlignment="Left" Text="ABS Alt: " Margin="5" TextWrapping="Wrap" VerticalAlignment="Top"/>
<TextBlock x:Name="RelAltitudeLabel" HorizontalAlignment="Left" Text="Rel Alt: " Margin="5" TextWrapping="Wrap" VerticalAlignment="Top"/>
<TextBlock x:Name="VelNorthLabel" HorizontalAlignment="Left" Text="Vel North: " Margin="5" TextWrapping="Wrap" VerticalAlignment="Top"/>
<TextBlock x:Name="VelEastLabel" HorizontalAlignment="Left" Text="Vel East: " Margin="5" TextWrapping="Wrap" VerticalAlignment="Top"/>
<TextBlock x:Name="VelForwardLabel" HorizontalAlignment="Left" Text="Vel Forw: " Margin="5" TextWrapping="Wrap" VerticalAlignment="Top"/>
<TextBlock x:Name="VelDownLabel" HorizontalAlignment="Left" Text="Vel Down: " Margin="5" TextWrapping="Wrap" VerticalAlignment="Top"/>
<TextBlock x:Name="DistanceDownSenseLabel" HorizontalAlignment="Left" Text="Dist Down: " Margin="5" TextWrapping="Wrap" VerticalAlignment="Top"/>
<TextBlock x:Name="YawAngleLabel" HorizontalAlignment="Left" Text="Yaw Angle: " Margin="5" TextWrapping="Wrap" VerticalAlignment="Top"/>
<TextBlock x:Name="YawCamAngleLabel" HorizontalAlignment="Left" Text="Yaw Deg: " Margin="5" TextWrapping="Wrap" VerticalAlignment="Top"/>
<TextBlock x:Name="PitchCamAngleLabel" HorizontalAlignment="Left" Text="Pitch Deg: " Margin="5" TextWrapping="Wrap" VerticalAlignment="Top" Width="67"/>
</StackPanel>
</Custom:AdaptiveGridView>
</Grid>
</Page>

Related

How to write my own custom CSS using <AmplifyS3Image /> from "#aws-amplify/ui-react"?

const ImageFiles = ({className, imgKey}) => {
const [imageLoading, setImageLoading] = useState(true);
const triggerOnLoad = (value)=> {
setImageLoading(value);
}
return (
<div className="image_files_container">
{imageLoading && (
<span className="image_loader_block">
<LoaderBig className="image_loader loader_msgList" loading={true} position="center" />
</span>
)}
<AmplifyS3Image
className={className}
imgKey={imgKey}
handleOnLoad={() => triggerOnLoad(false)}
/>
</div>
);
}
`amplify-s3-image {
--height: 300px;
--width: 90%;
}`

I want to replace string using regex and i want to replace [^a-zA-Z] to empty and get it back by clicking Alt button

My code:
private void toggleAlt()
{
foreach (Button ab in frKeyboard.Children.OfType<Button>().Select(child => child).Where(ab => Regex.IsMatch(ab.Content.ToString(), #"^[a-zA-Z0-9!##$%^&*+-_?~ {} .]+$")))
foreach (Button fb in grKeyboard.Children.OfType<Button>().Select(child => child).Where(fb => Regex.IsMatch(fb.Content.ToString(), #"^[a-zA-Z0-9!##$%^&*+-_?~ |{} .]+$")))
{
ab.Content = (IsAltEnable ? ab.Content.ToString().Replace("1", "!") : ab.Content.ToString().Replace("!", "1"));
ab.Content = (IsAltEnable ? ab.Content.ToString().Replace('2', '#') : ab.Content.ToString().Replace('#', '2'));
ab.Content = (IsAltEnable ? ab.Content.ToString().Replace('3', '#') : ab.Content.ToString().Replace('#', '3'));
ab.Content = (IsAltEnable ? ab.Content.ToString().Replace('4', '$') : ab.Content.ToString().Replace('$', '4'));
ab.Content = (IsAltEnable ? ab.Content.ToString().Replace('5', '%') : ab.Content.ToString().Replace('%', '5'));
ab.Content = (IsAltEnable ? ab.Content.ToString().Replace('6', '^') : ab.Content.ToString().Replace('^', '6'));
ab.Content = (IsAltEnable ? ab.Content.ToString().Replace('7', '&') : ab.Content.ToString().Replace('&', '7'));
ab.Content = (IsAltEnable ? ab.Content.ToString().Replace('8', '*') : ab.Content.ToString().Replace('*', '8'));
ab.Content = (IsAltEnable ? ab.Content.ToString().Replace("9", "-") : ab.Content.ToString().Replace("-", "9"));
ab.Content = (IsAltEnable ? ab.Content.ToString().Replace('0', '+') : ab.Content.ToString().Replace('+', '0'));
ab.Content = (IsAltEnable ? ab.Content.ToString().Replace('.', '?') : ab.Content.ToString().Replace('?', '.'));
fb.Content = (IsAltEnable ? fb.Content.ToString().Replace("l", "~") : fb.Content.ToString().Replace("~", "l"));
fb.Content = (IsAltEnable ? fb.Content.ToString().Replace("o", "{") : fb.Content.ToString().Replace("{", "o"));
fb.Content = (IsAltEnable ? fb.Content.ToString().Replace("p", "}") : fb.Content.ToString().Replace("}", "p"));
fb.Content = (IsAltEnable ? fb.Content.ToString().Replace('z', '|') : fb.Content.ToString().Replace('|', 'z'));
}
}
xaml code is like:
<Grid Name="frKeyboard" Width="Auto" Height="Auto">
<Rectangle Height="2" HorizontalAlignment="Stretch" Stroke="#6F9EC1" VerticalAlignment="Top"/>
<Button Content="1" Margin="4,8,0,0" Click="btnKeyboard_Click"/>
<Button Content="2" Margin="64,8,0,0" Click="btnKeyboard_Click"/>
<Button Content="3" Margin="124,8,0,0" Click="btnKeyboard_Click"/>
<Button Content="4" Margin="184,8,0,0" Click="btnKeyboard_Click"/>
<Button Content="5" Margin="244,8,0,0" Click="btnKeyboard_Click"/>
<Button Content="6" Margin="304,8,0,0" Click="btnKeyboard_Click"/>
<Button Content="7" Margin="364,8,0,0" Click="btnKeyboard_Click"/>
<Button Content="8" Margin="424,8,0,0" Click="btnKeyboard_Click"/>
<Button Content="9" Margin="484,8,0,0" Click="btnKeyboard_Click"/>
<Button Content="0" Margin="544,8,0,0" Click="btnKeyboard_Click"/>
<Button Content="." Margin="544,188,0,0" Click="btnKeyboard_Click"/>
<!--<Button Content="bv" Margin="604,8,0,0" Width="60" Visibility="Visible" FontSize="48" Click="btnKeyboard_Click" IsEnabled="{Binding ElementName=AlphaNumericKeyboardControl, Path=IsAltEnable, Mode=TwoWay}"/>-->
</Grid>
<Grid Name="grKeyboard" Width="Auto" Height="Auto">
<Rectangle Height="2" HorizontalAlignment="Stretch" Stroke="#6F9EC1" VerticalAlignment="Top"/>
<Button Content="" Margin="34,68,0,0" Click="btnKeyboard_Click" IsEnabled="{Binding Path=btnq, Mode=TwoWay}"/>
<Button Content="q" Margin="34,68,0,0" Click="btnKeyboard_Click" Style="{StaticResource TransparentStyle}" IsEnabled="{Binding ElementName=AlphaNumericKeyboardControl, Path=IsAltEnable, Mode=TwoWay}"/>
<Button Content="w" x:Name="btnw" Margin="94,68,0,0" Click="btnKeyboard_Click"/>
<Button Content="e" Margin="154,68,0,0" Click="btnKeyboard_Click"/>
<Button Content="r" Margin="214,68,0,0" Click="btnKeyboard_Click"/>
<Button Content="t" Margin="274,68,0,0" Click="btnKeyboard_Click"/>
<Button Content="" Margin="334,68,0,0" Click="btnKeyboard_Click" />
<Button Content="y" Margin="334,68,0,0" Click="btnKeyboard_Click" IsEnabled="{Binding ElementName=AlphaNumericKeyboardControl, Path=IsAltEnabled, Mode=TwoWay}"/>
<Button Content="u" Margin="394,68,0,0" Click="btnKeyboard_Click"/>
<Button Content="i" Margin="454,68,0,0" Click="btnKeyboard_Click"/>
<Button Content="l" Margin="544,128,0,0" Click="btnKeyboard_Click"/>
<Button Content="!" Margin="604,8,0,0" Width="60" FontFamily="Wingdings 3" FontSize="48" Click="btnClear_Click"/>
<Button Content="a" Margin="64,128,0,0" Click="btnKeyboard_Click"/>
<Button Content="s" Margin="124,128,0,0" Click="btnKeyboard_Click"/>
<Button Content="d" Margin="184,128,0,0" Click="btnKeyboard_Click"/>
<Button Content="f" Margin="245,129,0,0" Click="btnKeyboard_Click"/>
<Button Content="g" Margin="304,128,0,0" Click="btnKeyboard_Click"/>
<Button Content="h" Margin="364,128,0,0" Click="btnKeyboard_Click"/>
<Button Content="j" Margin="424,128,0,0" Click="btnKeyboard_Click"/>
<Button Content="k" Margin="484,128,0,0" Click="btnKeyboard_Click"/>
<Button Content="o" Margin="514,68,0,0" Click="btnKeyboard_Click"/>
<Button Content="p" Margin="574,68,0,0" Click="btnKeyboard_Click"/>
}
I want to replace string using regex and I want to replace [^a-zA-Z] to empty and get it back by clicking Alt button.
Actually I am working on an application and I want to switch my buttons.
This is my existing keyboard view:
And I want to make it like this on Alt Press

Xamdatagrid set the selected backgroud color when alternate reocrd is true

i am currently facing issue to set the backgroud color to yellow when alternate row is true
i have grid in which few columns background is set to different colour. i have set highlightlight alterate row is to true. i have also set the yellow background when record is selected.
<Window.Resources>
<ObjectDataProvider x:Key="CarData" ObjectType="{x:Type Cars:CarsBusinessLogic}" MethodName="GetCars" />
<Style TargetType="{x:Type igDP:DataRecordCellArea}" >
<Setter Property="BackgroundSelected" Value="#FFDB4C"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Path=IsSelected}" Value="False">
<Setter Property="BackgroundActive" Value="Transparent"/>
<Setter Property="BorderActiveBrush" Value="Transparent"/>
</DataTrigger>
</Style.Triggers>
</Style>
<Style TargetType="{x:Type igDP:DataRecordPresenter}" >
<EventSetter Event="PreviewMouseLeftButtonDown" Handler="drp_PreviewMouseLeftButtonDown"/>
</Style>
<Style TargetType="{x:Type igDP:DataRecordCellArea}" x:Key="RecordAlignment">
<Setter Property="HorizontalContentAlignment" Value="Center"></Setter>
<Setter Property="HorizontalAlignment" Value="Center"></Setter>
<Setter Property="VerticalAlignment" Value="Top"></Setter>
<Setter Property="VerticalContentAlignment" Value="Top"></Setter>
<Setter Property="BackgroundActive" Value="#FFDB4C"/>
<Setter Property="BackgroundSelected" Value="#FFDB4C"/>
<Setter Property="BackgroundHover" Value="#7092BE"/>
<Style.Triggers>
<DataTrigger Binding="{Binding DataItem.Hovered}" Value="True">
<Setter Property="Background" Value="{Binding RelativeSource={RelativeSource Self}, Path=BackgroundHover}"/>
<Setter Property="BackgroundAlternate" Value="{Binding RelativeSource={RelativeSource Self}, Path=BackgroundHover}"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontWeight" Value="Bold"></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding Path=IsSelected}" Value="False">
<Setter Property="BackgroundActive" Value="Transparent"/>
<Setter Property="BorderActiveBrush" Value="Transparent"/>
</DataTrigger>
</Style.Triggers>
</Style>
<Style x:Key="ColumnStyle1" TargetType="{x:Type igDP:CellValuePresenter}" >
<Setter Property="Background" Value="#D8E4BC"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Path=IsMouseOver, RelativeSource={RelativeSource AncestorType={x:Type igDP:DataRecordCellArea}}}" Value="True">
<Setter Property="Background" Value="Transparent"/>
</DataTrigger>
<DataTrigger Binding="{Binding IsSelected}" Value="True">
<Setter Property="Background" Value="Transparent"/>
</DataTrigger>
<DataTrigger Binding="{Binding DataItem.IsActive}" Value="True">
<Setter Property="Background" Value="Transparent"/>
</DataTrigger>
<DataTrigger Binding="{Binding Path=IsAlternate,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={ x:Type igDP:DataRecordCellArea}} }" Value="True">
<Setter Property="Background" Value="#EFF7DB" />
</DataTrigger>
<DataTrigger Binding="{Binding DataItem.Hovered}" Value="True">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontWeight" Value="Bold"></Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</Window.Resources>
<Grid>
<ScrollViewer Name="view1">
<igDP:XamDataGrid
Width="490" DataSource="{Binding Source={StaticResource CarData}}" HorizontalAlignment="Left" Name="xamDataGrid1" VerticalAlignment="Top" >
<igDP:XamDataGrid.Resources>
<Style TargetType="{x:Type igDP:RecordListControl}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type igDP:RecordListControl}">
<ScrollViewer CanContentScroll="true"
VerticalScrollBarVisibility="Disabled"
HorizontalScrollBarVisibility="Disabled" >
<ItemsPresenter/>
</ScrollViewer>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</igDP:XamDataGrid.Resources>
<igDP:XamDataGrid.FieldSettings>
<igDP:FieldSettings AllowEdit="False" AllowFixing="No"
CellClickAction="SelectRecord"
CellHeight="25" AutoSizeOptions="All"
AutoSizeScope="RecordsInView"
CellContentAlignment="LabelAboveValueAlignLeft" />
</igDP:XamDataGrid.FieldSettings>
<igDP:XamDataGrid.FieldLayoutSettings>
<igDP:FieldLayoutSettings SelectionTypeRecord="Single" ></igDP:FieldLayoutSettings>
</igDP:XamDataGrid.FieldLayoutSettings>
<igDP:XamDataGrid.FieldLayouts>
<igDP:FieldLayout Key="BrandLevel" Tag="Brand" >
<igDP:FieldLayout.Settings>
<igDP:FieldLayoutSettings HighlightAlternateRecords="True" ></igDP:FieldLayoutSettings>
</igDP:FieldLayout.Settings>
<igDP:FieldLayout.Fields>
<igDP:Field Name="Make"/>
<igDP:Field Name="Model" />
<igDP:Field Name="BasePrice" >
<igDP:Field.Settings>
<igDP:FieldSettings CellMinWidth="50" CellValuePresenterStyle="{StaticResource ColumnStyle1}">
</igDP:FieldSettings>
</igDP:Field.Settings>
</igDP:Field>
<igDP:Field Name="Mileage"/>
</igDP:FieldLayout.Fields>
</igDP:FieldLayout>
</igDP:XamDataGrid.FieldLayouts>
</igDP:XamDataGrid>
</ScrollViewer>
</Grid>
To keep the yellow background when an alternate record is selected, set the CellValuePresenter background to Transparent. Something like this should do the trick.
<Style x:Key="CellBackgroundStyle" TargetType="{x:Type igDP:CellValuePresenter}" >
<Style.Triggers>
<DataTrigger Binding="{Binding Path=IsMouseOver, RelativeSource={RelativeSource AncestorType={x:Type igDP:DataRecordCellArea}}}" Value="True">
<Setter Property="Background" Value="Transparent"/>
</DataTrigger>
<DataTrigger Binding="{Binding Path=IsSelected, RelativeSource={RelativeSource AncestorType={x:Type igDP:DataRecordCellArea}}}" Value="True">
<Setter Property="Background" Value="Transparent"/>
</DataTrigger>
<DataTrigger Binding="{Binding Path=IsActive, RelativeSource={RelativeSource AncestorType={x:Type igDP:DataRecordCellArea}}}" Value="True">
<Setter Property="Background" Value="Transparent"/>
</DataTrigger>
</Style.Triggers>
</Style>

SOAP fault message <faultcode>S:Server</faultcode> cannot be cast to

en I am inserting three input in SOAP request and when trying to get a response I am getting fault message specifying that cannot be cast to a class.
Here I have attached the SOAP response which I am facing.
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<S:Fault xmlns:ns4="http://www.w3.org/2003/05/soap-envelope">
<faultcode>S:Server</faultcode>
<faultstring>...bssv.J570040.valueobject.InternalOrderVO cannot be cast to ...bssv.JP570040.valueobject.IntermediateShipDet</faultstring>
<detail>
<ns2:exception xmlns:ns2="http://jax-ws.dev.java.net/" class="java.lang.ClassCastException" note="To disable this feature, set com.sun.xml.ws.fault.SOAPFaultBuilder.disableCaptureStackTrace system property to false">
<message>bssv.J570040.valueobject.InternalOrderVO cannot be cast to bssv.JP570040.valueobject.IntermediateShipDet</message>
<ns2:stackTrace>
<ns2:frame class="bssv.JP570040.valueobject.showOrderDetVO" file="showOrderDetVO.java" line="123" method="<init>" />
<ns2:frame class="bssv.JP570040.InvokeShippingDet" file="InvokeShippingDet.java" line="82" method="GetShippingOrder" />
<ns2:frame class="bssv.JP570040.InvokeShippingDet" file="InvokeShippingDet.java" line="39" method="GetShippingOrder" />
<ns2:frame class="sun.reflect.NativeMethodAccessorImpl" file="NativeMethodAccessorImpl.java" line="native" method="invoke0" />
<ns2:frame class="sun.reflect.NativeMethodAccessorImpl" file="NativeMethodAccessorImpl.java" line="39" method="invoke" />
<ns2:frame class="sun.reflect.DelegatingMethodAccessorImpl" file="DelegatingMethodAccessorImpl.java" line="25" method="invoke" />
<ns2:frame class="java.lang.reflect.Method" file="Method.java" line="597" method="invoke" />
<ns2:frame class="weblogic.wsee.jaxws.WLSInstanceResolver$WLSInvoker" file="WLSInstanceResolver.java" line="92" method="invoke" />
<ns2:frame class="weblogic.wsee.jaxws.WLSInstanceResolver$WLSInvoker" file="WLSInstanceResolver.java" line="74" method="invoke" />
<ns2:frame class="com.sun.xml.ws.server.InvokerTube$2" file="InvokerTube.java" line="151" method="invoke" />
<ns2:frame class="com.sun.xml.ws.server.sei.EndpointMethodHandlerImpl" file="EndpointMethodHandlerImpl.java" line="268" method="invoke" />
<ns2:frame class="com.sun.xml.ws.server.sei.SEIInvokerTube" file="SEIInvokerTube.java" line="100" method="processRequest" />
<ns2:frame class="com.sun.xml.ws.api.pipe.Fiber" file="Fiber.java" line="866" method="__doRun" />
<ns2:frame class="com.sun.xml.ws.api.pipe.Fiber" file="Fiber.java" line="815" method="_doRun" />
<ns2:frame class="com.sun.xml.ws.api.pipe.Fiber" file="Fiber.java" line="778" method="doRun" />
<ns2:frame class="com.sun.xml.ws.api.pipe.Fiber" file="Fiber.java" line="680" method="runSync" />
<ns2:frame class="com.sun.xml.ws.server.WSEndpointImpl$2" file="WSEndpointImpl.java" line="403" method="process" />
<ns2:frame class="com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit" file="HttpAdapter.java" line="532" method="handle" />
<ns2:frame class="com.sun.xml.ws.transport.http.HttpAdapter" file="HttpAdapter.java" line="253" method="handle" />
<ns2:frame class="com.sun.xml.ws.transport.http.servlet.ServletAdapter" file="ServletAdapter.java" line="140" method="handle" />
<ns2:frame class="weblogic.wsee.jaxws.WLSServletAdapter" file="WLSServletAdapter.java" line="171" method="handle" />
<ns2:frame class="weblogic.wsee.jaxws.HttpServletAdapter$AuthorizedInvoke" file="HttpServletAdapter.java" line="708" method="run" />
<ns2:frame class="weblogic.security.acl.internal.AuthenticatedSubject" file="AuthenticatedSubject.java" line="363" method="doAs" />
<ns2:frame class="weblogic.security.service.SecurityManager" file="SecurityManager.java" line="146" method="runAs" />
<ns2:frame class="weblogic.wsee.util.ServerSecurityHelper" file="ServerSecurityHelper.java" line="103" method="authenticatedInvoke" />
<ns2:frame class="weblogic.wsee.jaxws.HttpServletAdapter$3" file="HttpServletAdapter.java" line="311" method="run" />
<ns2:frame class="weblogic.wsee.jaxws.HttpServletAdapter" file="HttpServletAdapter.java" line="336" method="post" />
<ns2:frame class="weblogic.wsee.jaxws.JAXWSServlet" file="JAXWSServlet.java" line="95" method="doRequest" />
<ns2:frame class="weblogic.servlet.http.AbstractAsyncServlet" file="AbstractAsyncServlet.java" line="99" method="service" />
<ns2:frame class="javax.servlet.http.HttpServlet" file="HttpServlet.java" line="820" method="service" />
<ns2:frame class="weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction" file="StubSecurityHelper.java" line="227" method="run" />
<ns2:frame class="weblogic.servlet.internal.StubSecurityHelper" file="StubSecurityHelper.java" line="125" method="invokeServlet" />
<ns2:frame class="weblogic.servlet.internal.ServletStubImpl" file="ServletStubImpl.java" line="300" method="execute" />
<ns2:frame class="weblogic.servlet.internal.TailFilter" file="TailFilter.java" line="26" method="doFilter" />
<ns2:frame class="weblogic.servlet.internal.FilterChainImpl" file="FilterChainImpl.java" line="56" method="doFilter" />
<ns2:frame class="oracle.security.jps.ee.http.JpsAbsFilter$1" file="JpsAbsFilter.java" line="111" method="run" />
<ns2:frame class="java.security.AccessController" file="AccessController.java" line="native" method="doPrivileged" />
<ns2:frame class="oracle.security.jps.util.JpsSubject" file="JpsSubject.java" line="313" method="doAsPrivileged" />
<ns2:frame class="oracle.security.jps.ee.util.JpsPlatformUtil" file="JpsPlatformUtil.java" line="413" method="runJaasMode" />
<ns2:frame class="oracle.security.jps.ee.http.JpsAbsFilter" file="JpsAbsFilter.java" line="94" method="runJaasMode" />
<ns2:frame class="oracle.security.jps.ee.http.JpsAbsFilter" file="JpsAbsFilter.java" line="161" method="doFilter" />
<ns2:frame class="oracle.security.jps.ee.http.JpsFilter" file="JpsFilter.java" line="71" method="doFilter" />
<ns2:frame class="weblogic.servlet.internal.FilterChainImpl" file="FilterChainImpl.java" line="56" method="doFilter" />
<ns2:frame class="oracle.dms.servlet.DMSServletFilter" file="DMSServletFilter.java" line="136" method="doFilter" />
<ns2:frame class="weblogic.servlet.internal.FilterChainImpl" file="FilterChainImpl.java" line="56" method="doFilter" />
<ns2:frame class="weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction" file="WebAppServletContext.java" line="3715" method="wrapRun" />
<ns2:frame class="weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction" file="WebAppServletContext.java" line="3681" method="run" />
<ns2:frame class="weblogic.security.acl.internal.AuthenticatedSubject" file="AuthenticatedSubject.java" line="321" method="doAs" />
<ns2:frame class="weblogic.security.service.SecurityManager" file="SecurityManager.java" line="120" method="runAs" />
<ns2:frame class="weblogic.servlet.internal.WebAppServletContext" file="WebAppServletContext.java" line="2277" method="securedExecute" />
<ns2:frame class="weblogic.servlet.internal.WebAppServletContext" file="WebAppServletContext.java" line="2183" method="execute" />
<ns2:frame class="weblogic.servlet.internal.ServletRequestImpl" file="ServletRequestImpl.java" line="1454" method="run" />
<ns2:frame class="weblogic.work.ExecuteThread" file="ExecuteThread.java" line="209" method="execute" />
<ns2:frame class="weblogic.work.ExecuteThread" file="ExecuteThread.java" line="178" method="run" />
</ns2:stackTrace>
</ns2:exception>
</detail>
</S:Fault>
Just looking at the error I would assume that, there is an error converting internal data item from Date type to external data item of Calendar data type.
Please find a sample of such conversion in bssv
public Calendar setCalendar(Date date)
{
Calendar cal = Calendar.getInstance();
if (date != null)
{
cal.setTime(date);
}
return cal;
}

Custom control binding to a collection within a property

I stuggeling with the databinding with in a custom control
I've got some properties within my custom control.
public static DependencyProperty TitleProperty;
public static DependencyProperty PageDictionaryProperty;
public string Title
{
get
{
return (string)base.GetValue(TitleProperty);
}
set
{
base.SetValue(TitleProperty, value);
}
}
public Innax.ManualParts.PageDictionary PageDictionary
{
get
{
return (Innax.ManualParts.PageDictionary)base.GetValue(PageDictionaryProperty);
}
set
{
base.SetValue(PageDictionaryProperty, value);
}
}
binding to the table isn't a problem. this works fine
but now i want to bind to the keyword property within the pageDictionary.
public class PageDictionary
{
//some other properties....
public List<string> Keywords
{
get
{
return GetKeyWords();
}
}
}
This is the XAML file.
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:InnaxBook" >
<Style x:Key="alternatingWithTriggers"
TargetType="{x:Type ContentPresenter}">
<Setter Property="Height" Value="25"></Setter>
</Style>
<DataTemplate x:Key="HelpTopicLineTemplate">
<Border x:Name="HelpTopicLine">
<StackPanel Orientation="Horizontal">
<Button Content="{Binding DictionaryName}" Width="25px" x:Name="btnGoto" ></Button>
</StackPanel>
</Border>
</DataTemplate>
<Style TargetType="{x:Type local:Manual}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type local:Manual}" >
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<Grid>
<Grid Height="Auto" Width="Auto">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="125" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition Height="*" />
<RowDefinition Height="30" />
</Grid.RowDefinitions >
<Label x:Name="TitleControl" Content="{TemplateBinding Title }" Grid.ColumnSpan="2" Grid.Column="0" Grid.Row="0" Background="Aqua" ></Label>
<StackPanel x:Name="IndexContainer" Grid.Column="0" Grid.Row="1" Height="Auto" Width="Auto" Orientation="Vertical" ScrollViewer.CanContentScroll="True">
<Label Height="30" Margin="0,0,0,0" HorizontalAlignment="Left" Content="{TemplateBinding IndexLabelText}" />
<ListView HorizontalAlignment="Stretch">
<Button Height="Auto" HorizontalContentAlignment="Stretch" Content="knoppie" />
</ListView>
<ItemsControl ItemContainerStyle="{StaticResource alternatingWithTriggers}"
AlternationCount="2"
x:Name="RelatedItemsControl"
Grid.Row="1"
Grid.Column="0"
ItemsSource="{TemplateBinding PageDictionary}"
ItemTemplate="{StaticResource HelpTopicLineTemplate}">
</ItemsControl>
</StackPanel>
</Grid>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
if anyone could help me with this...
In your case the PageDirectory class need to implement INotifyPropertyChanged interface. Each time the keyword inside changed you need to raise a PropertyChanged event like this:
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs("Keywords"))
The binding string then will have view like this:
{Binding Keywords, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:PageDictionary}}}
Where local is namespace declared upper in the xaml for access PageDictionary type.